Mercurial > libervia-backend
comparison libervia/backend/plugins/plugin_xep_0353.py @ 4183:6784d07b99c8
plugin XEP-053, component AP gateway: use the new `trigger.add_with_check` method
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 09 Dec 2023 19:20:13 +0100 |
parents | 0da563780ffc |
children | e11b13418ba6 |
comparison
equal
deleted
inserted
replaced
4182:4dc00e848961 | 4183:6784d07b99c8 |
---|---|
37 | 37 |
38 PLUGIN_INFO = { | 38 PLUGIN_INFO = { |
39 C.PI_NAME: "Jingle Message Initiation", | 39 C.PI_NAME: "Jingle Message Initiation", |
40 C.PI_IMPORT_NAME: "XEP-0353", | 40 C.PI_IMPORT_NAME: "XEP-0353", |
41 C.PI_TYPE: "XEP", | 41 C.PI_TYPE: "XEP", |
42 C.PI_MODES: [C.PLUG_MODE_CLIENT], | 42 C.PI_MODES: C.PLUG_MODE_BOTH, |
43 C.PI_PROTOCOLS: ["XEP-0353"], | 43 C.PI_PROTOCOLS: ["XEP-0353"], |
44 C.PI_DEPENDENCIES: ["XEP-0166", "XEP-0334"], | 44 C.PI_DEPENDENCIES: ["XEP-0166", "XEP-0334"], |
45 C.PI_MAIN: "XEP_0353", | 45 C.PI_MAIN: "XEP_0353", |
46 C.PI_HANDLER: "yes", | 46 C.PI_HANDLER: "yes", |
47 C.PI_DESCRIPTION: _("""Implementation of Jingle Message Initiation"""), | 47 C.PI_DESCRIPTION: _("""Implementation of Jingle Message Initiation"""), |
64 log.info(_("plugin {name} initialization").format(name=PLUGIN_INFO[C.PI_NAME])) | 64 log.info(_("plugin {name} initialization").format(name=PLUGIN_INFO[C.PI_NAME])) |
65 self.host = host | 65 self.host = host |
66 host.register_namespace("jingle-message", NS_JINGLE_MESSAGE) | 66 host.register_namespace("jingle-message", NS_JINGLE_MESSAGE) |
67 self._j = host.plugins["XEP-0166"] | 67 self._j = host.plugins["XEP-0166"] |
68 self._h = host.plugins["XEP-0334"] | 68 self._h = host.plugins["XEP-0334"] |
69 host.trigger.add( | 69 host.trigger.add_with_check( |
70 "XEP-0166_initiate_elt_built", | 70 "XEP-0166_initiate_elt_built", |
71 self, | |
71 self._on_initiate_trigger, | 72 self._on_initiate_trigger, |
72 # this plugin set the resource, we want it to happen first to other trigger | 73 # this plugin set the resource, we want it to happen first to other trigger |
73 # can get the full peer JID | 74 # can get the full peer JID |
74 priority=host.trigger.MAX_PRIORITY, | 75 priority=host.trigger.MAX_PRIORITY, |
75 ) | 76 ) |
76 host.trigger.add( | 77 host.trigger.add_with_check( |
77 "XEP-0166_terminate", | 78 "XEP-0166_terminate", |
79 self, | |
78 self._terminate_trigger, | 80 self._terminate_trigger, |
79 priority=host.trigger.MAX_PRIORITY, | 81 priority=host.trigger.MAX_PRIORITY, |
80 ) | 82 ) |
81 host.trigger.add("message_received", self._on_message_received) | 83 host.trigger.add("message_received", self._on_message_received) |
82 | 84 |