XMPP debug output
This commit is contained in:
parent
aceced844a
commit
5f09a187ce
|
@ -9,7 +9,7 @@ type Config struct {
|
||||||
Host string
|
Host string
|
||||||
Connection string
|
Connection string
|
||||||
Secret string
|
Secret string
|
||||||
XMPPLog bool `toml:"xmpp_log"`
|
XMPPDebug bool `toml:"xmpp_debug"`
|
||||||
Special map[string]interface{}
|
Special map[string]interface{}
|
||||||
|
|
||||||
xmpp *xmpp.Component
|
xmpp *xmpp.Component
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (c *Config) receiving(packet xmpp.Packet) (xmpp.Packet, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case xmpp.Message:
|
case xmpp.Message:
|
||||||
if c.XMPPLog {
|
if c.XMPPDebug {
|
||||||
logger.WithFields(map[string]interface{}{
|
logger.WithFields(map[string]interface{}{
|
||||||
"from": p.PacketAttrs.From,
|
"from": p.PacketAttrs.From,
|
||||||
"to": p.PacketAttrs.To,
|
"to": p.PacketAttrs.To,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
func TestReceive(t *testing.T) {
|
func TestReceive(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
c := Config{Host: "example.org", Type: "monkeyservice"}
|
c := Config{Host: "example.org", Type: "monkeyservice", XMPPDebug: true}
|
||||||
|
|
||||||
// ignoring packet
|
// ignoring packet
|
||||||
p, _ := c.receiving(xmpp.Handshake{})
|
p, _ := c.receiving(xmpp.Handshake{})
|
||||||
|
|
|
@ -22,7 +22,7 @@ func (c *Config) sending(packet xmpp.Packet) xmpp.Packet {
|
||||||
} else {
|
} else {
|
||||||
p.PacketAttrs.From += "@" + c.Host
|
p.PacketAttrs.From += "@" + c.Host
|
||||||
}
|
}
|
||||||
if c.XMPPLog {
|
if c.XMPPDebug {
|
||||||
logger.WithFields(map[string]interface{}{
|
logger.WithFields(map[string]interface{}{
|
||||||
"from": p.PacketAttrs.From,
|
"from": p.PacketAttrs.From,
|
||||||
"to": p.PacketAttrs.To,
|
"to": p.PacketAttrs.To,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
func TestSend(t *testing.T) {
|
func TestSend(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
c := Config{Host: "example.org"}
|
c := Config{Host: "example.org", XMPPDebug: true}
|
||||||
|
|
||||||
// ignoring packet
|
// ignoring packet
|
||||||
p := c.sending(xmpp.IQ{})
|
p := c.sending(xmpp.IQ{})
|
||||||
|
|
|
@ -5,7 +5,7 @@ type = "threema"
|
||||||
host = "threema.chat.sum7.eu"
|
host = "threema.chat.sum7.eu"
|
||||||
connection = "localhost:5347"
|
connection = "localhost:5347"
|
||||||
secret = "change_me"
|
secret = "change_me"
|
||||||
xmpp_log = false
|
xmpp_debug = false
|
||||||
|
|
||||||
[component.special]
|
[component.special]
|
||||||
http_upload_url = "https://example.org/upload/threema"
|
http_upload_url = "https://example.org/upload/threema"
|
||||||
|
|
Reference in New Issue