5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-26 10:02:06 +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 { func (b *Bxmpp) handleXmpp() error {
done := b.xmppKeepAlive() done := b.xmppKeepAlive()
defer close(done) defer close(done)
nodelay := time.Time{}
for { for {
m, err := b.xc.Recv() m, err := b.xc.Recv()
if err != nil { if err != nil {
@ -115,7 +116,7 @@ func (b *Bxmpp) handleXmpp() error {
if len(s) == 2 { if len(s) == 2 {
nick = s[1] 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) 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} b.Remote <- config.Message{Username: nick, Text: v.Text, Channel: channel, Account: b.Account}
} }