diff src/core/sat_main.py @ 2131:628c1c95f442

plugin XEP-0334: fixed and improved message processing hints: - wrong elements were used in this plugging, it could not work properly - use constants for hints - add addHint method so other plugins can add a hint easily - hints can be added by frontends in mess_data['extra']['hints'] (serialized dict) or by other plugins using addHint - if history is skipped on message reception, mess_data['extra']['history']['skipped'] is set - introduced PLUGIN_INFO['usage'] for usage information for developers
author Goffi <goffi@goffi.org>
date Sun, 05 Feb 2017 14:55:19 +0100
parents 6a66c8c5a567
children 6e509ee853a8
line wrap: on
line diff
--- a/src/core/sat_main.py	Sat Feb 04 17:59:15 2017 +0100
+++ b/src/core/sat_main.py	Sun Feb 05 14:55:19 2017 +0100
@@ -672,7 +672,7 @@
         @param data: message data dictionnary
         @param client: profile's client
         """
-        client.send(data['xml'])
+        client.send(data[u'xml'])
         return data
 
     def messageAddToHistory(self, data, client):
@@ -681,10 +681,10 @@
         @param data: message data dictionnary
         @param client: profile's client
         """
-        if data["type"] != C.MESS_TYPE_GROUPCHAT:
+        if data[u"type"] != C.MESS_TYPE_GROUPCHAT:
             # we don't add groupchat message to history, as we get them back
             # and they will be added then
-            if data['message'] or data['subject']: # we need a message to store
+            if data[u'message'] or data[u'subject']: # we need a message to store
                 self.memory.addToHistory(client, data)
             else:
                log.warning(u"No message found") # empty body should be managed by plugins before this point
@@ -696,14 +696,14 @@
         @param data: message data dictionnary
         @param client: profile's client
         """
-        if data["type"] != C.MESS_TYPE_GROUPCHAT:
+        if data[u"type"] != C.MESS_TYPE_GROUPCHAT:
             # we don't send groupchat message to bridge, as we get them back
             # and they will be added the
-            if data['message'] or data['subject']: # we need a message to send something
+            if data[u'message'] or data[u'subject']: # we need a message to send something
                 # We send back the message, so all frontends are aware of it
-                self.bridge.messageNew(data['uid'], data['timestamp'], data['from'].full(), data['to'].full(), data['message'], data['subject'], data['type'], data['extra'], profile=client.profile)
+                self.bridge.messageNew(data[u'uid'], data[u'timestamp'], data[u'from'].full(), data[u'to'].full(), data[u'message'], data[u'subject'], data[u'type'], data[u'extra'], profile=client.profile)
             else:
-               log.warning(_("No message found"))
+               log.warning(_(u"No message found"))
         return data
 
     def _setPresence(self, to="", show="", statuses=None, profile_key=C.PROF_KEY_NONE):