diff options
author | xengineering <me@xengineering.eu> | 2023-07-04 22:09:13 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-07-04 22:09:13 +0200 |
commit | 4c9c6c91f9dfca9fd17731d5b0e94aaaace4a137 (patch) | |
tree | 33a991b590e9cf0ef225f773b1544fbb26cf3501 | |
parent | a23ba089a4e715e68b8c8d4179290692215784a2 (diff) | |
download | limox-4c9c6c91f9dfca9fd17731d5b0e94aaaace4a137.tar limox-4c9c6c91f9dfca9fd17731d5b0e94aaaace4a137.tar.zst limox-4c9c6c91f9dfca9fd17731d5b0e94aaaace4a137.zip |
Remove unused code
-rw-r--r-- | xmpp/sasl.go | 43 | ||||
-rw-r--r-- | xmpp/streams.go | 26 |
2 files changed, 3 insertions, 66 deletions
diff --git a/xmpp/sasl.go b/xmpp/sasl.go index 5fac934..ae3be4a 100644 --- a/xmpp/sasl.go +++ b/xmpp/sasl.go @@ -10,12 +10,6 @@ type saslRequest struct { Payload []byte `xml:",chardata"` } -type saslSuccess struct {} - -func handleSaslSuccess(s *session) { - openStream(s.tx, s.jid) -} - func (s *session) sasl() { start := xml.StartElement{ xml.Name{"urn:ietf:params:xml:ns:xmpp-sasl", "auth"}, @@ -35,39 +29,8 @@ func (s *session) sasl() { } } -// hasSaslPlain scans the given stream features XML element for the SASL PLAIN -// mechanism which is supported by xengineering.eu/limox/xmpp. It returns true -// if the stream has support for this mechanism and false otherwise. -func hasSaslPlain(e []xml.Token) bool { - mechanism := xml.Name{`urn:ietf:params:xml:ns:xmpp-sasl`, `mechanism`} - - for i, t := range e { - switch s := t.(type) { - case xml.StartElement: - if s.Name == mechanism { - if i+1 < len(e) { - subtype := func() string { - switch c := e[i+1].(type) { - case xml.CharData: - return string(c) - default: - return "" - } - }() - if subtype == `PLAIN` { - return true - } - } - } - } - } - - return false -} - -func saslSuccessHandler(s *session, e []xml.Token) { -} +type saslSuccess struct {} -func saslFailureHandler(s *session, e []xml.Token) { - log.Println("SASL autentication failed!") +func handleSaslSuccess(s *session) { + openStream(s.tx, s.jid) } diff --git a/xmpp/streams.go b/xmpp/streams.go index 18a5e6a..ec16a02 100644 --- a/xmpp/streams.go +++ b/xmpp/streams.go @@ -11,8 +11,6 @@ type streamFeatures struct { } func handleStreamFeatures(s *session, f streamFeatures) { - log.Print(f) - if len(f.SaslMechanisms) > 0 { for _, v := range f.SaslMechanisms { if v == "PLAIN" { @@ -64,27 +62,3 @@ func closeStream(e *xml.Encoder) { log.Println("Could not flush after stream end!") } } - -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() - } - } -} |