summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-06 21:29:34 +0200
committerxengineering <me@xengineering.eu>2023-07-06 21:29:34 +0200
commit7960453fb4c56d2fdf9cae08df457027bd62ae6d (patch)
treeabe2cf6b84643abc0bd0f32af97adbdfee6bd251
parent553537a2c9f08450614648d7184b6bbf212d5ed5 (diff)
downloadlimox-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.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/xmpp/iq.go b/xmpp/iq.go
index 3d0e5a2..3abcc4a 100644
--- a/xmpp/iq.go
+++ b/xmpp/iq.go
@@ -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!")
+ }
+}