From c4551ceac72541a38fb5aa90ce0a3771990227f4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 31 Jul 2026 13:09:39 +0100 Subject: Add a method for getting a description of a user. --- src/users.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/users.cpp') 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) -- cgit v1.3.1-10-gc9f91