diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-07-18 13:34:08 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-07-21 16:01:28 +0200 |
commit | 0b3a4371c504c45c8a4504d114efb2ca674374e0 (patch) | |
tree | abdfc930fc972200a7fdb7299d8c0a47b5d13948 /src | |
parent | 05f54a7222d264052425ce4b114dc09f761714b8 (diff) |
m_namesx Handle colons in channel names properly
Fixes #258 reported by @FxChiP
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_namesx.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 2603b0ce5..7e9c5fd48 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -83,13 +83,16 @@ class ModuleNamesX : public Module void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) { - if (!cap.ext.get(source) || line.empty()) + if (!cap.ext.get(source)) return; - std::string::size_type pos = line.find(':'); - if (pos == std::string::npos || pos < 2) + // Channel names can contain ":", and ":" as a 'start-of-token' delimiter is + // only ever valid after whitespace, so... find the actual delimiter first! + // Thanks to FxChiP for pointing this out. + std::string::size_type pos = line.find(" :"); + if (pos == std::string::npos || pos == 0) return; - pos -= 2; + pos--; // Don't do anything if the user has no prefixes if ((line[pos] == 'H') || (line[pos] == 'G') || (line[pos] == '*')) return; |