MAM: Display received mam message in open chats
This commit is contained in:
parent
12b27bf5ba
commit
c6e7f8628d
|
@ -240,6 +240,9 @@ class ChatControl(ChatControlBase):
|
|||
self._nec_caps_received)
|
||||
app.ged.register_event_handler('stanza-message-outgoing', ged.OUT_POSTCORE,
|
||||
self._message_sent)
|
||||
app.ged.register_event_handler(
|
||||
'mam-decrypted-message-received',
|
||||
ged.GUI1, self._nec_mam_decrypted_message_received)
|
||||
|
||||
# PluginSystem: adding GUI extension point for this ChatControl
|
||||
# instance object
|
||||
|
@ -806,6 +809,20 @@ class ChatControl(ChatControlBase):
|
|||
app.plugin_manager.extension_point(
|
||||
'encryption_dialog' + self.encryption, self)
|
||||
|
||||
def _nec_mam_decrypted_message_received(self, obj):
|
||||
if obj.conn.name != self.account:
|
||||
return
|
||||
if obj.with_ != self.contact.jid:
|
||||
return
|
||||
|
||||
kind = 'incoming'
|
||||
if obj.kind == KindConstant.CHAT_MSG_SENT:
|
||||
kind = 'outgoing'
|
||||
|
||||
self.print_conversation(obj.msgtxt, kind, tim=obj.timestamp,
|
||||
encrypted=obj.encrypted, correct_id=obj.correct_id,
|
||||
msg_stanza_id=obj.message_id, additional_data=obj.additional_data)
|
||||
|
||||
def _message_sent(self, obj):
|
||||
if obj.conn.name != self.account:
|
||||
return
|
||||
|
|
|
@ -1052,6 +1052,7 @@ class MamMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
|||
|
||||
# use stanza-id as unique-id
|
||||
self.unique_id, origin_id = self.get_unique_id()
|
||||
self.message_id = self.msg_.getID()
|
||||
|
||||
# Check for duplicates
|
||||
if app.logger.find_stanza_id(account,
|
||||
|
@ -1199,11 +1200,17 @@ class MamDecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
|
|||
base_network_events = []
|
||||
|
||||
def generate(self):
|
||||
self.correct_id = None
|
||||
|
||||
if not self.msgtxt:
|
||||
# For example Chatstates, Receipts, Chatmarkers
|
||||
log.debug('Received MAM message without text')
|
||||
return
|
||||
|
||||
replace = self.msg_.getTag('replace', namespace=nbxmpp.NS_CORRECT)
|
||||
if replace is not None:
|
||||
self.correct_id = replace.getAttr('id')
|
||||
|
||||
self.get_oob_data(self.msg_)
|
||||
|
||||
if self.groupchat:
|
||||
|
|
Loading…
Reference in New Issue