changeset 2856:26d6ac4e4a66

plugin android: don't send notification if message comes from ourself (from an other device)
author Goffi <goffi@goffi.org>
date Sat, 16 Mar 2019 14:39:02 +0100
parents ef65dbce313b
children 88f10630d5ea
files sat/plugins/plugin_misc_android.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_android.py	Sun Mar 10 18:04:27 2019 +0100
+++ b/sat/plugins/plugin_misc_android.py	Sat Mar 16 14:39:02 2019 +0100
@@ -155,8 +155,14 @@
         pass
 
     def _notifyMessage(self, mess_data, client):
-        # send notification if there is a message and it is not a groupchat
-        if mess_data["message"] and mess_data["type"] != C.MESS_TYPE_GROUPCHAT:
+        """Send notification when suitable
+
+        notification is sent if:
+            - there is a message and it is not a groupchat
+            - message is not coming from ourself
+        """
+        if (mess_data["message"] and mess_data["type"] != C.MESS_TYPE_GROUPCHAT
+            and not mess_data["from"].userhostJID() == client.jid.userhostJID()):
             message = mess_data["message"].itervalues().next()
             try:
                 subject = mess_data["subject"].itervalues().next()