aboutsummaryrefslogtreecommitdiff
path: root/connector/xmpp
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-27 11:13:15 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-27 11:13:15 +0100
commit11963aaf3d7f681b27cd1e48f596cb1d5ca9d349 (patch)
tree50109945fcbc28f716d6ddb1c665571176846c10 /connector/xmpp
parentbe9278ab026fed34743487ee8305541933e7ae6f (diff)
downloadeasybridge-11963aaf3d7f681b27cd1e48f596cb1d5ca9d349.tar.gz
easybridge-11963aaf3d7f681b27cd1e48f596cb1d5ca9d349.zip
XMPP logging
Diffstat (limited to 'connector/xmpp')
-rw-r--r--connector/xmpp/config.go2
-rw-r--r--connector/xmpp/xmpp.go19
2 files changed, 10 insertions, 11 deletions
diff --git a/connector/xmpp/config.go b/connector/xmpp/config.go
index 6fd5f9b..a5306b4 100644
--- a/connector/xmpp/config.go
+++ b/connector/xmpp/config.go
@@ -26,7 +26,7 @@ func init() {
Name: "port",
Description: "Port",
IsNumeric: true,
- Default: "6667",
+ Default: "5222",
},
&ConfigEntry{
Name: "ssl",
diff --git a/connector/xmpp/xmpp.go b/connector/xmpp/xmpp.go
index 4af016c..fb34361 100644
--- a/connector/xmpp/xmpp.go
+++ b/connector/xmpp/xmpp.go
@@ -1,11 +1,10 @@
package xmpp
import (
- "time"
- //"os"
"crypto/tls"
"fmt"
"strings"
+ "time"
gxmpp "github.com/matterbridge/go-xmpp"
"github.com/rs/xid"
@@ -123,8 +122,8 @@ func (xm *XMPP) connectLoop(num int) {
xm.conn, err = options.NewClient()
if err != nil {
xm.connected = false
- fmt.Printf("XMPP failed to connect / disconnected: %s\n", err)
- fmt.Printf("Retrying in %ds\n", xm.timeout)
+ log.Debugf("XMPP failed to connect / disconnected: %s\n", err)
+ log.Debugf("Retrying in %ds\n", xm.timeout)
time.Sleep(time.Duration(xm.timeout) * time.Second)
xm.timeout *= 2
if xm.timeout > 600 {
@@ -136,8 +135,8 @@ func (xm *XMPP) connectLoop(num int) {
err = xm.handleXMPP()
if err != nil {
xm.connected = false
- fmt.Printf("XMPP disconnected: %s\n", err)
- fmt.Printf("Reconnecting.\n")
+ log.Debugf("XMPP disconnected: %s\n", err)
+ log.Debugf("Reconnecting.\n")
}
}
}
@@ -152,7 +151,7 @@ func (xm *XMPP) xmppKeepAlive() chan bool {
select {
case <-ticker.C:
if err := xm.conn.PingC2S("", ""); err != nil {
- log.Printf("PING failed %#v\n", err)
+ log.Debugf("PING failed %#v\n", err)
}
case <-done:
return
@@ -172,7 +171,7 @@ func (xm *XMPP) handleXMPP() error {
return err
}
- fmt.Printf("XMPP: %#v\n", m)
+ log.Tracef("XMPP: %#v\n", m)
switch v := m.(type) {
case gxmpp.Chat:
@@ -288,7 +287,7 @@ func (xm *XMPP) SetRoomInfo(roomId RoomID, info *RoomInfo) error {
func (xm *XMPP) Join(roomId RoomID) error {
xm.isMUC[string(roomId)] = true
- fmt.Printf("Join %s with nick %s\n", roomId, xm.nickname)
+ log.Tracef("Join %s with nick %s\n", roomId, xm.nickname)
_, err := xm.conn.JoinMUCNoHistory(string(roomId), xm.nickname)
return err
}
@@ -321,7 +320,7 @@ func (xm *XMPP) Send(event *Event) error {
}
}
- fmt.Printf("xm *XMPP Send %#v\n", event)
+ log.Tracef("xm *XMPP Send %#v\n", event)
if len(event.Recipient) > 0 {
_, err := xm.conn.Send(gxmpp.Chat{
Type: "chat",