diff sat/plugins/plugin_exp_invitation_file.py @ 2931:b256e90612d0

plugins invitation*, events: added an extra parameter and use it to keep a thumnail URL
author Goffi <goffi@goffi.org>
date Fri, 03 May 2019 13:05:01 +0200
parents adf6e33a3e50
children ab2696e34d29
line wrap: on
line diff
--- a/sat/plugins/plugin_exp_invitation_file.py	Fri May 03 13:00:08 2019 +0200
+++ b/sat/plugins/plugin_exp_invitation_file.py	Fri May 03 13:05:01 2019 +0200
@@ -20,6 +20,7 @@
 from sat.core.i18n import _
 from sat.core.constants import Const as C
 from sat.core.log import getLogger
+from sat.tools.common import data_format
 from twisted.words.protocols.jabber import jid
 
 log = getLogger(__name__)
@@ -48,22 +49,24 @@
         host.bridge.addMethod(
             "FISInvite",
             ".plugin",
-            in_sign="sssssss",
+            in_sign="ssssssss",
             out_sign="",
             method=self._sendFileSharingInvitation,
         )
 
     def _sendFileSharingInvitation(
             self, invitee_jid_s, service_s, repos_type=None, namespace=None, path=None,
-            name=None, profile_key=C.PROF_KEY_NONE):
+            name=None, extra_s=u'', profile_key=C.PROF_KEY_NONE):
         client = self.host.getClient(profile_key)
         invitee_jid = jid.JID(invitee_jid_s)
         service = jid.JID(service_s)
+        extra = data_format.deserialise(extra_s)
         return self.host.plugins[u"INVITATION"].sendFileSharingInvitation(
-            client, invitee_jid, service, repos_type=None, namespace=None, path=None,
-            name=None)
+            client, invitee_jid, service, repos_type=repos_type or None,
+            namespace=namespace or None, path=path or None, name=name or None,
+            extra=extra)
 
-    def onInvitation(self, client, service, repos_type, namespace, path, name):
+    def onInvitation(self, client, name, extra, service, repos_type, namespace, path):
         if repos_type == u"files":
             type_human = _(u"file sharing")
         elif repos_type == u"photos":
@@ -79,4 +82,4 @@
             profile=client.profile, type_human=type_human, namespace=namespace, path=path)
             )
         return self.host.plugins[u'LIST_INTEREST'].registerFileSharing(
-            client, service, repos_type, namespace, path, name)
+            client, service, repos_type, namespace, path, name, extra)