From 0ab9d4e3ec0970217957d510538d4dfb9874c358 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 21 Nov 2003 11:45:43 +0000 Subject: [PATCH] Do sorting the right way (not only are cmp functions slow, but with nicks you need to sort by ircutils.toLower, not str.lower). --- plugins/Relay.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/Relay.py b/plugins/Relay.py index 04003e815..9ba356a32 100644 --- a/plugins/Relay.py +++ b/plugins/Relay.py @@ -284,8 +284,6 @@ class Relay(callbacks.Privmsg, plugins.Configurable): the channel itself. Returns the nicks of the people in the channel on the various networks the bot is connected to. """ - def comp(x, y): - return cmp(x.lower(), y.lower()) if not self.started: irc.error(msg, 'You must use the start command first.') return @@ -322,10 +320,10 @@ class Relay(callbacks.Privmsg, plugins.Configurable): voices.append('+%s' % s) else: usersS.append(s) - ops.sort(comp) - voices.sort(comp) - usersS.sort(comp) - halfops.sort(comp) + utils.sortBy(ircutils.toLower, ops) + utils.sortBy(ircutils.toLower, voices) + utils.sortBy(ircutils.toLower, halfops) + utils.sortBy(ircutils.toLower, usersS) usersS = ', '.join(ifilter(None, imap(', '.join, (ops,halfops,voices,usersS)))) users.append('%s: %s' % (ircutils.bold(abbreviation), usersS))