annotate sat/plugins/plugin_exp_invitation_pubsub.py @ 3728:b15644cae50d

component AP gateway: JID/node ⟺ AP outbox conversion: - convert a combination of JID and optional pubsub node to AP actor handle (see `getJIDAndNode` for details) and vice versa - the gateway now provides a Pubsub service - retrieve pubsub node and convert it to AP collection, AP pagination is converted to RSM - do the opposite: convert AP collection to pubsub and handle RSM request. Due to ActivityStream collection pagination limitations, some RSM request produce inefficient requests, but caching should be used most of the time in the future and avoid the problem. - set specific name to HTTP Server - new `local_only` setting (`True` by default) to indicate if the gateway can request or not XMPP Pubsub nodes from other servers - disco info now specifies important features such as Pubsub RSM, and nodes metadata ticket 363
author Goffi <goffi@goffi.org>
date Tue, 25 Jan 2022 17:54:06 +0100
parents edc79cefe968
children 26c3e1bc7fb7
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
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from sat.core.i18n import _
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from sat.core.constants import Const as C
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 from sat.core.log import getLogger
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from sat.core.xmpp import SatXMPPEntity
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 from sat.tools import utils
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 from sat.tools.common import data_format
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 = {}
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
54 host.bridge.addMethod(
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
55 "psInvite",
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="",
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
59 method=self._sendPubsubInvitation,
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
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
69 self.host.plugins["INVITATION"].registerNamespace(namespace, self.onInvitation)
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
70
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
71 def _sendPubsubInvitation(
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):
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
74 client = self.host.getClient(profile_key)
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]
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
107 preflight = handler.invitePreflight
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:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
111 log.debug(f"no invitePreflight method found for {namespace!r}")
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
112 else:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
113 await utils.asDeferred(
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
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
121 await self._p.setNodeAffiliations(client, service, node, {invitee_jid: "member"})
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
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
125 self.host.plugins["INVITATION"].sendPubsubInvitation(
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
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
135 async def onInvitation(
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]
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
150 preflight = handler.onInvitationPreflight
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:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
154 log.debug(f"no onInvitationPreflight method found for {namespace!r}")
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
155 else:
12dc234f698c plugin invitation: pubsub invitations:
Goffi <goffi@goffi.org>
parents:
diff changeset
156 await utils.asDeferred(
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
3584
edc79cefe968 plugin XEP-0060: `getItem(s)`, `publish` and `(un)subscribe` are now coroutines
Goffi <goffi@goffi.org>
parents: 3462
diff changeset
167 return await self.host.plugins['LIST_INTEREST'].registerPubsub(
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)