Commit ff8e02c6 authored by singpolyma's avatar singpolyma

Display OOB content, even without <body/>

Also, if the OOB URL is identical to the entire contents of a <body/>,
no reason to show both.

Closes #8521
parent 755b9bed
......@@ -1462,12 +1462,15 @@ class DecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
self.oob_url = oob_node.getTagData('url')
self.oob_desc = oob_node.getTagData('desc')
if self.oob_url:
self.msgtxt += '\n'
if self.oob_desc:
self.msgtxt += self.oob_desc
if self.msgtxt in [None, '', self.oob_url]:
self.msgtxt = ''
else:
self.msgtxt += _('URL:')
self.msgtxt += ' ' + self.oob_url
self.msgtxt += '\n'
if self.oob_desc:
self.msgtxt += self.oob_desc + ' '
elif self.msgtxt != '':
self.msgtxt += _('URL:') + ' '
self.msgtxt += self.oob_url
replace = self.stanza.getTag('replace', namespace=nbxmpp.NS_CORRECT)
if replace:
......
......@@ -83,7 +83,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
self.control.change_resource(self.resource)
if obj.mtype == 'chat':
if not obj.stanza.getTag('body') and obj.chatstate is None:
if not obj.msgtxt and obj.chatstate is None:
return
log_type = 'chat_msg'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment