summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-11-26 15:06:05 +0100
committerWim <wim@42.be>2016-11-26 15:08:41 +0100
commit4960273832aa9b64a0c8872cc434fb6dec841bf6 (patch)
tree7411384b2883b02cf7c9b57a28c48ea7ca336e20
parent6c018ee6fea5114cfeda9c3e1043c50b1139d3eb (diff)
downloadmatterbridge-msglm-4960273832aa9b64a0c8872cc434fb6dec841bf6.tar.gz
matterbridge-msglm-4960273832aa9b64a0c8872cc434fb6dec841bf6.tar.bz2
matterbridge-msglm-4960273832aa9b64a0c8872cc434fb6dec841bf6.zip
Do not relay empty or delayed messages (xmpp)
-rw-r--r--bridge/xmpp/xmpp.go3
1 files changed, 2 insertions, 1 deletions
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}
}