From 4960273832aa9b64a0c8872cc434fb6dec841bf6 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 26 Nov 2016 15:06:05 +0100 Subject: [PATCH] Do not relay empty or delayed messages (xmpp) --- bridge/xmpp/xmpp.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index 9ec6b234..e41baf86 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -98,6 +98,7 @@ func (b *Bxmpp) xmppKeepAlive() chan bool { func (b *Bxmpp) handleXmpp() error { done := b.xmppKeepAlive() defer close(done) + nodelay := time.Time{} for { m, err := b.xc.Recv() if err != nil { @@ -115,7 +116,7 @@ func (b *Bxmpp) handleXmpp() error { if len(s) == 2 { nick = s[1] } - if nick != b.Config.Nick { + if nick != b.Config.Nick && v.Stamp == nodelay && v.Text != "" { flog.Debugf("Sending message from %s on %s to gateway", nick, b.Account) b.Remote <- config.Message{Username: nick, Text: v.Text, Channel: channel, Account: b.Account} }