From 8715603ce1a713d1c8841382bb965cb55948fedd Mon Sep 17 00:00:00 2001 From: xengineering Date: Mon, 26 Jun 2023 18:37:16 +0200 Subject: xmpp: Remove unused code This is part of the refactoring. Details of the old implementation should be looked up by older commits. --- xmpp/decoder.go | 57 --------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 xmpp/decoder.go (limited to 'xmpp/decoder.go') diff --git a/xmpp/decoder.go b/xmpp/decoder.go deleted file mode 100644 index 7139b5a..0000000 --- a/xmpp/decoder.go +++ /dev/null @@ -1,57 +0,0 @@ -package xmpp - -import ( - "crypto/tls" - "encoding/xml" - "log" - "os" -) - -type decoder struct { - terminator chan bool - data chan xml.Token - decoder *xml.Decoder - debug *xml.Encoder -} - -func newDecoder(conn *tls.Conn) decoder { - d := decoder{ - make(chan bool), - make(chan xml.Token), - xml.NewDecoder(conn), - xml.NewEncoder(os.Stdout), - } - - d.debug.Indent("S: ", " ") - - return d -} - -func (r *decoder) run() { - for { - select { - case <-r.terminator: - return - default: - t, err := r.decoder.Token() - if t != nil && err == nil { - err := r.debug.EncodeToken(t) - if err != nil { - log.Println("Could not encode received XML token to debug output!") - } - err = r.debug.Flush() - if err != nil { - log.Println("Could not flush debug output after receive!") - } - r.data <- xml.CopyToken(t) - } - if err != nil { - return // FIXME disconnect on parsing error - } - } - } -} - -func (r *decoder) stop() { - r.terminator <- true -} -- cgit v1.2.3-70-g09d2