From 7960453fb4c56d2fdf9cae08df457027bd62ae6d Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 6 Jul 2023 21:29:34 +0200 Subject: Implement roster get request This asks the server for the roster / contact list for the current account. --- xmpp/iq.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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!") + } +} -- cgit v1.2.3-70-g09d2