comparison sat/plugins/plugin_misc_android.py @ 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 90115cf4e731
children 5546613f5007
comparison
equal deleted inserted replaced
2855:ef65dbce313b 2856:26d6ac4e4a66
153 153
154 def _onStopped(self, previous_state): 154 def _onStopped(self, previous_state):
155 pass 155 pass
156 156
157 def _notifyMessage(self, mess_data, client): 157 def _notifyMessage(self, mess_data, client):
158 # send notification if there is a message and it is not a groupchat 158 """Send notification when suitable
159 if mess_data["message"] and mess_data["type"] != C.MESS_TYPE_GROUPCHAT: 159
160 notification is sent if:
161 - there is a message and it is not a groupchat
162 - message is not coming from ourself
163 """
164 if (mess_data["message"] and mess_data["type"] != C.MESS_TYPE_GROUPCHAT
165 and not mess_data["from"].userhostJID() == client.jid.userhostJID()):
160 message = mess_data["message"].itervalues().next() 166 message = mess_data["message"].itervalues().next()
161 try: 167 try:
162 subject = mess_data["subject"].itervalues().next() 168 subject = mess_data["subject"].itervalues().next()
163 except StopIteration: 169 except StopIteration:
164 subject = u"Cagou new message" 170 subject = u"Cagou new message"