diff options
author | xengineering <me@xengineering.eu> | 2023-07-04 22:04:05 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-07-04 22:04:05 +0200 |
commit | a23ba089a4e715e68b8c8d4179290692215784a2 (patch) | |
tree | f7c13f78ff728b9e0e59045f1709907c29c55e37 /xmpp/jid.go | |
parent | ed6b4e818f4090c0c707fab49093bc4c3cc3ac20 (diff) | |
download | limox-a23ba089a4e715e68b8c8d4179290692215784a2.tar limox-a23ba089a4e715e68b8c8d4179290692215784a2.tar.zst limox-a23ba089a4e715e68b8c8d4179290692215784a2.zip |
Re-implement resource binding and presence
This was removed for refactoring.
Diffstat (limited to 'xmpp/jid.go')
-rw-r--r-- | xmpp/jid.go | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/xmpp/jid.go b/xmpp/jid.go index 83772fd..c732027 100644 --- a/xmpp/jid.go +++ b/xmpp/jid.go @@ -41,21 +41,6 @@ func username(jid string) string { return "" } -func hasBind(e []xml.Token) bool { - bind := xml.Name{`urn:ietf:params:xml:ns:xmpp-bind`, `bind`} - - for _, v := range e { - switch s := v.(type) { - case xml.StartElement: - if s.Name == bind { - return true - } - } - } - - return false -} - type bindRequest struct { Bind struct { Xmlns string `xml:"xmlns,attr"` @@ -86,3 +71,15 @@ func (s *session) sendBind() { log.Println("Could not encode ressource binding!") } } + +type iqResponse struct { + Jid string `xml:"urn:ietf:params:xml:ns:xmpp-bind bind>jid"` +} + +func handleIqResponse(s *session, i iqResponse) { + if i.Jid != "" { + s.jid = i.Jid + s.sendPresence() + return + } +} |