summaryrefslogtreecommitdiff
path: root/xmpp/streams.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-04 21:24:04 +0200
committerxengineering <me@xengineering.eu>2023-07-04 21:24:04 +0200
commit2c71877e392da6c2691827160142e95142f7bea6 (patch)
treef7b3a0b9d8d98e422a5ca579fd8fbceb654ad0a6 /xmpp/streams.go
parente529bab2e5df93ff8e9fd415b9d65e9bb6d17695 (diff)
downloadlimox-2c71877e392da6c2691827160142e95142f7bea6.tar
limox-2c71877e392da6c2691827160142e95142f7bea6.tar.zst
limox-2c71877e392da6c2691827160142e95142f7bea6.zip
Re-implement SASL
Was broken because of switch to new RX concept.
Diffstat (limited to 'xmpp/streams.go')
-rw-r--r--xmpp/streams.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/xmpp/streams.go b/xmpp/streams.go
index 3aca8a2..8f6fd03 100644
--- a/xmpp/streams.go
+++ b/xmpp/streams.go
@@ -5,6 +5,23 @@ import (
"log"
)
+type streamFeatures struct {
+ SaslMechanisms []string `xml:"mechanisms>mechanism"`
+}
+
+func handleStreamFeatures(s *session, f streamFeatures) {
+ if len(f.SaslMechanisms) > 0 {
+ for _, v := range f.SaslMechanisms {
+ if v == "PLAIN" {
+ s.sasl()
+ return
+ }
+ }
+ log.Println("No compatible SASL mechanism found!")
+ return
+ }
+}
+
func openStream(e *xml.Encoder, jid string) {
start := xml.StartElement{
xml.Name{"jabber:client", "stream:stream"},
@@ -63,7 +80,3 @@ func iqHandler(s *session, e []xml.Token) {
}
}
}
-
-type streamFeatures struct {
- SaslMechanisms []string `xml:"mechanisms>mechanism"`
-}