diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-08-31 12:49:19 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-08-31 12:49:19 +0200 |
commit | 77576e0fea41a3dbb06398ba9cf915105bfa7b10 (patch) | |
tree | fa883293127e8a213ac961b84c75a349d87efb4b | |
parent | c9092344a5e6245a72dd4f16205ea8d788053a90 (diff) |
m_blockamsg Uncrook channel counting logic
-rw-r--r-- | src/modules/m_blockamsg.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
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) == '#')) |