Mercurial > libervia-backend
comparison sat/plugins/plugin_exp_parrot.py @ 3172:dcebc585c29f
core: renamed "MessageReceived" trigger to "messageReceived" for consistency.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 18 Feb 2020 18:13:19 +0100 |
parents | 559a625a236b |
children | 6cf4bd6972c2 |
comparison
equal
deleted
inserted
replaced
3171:d073d82d9044 | 3172:dcebc585c29f |
---|---|
53 # FIXME: potentially unsecure, specially with e2e encryption | 53 # FIXME: potentially unsecure, specially with e2e encryption |
54 | 54 |
55 def __init__(self, host): | 55 def __init__(self, host): |
56 log.info(_("Plugin Parrot initialization")) | 56 log.info(_("Plugin Parrot initialization")) |
57 self.host = host | 57 self.host = host |
58 host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100) | 58 host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=100) |
59 # host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100) | 59 # host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100) |
60 try: | 60 try: |
61 self.host.plugins[C.TEXT_CMDS].registerTextCommands(self) | 61 self.host.plugins[C.TEXT_CMDS].registerTextCommands(self) |
62 except KeyError: | 62 except KeyError: |
63 log.info(_("Text commands not available")) | 63 log.info(_("Text commands not available")) |
71 # | 71 # |
72 # if mess_data['to'].userhostJID() in _links.values(): | 72 # if mess_data['to'].userhostJID() in _links.values(): |
73 # log.debug("Parrot link detected, skipping other triggers") | 73 # log.debug("Parrot link detected, skipping other triggers") |
74 # raise trigger.SkipOtherTriggers | 74 # raise trigger.SkipOtherTriggers |
75 | 75 |
76 def MessageReceivedTrigger(self, client, message_elt, post_treat): | 76 def messageReceivedTrigger(self, client, message_elt, post_treat): |
77 """ Check if source is linked and repeat message, else do nothing """ | 77 """ Check if source is linked and repeat message, else do nothing """ |
78 # TODO: many things are not repeated (subject, thread, etc) | 78 # TODO: many things are not repeated (subject, thread, etc) |
79 profile = client.profile | 79 profile = client.profile |
80 client = self.host.getClient(profile) | 80 client = self.host.getClient(profile) |
81 from_jid = message_elt["from"] | 81 from_jid = message_elt["from"] |