jp (file/share): added invite command to invite an entity to a file sharing repository
This commit is contained in:
parent
c3fcfb3d64
commit
97563c3f25
1 changed files with 72 additions and 1 deletions
|
|
@ -701,8 +701,79 @@ class SharePath(base.CommandBase):
|
|||
)
|
||||
|
||||
|
||||
class ShareInvite(base.CommandBase):
|
||||
def __init__(self, host):
|
||||
super(ShareInvite, self).__init__(
|
||||
host, "invite", help=_(u"send invitation for a shared repository")
|
||||
)
|
||||
self.need_loop = True
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument(
|
||||
"-n",
|
||||
"--name",
|
||||
type=base.unicode_decoder,
|
||||
default=u"",
|
||||
help=_(u"name of the repository"),
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"-N",
|
||||
"--namespace",
|
||||
type=base.unicode_decoder,
|
||||
default=u"",
|
||||
help=_(u"namespace of the repository"),
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"-P",
|
||||
"--path",
|
||||
type=base.unicode_decoder,
|
||||
help=_(u"path to the repository"),
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"-t",
|
||||
"--type",
|
||||
choices=[u"files", u"photos"],
|
||||
default=u"files",
|
||||
help=_(u"type of the repository"),
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"service",
|
||||
type=base.unicode_decoder,
|
||||
help=_(u"jid of the file sharing service hosting the repository"),
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"jid",
|
||||
type=base.unicode_decoder,
|
||||
help=_(u"jid of the person to invite"),
|
||||
)
|
||||
|
||||
def _FISInviteCb(self):
|
||||
self.disp(
|
||||
_(u'invitation sent do {entity}').format(entity=self.args.jid)
|
||||
)
|
||||
self.host.quit()
|
||||
|
||||
def start(self):
|
||||
self.path = os.path.abspath(self.args.path) if self.args.path else u""
|
||||
self.host.bridge.FISInvite(
|
||||
self.args.jid,
|
||||
self.args.service,
|
||||
self.args.type,
|
||||
self.args.namespace,
|
||||
self.path,
|
||||
self.args.name,
|
||||
self.profile,
|
||||
callback=self._FISInviteCb,
|
||||
errback=partial(
|
||||
self.errback,
|
||||
msg=_(u"can't send invitation: {}"),
|
||||
exit_code=C.EXIT_BRIDGE_ERRBACK,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class Share(base.CommandBase):
|
||||
subcommands = (ShareList, SharePath)
|
||||
subcommands = (ShareList, SharePath, ShareInvite)
|
||||
|
||||
def __init__(self, host):
|
||||
super(Share, self).__init__(
|
||||
|
|
|
|||
Loading…
Reference in a new issue