Mercurial > libervia-backend
comparison src/plugins/plugin_exp_parrot.py @ 2128:aa94f33fd2ad
plugin otr: various improvments:
- messageSend trigger now use pre_xml_treatments so it doesn't block other triggers of higher priority
- text commands now use a very high priority, as it is local command and should not be blocked in most of cases
- new otrState signal, to send state change to frontends
- history is not skipped anymore, a future option may change this behaviour
- OTR trigger are skipped on groupchat messages
- context_manager is now in client instead of being global to plugin
- removed fixPotr as it is fixed upstream
note triggers should be improved for encryption methods, as skipping an encrypter may break security, but putting it in top priority may break nice features.
fix bug 170
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 01 Feb 2017 21:44:24 +0100 |
parents | 200cd707a46d |
children | 1d3f73e065e1 |
comparison
equal
deleted
inserted
replaced
2127:8717e9cc95c0 | 2128:aa94f33fd2ad |
---|---|
33 "protocols": [], | 33 "protocols": [], |
34 "dependencies": ["XEP-0045"], | 34 "dependencies": ["XEP-0045"], |
35 "recommendations": [C.TEXT_CMDS], | 35 "recommendations": [C.TEXT_CMDS], |
36 "main": "Exp_Parrot", | 36 "main": "Exp_Parrot", |
37 "handler": "no", | 37 "handler": "no", |
38 "description": _("""Implementation of parrot mode (repeat messages between 2 entities)""") | 38 "description": _(u"""Implementation of parrot mode (repeat messages between 2 entities)""") |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 class Exp_Parrot(object): | 42 class Exp_Parrot(object): |
43 """Parrot mode plugin: repeat messages from one entity or MUC room to another one""" | 43 """Parrot mode plugin: repeat messages from one entity or MUC room to another one""" |
44 #XXX: This plugin can be potentially dangerous if we don't trust entities linked | 44 # XXX: This plugin can be potentially dangerous if we don't trust entities linked |
45 # this is specially true if we have other triggers. | 45 # this is specially true if we have other triggers. |
46 # messageSendTrigger avoid other triggers execution, it's deactivated to allow | 46 # messageSendTrigger avoid other triggers execution, it's deactivated to allow |
47 # /unparrot command in text commands plugin. | 47 # /unparrot command in text commands plugin. |
48 # FIXME: potentially unsecure, specially with e2e encryption | |
48 | 49 |
49 def __init__(self, host): | 50 def __init__(self, host): |
50 log.info(_("Plugin Parrot initialization")) | 51 log.info(_("Plugin Parrot initialization")) |
51 self.host = host | 52 self.host = host |
52 host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100) | 53 host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100) |
53 #host.trigger.add("messageSend", self.messageSendTrigger, priority=100) | 54 #host.trigger.add("messageSend", self.messageSendTrigger, priority=100) |
54 try: | 55 try: |
55 self.host.plugins[C.TEXT_CMDS].registerTextCommands(self) | 56 self.host.plugins[C.TEXT_CMDS].registerTextCommands(self) |
56 except KeyError: | 57 except KeyError: |
57 log.info(_("Text commands not available")) | 58 log.info(_(u"Text commands not available")) |
58 | 59 |
59 #def messageSendTrigger(self, client, mess_data, treatments): | 60 #def messageSendTrigger(self, client, mess_data, treatments): |
60 # """ Deactivate other triggers if recipient is in parrot links """ | 61 # """ Deactivate other triggers if recipient is in parrot links """ |
61 # try: | 62 # try: |
62 # _links = client.parrot_links | 63 # _links = client.parrot_links |