From: Bernhard Tittelbach Date: Fri, 8 Nov 2013 04:10:56 +0000 (+0000) Subject: disable user on message error X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=39422bed6ea1746af53efd33311634b3f27dca01;p=svn42.git disable user on message error --- diff --git a/go/r3-netstatus/r3xmppbot/r3xmppbot.go b/go/r3-netstatus/r3xmppbot/r3xmppbot.go index 795d7a8..3ad4177 100644 --- a/go/r3-netstatus/r3xmppbot/r3xmppbot.go +++ b/go/r3-netstatus/r3xmppbot/r3xmppbot.go @@ -329,12 +329,18 @@ func (botdata *XmppBot) handleIncomingXMPPStanzas(xmppin <- chan xmpp.Stanza, xm switch stanza := incoming_stanza.(type) { case *xmpp.Message: if stanza.GetHeader() == nil { continue } - botdata.handleIncomingMessageDialog(*stanza, xmppout, jabber_events) if stanza.Type == "error" || stanza.Error != nil { Syslog_.Printf("XMPP %T Error: %s", stanza, stanza) + if stanza.Error.Type == "cancel" { + // asume receipient not reachable -> disable + Syslog_.Printf("Error reaching %s. Disabling user, please reenable manually", stanza.From) + jabber_events <- JabberEvent{stanza.From, false, R3NeverInfo, false} + continue + } if handleStanzaError() { return } continue } else { error_count = 0 } + botdata.handleIncomingMessageDialog(*stanza, xmppout, jabber_events) case *xmpp.Presence: if stanza.GetHeader() == nil { continue } if stanza.Type == "error" || stanza.Error != nil {