From a3e01c9a867791b466fe2a3e1d0efd77c840729b Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 6 Jul 2023 21:42:43 +0200 Subject: Implement roster result handling This completes the roster get / result cycle which is needed for a MVP. --- xmpp/iq.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xmpp/iq.go b/xmpp/iq.go index 3abcc4a..d3d77b1 100644 --- a/xmpp/iq.go +++ b/xmpp/iq.go @@ -14,6 +14,13 @@ type iqRx struct { Bind struct{ Jid string `xml:"jid"` } `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"` + Query []RosterItem `xml:"jabber:iq:roster query>item"` +} + +type RosterItem struct { + Jid string `xml:"jid,attr"` + Subscription string `xml:"subscription,attr"` + Name string `xml:"name,attr"` } func (i iqRx) handle(s *session) { @@ -23,6 +30,13 @@ func (i iqRx) handle(s *session) { s.sendRosterGet() return } + + if len(i.Query) > 0 { + log.Println("Got roster:") + for _, v := range i.Query { + log.Printf("- %s\n", v.Jid) + } + } } type bindSet struct { -- cgit v1.2.3-70-g09d2