summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules/sql.h2
-rw-r--r--include/users.h13
-rw-r--r--src/coremods/core_user/cmd_user.cpp3
-rw-r--r--src/coremods/core_who.cpp8
-rw-r--r--src/coremods/core_whois.cpp2
-rw-r--r--src/coremods/core_whowas.cpp2
-rw-r--r--src/modules/m_check.cpp8
-rw-r--r--src/modules/m_chgname.cpp2
-rw-r--r--src/modules/m_gecosban.cpp2
-rw-r--r--src/modules/m_httpd_stats.cpp2
-rw-r--r--src/modules/m_ircv3.cpp2
-rw-r--r--src/modules/m_rline.cpp4
-rw-r--r--src/modules/m_spanningtree/uid.cpp6
-rw-r--r--src/users.cpp11
14 files changed, 36 insertions, 31 deletions
diff --git a/include/modules/sql.h b/include/modules/sql.h
index 1f5bb7ff3..15e8260b6 100644
--- a/include/modules/sql.h
+++ b/include/modules/sql.h
@@ -260,7 +260,7 @@ inline void SQL::PopulateUserInfo(User* user, ParamMap& userinfo)
userinfo["nick"] = user->nick;
userinfo["host"] = user->GetRealHost();
userinfo["ip"] = user->GetIPString();
- userinfo["real"] = user->fullname;
+ userinfo["real"] = user->GetRealName();
userinfo["ident"] = user->ident;
userinfo["server"] = user->server->GetName();
userinfo["uuid"] = user->uuid;
diff --git a/include/users.h b/include/users.h
index 9bca1d7a6..21a35645d 100644
--- a/include/users.h
+++ b/include/users.h
@@ -250,6 +250,9 @@ class CoreExport User : public Extensible
/** The real hostname of this user. */
std::string realhost;
+ /** The real name of this user. */
+ std::string realname;
+
/** The user's mode list.
* Much love to the STL for giving us an easy to use bitset, saving us RAM.
* if (modes[modeid]) is set, then the mode is set.
@@ -308,10 +311,6 @@ class CoreExport User : public Extensible
*/
std::string ident;
- /** The users full name.
- */
- std::string fullname;
-
/** What snomasks are set on this user.
* This functions the same as the above modes.
*/
@@ -371,6 +370,9 @@ class CoreExport User : public Extensible
/** Retrieves this user's real hostname. */
const std::string& GetRealHost() const;
+ /** Retrieves this user's real name. */
+ const std::string& GetRealName() const;
+
/** Get CIDR mask, using default range, for this user
*/
irc::sockets::cidr_mask GetCIDRMask();
@@ -704,9 +706,6 @@ class CoreExport User : public Extensible
bool ChangeIdent(const std::string& newident);
/** Change a users realname field.
- * ALWAYS use this function, rather than writing User::fullname directly,
- * as this triggers module events allowing the change to be syncronized to
- * remote servers.
* @param real The user's new real name
* @return True if the change succeeded, false if otherwise
*/
diff --git a/src/coremods/core_user/cmd_user.cpp b/src/coremods/core_user/cmd_user.cpp
index 75fab929f..1a8b091f3 100644
--- a/src/coremods/core_user/cmd_user.cpp
+++ b/src/coremods/core_user/cmd_user.cpp
@@ -30,6 +30,7 @@ enum
CommandUser::CommandUser(Module* parent)
: SplitCommand(parent, "USER", 4, 4)
{
+ allow_empty_last_param = false;
works_before_reg = true;
Penalty = 0;
syntax = "<username> <localhost> <remotehost> <realname>";
@@ -48,7 +49,7 @@ CmdResult CommandUser::HandleLocal(LocalUser* user, const Params& parameters)
else
{
user->ChangeIdent(parameters[0]);
- user->fullname.assign(parameters[3].empty() ? "No info" : parameters[3], 0, ServerInstance->Config->Limits.MaxReal);
+ user->ChangeRealName(parameters[3]);
user->registered = (user->registered | REG_USER);
}
}
diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp
index 8bba1f860..362e79c03 100644
--- a/src/coremods/core_who.cpp
+++ b/src/coremods/core_who.cpp
@@ -304,7 +304,7 @@ bool CommandWho::MatchUser(LocalUser* source, User* user, WhoData& data)
// The source wants to match against users' real names.
else if (data.flags['r'])
- match = InspIRCd::Match(user->fullname, data.matchtext, ascii_case_insensitive_map);
+ match = InspIRCd::Match(user->GetRealName(), data.matchtext, ascii_case_insensitive_map);
else if (data.flags['s'])
{
@@ -340,7 +340,7 @@ bool CommandWho::MatchUser(LocalUser* source, User* user, WhoData& data)
}
if (!match)
- match = InspIRCd::Match(user->fullname, data.matchtext, ascii_case_insensitive_map);
+ match = InspIRCd::Match(user->GetRealName(), data.matchtext, ascii_case_insensitive_map);
if (!match)
match = InspIRCd::Match(user->nick, data.matchtext);
@@ -484,7 +484,7 @@ void CommandWho::SendWhoLine(LocalUser* source, const std::vector<std::string>&
// Include the user's real name.
if (data.whox_fields['r'])
- wholine.push(user->fullname);
+ wholine.push(user->GetRealName());
}
else
{
@@ -530,7 +530,7 @@ void CommandWho::SendWhoLine(LocalUser* source, const std::vector<std::string>&
// Include the number of hops between the users and the user's real name.
wholine.push("0 ");
- wholine.GetParams().back().append(user->fullname);
+ wholine.GetParams().back().append(user->GetRealName());
}
ModResult res;
diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp
index 8f09396b2..7fbaf2226 100644
--- a/src/coremods/core_whois.cpp
+++ b/src/coremods/core_whois.cpp
@@ -211,7 +211,7 @@ void CommandWhois::DoWhois(LocalUser* user, User* dest, time_t signon, unsigned
{
WhoisContextImpl whois(user, dest, lineevprov);
- whois.SendLine(RPL_WHOISUSER, dest->ident, dest->GetDisplayedHost(), '*', dest->fullname);
+ whois.SendLine(RPL_WHOISUSER, dest->ident, dest->GetDisplayedHost(), '*', dest->GetRealName());
if (whois.IsSelfWhois() || user->HasPrivPermission("users/auspex"))
{
whois.SendLine(RPL_WHOISHOST, InspIRCd::Format("is connecting from %s@%s %s", dest->ident.c_str(), dest->GetRealHost().c_str(), dest->GetIPString().c_str()));
diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp
index 73251b442..65c83e08b 100644
--- a/src/coremods/core_whowas.cpp
+++ b/src/coremods/core_whowas.cpp
@@ -245,7 +245,7 @@ WhoWas::Entry::Entry(User* user)
, dhost(user->GetDisplayedHost())
, ident(user->ident)
, server(user->server->GetName())
- , real(user->fullname)
+ , real(user->GetRealName())
, signon(user->signon)
{
}
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index cbb32db48..f820f2bd0 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -168,7 +168,7 @@ class CommandCheck : public Command
/* /check on a user */
context.Write("nuh", targuser->GetFullHost());
context.Write("realnuh", targuser->GetFullRealHost());
- context.Write("realname", targuser->fullname);
+ context.Write("realname", targuser->GetRealName());
context.Write("modes", targuser->GetModeLetters());
context.Write("snomasks", GetSnomasks(targuser));
context.Write("server", targuser->server->GetName());
@@ -263,7 +263,7 @@ class CommandCheck : public Command
const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first);
context.Write("member", InspIRCd::Format("%-3u %s%s (%s@%s) %s ", clonecount.global,
i->second->GetAllPrefixChars().c_str(), i->first->nick.c_str(),
- i->first->ident.c_str(), i->first->GetDisplayedHost().c_str(), i->first->fullname.c_str()));
+ i->first->ident.c_str(), i->first->GetDisplayedHost().c_str(), i->first->GetRealName().c_str()));
}
const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
@@ -284,13 +284,13 @@ class CommandCheck : public Command
if (InspIRCd::Match(a->second->GetRealHost(), parameters[0], ascii_case_insensitive_map) || InspIRCd::Match(a->second->GetDisplayedHost(), parameters[0], ascii_case_insensitive_map))
{
/* host or vhost matches mask */
- context.Write("match", ConvToStr(++x) + " " + a->second->GetFullRealHost() + " " + a->second->GetIPString() + " " + a->second->fullname);
+ context.Write("match", ConvToStr(++x) + " " + a->second->GetFullRealHost() + " " + a->second->GetIPString() + " " + a->second->GetRealName());
}
/* IP address */
else if (InspIRCd::MatchCIDR(a->second->GetIPString(), parameters[0]))
{
/* same IP. */
- context.Write("match", ConvToStr(++x) + " " + a->second->GetFullRealHost() + " " + a->second->GetIPString() + " " + a->second->fullname);
+ context.Write("match", ConvToStr(++x) + " " + a->second->GetFullRealHost() + " " + a->second->GetIPString() + " " + a->second->GetRealName());
}
}
diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp
index f6ab800be..aedd75d94 100644
--- a/src/modules/m_chgname.cpp
+++ b/src/modules/m_chgname.cpp
@@ -58,7 +58,7 @@ class CommandChgname : public Command
if (IS_LOCAL(dest))
{
dest->ChangeRealName(parameters[1]);
- ServerInstance->SNO->WriteGlobalSno('a', "%s used CHGNAME to change %s's real name to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->fullname.c_str());
+ ServerInstance->SNO->WriteGlobalSno('a', "%s used CHGNAME to change %s's real name to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->GetRealName().c_str());
}
return CMD_SUCCESS;
diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp
index 9b449da06..ae399a81f 100644
--- a/src/modules/m_gecosban.cpp
+++ b/src/modules/m_gecosban.cpp
@@ -31,7 +31,7 @@ class ModuleGecosBan : public Module
{
if ((mask.length() > 2) && (mask[0] == 'r') && (mask[1] == ':'))
{
- if (InspIRCd::Match(user->fullname, mask.substr(2)))
+ if (InspIRCd::Match(user->GetRealName(), mask.substr(2)))
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 818c06297..6db292eb3 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -184,7 +184,7 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener
data << "<user>";
data << "<nickname>" << u->nick << "</nickname><uuid>" << u->uuid << "</uuid><realhost>"
<< u->GetRealHost() << "</realhost><displayhost>" << u->GetDisplayedHost() << "</displayhost><realname>"
- << Sanitize(u->fullname) << "</realname><server>" << u->server->GetName() << "</server>";
+ << Sanitize(u->GetRealName()) << "</realname><server>" << u->server->GetName() << "</server>";
if (u->IsAway())
data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>";
if (u->IsOper())
diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp
index 543fb49a4..bbf3d7bc4 100644
--- a/src/modules/m_ircv3.cpp
+++ b/src/modules/m_ircv3.cpp
@@ -108,7 +108,7 @@ class ModuleIRCv3 : public Module, public AccountEventListener
if (!has_account)
line += "*";
- line += " :" + memb->user->fullname;
+ line += " :" + memb->user->GetRealName();
// If the joining user received privileges from another module then we must send them as well,
// since silencing the normal join means the MODE will be silenced as well
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 64228caf7..bf6a64d84 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -63,8 +63,8 @@ class RLine : public XLine
if (lu && lu->exempt)
return false;
- const std::string host = u->nick + "!" + u->ident + "@" + u->GetRealHost() + " " + u->fullname;
- const std::string ip = u->nick + "!" + u->ident + "@" + u->GetIPString() + " " + u->fullname;
+ const std::string host = u->nick + "!" + u->ident + "@" + u->GetRealHost() + " " + u->GetRealName();
+ const std::string ip = u->nick + "!" + u->ident + "@" + u->GetIPString() + " " + u->GetRealName();
return (regex->Matches(host) || regex->Matches(ip));
}
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 11c5ffc91..01af56fa6 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -76,7 +76,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params
_new->ChangeRealHost(params[3], false);
_new->ChangeDisplayedHost(params[4]);
_new->ident = params[5];
- _new->fullname = params.back();
+ _new->ChangeRealName(params.back());
_new->registered = REG_ALL;
_new->signon = signon;
_new->age = age_t;
@@ -126,7 +126,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params
dosend = false;
if (dosend)
- ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s (%s) [%s]", remoteserver->GetName().c_str(), _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->fullname.c_str());
+ ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s (%s) [%s]", remoteserver->GetName().c_str(), _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->GetRealName().c_str());
FOREACH_MOD(OnPostConnect, (_new));
@@ -163,5 +163,5 @@ CommandUID::Builder::Builder(User* user)
push(user->GetIPString());
push_int(user->signon);
push(user->GetModeLetters(true));
- push_last(user->fullname);
+ push_last(user->GetRealName());
}
diff --git a/src/users.cpp b/src/users.cpp
index fb4888639..5310c7c96 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -586,7 +586,7 @@ void LocalUser::FullConnect()
FOREACH_MOD(OnPostConnect, (this));
ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]",
- this->GetServerPort(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->fullname.c_str());
+ this->GetServerPort(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str());
ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString());
ServerInstance->BanCache.AddHit(this->GetIPString(), "", "");
// reset the flood penalty (which could have been raised due to things like auto +x)
@@ -708,6 +708,11 @@ const std::string& User::GetRealHost() const
return realhost;
}
+const std::string& User::GetRealName() const
+{
+ return realname;
+}
+
irc::sockets::cidr_mask User::GetCIDRMask()
{
unsigned char range = 0;
@@ -997,7 +1002,7 @@ bool User::SharesChannelWith(User *other)
bool User::ChangeRealName(const std::string& real)
{
- if (!this->fullname.compare(real))
+ if (!this->realname.compare(real))
return true;
if (IS_LOCAL(this))
@@ -1008,7 +1013,7 @@ bool User::ChangeRealName(const std::string& real)
return false;
FOREACH_MOD(OnChangeRealName, (this, real));
}
- this->fullname.assign(real, 0, ServerInstance->Config->Limits.MaxReal);
+ this->realname.assign(real, 0, ServerInstance->Config->Limits.MaxReal);
return true;
}