Mercurial > libervia-backend
changeset 2133:7de291c3cd0c
plugin XEP-0280: new setPrivate method to tell server not to carbon copy it.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 05 Feb 2017 14:55:21 +0100 (2017-02-05) |
parents | c0577837680a |
children | f45250052846 |
files | src/plugins/plugin_xep_0280.py |
diffstat | 1 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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 <private/> 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): <message> stanza + """ + if message_elt.name != u'message': + log.error(u"addPrivateElt must be used with <message> 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"""