comparison sat/plugins/plugin_exp_invitation.py @ 3350:cc6164a4973b

plugin list of interests: normalize item ID + added `get` method
author Goffi <goffi@goffi.org>
date Sat, 05 Sep 2020 20:22:23 +0200
parents b57b5e42e894
children 19bad15f4c0a
comparison
equal deleted inserted replaced
3349:2a7e36b69fd2 3350:cc6164a4973b
33 PLUGIN_INFO = { 33 PLUGIN_INFO = {
34 C.PI_NAME: "Invitation", 34 C.PI_NAME: "Invitation",
35 C.PI_IMPORT_NAME: "INVITATION", 35 C.PI_IMPORT_NAME: "INVITATION",
36 C.PI_TYPE: "EXP", 36 C.PI_TYPE: "EXP",
37 C.PI_PROTOCOLS: [], 37 C.PI_PROTOCOLS: [],
38 C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0106", "XEP-0329"], 38 C.PI_DEPENDENCIES: ["XEP-0060", "XEP-0329", "LIST_INTEREST"],
39 C.PI_RECOMMENDATIONS: ["EMAIL_INVITATION"], 39 C.PI_RECOMMENDATIONS: ["EMAIL_INVITATION"],
40 C.PI_MAIN: "Invitation", 40 C.PI_MAIN: "Invitation",
41 C.PI_HANDLER: "yes", 41 C.PI_HANDLER: "yes",
42 C.PI_DESCRIPTION: _("Experimental handling of invitations"), 42 C.PI_DESCRIPTION: _("Experimental handling of invitations"),
43 } 43 }
161 @param name(unicode, None): see [_generateBaseInvitation] 161 @param name(unicode, None): see [_generateBaseInvitation]
162 @param extra(dict, None): see [_generateBaseInvitation] 162 @param extra(dict, None): see [_generateBaseInvitation]
163 """ 163 """
164 if extra is None: 164 if extra is None:
165 extra = {} 165 extra = {}
166 # FIXME: Q&D fix as the bare file sharing service JID will lead to user own 166 li_plg = self.host.plugins["LIST_INTEREST"]
167 # repository, which thus would not be the same for the host and the guest. 167 li_plg.normaliseFileSharingService(client, service)
168 # By specifying the user part, we for the use of the host repository.
169 # A cleaner way should be implemented
170 if service.user is None:
171 service.user = self.host.plugins['XEP-0106'].escape(client.jid.user)
172 168
173 # FIXME: not the best place to adapt permission, but it's necessary to check them 169 # FIXME: not the best place to adapt permission, but it's necessary to check them
174 # for UX 170 # for UX
175 try: 171 try:
176 await self.host.plugins['XEP-0329'].affiliationsSet( 172 await self.host.plugins['XEP-0329'].affiliationsSet(