prevent showing error message when we receive a PEP error message and really ignore it

This commit is contained in:
Yann Leboulanger 2009-11-25 16:50:49 +01:00
parent 351ddb4718
commit 98e27253b6
2 changed files with 7 additions and 2 deletions

View File

@ -2733,8 +2733,11 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
con.RegisterHandler('message', self._messageCB) con.RegisterHandler('message', self._messageCB)
con.RegisterHandler('presence', self._presenceCB) con.RegisterHandler('presence', self._presenceCB)
con.RegisterHandler('presence', self._capsPresenceCB) con.RegisterHandler('presence', self._capsPresenceCB)
con.RegisterHandler('message', self._pubsubEventCB, # We use makefirst so that this handler is called before _messageCB, and
ns=common.xmpp.NS_PUBSUB_EVENT) # can prevent calling it when it's not needed.
# We also don't check for namespace, else it cannot stop _messageCB to be
# called
con.RegisterHandler('message', self._pubsubEventCB, makefirst=True)
con.RegisterHandler('iq', self._vCardCB, 'result', con.RegisterHandler('iq', self._vCardCB, 'result',
common.xmpp.NS_VCARD) common.xmpp.NS_VCARD)
con.RegisterHandler('iq', self._rosterSetCB, 'set', con.RegisterHandler('iq', self._rosterSetCB, 'set',

View File

@ -454,6 +454,8 @@ class ConnectionPEP(object):
def _pubsubEventCB(self, xmpp_dispatcher, msg): def _pubsubEventCB(self, xmpp_dispatcher, msg):
''' Called when we receive <message /> with pubsub event. ''' ''' Called when we receive <message /> with pubsub event. '''
if not msg.getTag('event'):
return
if msg.getTag('error'): if msg.getTag('error'):
log.debug('PubsubEventCB received error stanza. Ignoring') log.debug('PubsubEventCB received error stanza. Ignoring')
raise xmpp.NodeProcessed raise xmpp.NodeProcessed