MAM: Check muc#user namespace before we disco
1. Check if the message has the muc#user namespace 2. Check if we have this jid already in the DB 3. Last resort disco the jid
This commit is contained in:
parent
f30564c15c
commit
994244c910
|
@ -1127,6 +1127,8 @@ class MamGcMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
:stanza: Complete stanza Node
|
:stanza: Complete stanza Node
|
||||||
:forwarded: Forwarded Node
|
:forwarded: Forwarded Node
|
||||||
:result: Result Node
|
:result: Result Node
|
||||||
|
:muc_pm: True, if this is a MUC PM
|
||||||
|
propagated to MamDecryptedMessageReceivedEvent
|
||||||
'''
|
'''
|
||||||
self._set_base_event_vars_as_attributes(base_event)
|
self._set_base_event_vars_as_attributes(base_event)
|
||||||
self.additional_data = {}
|
self.additional_data = {}
|
||||||
|
@ -1207,8 +1209,12 @@ class MamDecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
if self.groupchat:
|
if self.groupchat:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self.is_pm = app.logger.jid_is_room_jid(self.with_.getStripped())
|
if not self.muc_pm:
|
||||||
if self.is_pm is None:
|
# muc_pm = False, means only there was no muc#user namespace
|
||||||
|
# This could still be a muc pm, we check the database if we
|
||||||
|
# know this jid. If not we disco it.
|
||||||
|
self.muc_pm = app.logger.jid_is_room_jid(self.with_.getStripped())
|
||||||
|
if self.muc_pm is None:
|
||||||
# Check if this event is triggered after a disco, so we dont
|
# Check if this event is triggered after a disco, so we dont
|
||||||
# run into an endless loop
|
# run into an endless loop
|
||||||
if hasattr(self, 'disco'):
|
if hasattr(self, 'disco'):
|
||||||
|
@ -1223,7 +1229,7 @@ class MamDecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
||||||
self.conn.mam_awaiting_disco_result[server].append(self)
|
self.conn.mam_awaiting_disco_result[server].append(self)
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.is_pm:
|
if self.muc_pm:
|
||||||
self.with_ = str(self.with_)
|
self.with_ = str(self.with_)
|
||||||
else:
|
else:
|
||||||
self.with_ = self.with_.getStripped()
|
self.with_ = self.with_.getStripped()
|
||||||
|
|
Loading…
Reference in New Issue