diff src/core/sat_main.py @ 2138:6e509ee853a8

plugin OTR, core; use of new sendMessage + OTR mini refactoring: - new client.sendMessage method is used instead of sendMessageToStream - client.feedback is used in OTR - OTR now add message processing hints and carbon private element as recommanded by XEP-0364. Explicit Message Encryption is still TODO - OTR use the new sendMessageFinish trigger, this has a number of advantages: * there is little risk that OTR is skipped by other plugins (they have to use client.sendMessage as recommanded) * being at the end of the chain, OTR can check and remove any HTML or other leaking elements * OTR doesn't have to skip other plugins anymore, this means that things like delivery receipts are now working with OTR (but because there is not full stanza encryption, they can leak metadata) * OTR can decide to follow storage hint by letting or deleting "history" key
author Goffi <goffi@goffi.org>
date Sun, 05 Feb 2017 15:00:01 +0100
parents 628c1c95f442
children be96beb7ca14
line wrap: on
line diff
--- a/src/core/sat_main.py	Sun Feb 05 14:55:56 2017 +0100
+++ b/src/core/sat_main.py	Sun Feb 05 15:00:01 2017 +0100
@@ -652,7 +652,7 @@
 
         pre_xml_treatments.addCallback(lambda dummy: self.generateMessageXML(data))
         pre_xml_treatments.chainDeferred(post_xml_treatments)
-        post_xml_treatments.addCallback(self.messageSendToStream, client)
+        post_xml_treatments.addCallback(client.sendMessage)
         if send_only:
             log.debug(_("Triggers, storage and echo have been inhibited by the 'send_only' parameter"))
         else:
@@ -666,15 +666,6 @@
         """A message sending can be cancelled by a plugin treatment"""
         failure.trap(exceptions.CancelError)
 
-    def messageSendToStream(self, data, client):
-        """Actualy send the message to the server
-
-        @param data: message data dictionnary
-        @param client: profile's client
-        """
-        client.send(data[u'xml'])
-        return data
-
     def messageAddToHistory(self, data, client):
         """Store message into database (for local history)