Mercurial > libervia-backend
comparison libervia/backend/plugins/plugin_exp_invitation_file.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children |
comparison
equal
deleted
inserted
replaced
4269:64a85ce8be70 | 4270:0d7bb4df2343 |
---|---|
51 "fis_invite", | 51 "fis_invite", |
52 ".plugin", | 52 ".plugin", |
53 in_sign="ssssssss", | 53 in_sign="ssssssss", |
54 out_sign="", | 54 out_sign="", |
55 method=self._send_file_sharing_invitation, | 55 method=self._send_file_sharing_invitation, |
56 async_=True | 56 async_=True, |
57 ) | 57 ) |
58 | 58 |
59 def _send_file_sharing_invitation( | 59 def _send_file_sharing_invitation( |
60 self, invitee_jid_s, service_s, repos_type=None, namespace=None, path=None, | 60 self, |
61 name=None, extra_s='', profile_key=C.PROF_KEY_NONE): | 61 invitee_jid_s, |
62 service_s, | |
63 repos_type=None, | |
64 namespace=None, | |
65 path=None, | |
66 name=None, | |
67 extra_s="", | |
68 profile_key=C.PROF_KEY_NONE, | |
69 ): | |
62 client = self.host.get_client(profile_key) | 70 client = self.host.get_client(profile_key) |
63 invitee_jid = jid.JID(invitee_jid_s) | 71 invitee_jid = jid.JID(invitee_jid_s) |
64 service = jid.JID(service_s) | 72 service = jid.JID(service_s) |
65 extra = data_format.deserialise(extra_s) | 73 extra = data_format.deserialise(extra_s) |
66 return defer.ensureDeferred( | 74 return defer.ensureDeferred( |
67 self.host.plugins["INVITATION"].send_file_sharing_invitation( | 75 self.host.plugins["INVITATION"].send_file_sharing_invitation( |
68 client, invitee_jid, service, repos_type=repos_type or None, | 76 client, |
69 namespace=namespace or None, path=path or None, name=name or None, | 77 invitee_jid, |
70 extra=extra) | 78 service, |
79 repos_type=repos_type or None, | |
80 namespace=namespace or None, | |
81 path=path or None, | |
82 name=name or None, | |
83 extra=extra, | |
84 ) | |
71 ) | 85 ) |
72 | 86 |
73 def on_invitation( | 87 def on_invitation( |
74 self, | 88 self, |
75 client: SatXMPPEntity, | 89 client: SatXMPPEntity, |
77 name: str, | 91 name: str, |
78 extra: dict, | 92 extra: dict, |
79 service: jid.JID, | 93 service: jid.JID, |
80 repos_type: str, | 94 repos_type: str, |
81 sharing_ns: str, | 95 sharing_ns: str, |
82 path: str | 96 path: str, |
83 ): | 97 ): |
84 if repos_type == "files": | 98 if repos_type == "files": |
85 type_human = _("file sharing") | 99 type_human = _("file sharing") |
86 elif repos_type == "photos": | 100 elif repos_type == "photos": |
87 type_human = _("photo album") | 101 type_human = _("photo album") |
88 else: | 102 else: |
89 log.warning("Unknown repository type: {repos_type}".format( | 103 log.warning( |
90 repos_type=repos_type)) | 104 "Unknown repository type: {repos_type}".format(repos_type=repos_type) |
105 ) | |
91 repos_type = "file" | 106 repos_type = "file" |
92 type_human = _("file sharing") | 107 type_human = _("file sharing") |
93 log.info(_( | 108 log.info( |
94 '{profile} has received an invitation for a files repository ({type_human}) ' | 109 _( |
95 'with namespace {sharing_ns!r} at path [{path}]').format( | 110 "{profile} has received an invitation for a files repository ({type_human}) " |
96 profile=client.profile, type_human=type_human, sharing_ns=sharing_ns, | 111 "with namespace {sharing_ns!r} at path [{path}]" |
97 path=path) | 112 ).format( |
113 profile=client.profile, | |
114 type_human=type_human, | |
115 sharing_ns=sharing_ns, | |
116 path=path, | |
98 ) | 117 ) |
118 ) | |
99 return defer.ensureDeferred( | 119 return defer.ensureDeferred( |
100 self.host.plugins['LIST_INTEREST'].register_file_sharing( | 120 self.host.plugins["LIST_INTEREST"].register_file_sharing( |
101 client, service, repos_type, sharing_ns, path, name, extra | 121 client, service, repos_type, sharing_ns, path, name, extra |
102 ) | 122 ) |
103 ) | 123 ) |