summaryrefslogtreecommitdiff
path: root/src/modules/m_cgiirc.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-11-29 20:12:33 +0100
committerattilamolnar <attilamolnar@hush.com>2012-11-29 21:12:13 +0100
commit83db3dc06a44b50d8e25828e201a51edb4030d92 (patch)
tree6a1439fb8bcb0a034e53ff35b84f38696c330dae /src/modules/m_cgiirc.cpp
parentd53f0956ab7ff6b63430bb62ba7dbcfd2fde8e41 (diff)
m_cgiirc Fix wrong announcement when the host in WEBIRC is too long
Diffstat (limited to 'src/modules/m_cgiirc.cpp')
-rw-r--r--src/modules/m_cgiirc.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index f6ad5992a..08b8d3f1c 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -89,11 +89,15 @@ class CommandWebirc : public Command
{
realhost.set(user, user->host);
realip.set(user, user->GetIPString());
+
+ bool host_ok = (parameters[2].length() < 64);
+ const std::string& newhost = (host_ok ? parameters[2] : parameters[3]);
+
if (notify)
- ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick.c_str(), user->host.c_str(), parameters[2].c_str(), user->host.c_str());
+ ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick.c_str(), user->host.c_str(), newhost.c_str(), user->host.c_str());
// Check if we're happy with the provided hostname. If it's problematic then make sure we won't set a host later, just the IP
- if (parameters[2].length() < 64)
+ if (host_ok)
webirc_hostname.set(user, parameters[2]);
else
webirc_hostname.unset(user);