diff options
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 + } +} |