summaryrefslogtreecommitdiff
path: root/modules/protocol/ngircd.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-02-22 15:58:23 +0000
committerSadie Powell <sadie@witchery.services>2024-02-22 17:05:30 +0000
commitc4e9c0bf8548da1bf4fe2cfe5e7f5ab101b35e52 (patch)
treeedcb3b44b2c600aa40ebfb743fe7edfad4f06149 /modules/protocol/ngircd.cpp
parent84ad85ee857e9a088bf2d5e3e5b1056d1bf52bf8 (diff)
If the IRCd sends a field limit then use it over that of the config.
Diffstat (limited to 'modules/protocol/ngircd.cpp')
-rw-r--r--modules/protocol/ngircd.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index 6dfb91b6c..3c80fecc6 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -11,6 +11,11 @@
#include "module.h"
+namespace
+{
+ size_t nicklen = 0;
+}
+
class ngIRCdProto final
: public IRCDProto
{
@@ -31,6 +36,11 @@ public:
MaxModes = 5;
}
+ size_t GetMaxNick() override
+ {
+ return nicklen ? nicklen : IRCDProto::GetMaxNick();
+ }
+
void SendAkill(User *u, XLine *x) override
{
// Calculate the time left before this would expire
@@ -172,11 +182,7 @@ struct IRCDMessage005 final
}
else if (parameter == "NICKLEN")
{
- unsigned newlen = convertTo<unsigned>(data), len = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen");
- if (len != newlen)
- {
- Log() << "Warning: NICKLEN is " << newlen << " but networkinfo:nicklen is " << len;
- }
+ nicklen = data.is_pos_number_only() ? convertTo<size_t>(data) : 0;
}
}
}