Mercurial > libervia-backend
diff sat/plugins/plugin_exp_invitation_file.py @ 3462:12dc234f698c
plugin invitation: pubsub invitations:
- new Pubsub invitation plugin, to have a generic way to manage invitation on Pubsub based
features
- `invitePreflight` and `onInvitationPreflight` method can be implemented to customise
invitation for a namespace
- refactored events invitations to use the new plugin
- a Pubsub invitation can now be for a whole node instead of a specific item
- if invitation is for a node, a namespace can be specified to indicate what this node is
about. It is then added in `extra` data
- an element (domish.Element) can be added in `extra` data, it will then be added in the
invitation
- some code modernisation
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 19 Feb 2021 15:50:22 +0100 |
parents | b57b5e42e894 |
children | be6d91572633 |
line wrap: on
line diff
--- a/sat/plugins/plugin_exp_invitation_file.py Fri Feb 19 15:49:59 2021 +0100 +++ b/sat/plugins/plugin_exp_invitation_file.py Fri Feb 19 15:50:22 2021 +0100 @@ -19,6 +19,7 @@ from sat.core.i18n import _ from sat.core.constants import Const as C from sat.core.log import getLogger +from sat.core.xmpp import SatXMPPEntity from sat.tools.common import data_format from twisted.internet import defer from twisted.words.protocols.jabber import jid @@ -69,7 +70,17 @@ extra=extra) ) - def onInvitation(self, client, name, extra, service, repos_type, namespace, path): + def onInvitation( + self, + client: SatXMPPEntity, + namespace: str, + name: str, + extra: dict, + service: jid.JID, + repos_type: str, + sharing_ns: str, + path: str + ): if repos_type == "files": type_human = _("file sharing") elif repos_type == "photos": @@ -81,11 +92,12 @@ type_human = _("file sharing") log.info(_( '{profile} has received an invitation for a files repository ({type_human}) ' - 'with namespace {namespace!r} at path [{path}]').format( - profile=client.profile, type_human=type_human, namespace=namespace, path=path) + 'with namespace {sharing_ns!r} at path [{path}]').format( + profile=client.profile, type_human=type_human, sharing_ns=sharing_ns, + path=path) ) return defer.ensureDeferred( self.host.plugins['LIST_INTEREST'].registerFileSharing( - client, service, repos_type, namespace, path, name, extra + client, service, repos_type, sharing_ns, path, name, extra ) )