5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-12-24 03:25:40 +00:00

Do not relay empty or delayed messages (xmpp)

This commit is contained in:
Wim 2016-11-26 15:06:05 +01:00
parent 6c018ee6fe
commit 4960273832

View File

@ -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}
}