From 4c9c6c91f9dfca9fd17731d5b0e94aaaace4a137 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 4 Jul 2023 22:09:13 +0200 Subject: Remove unused code --- xmpp/sasl.go | 43 +++---------------------------------------- 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() - } - } -} -- cgit v1.2.3-70-g09d2