changeset aa168d39f846 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=aa168d39f846
description: Reimplemented the /names command
diffstat:
src/command_system/implementation/standard.py | 35 +++++++++++++-------------
1 files changed, 18 insertions(+), 17 deletions(-)
diffs (75 lines):
diff -r dfe453098061 -r aa168d39f846
src/command_system/implementation/standard.py
--- a/src/command_system/implementation/standard.py Fri Aug 06 21:47:34
2010 +0300
+++ b/src/command_system/implementation/standard.py Sat Aug 07 16:38:05
2010 +0300
@@ -224,7 +224,7 @@
"""
AUTOMATIC = True
- HOSTS = (ChatCommands,)
+ HOSTS = ChatCommands,
class StandardPrivateChatCommands(CommandContainer):
"""
@@ -233,7 +233,7 @@
"""
AUTOMATIC = True
- HOSTS = (PrivateChatCommands,)
+ HOSTS = PrivateChatCommands,
class StandardGroupChatCommands(CommandContainer):
"""
@@ -242,7 +242,7 @@
"""
AUTOMATIC = True
- HOSTS = (GroupChatCommands,)
+ HOSTS = GroupChatCommands,
@command(raw=True)
@doc(_("Change your nickname in a group chat"))
@@ -330,23 +330,24 @@
@command
@doc(_("Display names of all group chat occupants"))
def names(self, verbose=False):
- get_contact = lambda nick: gajim.contacts.get_gc_contact(self.account,
self.room_jid, nick)
- nicks = gajim.contacts.get_nick_list(self.account, self.room_jid)
+ ggc = gajim.contacts.get_gc_contact
+ gnl = gajim.contacts.get_nick_list
- # First we do alpha-numeric sort and then role-based one.
- nicks.sort()
- nicks.sort(key=lambda nick: get_contact(nick).role)
+ get_contact = lambda nick: ggc(self.account, self.room_jid, nick)
+ get_role = lambda nick: get_contact(nick).role
+ nicks = gnl(self.account, self.room_jid)
- if verbose:
- for nick in nicks:
- contact = get_contact(nick)
+ nicks = sorted(nicks)
+ nicks = sorted(nicks, key=get_role)
- role = helpers.get_uf_role(contact.role)
- affiliation = helpers.get_uf_affiliation(contact.affiliation)
+ if not verbose:
+ return ", ".join(nicks)
- self.echo("%s - %s - %s" % (nick, role, affiliation))
- else:
- return ', '.join(nicks)
+ for nick in nicks:
+ contact = get_contact(nick)
+ role = helpers.get_uf_role(contact.role)
+ affiliation = helpers.get_uf_affiliation(contact.affiliation)
+ self.echo("%s - %s - %s" % (nick, role, affiliation))
@command('ignore', raw=True)
@doc(_("Forbid an occupant to send you public or private messages"))
@@ -356,4 +357,4 @@
@command('unignore', raw=True)
@doc(_("Allow an occupant to send you public or private messages"))
def unblock(self, who):
- self.on_unblock(None, who)
+ self.on_unblock(None, who)
\ No newline at end of file
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits