diff --git a/src/callbacks.py b/src/callbacks.py index 915b44d0a..037ec96d3 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -67,7 +67,8 @@ def addressed(nick, msg): """If msg is addressed to 'name', returns the portion after the address. Otherwise returns the empty string. """ - if msg.args[0] == nick: + nick = ircutils.toLower(nick) + if ircutils.nickEqual(msg.args[0], nick): if msg.args[1][0] in conf.prefixChars: return msg.args[1][1:].strip() else: @@ -77,7 +78,7 @@ def addressed(nick, msg): (maybeNick, rest) = msg.args[1].split(None, 1) while not ircutils.isNick(maybeNick): maybeNick = maybeNick[:-1] - if maybeNick == nick: + if ircutils.nickEqual(maybeNick, nick): return rest else: return '' diff --git a/test/test_callbacks.py b/test/test_callbacks.py index e9e66e876..0835dced6 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -116,7 +116,8 @@ class FunctionsTestCase(unittest.TestCase): nick = 'supybot' conf.prefixChars = '~!@' inChannel = ['~foo', '@foo', '!foo', - '%s: foo' % nick, '%s foo' % nick] + '%s: foo' % nick, '%s foo' % nick, + '%s: foo' % nick.capitalize(), '%s: foo' % nick.upper()] inChannel = [ircmsgs.privmsg('#foo', s) for s in inChannel] badmsg = ircmsgs.privmsg('#foo', '%s:foo' % nick) self.failIf(callbacks.addressed(nick, badmsg))