From c4e9c0bf8548da1bf4fe2cfe5e7f5ab101b35e52 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 22 Feb 2024 15:58:23 +0000 Subject: If the IRCd sends a field limit then use it over that of the config. --- modules/botserv/bs_bot.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'modules/botserv') diff --git a/modules/botserv/bs_bot.cpp b/modules/botserv/bs_bot.cpp index 170e1073a..5571a82c9 100644 --- a/modules/botserv/bs_bot.cpp +++ b/modules/botserv/bs_bot.cpp @@ -28,23 +28,21 @@ private: return; } - Configuration::Block *networkinfo = Config->GetBlock("networkinfo"); - - if (nick.length() > networkinfo->Get("nicklen")) + if (nick.length() > IRCD->GetMaxNick()) { - source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get("nicklen")); + source.Reply(_("Bot nicks may only be %zu characters long."), IRCD->GetMaxNick()); return; } - if (user.length() > networkinfo->Get("userlen")) + if (user.length() > IRCD->GetMaxUser()) { - source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get("userlen")); + source.Reply(_("Bot idents may only be %zu characters long."), IRCD->GetMaxUser()); return; } - if (host.length() > networkinfo->Get("hostlen")) + if (host.length() > IRCD->GetMaxHost()) { - source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get("hostlen")); + source.Reply(_("Bot hosts may only be %zu characters long."), IRCD->GetMaxHost()); return; } @@ -120,23 +118,22 @@ private: return; } - Configuration::Block *networkinfo = Config->GetBlock("networkinfo"); - - if (nick.length() > networkinfo->Get("nicklen")) + if (nick.length() > IRCD->GetMaxNick()) { - source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get("nicklen")); + source.Reply(_("Bot nicks may only be %zu characters long."), IRCD->GetMaxNick()); return; } - if (user.length() > networkinfo->Get("userlen")) + if (user.length() > IRCD->GetMaxUser()) { - source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get("userlen")); + source.Reply(_("Bot idents may only be %zu characters long."), IRCD->GetMaxUser()); return; } - if (host.length() > networkinfo->Get("hostlen")) + if (host.length() > IRCD->GetMaxHost()) { - source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get("hostlen")); + source.Reply(_("Bot hosts may only be %zu characters long."), IRCD->GetMaxHost() + ); return; } -- cgit