Do sorting the right way (not only are cmp functions slow, but with nicks you need to sort by ircutils.toLower, not str.lower).

This commit is contained in:
Jeremy Fincher 2003-11-21 11:45:43 +00:00
parent c283ca73de
commit 0ab9d4e3ec

View File

@ -284,8 +284,6 @@ class Relay(callbacks.Privmsg, plugins.Configurable):
the channel itself. Returns the nicks of the people in the channel on the channel itself. Returns the nicks of the people in the channel on
the various networks the bot is connected to. the various networks the bot is connected to.
""" """
def comp(x, y):
return cmp(x.lower(), y.lower())
if not self.started: if not self.started:
irc.error(msg, 'You must use the start command first.') irc.error(msg, 'You must use the start command first.')
return return
@ -322,10 +320,10 @@ class Relay(callbacks.Privmsg, plugins.Configurable):
voices.append('+%s' % s) voices.append('+%s' % s)
else: else:
usersS.append(s) usersS.append(s)
ops.sort(comp) utils.sortBy(ircutils.toLower, ops)
voices.sort(comp) utils.sortBy(ircutils.toLower, voices)
usersS.sort(comp) utils.sortBy(ircutils.toLower, halfops)
halfops.sort(comp) utils.sortBy(ircutils.toLower, usersS)
usersS = ', '.join(ifilter(None, imap(', '.join, usersS = ', '.join(ifilter(None, imap(', '.join,
(ops,halfops,voices,usersS)))) (ops,halfops,voices,usersS))))
users.append('%s: %s' % (ircutils.bold(abbreviation), usersS)) users.append('%s: %s' % (ircutils.bold(abbreviation), usersS))