Mercurial > libervia-backend
annotate sat_frontends/jp/cmd_message.py @ 3586:5f65f4e9f8cb
plugin XEP-0060: getItems extra is now serialised dict
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 28 Jul 2021 23:01:15 +0200 |
parents | be6d91572633 |
children | 33ab258df0de |
rev | line source |
---|---|
3137 | 1 #!/usr/bin/env python3 |
2 | |
815 | 3 |
4 # jp: a SAT command line tool | |
3479 | 5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) |
815 | 6 |
7 # This program is free software: you can redistribute it and/or modify | |
8 # it under the terms of the GNU Affero General Public License as published by | |
9 # the Free Software Foundation, either version 3 of the License, or | |
10 # (at your option) any later version. | |
11 | |
12 # This program is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 # GNU Affero General Public License for more details. | |
16 | |
17 # You should have received a copy of the GNU Affero General Public License | |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
2708 | 20 import sys |
817 | 21 from sat_frontends.jp import base |
2663
32b5f68a23b4
jp (message): new encryption/algorithms command to retrieve available encryptions algorithms.
Goffi <goffi@goffi.org>
parents:
2624
diff
changeset
|
22 from sat_frontends.jp.constants import Const as C |
2708 | 23 from sat_frontends.tools import jid |
771 | 24 from sat.core.i18n import _ |
817 | 25 from sat.tools.utils import clean_ustr |
2708 | 26 from sat.tools.common import data_format |
2719
45189c8bd165
jp (message/mam): display metadata when verbose
Goffi <goffi@goffi.org>
parents:
2708
diff
changeset
|
27 from sat.tools.common.ansi import ANSI as A |
0 | 28 |
817 | 29 __commands__ = ["Message"] |
393 | 30 |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
31 |
1828
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
32 class Send(base.CommandBase): |
817 | 33 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
34 super(Send, self).__init__(host, "send", help=_("send a message to a contact")) |
817 | 35 |
36 def add_parser_options(self): | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
37 self.parser.add_argument( |
3028 | 38 "-l", "--lang", type=str, default="", help=_("language of the message") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
39 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
40 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
41 "-s", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
42 "--separate", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
43 action="store_true", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
44 help=_( |
3028 | 45 "separate xmpp messages: send one message per line instead of one " |
46 "message alone." | |
2624
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 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
49 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
50 "-n", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
51 "--new-line", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
52 action="store_true", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
53 help=_( |
3028 | 54 "add a new line at the beginning of the input (usefull for ascii art ;))" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
55 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
56 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
57 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
58 "-S", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
59 "--subject", |
3028 | 60 help=_("subject of the message"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
61 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
62 self.parser.add_argument( |
3411
f30b238d9c45
jp: follow best practices and use a dash (`-`) instead of underscore (`_`) for long options.
Goffi <goffi@goffi.org>
parents:
3356
diff
changeset
|
63 "-L", "--subject-lang", type=str, default="", help=_("language of subject") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
64 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
65 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
66 "-t", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
67 "--type", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
68 choices=C.MESS_TYPE_STANDARD + (C.MESS_TYPE_AUTO,), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
69 default=C.MESS_TYPE_AUTO, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
70 help=_("type of the message"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
71 ) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
72 self.parser.add_argument("-e", "--encrypt", metavar="ALGORITHM", |
3028 | 73 help=_("encrypt message using given algorithm")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
74 self.parser.add_argument( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
75 "--encrypt-noreplace", |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
76 action="store_true", |
3028 | 77 help=_("don't replace encryption algorithm if an other one is already used")) |
2081
2265d9df4cfb
jp (message/send): message/send can now send XHTML (-x) or rich (-r) messages
Goffi <goffi@goffi.org>
parents:
1963
diff
changeset
|
78 syntax = self.parser.add_mutually_exclusive_group() |
3028 | 79 syntax.add_argument("-x", "--xhtml", action="store_true", help=_("XHTML body")) |
80 syntax.add_argument("-r", "--rich", action="store_true", help=_("rich body")) | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
81 self.parser.add_argument( |
3028 | 82 "jid", help=_("the destination jid") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
83 ) |
401
b2caa2615c4c
jp roster name manegement + Pipe transfer
Goffi <goffi@goffi.org>
parents:
393
diff
changeset
|
84 |
3040 | 85 async def sendStdin(self, dest_jid): |
817 | 86 """Send incomming data on stdin to jabber contact |
1828
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
87 |
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
88 @param dest_jid: destination jid |
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
89 """ |
817 | 90 header = "\n" if self.args.new_line else "" |
3040 | 91 # FIXME: stdin is not read asynchronously at the moment |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
92 stdin_lines = [ |
3040 | 93 stream for stream in sys.stdin.readlines() |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
94 ] |
2081
2265d9df4cfb
jp (message/send): message/send can now send XHTML (-x) or rich (-r) messages
Goffi <goffi@goffi.org>
parents:
1963
diff
changeset
|
95 extra = {} |
1963
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
96 if self.args.subject is None: |
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
97 subject = {} |
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
98 else: |
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
99 subject = {self.args.subject_lang: self.args.subject} |
817 | 100 |
2081
2265d9df4cfb
jp (message/send): message/send can now send XHTML (-x) or rich (-r) messages
Goffi <goffi@goffi.org>
parents:
1963
diff
changeset
|
101 if self.args.xhtml or self.args.rich: |
3028 | 102 key = "xhtml" if self.args.xhtml else "rich" |
2081
2265d9df4cfb
jp (message/send): message/send can now send XHTML (-x) or rich (-r) messages
Goffi <goffi@goffi.org>
parents:
1963
diff
changeset
|
103 if self.args.lang: |
3040 | 104 key = f"{key}_{self.args.lang}" |
3028 | 105 extra[key] = clean_ustr("".join(stdin_lines)) |
2081
2265d9df4cfb
jp (message/send): message/send can now send XHTML (-x) or rich (-r) messages
Goffi <goffi@goffi.org>
parents:
1963
diff
changeset
|
106 stdin_lines = [] |
2265d9df4cfb
jp (message/send): message/send can now send XHTML (-x) or rich (-r) messages
Goffi <goffi@goffi.org>
parents:
1963
diff
changeset
|
107 |
3040 | 108 to_send = [] |
109 | |
110 error = False | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
111 |
3040 | 112 if self.args.separate: |
113 # we send stdin in several messages | |
0 | 114 if header: |
3040 | 115 # first we sent the header |
116 try: | |
117 await self.host.bridge.messageSend( | |
118 dest_jid, | |
119 {self.args.lang: header}, | |
120 subject, | |
121 self.args.type, | |
122 profile_key=self.profile, | |
123 ) | |
124 except Exception as e: | |
125 self.disp(f"can't send header: {e}", error=True) | |
126 error = True | |
127 | |
128 to_send.extend({self.args.lang: clean_ustr(l.replace("\n", ""))} | |
129 for l in stdin_lines) | |
130 else: | |
131 # we sent all in a single message | |
132 if not (self.args.xhtml or self.args.rich): | |
133 msg = {self.args.lang: header + clean_ustr("".join(stdin_lines))} | |
134 else: | |
135 msg = {} | |
136 to_send.append(msg) | |
137 | |
138 for msg in to_send: | |
139 try: | |
140 await self.host.bridge.messageSend( | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
141 dest_jid, |
3040 | 142 msg, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
143 subject, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
144 self.args.type, |
3179
84a94b385760
bridge: messageSend's extra is now serialised
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
145 data_format.serialise(extra), |
3040 | 146 profile_key=self.host.profile) |
147 except Exception as e: | |
148 self.disp(f"can't send message {msg!r}: {e}", error=True) | |
149 error = True | |
0 | 150 |
3040 | 151 if error: |
152 # at least one message sending failed | |
153 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
154 |
3040 | 155 self.host.quit() |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
156 |
3040 | 157 async def start(self): |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
158 if self.args.xhtml and self.args.separate: |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
159 self.disp( |
3028 | 160 "argument -s/--separate is not compatible yet with argument -x/--xhtml", |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
161 error=True, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
162 ) |
3040 | 163 self.host.quit(C.EXIT_BAD_ARG) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
164 |
3040 | 165 jids = await self.host.check_jids([self.args.jid]) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
166 jid_ = jids[0] |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
167 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
168 if self.args.encrypt_noreplace and self.args.encrypt is None: |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
169 self.parser.error("You need to use --encrypt if you use --encrypt-noreplace") |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
170 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
171 if self.args.encrypt is not None: |
3040 | 172 try: |
173 namespace = await self.host.bridge.encryptionNamespaceGet( | |
174 self.args.encrypt) | |
175 except Exception as e: | |
176 self.disp(f"can't get encryption namespace: {e}", error=True) | |
177 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
178 | |
179 try: | |
180 await self.host.bridge.messageEncryptionStart( | |
181 jid_, namespace, not self.args.encrypt_noreplace, self.profile | |
182 ) | |
183 except Exception as e: | |
184 self.disp(f"can't start encryption session: {e}", error=True) | |
185 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
186 | |
187 await self.sendStdin(jid_) | |
1828
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
188 |
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
189 |
2708 | 190 class MAM(base.CommandBase): |
191 | |
192 def __init__(self, host): | |
193 super(MAM, self).__init__( | |
3040 | 194 host, "mam", use_output=C.OUTPUT_MESS, use_verbose=True, |
195 help=_("query archives using MAM")) | |
2708 | 196 |
197 def add_parser_options(self): | |
198 self.parser.add_argument( | |
3028 | 199 "-s", "--service", default="", |
200 help=_("jid of the service (default: profile's server")) | |
2708 | 201 self.parser.add_argument( |
202 "-S", "--start", dest="mam_start", type=base.date_decoder, | |
2824
0ae25883e223
jp (message/mam): --start doesn't defaut anymore to "1 day ago", it is now unset by default
Goffi <goffi@goffi.org>
parents:
2819
diff
changeset
|
203 help=_( |
3028 | 204 "start fetching archive from this date (default: from the beginning)")) |
2708 | 205 self.parser.add_argument( |
206 "-E", "--end", dest="mam_end", type=base.date_decoder, | |
3028 | 207 help=_("end fetching archive after this date (default: no limit)")) |
2708 | 208 self.parser.add_argument( |
3028 | 209 "-W", "--with", dest="mam_with", |
210 help=_("retrieve only archives with this jid")) | |
2708 | 211 self.parser.add_argument( |
2764
92af49cde255
jp (base): MAM and RSM arguments can now be used for pubsub commands:
Goffi <goffi@goffi.org>
parents:
2740
diff
changeset
|
212 "-m", "--max", dest="rsm_max", type=int, default=20, |
3028 | 213 help=_("maximum number of items to retrieve, using RSM (default: 20))")) |
2819
fd45089b3a92
jp (message/mam): added missing RSM options
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
214 rsm_page_group = self.parser.add_mutually_exclusive_group() |
fd45089b3a92
jp (message/mam): added missing RSM options
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
215 rsm_page_group.add_argument( |
3028 | 216 "-a", "--after", dest="rsm_after", |
217 help=_("find page after this item"), metavar='ITEM_ID') | |
2819
fd45089b3a92
jp (message/mam): added missing RSM options
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
218 rsm_page_group.add_argument( |
3028 | 219 "-b", "--before", dest="rsm_before", |
220 help=_("find page before this item"), metavar='ITEM_ID') | |
2819
fd45089b3a92
jp (message/mam): added missing RSM options
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
221 rsm_page_group.add_argument( |
fd45089b3a92
jp (message/mam): added missing RSM options
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
222 "--index", dest="rsm_index", type=int, |
3028 | 223 help=_("index of the page to retrieve")) |
2708 | 224 |
3040 | 225 async def start(self): |
226 extra = {} | |
227 if self.args.mam_start is not None: | |
228 extra["mam_start"] = float(self.args.mam_start) | |
229 if self.args.mam_end is not None: | |
230 extra["mam_end"] = float(self.args.mam_end) | |
231 if self.args.mam_with is not None: | |
232 extra["mam_with"] = self.args.mam_with | |
233 for suff in ('max', 'after', 'before', 'index'): | |
234 key = 'rsm_' + suff | |
235 value = getattr(self.args,key) | |
236 if value is not None: | |
237 extra[key] = str(value) | |
238 try: | |
3356
569f4cf7183b
plugin XEP-0313: fixed `MAMGet` signature
Goffi <goffi@goffi.org>
parents:
3179
diff
changeset
|
239 data, metadata_s, profile = await self.host.bridge.MAMGet( |
3040 | 240 self.args.service, data_format.serialise(extra), self.profile) |
241 except Exception as e: | |
242 self.disp(f"can't retrieve MAM archives: {e}", error=True) | |
243 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
244 | |
3356
569f4cf7183b
plugin XEP-0313: fixed `MAMGet` signature
Goffi <goffi@goffi.org>
parents:
3179
diff
changeset
|
245 metadata = data_format.deserialise(metadata_s) |
569f4cf7183b
plugin XEP-0313: fixed `MAMGet` signature
Goffi <goffi@goffi.org>
parents:
3179
diff
changeset
|
246 |
3040 | 247 try: |
248 session_info = await self.host.bridge.sessionInfosGet(self.profile) | |
249 except Exception as e: | |
250 self.disp(f"can't get session infos: {e}", error=True) | |
251 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
252 | |
253 # we need to fill own_jid for message output | |
3028 | 254 self.host.own_jid = jid.JID(session_info["jid"]) |
3040 | 255 |
256 await self.output(data) | |
257 | |
2719
45189c8bd165
jp (message/mam): display metadata when verbose
Goffi <goffi@goffi.org>
parents:
2708
diff
changeset
|
258 # FIXME: metadata are not displayed correctly and don't play nice with output |
45189c8bd165
jp (message/mam): display metadata when verbose
Goffi <goffi@goffi.org>
parents:
2708
diff
changeset
|
259 # they should be added to output data somehow |
45189c8bd165
jp (message/mam): display metadata when verbose
Goffi <goffi@goffi.org>
parents:
2708
diff
changeset
|
260 if self.verbosity: |
3028 | 261 for value in ("rsm_first", "rsm_last", "rsm_index", "rsm_count", |
262 "mam_complete", "mam_stable"): | |
2719
45189c8bd165
jp (message/mam): display metadata when verbose
Goffi <goffi@goffi.org>
parents:
2708
diff
changeset
|
263 if value in metadata: |
3028 | 264 label = value.split("_")[1] |
2719
45189c8bd165
jp (message/mam): display metadata when verbose
Goffi <goffi@goffi.org>
parents:
2708
diff
changeset
|
265 self.disp(A.color( |
3028 | 266 C.A_HEADER, label, ': ' , A.RESET, metadata[value])) |
2719
45189c8bd165
jp (message/mam): display metadata when verbose
Goffi <goffi@goffi.org>
parents:
2708
diff
changeset
|
267 |
2708 | 268 self.host.quit() |
269 | |
270 | |
1828
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
271 class Message(base.CommandBase): |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
2719
diff
changeset
|
272 subcommands = (Send, MAM) |
1828
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
273 |
cb4be663a4a7
jp (message): message is now a subcommand, and the sending command is moved to message/send
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
274 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
275 super(Message, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
276 host, "message", use_profile=False, help=_("messages handling") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
277 ) |