diff options
-rw-r--r-- | include/protocol.h | 4 | ||||
-rw-r--r-- | modules/protocol/inspircd.cpp | 6 | ||||
-rw-r--r-- | src/modes.cpp | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/include/protocol.h b/include/protocol.h index 1b067421c..036332464 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -117,10 +117,10 @@ public: size_t MaxHost = 0; /* The maximum number of bytes a line may have */ - unsigned MaxLine = 512; + size_t MaxLine = 512; /* The maximum number of modes we are allowed to set with one MODE command */ - unsigned MaxModes = 3; + size_t MaxModes = 3; /* The maximum length of a nickname. */ size_t MaxNick = 0; diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index 8ba398038..52a2bacdc 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -143,8 +143,8 @@ public: CanSVSLogout = true; CanCertFP = true; RequiresID = true; - MaxModes = 20; - MaxLine = 4096; + MaxModes = 0; + MaxLine = 0; } size_t GetMaxListFor(Channel *c, ChannelMode *cm) override @@ -1512,8 +1512,6 @@ struct IRCDMessageCapab final IRCD->MaxChannel = tokvalue; else if (tokname == "MAXHOST") IRCD->MaxHost = tokvalue; - else if (tokname == "MAXMODES") - IRCD->MaxModes = tokvalue; else if (tokname == "MAXNICK") IRCD->MaxNick = tokvalue; else if (tokname == "MAXUSER") diff --git a/src/modes.cpp b/src/modes.cpp index 8b2534268..b0fbf9cca 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -338,7 +338,7 @@ static auto BuildModeStrings(StackerInfo *info) for (it = info->AddModes.begin(), it_end = info->AddModes.end(); it != it_end; ++it) { - if (++NModes > IRCD->MaxModes || (buf.length() + paramlen > IRCD->MaxLine - 100)) // Leave room for command, channel, etc + if ((IRCD->MaxModes && ++NModes > IRCD->MaxModes) || (IRCD->MaxLine && buf.length() + paramlen > IRCD->MaxLine - 100)) // Leave room for command, channel, etc { ret.push_back({buf, parambuf}); buf = "+"; @@ -362,7 +362,7 @@ static auto BuildModeStrings(StackerInfo *info) buf += "-"; for (it = info->DelModes.begin(), it_end = info->DelModes.end(); it != it_end; ++it) { - if (++NModes > IRCD->MaxModes || (buf.length() + paramlen > IRCD->MaxLine - 100)) // Leave room for command, channel, etc + if ((IRCD->MaxModes && ++NModes > IRCD->MaxModes) || (IRCD->MaxLine && buf.length() + paramlen > IRCD->MaxLine - 100)) // Leave room for command, channel, etc { ret.push_back({buf, parambuf}); buf = "-"; |