diff options
author | Sadie Powell <sadie@witchery.services> | 2024-02-22 15:58:23 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-02-22 17:05:30 +0000 |
commit | c4e9c0bf8548da1bf4fe2cfe5e7f5ab101b35e52 (patch) | |
tree | edcb3b44b2c600aa40ebfb743fe7edfad4f06149 | |
parent | 84ad85ee857e9a088bf2d5e3e5b1056d1bf52bf8 (diff) |
If the IRCd sends a field limit then use it over that of the config.
-rw-r--r-- | data/anope.example.conf | 15 | ||||
-rw-r--r-- | data/stats.standalone.example.conf | 15 | ||||
-rw-r--r-- | include/language.h | 4 | ||||
-rw-r--r-- | include/protocol.h | 12 | ||||
-rw-r--r-- | language/anope.en_US.po | 32 | ||||
-rw-r--r-- | language/anope.fr_FR.po | 32 | ||||
-rw-r--r-- | language/anope.it_IT.po | 32 | ||||
-rw-r--r-- | language/anope.nl_NL.po | 33 | ||||
-rw-r--r-- | language/anope.pl_PL.po | 32 | ||||
-rw-r--r-- | language/anope.tr_TR.po | 34 | ||||
-rw-r--r-- | modules/botserv/bs_bot.cpp | 29 | ||||
-rw-r--r-- | modules/chanserv/cs_seen.cpp | 4 | ||||
-rw-r--r-- | modules/hostserv/hs_request.cpp | 8 | ||||
-rw-r--r-- | modules/hostserv/hs_set.cpp | 8 | ||||
-rw-r--r-- | modules/nickserv/nickserv.cpp | 2 | ||||
-rw-r--r-- | modules/operserv/os_svs.cpp | 4 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 2 | ||||
-rw-r--r-- | modules/protocol/inspircd.cpp | 54 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 16 | ||||
-rw-r--r-- | modules/protocol/unrealircd.cpp | 2 | ||||
-rw-r--r-- | src/config.cpp | 8 | ||||
-rw-r--r-- | src/protocol.cpp | 34 |
22 files changed, 250 insertions, 162 deletions
diff --git a/data/anope.example.conf b/data/anope.example.conf index 393eeaa46..32d2a1907 100644 --- a/data/anope.example.conf +++ b/data/anope.example.conf @@ -302,25 +302,26 @@ networkinfo /* * Set this to the maximum allowed nick length on your network. * Be sure to set this correctly, as setting this wrong can result in - * Anope being disconnected from the network. + * Anope being disconnected from the network. Defaults to 31. */ - nicklen = 31 + #nicklen = 31 /* Set this to the maximum allowed ident length on your network. * Be sure to set this correctly, as setting this wrong can result in - * Anope being disconnected from the network. + * Anope being disconnected from the network. Defaults to 10. */ - userlen = 10 + #userlen = 10 /* Set this to the maximum allowed hostname length on your network. * Be sure to set this correctly, as setting this wrong can result in - * Anope being disconnected from the network. + * Anope being disconnected from the network. Defaults to 64. */ - hostlen = 64 + #hostlen = 64 /* Set this to the maximum allowed channel length on your network. + * Defaults to 32. */ - chanlen = 32 + #chanlen = 32 /* The maximum number of list modes settable on a channel (such as b, e, I). * Comment out or set to 0 to disable. diff --git a/data/stats.standalone.example.conf b/data/stats.standalone.example.conf index 51698e795..cf443a36f 100644 --- a/data/stats.standalone.example.conf +++ b/data/stats.standalone.example.conf @@ -283,25 +283,26 @@ networkinfo /* * Set this to the maximum allowed nick length on your network. * Be sure to set this correctly, as setting this wrong can result in - * Anope being disconnected from the network. + * Anope being disconnected from the network. Defaults to 31. */ - nicklen = 31 + #nicklen = 31 /* Set this to the maximum allowed ident length on your network. * Be sure to set this correctly, as setting this wrong can result in - * Anope being disconnected from the network. + * Anope being disconnected from the network. Defaults to 10. */ - userlen = 10 + #userlen = 10 /* Set this to the maximum allowed hostname length on your network. * Be sure to set this correctly, as setting this wrong can result in - * Anope being disconnected from the network. + * Anope being disconnected from the network. Defaults to 64. */ - hostlen = 64 + #hostlen = 64 /* Set this to the maximum allowed channel length on your network. + * Defaults to 64. */ - chanlen = 32 + #chanlen = 32 /* The maximum number of list modes settable on a channel (such as b, e, I). * Comment out or set to 0 to disable. diff --git a/include/language.h b/include/language.h index 8b9975d15..49af506be 100644 --- a/include/language.h +++ b/include/language.h @@ -124,7 +124,7 @@ namespace Language #define BOT_NOT_ON_CHANNEL _("Bot is not on channel \002%s\002.") #define HOST_SET_ERROR _("A vHost must be in the format of a valid hostname.") #define HOST_SET_IDENT_ERROR _("A vHost ident must be in the format of a valid ident.") -#define HOST_SET_TOOLONG _("Error! The vHost is too long, please use a hostname shorter than %d characters.") -#define HOST_SET_IDENTTOOLONG _("Error! The vHost ident is too long, please use an ident shorter than %d characters.") +#define HOST_SET_TOOLONG _("Error! The vHost is too long, please use a hostname shorter than %zu characters.") +#define HOST_SET_IDENTTOOLONG _("Error! The vHost ident is too long, please use an ident shorter than %zu characters.") #define HOST_NOT_ASSIGNED _("Please contact an Operator to get a vHost assigned to this nick.") #define HOST_NO_VIDENT _("Your IRCd does not support vIdent's, if this is incorrect, please report this as a possible bug") diff --git a/include/protocol.h b/include/protocol.h index 08924a092..67a746b0f 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -293,6 +293,18 @@ public: virtual unsigned GetMaxListFor(Channel *c, ChannelMode *cm); virtual Anope::string NormalizeMask(const Anope::string &mask); + + /** Retrieves the maximum length of a channel name. */ + virtual size_t GetMaxChannel(); + + /** Retrieves the maximum length of a hostname. */ + virtual size_t GetMaxHost(); + + /** Retrieves the maximum length of a nickname. */ + virtual size_t GetMaxNick(); + + /** Retrieves the maximum length of a username. */ + virtual size_t GetMaxUser(); }; class CoreExport MessageSource final diff --git a/language/anope.en_US.po b/language/anope.en_US.po index ae55adcdc..687bca46f 100644 --- a/language/anope.en_US.po +++ b/language/anope.en_US.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-19 22:16+0000\n" -"PO-Revision-Date: 2024-02-19 22:17+0000\n" +"POT-Creation-Date: 2024-02-22 16:34+0000\n" +"PO-Revision-Date: 2024-02-22 16:35+0000\n" "Last-Translator: Sadie Powell <sadie@witchery.services>\n" "Language-Team: English\n" "Language: en_US\n" @@ -2627,15 +2627,15 @@ msgid "Bot bans will no longer automatically expire." msgstr "Bot bans will no longer automatically expire." #, c-format -msgid "Bot hosts may only be %d characters long." -msgstr "Bot hosts may only be %d characters long." +msgid "Bot hosts may only be %zu characters long." +msgstr "" msgid "Bot hosts may only contain valid host characters." msgstr "Bot hosts may only contain valid host characters." #, c-format -msgid "Bot idents may only be %d characters long." -msgstr "Bot idents may only be %d characters long." +msgid "Bot idents may only be %zu characters long." +msgstr "Bot idents may only be %zu characters long." msgid "Bot idents may only contain valid ident characters." msgstr "Bot idents may only contain valid ident characters." @@ -2651,8 +2651,8 @@ msgid "Bot nick" msgstr "Bot nick" #, c-format -msgid "Bot nicks may only be %d characters long." -msgstr "Bot nicks may only be %d characters long." +msgid "Bot nicks may only be %zu characters long." +msgstr "Bot nicks may only be %zu characters long." msgid "Bot nicks may only contain valid nick characters." msgstr "Bot nicks may only contain valid nick characters." @@ -3918,12 +3918,12 @@ msgid "Error reloading configuration file: %s" msgstr "Error reloading configuration file: %s" #, c-format -msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters." -msgstr "Error! The vHost ident is too long, please use an ident shorter than %d characters." +msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters." +msgstr "Error! The vHost ident is too long, please use an ident shorter than %zu characters." #, c-format -msgid "Error! The vHost is too long, please use a hostname shorter than %d characters." -msgstr "Error! The vHost is too long, please use a hostname shorter than %d characters." +msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters." +msgstr "Error! The vHost is too long, please use a hostname shorter than %zu characters." msgid "" "Examples:\n" @@ -5107,8 +5107,8 @@ msgid "Nick %s isn't registered." msgstr "Nick %s isn't registered." #, c-format -msgid "Nick %s was truncated to %u characters." -msgstr "Nick %s was truncated to %u characters." +msgid "Nick %s was truncated to %zu characters." +msgstr "Nick %s was truncated to %zu characters." #, c-format msgid "Nick %s will expire." @@ -5151,8 +5151,8 @@ msgid "Nick %s is now suspended." msgstr "Nick %s is now suspended." #, c-format -msgid "Nick too long, max length is %u characters." -msgstr "Nick too long, max length is %u characters." +msgid "Nick too long, max length is %zu characters." +msgstr "Nick too long, max length is %zu characters." #, c-format msgid "Nickname %s has been dropped." diff --git a/language/anope.fr_FR.po b/language/anope.fr_FR.po index fab72bd97..f12b443b7 100644 --- a/language/anope.fr_FR.po +++ b/language/anope.fr_FR.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-08 13:20+0000\n" -"PO-Revision-Date: 2024-01-08 13:33+0000\n" +"POT-Creation-Date: 2024-02-22 16:34+0000\n" +"PO-Revision-Date: 2024-02-22 16:36+0000\n" "Last-Translator: Thomas Fargeix <t.fargeix@gmail.com>\n" "Language-Team: French\n" "Language: fr_FR\n" @@ -2640,15 +2640,15 @@ msgid "Bot bans will no longer automatically expire." msgstr "Le bans du bot n'expireront plus automatiquement." #, c-format -msgid "Bot hosts may only be %d characters long." -msgstr "Les hosts des bots ne doivent contenir que %d caractères." +msgid "Bot hosts may only be %zu characters long." +msgstr "Les hosts des bots ne doivent contenir que %zu caractères." msgid "Bot hosts may only contain valid host characters." msgstr "Les hosts des bots ne doivent contenir que des caractères valides pour un host." #, c-format -msgid "Bot idents may only be %d characters long." -msgstr "Les ident des bots ne doivent contenir que %d caractères." +msgid "Bot idents may only be %zu characters long." +msgstr "Les ident des bots ne doivent contenir que %zu caractères." msgid "Bot idents may only contain valid ident characters." msgstr "Les ident des bots ne doivent contenir que des caractères valides pour un ident." @@ -2664,8 +2664,8 @@ msgid "Bot nick" msgstr "Pseudo du bot" #, c-format -msgid "Bot nicks may only be %d characters long." -msgstr "Les pseudos des bots ne doivent contenir que %d caractères." +msgid "Bot nicks may only be %zu characters long." +msgstr "Les pseudos des bots ne doivent contenir que %zu caractères." msgid "Bot nicks may only contain valid nick characters." msgstr "Les pseudos des bots ne peuvent contenir que des caractères valides." @@ -3949,12 +3949,12 @@ msgid "Error reloading configuration file: %s" msgstr "Erreur en rechargeant le fichier de configuration : %s" #, c-format -msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters." -msgstr "Erreur ! L'ident du vHost est trop long, merci d'utiliser un ident plus court que %d caractères." +msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters." +msgstr "Erreur ! L'ident du vHost est trop long, merci d'utiliser un ident plus court que %zu caractères." #, c-format -msgid "Error! The vHost is too long, please use a hostname shorter than %d characters." -msgstr "Erreur ! Le vHost est trop long, merci d'utiliser un hostname plus court que %d caractères." +msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters." +msgstr "Erreur ! Le vHost est trop long, merci d'utiliser un hostname plus court que %zu caractères." msgid "" "Examples:\n" @@ -5140,8 +5140,8 @@ msgid "Nick %s isn't registered." msgstr "Le pseudo %s n'est pas enregistré." #, c-format -msgid "Nick %s was truncated to %u characters." -msgstr "Le pseudo %s a été tronqué à %u caractères." +msgid "Nick %s was truncated to %zu characters." +msgstr "Le pseudo %s a été tronqué à %zu caractères." #, c-format msgid "Nick %s will expire." @@ -5184,8 +5184,8 @@ msgid "Nick %s is now suspended." msgstr "Le pseudo %s a été suspendu." #, c-format -msgid "Nick too long, max length is %u characters." -msgstr "Pseudo trop long, la taille maximale est de %u caractères." +msgid "Nick too long, max length is %zu characters." +msgstr "Pseudo trop long, la taille maximale est de %zu caractères." #, c-format msgid "Nickname %s has been dropped." diff --git a/language/anope.it_IT.po b/language/anope.it_IT.po index 5c8f67efc..d36979342 100644 --- a/language/anope.it_IT.po +++ b/language/anope.it_IT.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-08 13:20+0000\n" -"PO-Revision-Date: 2024-01-08 13:40+0000\n" +"POT-Creation-Date: 2024-02-22 16:34+0000\n" +"PO-Revision-Date: 2024-02-22 16:38+0000\n" "Last-Translator: Dragone2 <dragone2@risposteinformatiche.it>\n" "Language-Team: Italian\n" "Language: it_IT\n" @@ -2637,15 +2637,15 @@ msgid "Bot bans will no longer automatically expire." msgstr "I ban del bot non scadranno automaticamente." #, c-format -msgid "Bot hosts may only be %d characters long." -msgstr "Gli host dei bot possono contenere solamente %d caratteri." +msgid "Bot hosts may only be %zu characters long." +msgstr "Gli host dei bot possono contenere solamente %zu caratteri." msgid "Bot hosts may only contain valid host characters." msgstr "Gli host dei bot possono contenere unicamente caratteri validi." #, c-format -msgid "Bot idents may only be %d characters long." -msgstr "Le ident dei bot possono contenere solamente %d caratteri." +msgid "Bot idents may only be %zu characters long." +msgstr "Le ident dei bot possono contenere solamente %zu caratteri." msgid "Bot idents may only contain valid ident characters." msgstr "Le ident dei bot possono contenere unicamente caratteri validi." @@ -2661,8 +2661,8 @@ msgid "Bot nick" msgstr "Bot nick" #, c-format -msgid "Bot nicks may only be %d characters long." -msgstr "I nick dei Bot possono contenere solamente %d caratteri." +msgid "Bot nicks may only be %zu characters long." +msgstr "I nick dei Bot possono contenere solamente %zu caratteri." msgid "Bot nicks may only contain valid nick characters." msgstr "I nick dei bot possono contenere unicamente caratteri validi." @@ -3942,12 +3942,12 @@ msgid "Error reloading configuration file: %s" msgstr "Errore durante il ricaricamento del file di configurazione: %s" #, c-format -msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters." -msgstr "Errore! L'ident del vHost è troppo lunga, usa una ident più corta di %d caratteri." +msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters." +msgstr "Errore! L'ident del vHost è troppo lunga, usa una ident più corta di %zu caratteri." #, c-format -msgid "Error! The vHost is too long, please use a hostname shorter than %d characters." -msgstr "Errore! Il vHost è troppo lungo, usa un hostname più corto di %d caratteri." +msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters." +msgstr "Errore! Il vHost è troppo lungo, usa un hostname più corto di %zu caratteri." msgid "" "Examples:\n" @@ -5143,8 +5143,8 @@ msgid "Nick %s isn't registered." msgstr "Il nick %s non è registrato." #, c-format -msgid "Nick %s was truncated to %u characters." -msgstr "Il nick %s è stato troncato a %u caratteri." +msgid "Nick %s was truncated to %zu characters." +msgstr "Il nick %s è stato troncato a %zu caratteri." #, c-format msgid "Nick %s will expire." @@ -5187,8 +5187,8 @@ msgid "Nick %s is now suspended." msgstr "Il nick %s è ora sospeso." #, c-format -msgid "Nick too long, max length is %u characters." -msgstr "Nick troppo lungo, lunghezza massima consentita %u caratteri." +msgid "Nick too long, max length is %zu characters." +msgstr "Nick troppo lungo, lunghezza massima consentita %zu caratteri." #, c-format msgid "Nickname %s has been dropped." diff --git a/language/anope.nl_NL.po b/language/anope.nl_NL.po index 316d89d2e..f4adda980 100644 --- a/language/anope.nl_NL.po +++ b/language/anope.nl_NL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-30 04:54+0100\n" -"PO-Revision-Date: 2024-01-31 05:55+0100\n" +"POT-Creation-Date: 2024-02-22 16:34+0000\n" +"PO-Revision-Date: 2024-02-22 16:39+0000\n" "Last-Translator: Robby <robby@chatbelgie.be>\n" "Language-Team: Dutch\n" "Language: nl_NL\n" @@ -16,6 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4\n" #, c-format msgid "%d channel(s) cleared, and %d channel(s) dropped." @@ -2643,15 +2644,15 @@ msgid "Bot bans will no longer automatically expire." msgstr "Bot bans zullen niet langer automatisch verlopen." #, c-format -msgid "Bot hosts may only be %d characters long." -msgstr "Bot hosts mogen maximaal %d karakters bevatten." +msgid "Bot hosts may only be %zu characters long." +msgstr "Bot hosts mogen maximaal %zu karakters bevatten." msgid "Bot hosts may only contain valid host characters." msgstr "Bot hosts mogen alleen geldige host-karakters bevatten." #, c-format -msgid "Bot idents may only be %d characters long." -msgstr "Bot idents mogen maximaal %d karakters bevatten." +msgid "Bot idents may only be %zu characters long." +msgstr "Bot idents mogen maximaal %zu karakters bevatten." msgid "Bot idents may only contain valid ident characters." msgstr "Bot idents mogen alleen geldige ident-karakters bevatten." @@ -2667,8 +2668,8 @@ msgid "Bot nick" msgstr "Bot nick" #, c-format -msgid "Bot nicks may only be %d characters long." -msgstr "Bot nicks mogen maximaal %d karakters bevatten." +msgid "Bot nicks may only be %zu characters long." +msgstr "Bot nicks mogen maximaal %zu karakters bevatten." msgid "Bot nicks may only contain valid nick characters." msgstr "Bot nicks mogen alleen geldige nick-karakters bevatten." @@ -3953,12 +3954,12 @@ msgid "Error reloading configuration file: %s" msgstr "Fout bij laden configuratiebestand: %s" #, c-format -msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters." -msgstr "Fout! De vHost ident is te lang, gelieve een ident korter dan %d karakters op te geven." +msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters." +msgstr "Fout! De vHost ident is te lang, gelieve een ident korter dan %zu karakters op te geven." #, c-format -msgid "Error! The vHost is too long, please use a hostname shorter than %d characters." -msgstr "Fout! De vHost is te lang, gelieve een host korter dan %d karakters op te geven." +msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters." +msgstr "Fout! De vHost is te lang, gelieve een host korter dan %zu karakters op te geven." msgid "" "Examples:\n" @@ -5156,8 +5157,8 @@ msgid "Nick %s isn't registered." msgstr "Nick %s is niet geregistreerd." #, c-format -msgid "Nick %s was truncated to %u characters." -msgstr "Nick %s werd verkort naar %u karakters." +msgid "Nick %s was truncated to %zu characters." +msgstr "Nick %s werd verkort naar %zu karakters." #, c-format msgid "Nick %s will expire." @@ -5200,8 +5201,8 @@ msgid "Nick %s is now suspended." msgstr "Nick %s is nu geschorst." #, c-format -msgid "Nick too long, max length is %u characters." -msgstr "Nick te lang, maximum lengte is %u karakters." +msgid "Nick too long, max length is %zu characters." +msgstr "Nick te lang, maximum lengte is %zu karakters." #, c-format msgid "Nickname %s has been dropped." diff --git a/language/anope.pl_PL.po b/language/anope.pl_PL.po index 476b62610..99ab2f888 100644 --- a/language/anope.pl_PL.po +++ b/language/anope.pl_PL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-08 13:20+0000\n" -"PO-Revision-Date: 2024-01-08 13:46+0000\n" +"POT-Creation-Date: 2024-02-22 16:34+0000\n" +"PO-Revision-Date: 2024-02-22 16:42+0000\n" "Last-Translator: Adam <adam@anope.org>\n" "Language-Team: Polish\n" "Language: pl_PL\n" @@ -2632,15 +2632,15 @@ msgid "Bot bans will no longer automatically expire." msgstr "Bany zakładane przez bota nie będą już się przedawniały." #, c-format -msgid "Bot hosts may only be %d characters long." -msgstr "Host bota może się składać maksymalnie z %d znaków." +msgid "Bot hosts may only be %zu characters long." +msgstr "Host bota może się składać maksymalnie z %zu znaków." msgid "Bot hosts may only contain valid host characters." msgstr "Host bota może zawierać tylko prawidłowe znaki." #, c-format -msgid "Bot idents may only be %d characters long." -msgstr "Ident bota może się składać maksymalnie z %d znaków." +msgid "Bot idents may only be %zu characters long." +msgstr "Ident bota może się składać maksymalnie z %zu znaków." msgid "Bot idents may only contain valid ident characters." msgstr "Ident bota może zawierać tylko prawidłowe znaki." @@ -2656,8 +2656,8 @@ msgid "Bot nick" msgstr "Nick bota" #, c-format -msgid "Bot nicks may only be %d characters long." -msgstr "Nick bota może się składać maksymalnie z %d znaków." +msgid "Bot nicks may only be %zu characters long." +msgstr "Nick bota może się składać maksymalnie z %zu znaków." msgid "Bot nicks may only contain valid nick characters." msgstr "Nick bota może zawierać tylko prawidłowe znaki." @@ -3926,12 +3926,12 @@ msgid "Error reloading configuration file: %s" msgstr "Błąd przeładowywania pliku konfiguracyjnego: %s" #, c-format -msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters." -msgstr "Błąd: podany wirtualny ident jest zbyt długi. Proszę użyć nazwy krótszej niż %d znaków." +msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters." +msgstr "Błąd: podany wirtualny ident jest zbyt długi. Proszę użyć nazwy krótszej niż %zu znaków." #, c-format -msgid "Error! The vHost is too long, please use a hostname shorter than %d characters." -msgstr "Błąd: podany vHost jest zbyt długi. Proszę użyć nazwy krótszej niż %d znaków." +msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters." +msgstr "Błąd: podany vHost jest zbyt długi. Proszę użyć nazwy krótszej niż %zu znaków." msgid "" "Examples:\n" @@ -5126,8 +5126,8 @@ msgid "Nick %s isn't registered." msgstr "Nick %s nie jest zarejestrowany." #, c-format -msgid "Nick %s was truncated to %u characters." -msgstr "Nick %s został skrócony do %u znaków." +msgid "Nick %s was truncated to %zu characters." +msgstr "Nick %s został skrócony do %zu znaków." #, c-format msgid "Nick %s will expire." @@ -5170,8 +5170,8 @@ msgid "Nick %s is now suspended." msgstr "Nick %s został zawieszony." #, c-format -msgid "Nick too long, max length is %u characters." -msgstr "Zbyt długi nick. Maksymalna długość to %u znaków." +msgid "Nick too long, max length is %zu characters." +msgstr "Zbyt długi nick. Maksymalna długość to %zu znaków." #, c-format msgid "Nickname %s has been dropped." diff --git a/language/anope.tr_TR.po b/language/anope.tr_TR.po index e5455f294..a497f63dc 100644 --- a/language/anope.tr_TR.po +++ b/language/anope.tr_TR.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-22 19:47+0000\n" -"PO-Revision-Date: 2024-01-22 22:41+0300\n" +"POT-Creation-Date: 2024-02-22 16:34+0000\n" +"PO-Revision-Date: 2024-02-22 16:43+0000\n" "Last-Translator: CaPaCuL <capacul@gmail.com>\n" "Language-Team: Turkish\n" "Language: tr_TR\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.4.2\n" +"X-Generator: Poedit 3.4\n" #, c-format msgid "%d channel(s) cleared, and %d channel(s) dropped." @@ -2626,15 +2626,15 @@ msgid "Bot bans will no longer automatically expire." msgstr "Bot banları artık otomatik olarak sona ermeyecek." #, c-format -msgid "Bot hosts may only be %d characters long." -msgstr "Bot hostları yalnızca %d karakter uzunluğunda olabilir." +msgid "Bot hosts may only be %zu characters long." +msgstr "Bot hostları yalnızca %zu karakter uzunluğunda olabilir." msgid "Bot hosts may only contain valid host characters." msgstr "Bot hostları yalnızca geçerli host karakterlerini içerebilir." #, c-format -msgid "Bot idents may only be %d characters long." -msgstr "Bot identleri yalnızca %d karakter uzunluğunda olabilir." +msgid "Bot idents may only be %zu characters long." +msgstr "Bot identleri yalnızca %zu karakter uzunluğunda olabilir." msgid "Bot idents may only contain valid ident characters." msgstr "Bot identleri yalnızca geçerli ident karakterlerini içerebilir." @@ -2650,8 +2650,8 @@ msgid "Bot nick" msgstr "Bot rumuzu" #, c-format -msgid "Bot nicks may only be %d characters long." -msgstr "Bot rumuzları yalnızca %d karakter uzunluğunda olabilir." +msgid "Bot nicks may only be %zu characters long." +msgstr "Bot rumuzları yalnızca %zu karakter uzunluğunda olabilir." msgid "Bot nicks may only contain valid nick characters." msgstr "Bot rumuzları yalnızca geçerli rumuz karakterlerini içerebilir." @@ -3917,12 +3917,12 @@ msgid "Error reloading configuration file: %s" msgstr "Yapılandırma dosyası yeniden yüklenirken hata oluştu: %s" #, c-format -msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters." -msgstr "Hata! vHost kimliği çok uzun, lütfen %d karakterden daha kısa bir ident kullanın." +msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters." +msgstr "Hata! vHost kimliği çok uzun, lütfen %zu karakterden daha kısa bir ident kullanın." #, c-format -msgid "Error! The vHost is too long, please use a hostname shorter than %d characters." -msgstr "Hata! vHost çok uzun, lütfen %d karakterden kısa bir host adı kullanın." +msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters." +msgstr "Hata! vHost çok uzun, lütfen %zu karakterden kısa bir host adı kullanın." msgid "" "Examples:\n" @@ -5106,8 +5106,8 @@ msgid "Nick %s isn't registered." msgstr "%s rumuzu kayıtlı değil." #, c-format -msgid "Nick %s was truncated to %u characters." -msgstr "%s rumuzu, %u karaktere kısaltıldı." +msgid "Nick %s was truncated to %zu characters." +msgstr "%s rumuzu, %zu karaktere kısaltıldı." #, c-format msgid "Nick %s will expire." @@ -5150,8 +5150,8 @@ msgid "Nick %s is now suspended." msgstr "%s rumuzu askıya alınmış." #, c-format -msgid "Nick too long, max length is %u characters." -msgstr "Rumuz çok uzun, maks uzunluk %u karakterdir." +msgid "Nick too long, max length is %zu characters." +msgstr "Rumuz çok uzun, maks uzunluk %zu karakterdir." #, c-format msgid "Nickname %s has been dropped." 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<unsigned>("nicklen")) + if (nick.length() > IRCD->GetMaxNick()) { - source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get<unsigned>("nicklen")); + source.Reply(_("Bot nicks may only be %zu characters long."), IRCD->GetMaxNick()); return; } - if (user.length() > networkinfo->Get<unsigned>("userlen")) + if (user.length() > IRCD->GetMaxUser()) { - source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get<unsigned>("userlen")); + source.Reply(_("Bot idents may only be %zu characters long."), IRCD->GetMaxUser()); return; } - if (host.length() > networkinfo->Get<unsigned>("hostlen")) + if (host.length() > IRCD->GetMaxHost()) { - source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get<unsigned>("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<unsigned>("nicklen")) + if (nick.length() > IRCD->GetMaxNick()) { - source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get<unsigned>("nicklen")); + source.Reply(_("Bot nicks may only be %zu characters long."), IRCD->GetMaxNick()); return; } - if (user.length() > networkinfo->Get<unsigned>("userlen")) + if (user.length() > IRCD->GetMaxUser()) { - source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get<unsigned>("userlen")); + source.Reply(_("Bot idents may only be %zu characters long."), IRCD->GetMaxUser()); return; } - if (host.length() > networkinfo->Get<unsigned>("hostlen")) + if (host.length() > IRCD->GetMaxHost()) { - source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get<unsigned>("hostlen")); + source.Reply(_("Bot hosts may only be %zu characters long."), IRCD->GetMaxHost() + ); return; } diff --git a/modules/chanserv/cs_seen.cpp b/modules/chanserv/cs_seen.cpp index 99f44e9fd..6f4119e2f 100644 --- a/modules/chanserv/cs_seen.cpp +++ b/modules/chanserv/cs_seen.cpp @@ -270,9 +270,9 @@ public: if (simple) return this->SimpleSeen(source, params); - if (target.length() > Config->GetBlock("networkinfo")->Get<unsigned>("nicklen")) + if (target.length() > IRCD->GetMaxNick()) { - source.Reply(_("Nick too long, max length is %u characters."), Config->GetBlock("networkinfo")->Get<unsigned>("nicklen")); + source.Reply(_("Nick too long, max length is %zu characters."), IRCD->GetMaxNick()); return; } diff --git a/modules/hostserv/hs_request.cpp b/modules/hostserv/hs_request.cpp index 25f089647..44612ada0 100644 --- a/modules/hostserv/hs_request.cpp +++ b/modules/hostserv/hs_request.cpp @@ -124,9 +124,9 @@ public: if (!user.empty()) { - if (user.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) + if (user.length() > IRCD->GetMaxUser()) { - source.Reply(HOST_SET_IDENTTOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("userlen")); + source.Reply(HOST_SET_IDENTTOOLONG, IRCD->GetMaxUser()); return; } else if (!IRCD->CanSetVIdent) @@ -144,9 +144,9 @@ public: } } - if (host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")) + if (host.length() > IRCD->GetMaxHost()) { - source.Reply(HOST_SET_TOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); + source.Reply(HOST_SET_TOOLONG, IRCD->GetMaxHost()); return; } diff --git a/modules/hostserv/hs_set.cpp b/modules/hostserv/hs_set.cpp index e35f4d3b9..f923057c2 100644 --- a/modules/hostserv/hs_set.cpp +++ b/modules/hostserv/hs_set.cpp @@ -71,9 +71,9 @@ public: } } - if (host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")) + if (host.length() > IRCD->GetMaxHost()) { - source.Reply(HOST_SET_TOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); + source.Reply(HOST_SET_TOOLONG, IRCD->GetMaxHost()); return; } @@ -177,9 +177,9 @@ public: } } - if (host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")) + if (host.length() > IRCD->GetMaxHost()) { - source.Reply(HOST_SET_TOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); + source.Reply(HOST_SET_TOOLONG, IRCD->GetMaxHost()); return; } diff --git a/modules/nickserv/nickserv.cpp b/modules/nickserv/nickserv.cpp index 2706ea23e..673400e92 100644 --- a/modules/nickserv/nickserv.cpp +++ b/modules/nickserv/nickserv.cpp @@ -251,7 +251,7 @@ public: if (IRCD->CanSVSNick) { - unsigned nicklen = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); + unsigned nicklen = IRCD->GetMaxNick(); const Anope::string &guestprefix = Config->GetModule("nickserv")->Get<const Anope::string>("guestnickprefix", "Guest"); Anope::string guestnick; diff --git a/modules/operserv/os_svs.cpp b/modules/operserv/os_svs.cpp index 3a1ba29b8..ee2131c17 100644 --- a/modules/operserv/os_svs.cpp +++ b/modules/operserv/os_svs.cpp @@ -34,10 +34,10 @@ public: } /* Truncate long nicknames to nicklen characters */ - unsigned nicklen = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); + size_t nicklen = IRCD->GetMaxNick(); if (newnick.length() > nicklen) { - source.Reply(_("Nick \002%s\002 was truncated to %u characters."), newnick.c_str(), nicklen); + source.Reply(_("Nick \002%s\002 was truncated to %zu characters."), newnick.c_str(), nicklen); newnick = params[1].substr(0, nicklen); } diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index fa095f485..3e19daf1a 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -280,7 +280,7 @@ public: bool IsIdentValid(const Anope::string &ident) override { - if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) + if (ident.empty() || ident.length() > IRCD->GetMaxUser()) return false; /* diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index b72f06f49..4702fac25 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -26,6 +26,8 @@ static std::list<SASLUser> saslusers; static Anope::string rsquit_server, rsquit_id; +static size_t maxchannel = 0, maxhost = 0, maxnick = 0, maxuser = 0; + static void ParseModule(const Anope::string &module, Anope::string &modname, Anope::string &moddata) { size_t sep = module.find('='); @@ -102,6 +104,16 @@ public: MaxLine = 4096; } + size_t GetMaxChannel() override + { + return maxchannel ? maxchannel : IRCDProto::GetMaxChannel(); + } + + size_t GetMaxHost() override + { + return maxhost ? maxhost : IRCDProto::GetMaxHost(); + } + unsigned GetMaxListFor(Channel *c, ChannelMode *cm) override { ListLimits *limits = maxlist.Get(c); @@ -116,6 +128,16 @@ 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 { Uplink::Send("CAPAB", "START", 1205); @@ -526,7 +548,7 @@ public: bool IsIdentValid(const Anope::string &ident) override { - if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) + if (ident.empty() || ident.length() > IRCD->GetMaxUser()) return false; for (auto c : ident) @@ -1212,13 +1234,33 @@ struct IRCDMessageCapab final Anope::string capab; while (ssep.GetToken(capab)) { - if (capab.find("MAXMODES=") != Anope::string::npos) + if (capab == "GLOBOPS=1") + Servers::Capab.insert("GLOBOPS"); + else if (capab.find("CHANMAX=") != Anope::string::npos) { - Anope::string maxmodes(capab.begin() + 9, capab.end()); - IRCD->MaxModes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; + Anope::string value(capab.begin() + 8, capab.end()); + maxchannel = value.is_pos_number_only() ? convertTo<unsigned>(value) : 0; + } + else if (capab.find("IDENTMAX=") != Anope::string::npos) + { + Anope::string value(capab.begin() + 9, capab.end()); + maxuser = value.is_pos_number_only() ? convertTo<unsigned>(value) : 0; + } + else if (capab.find("MAXMODES=") != Anope::string::npos) + { + Anope::string value(capab.begin() + 9, capab.end()); + IRCD->MaxModes = value.is_pos_number_only() ? convertTo<unsigned>(value) : 3; + } + else if (capab.find("MAXHOST=") != Anope::string::npos) + { + Anope::string value(capab.begin() + 8, capab.end()); + maxhost = value.is_pos_number_only() ? convertTo<unsigned>(value) : 0; + } + else if (capab.find("NICKMAX=") != Anope::string::npos) + { + Anope::string value(capab.begin() + 8, capab.end()); + maxnick = value.is_pos_number_only() ? convertTo<unsigned>(value) : 0; } - else if (capab == "GLOBOPS=1") - Servers::Capab.insert("GLOBOPS"); } } else if (params[0].equals_cs("END")) 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; } } } diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp index 24a61fca3..22c1d4734 100644 --- a/modules/protocol/unrealircd.cpp +++ b/modules/protocol/unrealircd.cpp @@ -422,7 +422,7 @@ private: bool IsIdentValid(const Anope::string &ident) override { - if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) + if (ident.empty() || ident.length() > IRCD->GetMaxUser()) return false; for (auto c : ident) diff --git a/src/config.cpp b/src/config.cpp index c3e27d469..bcba9de38 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -178,10 +178,10 @@ Conf::Conf() : Block("") ValidateNotZero("options", "readtimeout", options->Get<time_t>("readtimeout")); ValidateNotZero("options", "warningtimeout", options->Get<time_t>("warningtimeout")); - ValidateNotZero("networkinfo", "nicklen", networkinfo->Get<unsigned>("nicklen")); - ValidateNotZero("networkinfo", "userlen", networkinfo->Get<unsigned>("userlen")); - ValidateNotZero("networkinfo", "hostlen", networkinfo->Get<unsigned>("hostlen")); - ValidateNotZero("networkinfo", "chanlen", networkinfo->Get<unsigned>("chanlen")); + ValidateNotZero("networkinfo", "nicklen", networkinfo->Get<unsigned>("nicklen", "1")); + ValidateNotZero("networkinfo", "userlen", networkinfo->Get<unsigned>("userlen", "1")); + ValidateNotZero("networkinfo", "hostlen", networkinfo->Get<unsigned>("hostlen", "1")); + ValidateNotZero("networkinfo", "chanlen", networkinfo->Get<unsigned>("chanlen", "1")); spacesepstream(options->Get<const Anope::string>("ulineservers")).GetTokens(this->Ulines); diff --git a/src/protocol.cpp b/src/protocol.cpp index bf7d1bc28..06b654123 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -343,7 +343,7 @@ bool IRCDProto::IsNickValid(const Anope::string &nick) bool IRCDProto::IsChannelValid(const Anope::string &chan) { - if (chan.empty() || chan[0] != '#' || chan.length() > Config->GetBlock("networkinfo")->Get<unsigned>("chanlen")) + if (chan.empty() || chan[0] != '#' || chan.length() > IRCD->GetMaxChannel()) return false; if (chan.find_first_of(" ,") != Anope::string::npos) @@ -354,7 +354,7 @@ bool IRCDProto::IsChannelValid(const Anope::string &chan) bool IRCDProto::IsIdentValid(const Anope::string &ident) { - if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) + if (ident.empty() || ident.length() > IRCD->GetMaxUser()) return false; for (auto c : ident) @@ -370,7 +370,7 @@ bool IRCDProto::IsIdentValid(const Anope::string &ident) bool IRCDProto::IsHostValid(const Anope::string &host) { - if (host.empty() || host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")) + if (host.empty() || host.length() > IRCD->GetMaxHost()) return false; const Anope::string &vhostdisablebe = Config->GetBlock("networkinfo")->Get<const Anope::string>("disallow_start_or_end"), @@ -416,6 +416,34 @@ Anope::string IRCDProto::NormalizeMask(const Anope::string &mask) return Entry("", mask).GetNUHMask(); } +size_t IRCDProto::GetMaxChannel() +{ + // We can cache this as its not allowed to change on rehash. + static size_t chanlen = Config->GetBlock("networkinfo")->Get<unsigned>("chanlen", "32"); + return chanlen; +} + +size_t IRCDProto::GetMaxHost() +{ + // We can cache this as its not allowed to change on rehash. + static size_t hostlen = Config->GetBlock("networkinfo")->Get<unsigned>("hostlen", "64"); + return hostlen; +} + +size_t IRCDProto::GetMaxNick() +{ + // We can cache this as its not allowed to change on rehash. + static size_t nicklen = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen", "31"); + return nicklen; +} + +size_t IRCDProto::GetMaxUser() +{ + // We can cache this as its not allowed to change on rehash. + static size_t userlen = Config->GetBlock("networkinfo")->Get<unsigned>("userlen", "10"); + return userlen; +} + MessageSource::MessageSource(const Anope::string &src) : source(src) { /* no source for incoming message is our uplink */ |