annotate sat_frontends/jp/cmd_roster.py @ 3288:780fb8dd07ef

core (memory/sqlite): new database schema (v9): this new schema brings the new `public_id` column, which will be used to serve files via HTTP, splits `mime_type` in 2 (`media_type` and `media_subtype`) to make indexing/media filtering easier, and fixes indexes for `files` table.
author Goffi <goffi@goffi.org>
date Fri, 29 May 2020 21:50:49 +0200
parents 012e89fb2dd1
children f30b238d9c45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3137
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
1 #!/usr/bin/env python3
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
2
3255
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
3 # jp: a SàT command line tool
3136
9d0df638c8b4 dates update
Goffi <goffi@goffi.org>
parents: 3040
diff changeset
4 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
5 # Copyright (C) 2003-2016 Adrien Cossa (souliane@mailoo.org)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
6
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # (at your option) any later version.
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
11
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
16
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
19
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
20 from . import base
2893
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
21 from collections import OrderedDict
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
22 from sat.core.i18n import _
2893
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
23 from sat_frontends.jp.constants import Const as C
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
24 from sat_frontends.tools import jid
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
25 from sat.tools.common.ansi import ANSI as A
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
26
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
27 __commands__ = ["Roster"]
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
28
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
29
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
30 class Get(base.CommandBase):
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
31
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
32 def __init__(self, host):
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
33 super().__init__(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
34 host, 'get', use_output=C.OUTPUT_DICT, use_verbose=True,
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
35 extra_outputs = {"default": self.default_output},
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
36 help=_('retrieve the roster entities'))
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
37
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
38 def add_parser_options(self):
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
39 pass
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
40
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
41 def default_output(self, data):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
42 for contact_jid, contact_data in data.items():
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
43 all_keys = list(contact_data.keys())
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
44 keys_to_show = []
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
45 name = contact_data.get('name', contact_jid.node)
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
46
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
47 if self.verbosity >= 1:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
48 keys_to_show.append('groups')
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
49 all_keys.remove('groups')
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
50 if self.verbosity >= 2:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
51 keys_to_show.extend(all_keys)
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
52
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
53 if name is None:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
54 self.disp(A.color(C.A_HEADER, contact_jid))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
55 else:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
56 self.disp(A.color(C.A_HEADER, name, A.RESET, f" ({contact_jid})"))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
57 for k in keys_to_show:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
58 value = contact_data[k]
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
59 if value:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
60 if isinstance(value, list):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
61 value = ', '.join(value)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
62 self.disp(A.color(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
63 " ", C.A_SUBHEADER, f"{k}: ", A.RESET, str(value)))
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
64
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
65 async def start(self):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
66 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
67 contacts = await self.host.bridge.getContacts(profile_key=self.host.profile)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
68 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
69 self.disp(f"error while retrieving the contacts: {e}", error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
70 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
71
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
72 contacts_dict = {}
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
73 for contact_jid_s, data, groups in contacts:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
74 # FIXME: we have to convert string to bool here for historical reason
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
75 # getContacts format should be changed and serialised properly
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
76 for key in ('from', 'to', 'ask'):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
77 if key in data:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
78 data[key] = C.bool(data[key])
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
79 data['groups'] = list(groups)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
80 contacts_dict[jid.JID(contact_jid_s)] = data
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
81
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
82 await self.output(contacts_dict)
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
83 self.host.quit()
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
84
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
85
3255
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
86 class Set(base.CommandBase):
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
87
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
88 def __init__(self, host):
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
89 super().__init__(host, 'set', help=_('set metadata for a roster entity'))
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
90
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
91 def add_parser_options(self):
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
92 self.parser.add_argument(
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
93 "-n", "--name", default="", help=_('name to use for this entity'))
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
94 self.parser.add_argument(
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
95 "-g", "--group", dest='groups', action='append', metavar='GROUP', default=[],
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
96 help=_('groups for this entity'))
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
97 self.parser.add_argument(
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
98 "-R", "--replace", action="store_true",
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
99 help=_("replace all metadata instead of adding them"))
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
100 self.parser.add_argument(
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
101 "jid", help=_("jid of the roster entity"))
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
102
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
103 async def start(self):
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
104
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
105 if self.args.replace:
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
106 name = self.args.name
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
107 groups = self.args.groups
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
108 else:
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
109 try:
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
110 entity_data = await self.host.bridge.contactGet(
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
111 self.args.jid, self.host.profile)
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
112 except Exception as e:
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
113 self.disp(f"error while retrieving the contact: {e}", error=True)
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
114 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
115 name = self.args.name or entity_data[0].get('name') or ''
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
116 groups = set(entity_data[1])
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
117 groups = list(groups.union(self.args.groups))
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
118
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
119 try:
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
120 await self.host.bridge.updateContact(
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
121 self.args.jid, name, groups, self.host.profile)
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
122 except Exception as e:
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
123 self.disp(f"error while updating the contact: {e}", error=True)
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
124 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
125 self.host.quit()
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
126
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
127
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
128 class Stats(base.CommandBase):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
129
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
130 def __init__(self, host):
1798
c5d58387d031 jp (roster stats): add some extra information
souliane <souliane@mailoo.org>
parents: 1797
diff changeset
131 super(Stats, self).__init__(host, 'stats', help=_('Show statistics about a roster'))
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
132
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
133 def add_parser_options(self):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
134 pass
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
135
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
136 async def start(self):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
137 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
138 contacts = await self.host.bridge.getContacts(profile_key=self.host.profile)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
139 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
140 self.disp(f"error while retrieving the contacts: {e}", error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
141 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
142
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
143 hosts = {}
1798
c5d58387d031 jp (roster stats): add some extra information
souliane <souliane@mailoo.org>
parents: 1797
diff changeset
144 unique_groups = set()
c5d58387d031 jp (roster stats): add some extra information
souliane <souliane@mailoo.org>
parents: 1797
diff changeset
145 no_sub, no_from, no_to, no_group, total_group_subscription = 0, 0, 0, 0, 0
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
146 for contact, attrs, groups in contacts:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
147 from_, to = C.bool(attrs["from"]), C.bool(attrs["to"])
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
148 if not from_:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
149 if not to:
1798
c5d58387d031 jp (roster stats): add some extra information
souliane <souliane@mailoo.org>
parents: 1797
diff changeset
150 no_sub += 1
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
151 else:
1798
c5d58387d031 jp (roster stats): add some extra information
souliane <souliane@mailoo.org>
parents: 1797
diff changeset
152 no_from += 1
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
153 elif not to:
1798
c5d58387d031 jp (roster stats): add some extra information
souliane <souliane@mailoo.org>
parents: 1797
diff changeset
154 no_to += 1
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
155
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
156 host = jid.JID(contact).domain
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
157
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
158 hosts.setdefault(host, 0)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
159 hosts[host] += 1
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
160 if groups:
1798
c5d58387d031 jp (roster stats): add some extra information
souliane <souliane@mailoo.org>
parents: 1797
diff changeset
161 unique_groups.update(groups)
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
162 total_group_subscription += len(groups)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
163 if not groups:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
164 no_group += 1
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
165 hosts = OrderedDict(sorted(list(hosts.items()), key=lambda item:-item[1]))
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
166
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
167 print()
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
168 print("Total number of contacts: %d" % len(contacts))
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
169 print("Number of different hosts: %d" % len(hosts))
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
170 print()
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
171 for host, count in hosts.items():
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
172 print("Contacts on {host}: {count} ({rate:.1f}%)".format(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
173 host=host, count=count, rate=100 * float(count) / len(contacts)))
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
174 print()
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
175 print("Contacts with no 'from' subscription: %d" % no_from)
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
176 print("Contacts with no 'to' subscription: %d" % no_to)
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
177 print("Contacts with no subscription at all: %d" % no_sub)
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
178 print()
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
179 print("Total number of groups: %d" % len(unique_groups))
1932
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
180 try:
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
181 contacts_per_group = float(total_group_subscription) / len(unique_groups)
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
182 except ZeroDivisionError:
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
183 contacts_per_group = 0
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
184 print("Average contacts per group: {:.1f}".format(contacts_per_group))
1932
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
185 try:
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
186 groups_per_contact = float(total_group_subscription) / len(contacts)
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
187 except ZeroDivisionError:
44342730df66 jp (cmd/roster): fixes division by zero exceptions
souliane <souliane@mailoo.org>
parents: 1864
diff changeset
188 groups_per_contact = 0
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
189 print(f"Average groups' subscriptions per contact: {groups_per_contact:.1f}")
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
190 print("Contacts not assigned to any group: %d" % no_group)
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
191 self.host.quit()
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
192
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
193
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
194 class Purge(base.CommandBase):
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
195
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
196 def __init__(self, host):
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
197 super(Purge, self).__init__(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
198 host, 'purge',
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
199 help=_('purge the roster from its contacts with no subscription'))
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
200
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
201 def add_parser_options(self):
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
202 self.parser.add_argument(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
203 "--no_from", action="store_true",
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
204 help=_("also purge contacts with no 'from' subscription"))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
205 self.parser.add_argument(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
206 "--no_to", action="store_true",
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
207 help=_("also purge contacts with no 'to' subscription"))
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
208
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
209 async def start(self):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
210 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
211 contacts = await self.host.bridge.getContacts(self.host.profile)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
212 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
213 self.disp(f"error while retrieving the contacts: {e}", error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
214 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
215
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
216 no_sub, no_from, no_to = [], [], []
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
217 for contact, attrs, groups in contacts:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
218 from_, to = C.bool(attrs["from"]), C.bool(attrs["to"])
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
219 if not from_:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
220 if not to:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
221 no_sub.append(contact)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
222 elif self.args.no_from:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
223 no_from.append(contact)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
224 elif not to and self.args.no_to:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
225 no_to.append(contact)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
226 if not no_sub and not no_from and not no_to:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
227 self.disp(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
228 f"Nothing to do - there's a from and/or to subscription(s) between "
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
229 f"profile {self.host.profile!r} and each of its contacts"
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
230 )
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
231 elif await self.ask_confirmation(no_sub, no_from, no_to):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
232 for contact in no_sub + no_from + no_to:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
233 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
234 await self.host.bridge.delContact(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
235 contact, profile_key=self.host.profile)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
236 except Exception as e:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
237 self.disp(f"can't delete contact {contact!r}: {e}", error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
238 else:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
239 self.disp(f"contact {contact!r} has been removed")
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
240
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
241 self.host.quit()
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
242
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
243 async def ask_confirmation(self, no_sub, no_from, no_to):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
244 """Ask the confirmation before removing contacts.
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
245
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
246 @param no_sub (list[unicode]): list of contacts with no subscription
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
247 @param no_from (list[unicode]): list of contacts with no 'from' subscription
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
248 @param no_to (list[unicode]): list of contacts with no 'to' subscription
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
249 @return bool
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
250 """
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
251 if no_sub:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
252 self.disp(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
253 f"There's no subscription between profile {self.host.profile!r} and the "
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
254 f"following contacts:")
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
255 self.disp(" " + "\n ".join(no_sub))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
256 if no_from:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
257 self.disp(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
258 f"There's no 'from' subscription between profile {self.host.profile!r} "
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
259 f"and the following contacts:")
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
260 self.disp(" " + "\n ".join(no_from))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
261 if no_to:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
262 self.disp(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
263 f"There's no 'to' subscription between profile {self.host.profile!r} and "
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
264 f"the following contacts:")
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
265 self.disp(" " + "\n ".join(no_to))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
266 message = f"REMOVE them from profile {self.host.profile}'s roster"
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
267 while True:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
268 res = await self.host.ainput(f"{message} (y/N)? ")
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
269 if not res or res.lower() == 'n':
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
270 return False
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
271 if res.lower() == 'y':
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
272 return True
1799
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
273
f1f4775f8cc0 jp (roster): add command "roster get" with parameters "--subscriptions", "--name" and "--groups"
souliane <souliane@mailoo.org>
parents: 1798
diff changeset
274
2893
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
275 class Resync(base.CommandBase):
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
276
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
277 def __init__(self, host):
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
278 super(Resync, self).__init__(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2893
diff changeset
279 host, 'resync', help=_('do a full resynchronisation of roster with server'))
2893
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
280
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
281 def add_parser_options(self):
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
282 pass
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
283
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
284 async def start(self):
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
285 try:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
286 await self.host.bridge.rosterResync(profile_key=self.host.profile)
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(f"can't resynchronise roster: {e}", error=True)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
289 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
290 else:
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
291 self.disp(_("Roster resynchronized"))
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
292 self.host.quit(C.EXIT_OK)
2893
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
293
7c8773723200 jp (roster): added resync command to do a full roster resynchronisation
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
294
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
295 class Roster(base.CommandBase):
3255
012e89fb2dd1 jp (roster): new roster/set command
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
296 subcommands = (Get, Set, Stats, Purge, Resync)
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
297
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
298 def __init__(self, host):
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
299 super(Roster, self).__init__(
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
300 host, 'roster', use_profile=True, help=_("Manage an entity's roster"))