diff options
author | xengineering <me@xengineering.eu> | 2023-07-06 21:29:34 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-07-06 21:29:34 +0200 |
commit | 7960453fb4c56d2fdf9cae08df457027bd62ae6d (patch) | |
tree | abe2cf6b84643abc0bd0f32af97adbdfee6bd251 | |
parent | 553537a2c9f08450614648d7184b6bbf212d5ed5 (diff) | |
download | limox-7960453fb4c56d2fdf9cae08df457027bd62ae6d.tar limox-7960453fb4c56d2fdf9cae08df457027bd62ae6d.tar.zst limox-7960453fb4c56d2fdf9cae08df457027bd62ae6d.zip |
Implement roster get request
This asks the server for the roster / contact list for the current
account.
-rw-r--r-- | xmpp/iq.go | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -20,6 +20,7 @@ func (i iqRx) handle(s *session) { if i.Bind.Jid != "" { s.jid = i.Bind.Jid s.sendPresence() + s.sendRosterGet() return } } @@ -46,3 +47,21 @@ func (s *session) sendBind() { log.Println("Could not encode ressource binding!") } } + +type rosterGet struct { + XMLName xml.Name `xml:"jabber:client iq"` + Type string `xml:"type,attr,omitempty"` + Id string `xml:"id,attr,omitempty"` + Query string `xml:"jabber:iq:roster query"` +} + +func (s *session) sendRosterGet() { + req := rosterGet{} + req.Id = fmt.Sprintf("%016x", rand.Uint64()) + req.Type = "get" + + err := s.tx.Encode(req) + if err != nil { + log.Println("Could not encode ressource binding!") + } +} |