summaryrefslogtreecommitdiff
path: root/modules/protocol/inspircd.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-03-12 12:22:57 +0000
committerSadie Powell <sadie@witchery.services>2024-03-12 12:24:02 +0000
commit06add0e5fc1b83b43014e731cb94229ab2be66f6 (patch)
tree16e08617a2e81a6bc8f44ab513e056a792bb07c2 /modules/protocol/inspircd.cpp
parent63d682314b7eb3f6e25ecf4ba81dc3bb17270f0e (diff)
Simplify limit extraction code.
Diffstat (limited to 'modules/protocol/inspircd.cpp')
-rw-r--r--modules/protocol/inspircd.cpp49
1 files changed, 9 insertions, 40 deletions
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp
index e0cf20b85..8ba398038 100644
--- a/modules/protocol/inspircd.cpp
+++ b/modules/protocol/inspircd.cpp
@@ -25,18 +25,6 @@ struct SASLUser final
namespace
{
- // The maximum length of a channel name.
- size_t maxchannel = 0;
-
- // The maximum length of a hostname.
- size_t maxhost = 0;
-
- // The maximum length of a nickname.
- size_t maxnick = 0;
-
- // The maximum length of a username.
- size_t maxuser = 0;
-
// The SID of a server we are waiting to squit.
Anope::string rsquit_id;
@@ -159,16 +147,6 @@ public:
MaxLine = 4096;
}
- size_t GetMaxChannel() override
- {
- return maxchannel ? maxchannel : IRCDProto::GetMaxChannel();
- }
-
- size_t GetMaxHost() override
- {
- return maxhost ? maxhost : IRCDProto::GetMaxHost();
- }
-
size_t GetMaxListFor(Channel *c, ChannelMode *cm) override
{
ListLimits *limits = maxlist.Get(c);
@@ -183,15 +161,6 @@ public:
return IRCDProto::GetMaxListFor(c, cm);
}
- size_t GetMaxNick() override
- {
- return maxnick ? maxnick : IRCDProto::GetMaxNick();
- }
-
- size_t GetMaxUser() override
- {
- return maxuser ? maxuser : IRCDProto::GetMaxUser();
- }
void SendConnect() override
{
@@ -650,7 +619,7 @@ public:
bool IsIdentValid(const Anope::string &ident) override
{
- if (ident.empty() || ident.length() > IRCD->GetMaxUser())
+ if (ident.empty() || ident.length() > IRCD->MaxUser)
return false;
for (auto c : ident)
@@ -1540,25 +1509,25 @@ struct IRCDMessageCapab final
{
auto [tokname, tokvalue] = ParseCapability(capab);
if (tokname == "MAXCHANNEL")
- maxchannel = tokvalue;
+ IRCD->MaxChannel = tokvalue;
else if (tokname == "MAXHOST")
- maxhost = tokvalue;
+ IRCD->MaxHost = tokvalue;
else if (tokname == "MAXMODES")
IRCD->MaxModes = tokvalue;
else if (tokname == "MAXNICK")
- maxnick = tokvalue;
+ IRCD->MaxNick = tokvalue;
else if (tokname == "MAXUSER")
- maxuser = tokvalue;
+ IRCD->MaxUser = tokvalue;
// Deprecated 1205 keys.
else if (tokname == "CHANMAX")
- maxchannel = tokvalue;
+ IRCD->MaxChannel = tokvalue;
else if (tokname == "GLOBOPS" && tokvalue)
Servers::Capab.insert("GLOBOPS");
else if (tokname == "IDENTMAX")
- maxuser = tokvalue;
+ IRCD->MaxUser = tokvalue;
else if (tokname == "NICKMAX")
- maxnick = tokvalue;
+ IRCD->MaxNick = tokvalue;
}
}
else if (params[0].equals_cs("END"))
@@ -1995,7 +1964,7 @@ struct IRCDMessageFJoin final
users.push_back(sju);
}
- auto ts = IRCD->ExtractTimestamp(params[0]);
+ auto ts = IRCD->ExtractTimestamp(params[1]);
Message::Join::SJoin(source, params[0], ts, modes, users);
}
};