core (xmpp): adapt message workflow to components:
message workflow were not used for components so far. This patch activate it, normalise namespace to the client one to simplify parsing, and use SatXMPPComponent.sendHistory and SatXMPPComponent.receiveHistory to indicate if a component should store sent and received message in database (they both default to False). OTR plugin is deactivated for components. rel 367
This commit is contained in:
parent
441ae82fcb
commit
3ccd4280ac
1 changed files with 34 additions and 15 deletions
|
|
@ -42,6 +42,7 @@ log = getLogger(__name__)
|
|||
PLUGIN_INFO = {
|
||||
C.PI_NAME: "OTR",
|
||||
C.PI_IMPORT_NAME: "OTR",
|
||||
C.PI_MODES: [C.PLUG_MODE_CLIENT],
|
||||
C.PI_TYPE: "SEC",
|
||||
C.PI_PROTOCOLS: ["XEP-0364"],
|
||||
C.PI_DEPENDENCIES: ["XEP-0280", "XEP-0334"],
|
||||
|
|
@ -731,6 +732,8 @@ class OTR(object):
|
|||
return data
|
||||
|
||||
def messageReceivedTrigger(self, client, message_elt, post_treat):
|
||||
if client.is_component:
|
||||
return True
|
||||
if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT:
|
||||
# OTR is not possible in group chats
|
||||
return True
|
||||
|
|
@ -745,6 +748,8 @@ class OTR(object):
|
|||
return True
|
||||
|
||||
def _sendMessageDataTrigger(self, client, mess_data):
|
||||
if client.is_component:
|
||||
return True
|
||||
encryption = mess_data.get(C.MESS_KEY_ENCRYPTION)
|
||||
if encryption is None or encryption['plugin'].namespace != NS_OTR:
|
||||
return
|
||||
|
|
@ -788,6 +793,8 @@ class OTR(object):
|
|||
|
||||
def sendMessageTrigger(self, client, mess_data, pre_xml_treatments,
|
||||
post_xml_treatments):
|
||||
if client.is_component:
|
||||
return True
|
||||
if mess_data["type"] == "groupchat":
|
||||
return True
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue