plugin list of interest: expose interestsRegisterFileSharing to bridge + use coroutines

This commit is contained in:
Goffi 2020-06-09 06:25:20 +02:00
commit 9f9a6a5a2b

View file

@ -21,6 +21,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.internet import defer
from twisted.words.protocols.jabber import jid
log = getLogger(__name__)
@ -70,7 +71,7 @@ class FileSharingInvitation(object):
if repos_type == "files":
type_human = _("file sharing")
elif repos_type == "photos":
type_human = _("photos album")
type_human = _("photo album")
else:
log.warning("Unknown repository type: {repos_type}".format(
repos_type=repos_type))
@ -81,5 +82,8 @@ class FileSharingInvitation(object):
'with namespace "{namespace}" at path [{path}]').format(
profile=client.profile, type_human=type_human, namespace=namespace, path=path)
)
return self.host.plugins['LIST_INTEREST'].registerFileSharing(
client, service, repos_type, namespace, path, name, extra)
return defer.ensureDeferred(
self.host.plugins['LIST_INTEREST'].registerFileSharing(
client, service, repos_type, namespace, path, name, extra
)
)