diff options
author | xengineering <me@xengineering.eu> | 2023-06-30 20:40:47 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-06-30 20:40:47 +0200 |
commit | dee833b803494ce962c577ddf950795a2fd490ae (patch) | |
tree | f353e8c8d653d9d94ab7e45a624ac8bd27f0e32f /xmpp/stream_pair.go | |
parent | e2c057571ae309cf503851ab8f63c2159f2ef4bc (diff) | |
download | limox-dee833b803494ce962c577ddf950795a2fd490ae.tar limox-dee833b803494ce962c577ddf950795a2fd490ae.tar.zst limox-dee833b803494ce962c577ddf950795a2fd490ae.zip |
Send initial presence after resource result
This completes the connection process.
Diffstat (limited to 'xmpp/stream_pair.go')
-rw-r--r-- | xmpp/stream_pair.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xmpp/stream_pair.go b/xmpp/stream_pair.go index 4690f57..87df86a 100644 --- a/xmpp/stream_pair.go +++ b/xmpp/stream_pair.go @@ -105,3 +105,27 @@ func streamFeaturesHandler(s *session, e []xml.Token) { log.Println("Stream has no implemented features!") } + +func iqHandler(s *session, e []xml.Token) { + isResult := false + idMatches := false + + result := xml.Attr{xml.Name{"", "type"}, "result"} + id := xml.Attr{xml.Name{"", "id"}, s.resourceReq} + + switch start := e[0].(type) { + case xml.StartElement: + for _, v := range start.Attr { + if v == result { + isResult = true + } + if v == id { + idMatches = true + } + } + + if isResult && idMatches { + s.sendPresence() + } + } +} |