From 56ba0787c3ecf4cedd6477aed7c16d5d4003505c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 18 Jun 2026 22:47:32 +0100 Subject: Deduplicate ident notices into PrefixUser. --- src/modules/m_ident.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/modules/m_ident.cpp') diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 9e843bc97..fb2a47762 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -284,7 +284,7 @@ private: SimpleExtItem socket; IntExtItem state; - static void PrefixUser(LocalUser* user) + static void PrefixUser(LocalUser* user, const std::string& message = "") { // Check that they haven't been prefixed already. if (user->GetRealUser().front() == '~') @@ -300,6 +300,9 @@ private: // Apply the new username. user->ChangeRealUser(newuser, user->GetDisplayedUser() == user->GetRealUser()); + + if (!message.empty()) + user->WriteNotice("*** {}; using {} instead.", message, user->GetRealUser()); } public: @@ -383,8 +386,7 @@ public: { /* Ident timeout */ state.Set(user, IDENT_MISSING); - PrefixUser(user); - user->WriteNotice("*** Ident lookup timed out, using " + user->GetRealUser() + " instead."); + PrefixUser(user, "Ident lookup timed out"); } else if (!isock->HasResult()) { @@ -396,8 +398,7 @@ public: else if (isock->result.empty()) { state.Set(user, IDENT_MISSING); - PrefixUser(user); - user->WriteNotice("*** Could not find your username, using " + user->GetRealUser() + " instead."); + PrefixUser(user, "Could not find your username"); } else { -- cgit v1.3.1-10-gc9f91