From 0d010f87ca31fc0dca5783fed468adf25decf77d Mon Sep 17 00:00:00 2001 From: Preston Date: Mon, 15 Jul 2013 10:24:17 -0700 Subject: [PATCH 1/2] Add str.lower() for channel name to set_mask() and show_mask() topic() calls lower() on the channel name, but not on set_mask() and show_mask(). If the channel name is not lower case, topic doesn't find the topic mask row in the database as the where condition is case sensitive. According to RFC2812 http://tools.ietf.org/html/rfc2812#section-1.3 channel names should be case insensitive, so lower() on all the channel names seems more appropriate than removing lower() from topic() --- willie/modules/adminchannel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/willie/modules/adminchannel.py b/willie/modules/adminchannel.py index 9a3711cf93..55f1f06a73 100644 --- a/willie/modules/adminchannel.py +++ b/willie/modules/adminchannel.py @@ -308,7 +308,7 @@ def set_mask(bot, trigger): if not bot.db: bot.say("I'm afraid I can't do that.") else: - bot.db.preferences.update(trigger.sender, {'topic_mask': trigger.group(2)}) + bot.db.preferences.update(trigger.sender.lower(), {'topic_mask': trigger.group(2)}) bot.say("Gotcha, " + trigger.nick) @@ -320,7 +320,7 @@ def show_mask(bot, trigger): if not bot.db: bot.say("I'm afraid I can't do that.") elif trigger.sender in bot.db.preferences: - bot.say(bot.db.preferences.get(trigger.sender, 'topic_mask')) + bot.say(bot.db.preferences.get(trigger.sender.lower(), 'topic_mask')) else: bot.say("%s") From 84ee55b9a4c8056ee660a721e42f8ee4cf86c35e Mon Sep 17 00:00:00 2001 From: Preston Bennes Date: Mon, 15 Jul 2013 10:49:08 -0700 Subject: [PATCH 2/2] Add str.lower() to elif in during lookup in show_mask() This needs to be lower()'d as well --- willie/modules/adminchannel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/willie/modules/adminchannel.py b/willie/modules/adminchannel.py index 55f1f06a73..64a7db209d 100644 --- a/willie/modules/adminchannel.py +++ b/willie/modules/adminchannel.py @@ -319,7 +319,7 @@ def show_mask(bot, trigger): return if not bot.db: bot.say("I'm afraid I can't do that.") - elif trigger.sender in bot.db.preferences: + elif trigger.sender.lower() in bot.db.preferences: bot.say(bot.db.preferences.get(trigger.sender.lower(), 'topic_mask')) else: bot.say("%s")