# HG changeset patch # User Goffi # Date 1486302921 -3600 # Node ID 7de291c3cd0cbf4e6e37ed10f4ca355c6a47e6b7 # Parent c0577837680a0df222f0246504c1d324947e6f06 plugin XEP-0280: new setPrivate method to tell server not to carbon copy it. diff -r c0577837680a -r 7de291c3cd0c src/plugins/plugin_xep_0280.py --- a/src/plugins/plugin_xep_0280.py Sun Feb 05 14:55:21 2017 +0100 +++ b/src/plugins/plugin_xep_0280.py Sun Feb 05 14:55:21 2017 +0100 @@ -39,14 +39,14 @@ NS_CARBONS = 'urn:xmpp:carbons:2' PLUGIN_INFO = { - "name": "XEP-0280 Plugin", - "import_name": "XEP-0280", - "type": "XEP", - "protocols": ["XEP-0280"], + "name": u"XEP-0280 Plugin", + "import_name": u"XEP-0280", + "type": u"XEP", + "protocols": [u"XEP-0280"], "dependencies": [], - "main": "XEP_0280", - "handler": "yes", - "description": _("""Implementation of Message Carbons""") + "main": u"XEP_0280", + "handler": u"yes", + "description": D_(u"""Implementation of Message Carbons""") } @@ -79,6 +79,18 @@ def getHandler(self, profile): return XEP_0280_handler() + def setPrivate(self, message_elt): + """Add a element to a message + + this method is intented to be called on final domish.Element by other plugins + (in particular end 2 end encryption plugins) + @param message_elt(domish.Element): stanza + """ + if message_elt.name != u'message': + log.error(u"addPrivateElt must be used with stanzas") + return + message_elt.addElement((NS_CARBONS, u'private')) + @defer.inlineCallbacks def profileConnected(self, profile): """activate message carbons on connection if possible and activated in config"""