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
This commit is contained in:
parent
13e2e50cb0
commit
a2c151f9c6
1 changed files with 63 additions and 55 deletions
|
|
@ -672,7 +672,7 @@ class SAT(service.Service):
|
|||
@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 @@ class SAT(service.Service):
|
|||
@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 @@ class SAT(service.Service):
|
|||
@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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue