Adapt to latest nbxmpp changes

This commit is contained in:
Philipp Hörist 2017-07-29 20:39:35 +02:00
parent 05b509e008
commit c1decf682b
1 changed files with 7 additions and 8 deletions

View File

@ -1062,7 +1062,7 @@ class MamMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
log.info('MAM message not from our user archive') log.info('MAM message not from our user archive')
return False return False
self.msg_ = self.forwarded.getTag('message') self.msg_ = self.forwarded.getTag('message', protocol=True)
if self.msg_.getType() == 'groupchat': if self.msg_.getType() == 'groupchat':
log.info('Received groupchat message from user archive') log.info('Received groupchat message from user archive')
@ -1075,11 +1075,8 @@ class MamMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
to = self.msg_.getTo() to = self.msg_.getTo()
if frm.bareMatch(own_jid): if frm.bareMatch(own_jid):
self.stanza_id = self.msg_.getTag('origin-id', self.stanza_id = self.msg_.getOriginID()
namespace=nbxmpp.NS_SID) if not self.stanza_id:
if self.stanza_id:
self.stanza_id = self.stanza_id.getID()
else:
self.stanza_id = self.msg_.getID() self.stanza_id = self.msg_.getID()
self.with_ = to self.with_ = to
@ -1228,11 +1225,13 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
return return
self.forwarded = True self.forwarded = True
result = self.stanza.getTag('result') result = self.stanza.getTag('result', protocol=True)
if result and result.getNamespace() in (nbxmpp.NS_MAM, if result and result.getNamespace() in (nbxmpp.NS_MAM,
nbxmpp.NS_MAM_1, nbxmpp.NS_MAM_1,
nbxmpp.NS_MAM_2): nbxmpp.NS_MAM_2):
forwarded = result.getTag('forwarded', namespace=nbxmpp.NS_FORWARD) forwarded = result.getTag('forwarded',
namespace=nbxmpp.NS_FORWARD,
protocol=True)
if not forwarded: if not forwarded:
log.warning('Invalid MAM Message: no forwarded child') log.warning('Invalid MAM Message: no forwarded child')
return return