summaryrefslogtreecommitdiff
path: root/src/modules/m_namesx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_namesx.cpp')
-rw-r--r--src/modules/m_namesx.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp
index 2603b0ce5..535f6ec10 100644
--- a/src/modules/m_namesx.cpp
+++ b/src/modules/m_namesx.cpp
@@ -52,13 +52,12 @@ class ModuleNamesX : public Module
ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, LocalUser *user, bool validated, const std::string &original_line)
{
- irc::string c = command.c_str();
/* We don't actually create a proper command handler class for PROTOCTL,
* because other modules might want to have PROTOCTL hooks too.
* Therefore, we just hook its as an unvalidated command therefore we
* can capture it even if it doesnt exist! :-)
*/
- if (c == "PROTOCTL")
+ if (command == "PROTOCTL")
{
if ((parameters.size()) && (!strcasecmp(parameters[0].c_str(),"NAMESX")))
{
@@ -83,13 +82,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;