annotate frontends/src/jp/cmd_roster.py @ 1796:314d2eb7fbaa

jp: add command "roster stats"
author souliane <souliane@mailoo.org>
date Wed, 13 Jan 2016 18:54:58 +0100
parents f39ca2832774
children 40cda0c08727
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
1 #! /usr/bin/python
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
3
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # jp: a SAT command line tool
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) 2009-2016 Jérôme Poisson (goffi@goffi.org)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
6 # 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
7
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # 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
9 # 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
10 # 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
11 # (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
12
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # 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
14 # 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
15 # 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
16 # 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
17
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # 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
19 # 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
20
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
21 import base
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_frontends.jp.constants import Const as C
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
23 from sat.core.i18n import _
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
24
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
25 from twisted.words.protocols.jabber import jid
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
26 from collections import OrderedDict
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
27
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
28 __commands__ = ["Roster"]
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
29
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
30
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 class Purge(base.CommandBase):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
33
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
34 def __init__(self, host):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
35 super(Purge, self).__init__(host, 'purge', help=_('Purge the roster from its contacts with no subscription'))
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
36
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
37 def add_parser_options(self):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
38 pass
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
39
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
40 def connected(self):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
41 self.need_loop = True
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
42 super(Purge, self).connected()
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
43 self.host.bridge.getContacts(profile_key=self.host.profile, callback=self.gotContacts, errback=self.error)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
44
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
45 def error(self, failure):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
46 print (_("Error while retrieving the contacts [%s]") % failure)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
47 self.host.quit(1)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
48
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
49 def ask_confirmation(self, to_remove):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
50 """Ask the confirmation before removing contacts without subscription.
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
51
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
52 @param to_remove (list[unicode]): list of contacts
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
53 @return bool
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
54 """
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
55 print "There's no subscription between profile [%s] and the following contacts:" % self.host.profile
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
56 print " " + "\n ".join(to_remove)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
57 message = "REMOVE them from profile [%s]'s roster" % self.host.profile
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
58 while True:
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
59 res = raw_input("%s (y/N)? " % message)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
60 if not res or res.lower() == 'n':
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
61 return False
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
62 if res.lower() == 'y':
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
63 return True
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
64
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
65 def gotContacts(self, contacts):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
66 """Process the list of contacts.
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
67
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
68 @param contacts(list[tuple]): list of contacts with their attributes and groups
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
69 """
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
70 to_remove = []
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
71 for contact, attrs, groups in contacts:
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
72 if not C.bool(attrs["from"]) and not C.bool(attrs["to"]):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
73 to_remove.append(contact)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
74 if not to_remove:
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
75 print "Nothing to do - there's a from and/or to subscription(s) between profile [%s] and each of its contacts" % self.host.profile
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
76 elif self.ask_confirmation(to_remove):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
77 for contact in to_remove:
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
78 self.host.bridge.delContact(contact, profile_key=self.host.profile, callback=lambda dummy: None, errback=lambda failure: None)
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
79 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
80
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
81
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
82 class Stats(base.CommandBase):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
83
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
84 def __init__(self, host):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
85 super(Stats, self).__init__(host, 'stats', help=_('Display show statistics about a roster'))
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
86
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
87 def add_parser_options(self):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
88 pass
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
89
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
90 def connected(self):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
91 self.need_loop = True
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
92 super(Stats, self).connected()
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
93 self.host.bridge.getContacts(profile_key=self.host.profile, callback=self.gotContacts, errback=self.error)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
94
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
95 def error(self, failure):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
96 print (_("Error while retrieving the contacts [%s]") % failure)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
97 self.host.quit(1)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
98
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
99 def gotContacts(self, contacts):
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
100 """Process the list of contacts.
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
101
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
102 @param contacts(list[tuple]): list of contacts with their attributes and groups
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
103 """
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
104 hosts = {}
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
105 no_subscription = 0
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
106 no_from_subscription = 0
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
107 no_to_subscription = 0
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
108 no_group = 0
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
109 total_group_subscription = 0
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
110 for contact, attrs, groups in contacts:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
111 from_, to = C.bool(attrs["from"]), C.bool(attrs["to"])
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
112 if not from_:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
113 if not to:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
114 no_subscription += 1
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
115 else:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
116 no_from_subscription += 1
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
117 elif not to:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
118 no_to_subscription += 1
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
119 host = jid.JID(contact).host
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
120 hosts.setdefault(host, 0)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
121 hosts[host] += 1
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
122 if groups:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
123 total_group_subscription += len(groups)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
124 if not groups:
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
125 no_group += 1
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
126 hosts = OrderedDict(sorted(hosts.items(), key=lambda item:-item[1]))
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
127
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
128 print
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
129 print "Total number of contacts: %d" % len(contacts)
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
130 print
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
131 for host, count in hosts.iteritems():
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
132 print "Contacts on {host}: {count} ({rate:.1f}%)".format(host=host, count=count, rate=100 * float(count) / len(contacts))
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
133 print
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
134 print "Contacts with no 'from' subscription: %d" % no_from_subscription
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
135 print "Contacts with no 'to' subscription: %d" % no_to_subscription
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
136 print "Contacts with no subscription at all: %d" % no_subscription
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
137 print
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
138 print "Contacts not assigned to any group: %d" % no_group
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
139 print "Average groups' subscriptions per contact: %.1f" % (float(total_group_subscription) / len(contacts))
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
140 self.host.quit()
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
141
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
142
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
143 class Roster(base.CommandBase):
1796
314d2eb7fbaa jp: add command "roster stats"
souliane <souliane@mailoo.org>
parents: 1793
diff changeset
144 subcommands = (Purge, Stats)
1793
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
145
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
146 def __init__(self, host):
f39ca2832774 jp: add command "roster purge" to remove the contacts with no from/to subscription
souliane <souliane@mailoo.org>
parents:
diff changeset
147 super(Roster, self).__init__(host, 'roster', use_profile=True, help=_("Manage an entity's roster"))