aboutsummaryrefslogtreecommitdiffstats
path: root/src/users.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-07-31 13:09:39 +0100
committerGravatar Sadie Powell2026-07-31 13:09:39 +0100
commitc4551ceac72541a38fb5aa90ce0a3771990227f4 (patch)
tree63041a78dde9152806c843212fdf7b99abe4022b /src/users.cpp
parentUse CommandBase::Params in the sasl module. (diff)
Add a method for getting a description of a user.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 428640135..37623a2dc 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -167,6 +167,17 @@ const std::string& User::GetRealMask()
return cached_realmask;
}
+const std::string& User::GetDescription()
+{
+ if (cached_description.empty())
+ {
+ cached_description = FMT::format("{} ({}@{}) [{}]", nick, GetRealUser(), GetRealHost(), GetAddress());
+ cached_description.shrink_to_fit();
+ }
+
+ return cached_description;
+}
+
LocalUser::LocalUser(LocalUserIO* lio, const irc::sockets::sockaddrs& clientsa, const irc::sockets::sockaddrs& serversa)
: User(ServerInstance->UIDGen.GetUID(), ServerInstance->LocalServer, User::TYPE_LOCAL)
, io(lio)
@@ -378,6 +389,7 @@ void User::InvalidateCache()
cached_realuserhost.clear();
cached_mask.clear();
cached_realmask.clear();
+ cached_description.clear();
}
bool User::ChangeNick(const std::string& newnick, time_t newts)