diff options
Diffstat (limited to 'xmpp.go')
-rw-r--r-- | xmpp.go | 24 |
1 files changed, 2 insertions, 22 deletions
@@ -7,7 +7,6 @@ import ( "crypto/x509" "encoding/xml" "log" - "reflect" ) type XmppEvent uint8 @@ -35,7 +34,8 @@ func (l *Limox) xmpp(jid string, pwd string) { return } - enc := xml.NewEncoder(conn) + multiw := io.MultiWriter(conn, os.Stdout) + enc := xml.NewEncoder(multiw) receiver := make(chan xml.Token) termination := make(chan bool) @@ -88,23 +88,6 @@ func (l *Limox) xmpp(jid string, pwd string) { l.XmppEvents <- XmppDisconnect } -func logToken(t xml.Token, isTx bool) { - return - var prefix string - if isTx { - prefix = "C" - } else { - prefix = "S" - } - - switch t.(type) { - case xml.CharData: - log.Printf("%s: [ %v ] %s\n", prefix, reflect.TypeOf(t), t) - default: - log.Printf("%s: [ %v ] %+v\n", prefix, reflect.TypeOf(t), t) - } -} - func sendStreamStart(enc *xml.Encoder, jid string) (xml.EndElement) { start := xml.StartElement{ xml.Name{"jabber:client", "stream:stream"}, @@ -127,7 +110,6 @@ func sendStreamStart(enc *xml.Encoder, jid string) (xml.EndElement) { log.Fatal("Could not flush XML encoder!") } - logToken(start, true) return start.End() } @@ -141,8 +123,6 @@ func sendStreamEnd(enc *xml.Encoder, end xml.EndElement) { if err != nil { log.Fatal("Could not flush XML encoder!") } - - logToken(end, true) } // domainpart extracts the domain name from a JID / XMPP address. See |