aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_ident.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-06-18 22:47:32 +0100
committerGravatar Sadie Powell2026-06-18 23:15:44 +0100
commit56ba0787c3ecf4cedd6477aed7c16d5d4003505c (patch)
tree72589f9caa9efa4951118f4d540b233020062fcc /src/modules/m_ident.cpp
parentClear the previous ident state when the user IP address changes. (diff)
Deduplicate ident notices into PrefixUser.
Diffstat (limited to 'src/modules/m_ident.cpp')
-rw-r--r--src/modules/m_ident.cpp11
1 files changed, 6 insertions, 5 deletions
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<IdentRequestSocket, Cullable::Deleter> 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
{