summaryrefslogtreecommitdiff
path: root/xmpp/stream_pair.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-06-30 20:43:12 +0200
committerxengineering <me@xengineering.eu>2023-06-30 20:43:25 +0200
commit0774275597131badfba5045b14f9632a78d063e8 (patch)
tree51d302e473b5474de8ed74dad42a387fa3e441fb /xmpp/stream_pair.go
parente2c057571ae309cf503851ab8f63c2159f2ef4bc (diff)
parentff92af1410f3c37c6cfa5fb7ff6e322c8d691121 (diff)
downloadlimox-0774275597131badfba5045b14f9632a78d063e8.tar
limox-0774275597131badfba5045b14f9632a78d063e8.tar.zst
limox-0774275597131badfba5045b14f9632a78d063e8.zip
Merge branch 'initial-presence'
This broadcasts that the LimoX client is ready for communication.
Diffstat (limited to 'xmpp/stream_pair.go')
-rw-r--r--xmpp/stream_pair.go24
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()
+ }
+ }
+}