diff options
| author | 2023-05-07 18:32:50 +0100 | |
|---|---|---|
| committer | 2023-05-07 18:32:50 +0100 | |
| commit | 00e4b08b4d87c434f352bb8aece1009a649604c4 (patch) | |
| tree | 6102e35bd0f22bc766164cfcef06af3c478e6a40 /src/modules/m_codepage.cpp | |
| parent | Tighten up the rules for nicknames to match the Modern IRC spec. (diff) | |
Improve the config error messages in the codepage module.
Diffstat (limited to 'src/modules/m_codepage.cpp')
| -rw-r--r-- | src/modules/m_codepage.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 001f1d6da..d3240782a 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -328,6 +328,14 @@ private: RehashHashmap(ServerInstance->Channels.GetChans()); } + static std::string GetPrintable(uint32_t chr) + { + if (isprint(chr)) + return INSP_FORMAT("{} ({})", reinterpret_cast<const char*>(&chr), chr); + else + return INSP_FORMAT("{}", chr); + } + public: ModuleCodepage() : Module(VF_VENDOR | VF_COMMON, "Allows the server administrator to define what characters are allowed in nicknames and how characters should be compared in a case insensitive way.") @@ -377,17 +385,17 @@ public: switch (newcodepage->AllowCharacter(static_cast<uint32_t>(pos), front)) { case Codepage::AllowCharacterResult::OKAY: - ServerInstance->Logs.Debug(MODNAME, "Marked {} ({:.4}) as allowed (front: {})", - pos, reinterpret_cast<const char*>(&pos), front ? "yes" : "no"); + ServerInstance->Logs.Debug(MODNAME, "Marked {} as allowed (front: {})", + GetPrintable(pos), front ? "yes" : "no"); break; case Codepage::AllowCharacterResult::NOT_VALID: throw ModuleException(this, INSP_FORMAT("<cpchars> tag contains a forbidden character: {} at {}", - pos, tag->source.str())); + GetPrintable(pos), tag->source.str())); case Codepage::AllowCharacterResult::NOT_VALID_AT_FRONT: throw ModuleException(this, INSP_FORMAT("<cpchars> tag contains a forbidden front character: {} at {}", - pos, tag->source.str())); + GetPrintable(pos), tag->source.str())); } } } |
