From dee833b803494ce962c577ddf950795a2fd490ae Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 30 Jun 2023 20:40:47 +0200 Subject: Send initial presence after resource result This completes the connection process. --- xmpp/stream_pair.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xmpp/stream_pair.go') 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() + } + } +} -- cgit v1.2.3-70-g09d2