From c8e7b72065b2686c9691b276989ee948023ffe4d Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 31 Aug 2015 11:44:23 -0700 Subject: [PATCH] protocols: lowercase channel names in PRIVMSG handling Merge NOTICE and PRIVMSG handlers together; they're essentially the same thing. --- protocols/inspircd.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 52a9171..c62b7e0 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -367,7 +367,15 @@ def handle_pong(irc, source, command, args): irc.lastping = time.time() def handle_privmsg(irc, source, command, args): - return {'target': args[0], 'text': args[1]} + # <- :70MAAAAAA PRIVMSG #dev :afasfsa + # <- :70MAAAAAA NOTICE 0ALAAAAAA :afasfsa + target = args[0] + # We use lowercase channels internally, but uppercase UIDs. + if utils.isChannel(target): + target = target.lower() + return {'target': target, 'text': args[1]} + +handle_notice = handle_privmsg def handle_kill(irc, source, command, args): killed = args[0] @@ -691,11 +699,6 @@ def handle_encap(irc, numeric, command, args): return {'parse_as': real_command, 'channel': channel, 'text': text} -def handle_notice(irc, numeric, command, args): - # <- :70MAAAAAA NOTICE #dev :afasfsa - # <- :70MAAAAAA NOTICE 0ALAAAAAA :afasfsa - return {'target': args[0], 'text': args[1]} - def handle_opertype(irc, numeric, command, args): # This is used by InspIRCd to denote an oper up; there is no MODE # command sent for it.