aboutsummaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-06-25 09:14:05 +0100
committerGravatar Sadie Powell2023-06-25 09:14:05 +0100
commit6654c1ed2e3be40771512543b7967f3ba1b9fea2 (patch)
tree939d61243601e12adf622314e1c5fbe4eae7e6a0 /src/users.cpp
parentMove example link config include to example module config file. (diff)
Avoid using too much memory for storing user data.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 3470c7ea8..a7d5fa4a0 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -568,6 +568,7 @@ bool User::ChangeNick(const std::string& newnick, time_t newts)
}
const std::string oldnick = nick;
nick = newnick;
+ nick.shrink_to_fit();
InvalidateCache();
ServerInstance->Users.clientlist.erase(oldnick);
@@ -936,6 +937,7 @@ bool User::ChangeRealName(const std::string& real)
}
FOREACH_MOD(OnChangeRealName, (this, real));
this->realname.assign(real, 0, ServerInstance->Config->Limits.MaxReal);
+ this->realname.shrink_to_fit();
return true;
}
@@ -960,6 +962,7 @@ bool User::ChangeDisplayedHost(const std::string& shost)
this->displayhost.clear();
else
this->displayhost.assign(shost, 0, ServerInstance->Config->Limits.MaxHost);
+ this->displayhost.shrink_to_fit();
this->InvalidateCache();
@@ -998,6 +1001,8 @@ void User::ChangeRealHost(const std::string& host, bool resetdisplay)
FOREACH_MOD(OnChangeRealHost, (this, host));
realhost = host;
+ realhost.shrink_to_fit();
+
this->InvalidateCache();
// Don't call the OnPostChangeRealHost event when initialising a user.
@@ -1013,6 +1018,7 @@ bool User::ChangeIdent(const std::string& newident)
FOREACH_MOD(OnChangeIdent, (this, newident));
this->ident.assign(newident, 0, ServerInstance->Config->Limits.MaxUser);
+ this->ident.shrink_to_fit();
this->InvalidateCache();
return true;