annotate libervia/backend/plugins/plugin_exp_invitation_pubsub.py @ 4255:32e49c389bfd

app (weblate): use `application weblate` section
author Goffi <goffi@goffi.org>
date Fri, 31 May 2024 15:15:42 +0200
parents 4b842c1fb686
children 0d7bb4df2343
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python3
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
2
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
3 # SàT plugin to send invitations for Pubsub
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
5
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # This program is free software: you can redistribute it and/or modify
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # it under the terms of the GNU Affero General Public License as published by
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # the Free Software Foundation, either version 3 of the License, or
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # (at your option) any later version.
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
10
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # GNU Affero General Public License for more details.
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
15
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
16 # You should have received a copy of the GNU Affero General Public License
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
18
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
19 from typing import Optional
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 from twisted.internet import defer
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 from twisted.words.protocols.jabber import jid
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 from twisted.words.xish import domish
4071
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
23 from libervia.backend.core.i18n import _
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
24 from libervia.backend.core.constants import Const as C
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
25 from libervia.backend.core.log import getLogger
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
26 from libervia.backend.core.xmpp import SatXMPPEntity
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
27 from libervia.backend.tools import utils
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
28 from libervia.backend.tools.common import data_format
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
29
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 log = getLogger(__name__)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
31
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
32
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
33 PLUGIN_INFO = {
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
34 C.PI_NAME: "Pubsub Invitation",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 C.PI_IMPORT_NAME: "PUBSUB_INVITATION",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 C.PI_TYPE: "EXP",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
37 C.PI_PROTOCOLS: [],
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 C.PI_DEPENDENCIES: ["XEP-0060", "INVITATION"],
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 C.PI_RECOMMENDATIONS: [],
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
40 C.PI_MAIN: "PubsubInvitation",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
41 C.PI_HANDLER: "no",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
42 C.PI_DESCRIPTION: _("Invitations for pubsub based features"),
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
43 }
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
44
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
45
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
46 class PubsubInvitation:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
47
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
48 def __init__(self, host):
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
49 log.info(_("Pubsub Invitation plugin initialization"))
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
50 self.host = host
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
51 self._p = host.plugins["XEP-0060"]
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
52 # namespace to handler map
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
53 self._ns_handler = {}
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
54 host.bridge.add_method(
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
55 "ps_invite",
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
56 ".plugin",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
57 in_sign="sssssss",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
58 out_sign="",
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
59 method=self._send_pubsub_invitation,
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
60 async_=True
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
61 )
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
62
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
63 def register(
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
64 self,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
65 namespace: str,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
66 handler
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
67 ) -> None:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
68 self._ns_handler[namespace] = handler
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
69 self.host.plugins["INVITATION"].register_namespace(namespace, self.on_invitation)
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
70
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
71 def _send_pubsub_invitation(
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
72 self, invitee_jid_s, service_s, node, item_id=None,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
73 name=None, extra_s='', profile_key=C.PROF_KEY_NONE):
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
74 client = self.host.get_client(profile_key)
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
75 invitee_jid = jid.JID(invitee_jid_s)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
76 service = jid.JID(service_s)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
77 extra = data_format.deserialise(extra_s)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
78 return defer.ensureDeferred(
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
79 self.invite(
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
80 client,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
81 invitee_jid,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
82 service,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
83 node,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
84 item_id or None,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
85 name=name or None,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 extra=extra
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
87 )
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
88 )
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
89
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
90 async def invite(
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
91 self,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
92 client: SatXMPPEntity,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
93 invitee_jid: jid.JID,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
94 service: jid.JID,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
95 node: str,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
96 item_id: Optional[str] = None,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
97 name: str = '',
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
98 extra: Optional[dict] = None,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
99 ) -> None:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
100 if extra is None:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
101 extra = {}
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
102 else:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
103 namespace = extra.get("namespace")
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
104 if namespace:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
105 try:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
106 handler = self._ns_handler[namespace]
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
107 preflight = handler.invite_preflight
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
108 except KeyError:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
109 pass
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
110 except AttributeError:
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
111 log.debug(f"no invite_preflight method found for {namespace!r}")
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
112 else:
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
113 await utils.as_deferred(
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
114 preflight,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
115 client, invitee_jid, service, node, item_id, name, extra
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
116 )
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
117 if item_id is None:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
118 item_id = extra.pop("default_item_id", None)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
119
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
120 # we authorize our invitee to see the nodes of interest
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
121 await self._p.set_node_affiliations(client, service, node, {invitee_jid: "member"})
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
122 log.debug(f"affiliation set on {service}'s {node!r} node")
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
123
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
124 # now we send the invitation
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
125 self.host.plugins["INVITATION"].send_pubsub_invitation(
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
126 client,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
127 invitee_jid,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
128 service,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
129 node,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
130 item_id,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
131 name=name or None,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
132 extra=extra
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
133 )
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
134
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
135 async def on_invitation(
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
136 self,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
137 client: SatXMPPEntity,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
138 namespace: str,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
139 name: str,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
140 extra: dict,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
141 service: jid.JID,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
142 node: str,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
143 item_id: Optional[str],
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
144 item_elt: domish.Element
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
145 ) -> None:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
146 if extra is None:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
147 extra = {}
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
148 try:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
149 handler = self._ns_handler[namespace]
4027
26c3e1bc7fb7 plugin XEP-0471: renamed "events" plugin to XEP-0471 now that there is a XEP
Goffi <goffi@goffi.org>
parents: 3584
diff changeset
150 preflight = handler.on_invitation_preflight
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
151 except KeyError:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
152 pass
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
153 except AttributeError:
4027
26c3e1bc7fb7 plugin XEP-0471: renamed "events" plugin to XEP-0471 now that there is a XEP
Goffi <goffi@goffi.org>
parents: 3584
diff changeset
154 log.debug(f"no on_invitation_preflight method found for {namespace!r}")
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
155 else:
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
156 await utils.as_deferred(
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
157 preflight,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
158 client, namespace, name, extra, service, node, item_id, item_elt
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
159 )
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
160 if item_id is None:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
161 item_id = extra.pop("default_item_id", None)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
162 creator = extra.pop("creator", False)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
163 element = extra.pop("element", None)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
164 if not name:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
165 name = extra.pop("name", "")
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
166
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 4027
diff changeset
167 return await self.host.plugins['LIST_INTEREST'].register_pubsub(
3462
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
168 client, namespace, service, node, item_id, creator,
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
169 name, element, extra)