annotate sat_frontends/jp/cmd_invitation.py @ 3115:3018d153a615

quick frontend (widgets): some more errors handling in getOrCreateWidget
author Goffi <goffi@goffi.org>
date Fri, 17 Jan 2020 18:47:02 +0100
parents fee60f17ebac
children 9d0df638c8b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python2
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
3
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # jp: a SàT command line tool
2771
003b8b4b56a7 date update
Goffi <goffi@goffi.org>
parents: 2765
diff changeset
5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org)
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
6
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
11
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
16
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
19
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
20
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
21 from . import base
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
22 from sat.core.i18n import _
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from sat_frontends.jp.constants import Const as C
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
24 from sat.tools.common.ansi import ANSI as A
2291
c05000d00dbb plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation:
Goffi <goffi@goffi.org>
parents: 2285
diff changeset
25 from sat.tools.common import data_format
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
26
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
27 __commands__ = ["Invitation"]
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
28
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
29
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
30 class Create(base.CommandBase):
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
31 def __init__(self, host):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
32 base.CommandBase.__init__(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
33 self,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
34 host,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
35 "create",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
36 use_profile=False,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
37 use_output=C.OUTPUT_DICT,
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
38 help=_("create and send an invitation"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
39 )
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
40
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
41 def add_parser_options(self):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
42 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
43 "-j",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
44 "--jid",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
45 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
46 help="jid of the invitee (default: generate one)",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
47 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
48 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
49 "-P",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
50 "--password",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
51 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
52 help="password of the invitee profile/XMPP account (default: generate one)",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
53 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
54 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
55 "-n",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
56 "--name",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
57 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
58 help="name of the invitee",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
59 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
60 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
61 "-N",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
62 "--host-name",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
63 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
64 help="name of the host",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
65 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
66 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
67 "-e",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
68 "--email",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
69 action="append",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
70 default=[],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
71 help="email(s) to send the invitation to (if --no-email is set, email will just be saved)",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
72 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
73 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
74 "--no-email", action="store_true", help="do NOT send invitation email"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
75 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
76 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
77 "-l",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
78 "--lang",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
79 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
80 help="main language spoken by the invitee",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
81 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
82 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
83 "-u",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
84 "--url",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
85 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
86 help="template to construct the URL",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
87 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
88 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
89 "-s",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
90 "--subject",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
91 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
92 help="subject of the invitation email (default: generic subject)",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
93 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
94 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
95 "-b",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
96 "--body",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
97 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
98 help="body of the invitation email (default: generic body)",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
99 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
100 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
101 "-x",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
102 "--extra",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
103 metavar=("KEY", "VALUE"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
104 action="append",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
105 nargs=2,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
106 default=[],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
107 help="extra data to associate with invitation/invitee",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
108 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
109 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
110 "-p",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
111 "--profile",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
112 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
113 help="profile doing the invitation (default: don't associate profile)",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
114 )
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
115
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
116 async def start(self):
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
117 extra = dict(self.args.extra)
2291
c05000d00dbb plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation:
Goffi <goffi@goffi.org>
parents: 2285
diff changeset
118 email = self.args.email[0] if self.args.email else None
c05000d00dbb plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation:
Goffi <goffi@goffi.org>
parents: 2285
diff changeset
119 emails_extra = self.args.email[1:]
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
120 if self.args.no_email:
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
121 if email:
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
122 extra["email"] = email
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
123 data_format.iter2dict("emails_extra", emails_extra)
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
124 else:
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
125 if not email:
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
126 self.parser.error(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
127 _("you need to specify an email address to send email invitation")
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
128 )
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
129
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
130 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
131 invitation_data = await self.host.bridge.invitationCreate(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
132 email,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
133 emails_extra,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
134 self.args.jid,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
135 self.args.password,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
136 self.args.name,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
137 self.args.host_name,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
138 self.args.lang,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
139 self.args.url,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
140 self.args.subject,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
141 self.args.body,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
142 extra,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
143 self.args.profile,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
144 )
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
145 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
146 self.disp(f"can't create invitation: {e}", error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
147 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
148 else:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
149 await self.output(invitation_data)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
150 self.host.quit(C.EXIT_OK)
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
151
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
152
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
153 class Get(base.CommandBase):
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
154 def __init__(self, host):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
155 base.CommandBase.__init__(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
156 self,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
157 host,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
158 "get",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
159 use_profile=False,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
160 use_output=C.OUTPUT_DICT,
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
161 help=_("get invitation data"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
162 )
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
163
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
164 def add_parser_options(self):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
165 self.parser.add_argument(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
166 "id", help=_("invitation UUID")
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
167 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
168 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
169 "-j",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
170 "--with-jid",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
171 action="store_true",
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
172 help=_("start profile session and retrieve jid"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
173 )
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
174
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
175 async def output_data(self, data, jid_=None):
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
176 if jid_ is not None:
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
177 data["jid"] = jid_
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
178 await self.output(data)
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
179 self.host.quit()
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
180
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
181 async def start(self):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
182 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
183 invitation_data = await self.host.bridge.invitationGet(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
184 self.args.id,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
185 )
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
186 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
187 self.disp(msg=_(f"can't get invitation data: {e}"), error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
188 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
189
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
190 if not self.args.with_jid:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
191 await self.output_data(invitation_data)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
192 else:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
193 profile = invitation_data["guest_profile"]
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
194 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
195 await self.host.bridge.profileStartSession(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
196 invitation_data["password"],
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
197 profile,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
198 )
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
199 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
200 self.disp(msg=_(f"can't start session: {e}"), error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
201 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
202
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
203 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
204 jid_ = await self.host.bridge.asyncGetParamA(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
205 "JabberID",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
206 "Connection",
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
207 profile_key=profile,
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
208 )
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
209 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
210 self.disp(msg=_(f"can't retrieve jid: {e}"), error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
211 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
212
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
213 await self.output_data(invitation_data, jid_)
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
214
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
215
2220
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
216 class Modify(base.CommandBase):
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
217 def __init__(self, host):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
218 base.CommandBase.__init__(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
219 self, host, "modify", use_profile=False, help=_("modify existing invitation")
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
220 )
2220
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
221
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
222 def add_parser_options(self):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
223 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
224 "--replace", action="store_true", help="replace the whole data"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
225 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
226 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
227 "-n",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
228 "--name",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
229 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
230 help="name of the invitee",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
231 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
232 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
233 "-N",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
234 "--host-name",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
235 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
236 help="name of the host",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
237 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
238 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
239 "-e",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
240 "--email",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
241 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
242 help="email to send the invitation to (if --no-email is set, email will just be saved)",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
243 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
244 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
245 "-l",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
246 "--lang",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
247 dest="language",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
248 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
249 help="main language spoken by the invitee",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
250 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
251 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
252 "-x",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
253 "--extra",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
254 metavar=("KEY", "VALUE"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
255 action="append",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
256 nargs=2,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
257 default=[],
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
258 help="extra data to associate with invitation/invitee",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
259 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
260 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
261 "-p",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
262 "--profile",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
263 default="",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
264 help="profile doing the invitation (default: don't associate profile",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
265 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
266 self.parser.add_argument(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
267 "id", help=_("invitation UUID")
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
268 )
2220
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
269
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
270 async def start(self):
2220
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
271 extra = dict(self.args.extra)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
272 for arg_name in ("name", "host_name", "email", "language", "profile"):
2220
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
273 value = getattr(self.args, arg_name)
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
274 if not value:
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
275 continue
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
276 if arg_name in extra:
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
277 self.parser.error(
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
278 _(f"you can't set {arg_name} in both optional argument and extra")
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
279 )
2220
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
280 extra[arg_name] = value
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
281 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
282 await self.host.bridge.invitationModify(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
283 self.args.id,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
284 extra,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
285 self.args.replace,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
286 )
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
287 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
288 self.disp(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
289 f"can't modify invitation: {e}", error=True
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
290 )
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
291 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
292 else:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
293 self.disp(_("invitations have been modified successfuly"))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
294 self.host.quit(C.EXIT_OK)
2220
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
295
0d27d95652a7 jp (invitation): added modify command
Goffi <goffi@goffi.org>
parents: 2215
diff changeset
296
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
297 class List(base.CommandBase):
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
298 def __init__(self, host):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
299 extra_outputs = {"default": self.default_output}
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
300 base.CommandBase.__init__(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
301 self,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
302 host,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
303 "list",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
304 use_profile=False,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
305 use_output=C.OUTPUT_COMPLEX,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
306 extra_outputs=extra_outputs,
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
307 help=_("list invitations data"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
308 )
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
309
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
310 def default_output(self, data):
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
311 for idx, datum in enumerate(data.items()):
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
312 if idx:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
313 self.disp("\n")
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
314 key, invitation_data = datum
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
315 self.disp(A.color(C.A_HEADER, key))
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
316 indent = " "
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
317 for k, v in invitation_data.items():
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
318 self.disp(indent + A.color(C.A_SUBHEADER, k + ":") + " " + str(v))
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
319
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
320 def add_parser_options(self):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
321 self.parser.add_argument(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
322 "-p",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
323 "--profile",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
324 default=C.PROF_KEY_NONE,
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
325 help=_("return only invitations linked to this profile"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
326 )
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
327
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
328 async def start(self):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
329 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
330 data = await self.host.bridge.invitationList(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
331 self.args.profile,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
332 )
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
333 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
334 self.disp(f"return only invitations linked to this profile: {e}", error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
335 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
336 else:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
337 await self.output(data)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
338 self.host.quit()
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
339
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
340
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
341 class Invitation(base.CommandBase):
2234
a41a4729c2d8 jp (invitation): added list subcommand
Goffi <goffi@goffi.org>
parents: 2220
diff changeset
342 subcommands = (Create, Get, Modify, List)
2215
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
343
5831e8fcc5f8 jp (invitation): invitation command first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
344 def __init__(self, host):
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
345 super(Invitation, self).__init__(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
346 host,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
347 "invitation",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
348 use_profile=False,
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
349 help=_("invitation of user(s) without XMPP account"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
350 )