From f82aa566910de95288311076d15ebc9c4b0d279a Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 10 May 2023 18:08:49 +0200 Subject: Use io.TeeReader to output received XML stream This should be used for debugging. --- xmpp.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xmpp.go b/xmpp.go index c40dee0..c9ae054 100644 --- a/xmpp.go +++ b/xmpp.go @@ -1,6 +1,8 @@ package main import ( + "io" + "os" "crypto/tls" "crypto/x509" "encoding/xml" @@ -39,7 +41,8 @@ func (l *Limox) xmpp(jid string, pwd string) { termination := make(chan bool) go func() { quit := false - dec := xml.NewDecoder(conn) + tee := io.TeeReader(conn, os.Stdout) + dec := xml.NewDecoder(tee) for { select { case <-termination: @@ -71,8 +74,8 @@ func (l *Limox) xmpp(jid string, pwd string) { default: //log.Fatalf("Unknown GuiEvent '%d'!\n", ev) } - case rx := <-receiver: - logToken(rx, false) + case <-receiver: + // ignoring incoming XML tokens for now ... } if closing { @@ -86,6 +89,7 @@ func (l *Limox) xmpp(jid string, pwd string) { } func logToken(t xml.Token, isTx bool) { + return var prefix string if isTx { prefix = "C" -- cgit v1.2.3-70-g09d2