Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim

Commits:
ff8e02c6 by Stephen Paul Weber at 2017-04-06T17:01:38-05:00
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

- - - - -
b4bb07a0 by Philipp Hörist at 2017-04-10T16:59:34+02:00
Merge branch 'improve-oob-display' into 'gajim_0.16'

Display OOB content, even without <body/>

See merge request !79
- - - - -


2 changed files:

- src/common/connection_handlers_events.py
- src/session.py


Changes:

=====================================
src/common/connection_handlers_events.py
=====================================
--- a/src/common/connection_handlers_events.py
+++ b/src/common/connection_handlers_events.py
@@ -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:


=====================================
src/session.py
=====================================
--- a/src/session.py
+++ b/src/session.py
@@ -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'



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/b5fabea53e87eeefd309e19e5babb7b9bff94031...b4bb07a071b5b096ee0bbd44ab12e1b13caa8f4f
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to