From 77576e0fea41a3dbb06398ba9cf915105bfa7b10 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 31 Aug 2014 12:49:19 +0200 Subject: m_blockamsg Uncrook channel counting logic --- src/modules/m_blockamsg.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 77607fc20..13533808a 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -88,17 +88,11 @@ class ModuleBlockAmsg : public Module if ((validated) && (parameters.size() >= 2) && ((command == "PRIVMSG") || (command == "NOTICE"))) { - // parameters[0] should have the target(s) in it. - // I think it will be faster to first check if there are any commas, and if there are then try and parse it out. - // Most messages have a single target so... - - int targets = 1; - - if(*parameters[0].c_str() != '#') - { - // Decrement if the first target wasn't a channel. - targets--; - } + // parameters[0] is the target list, count how many channels are there + unsigned int targets = 0; + // Is the first target a channel? + if (*parameters[0].c_str() == '#') + targets = 1; for(const char* c = parameters[0].c_str(); *c; c++) if((*c == ',') && *(c+1) && (*(c+1) == '#')) -- cgit v1.2.3