summaryrefslogtreecommitdiff
path: root/xmpp/jid.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-04 22:04:05 +0200
committerxengineering <me@xengineering.eu>2023-07-04 22:04:05 +0200
commita23ba089a4e715e68b8c8d4179290692215784a2 (patch)
treef7c13f78ff728b9e0e59045f1709907c29c55e37 /xmpp/jid.go
parented6b4e818f4090c0c707fab49093bc4c3cc3ac20 (diff)
downloadlimox-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.go27
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
+ }
+}