aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-06-29 22:29:34 +0100
committerGravatar Sadie Powell2023-06-29 22:52:07 +0100
commit1d96baaf774eacd5eacd357500a01af693aad654 (patch)
tree8c2e960bba6dc28f9c381c27a9c38524fda56946 /src
parentFix remote users on legacy servers not having a real username. (diff)
downloadinspircd++-1d96baaf774eacd5eacd357500a01af693aad654.tar.gz
inspircd++-1d96baaf774eacd5eacd357500a01af693aad654.tar.bz2
inspircd++-1d96baaf774eacd5eacd357500a01af693aad654.zip
Remove OnPreChange{Host,RealName} events and deboolify methods.
These have not ever been used as far as I can see.
Diffstat (limited to 'src')
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_chghost.cpp3
-rw-r--r--src/modules/m_sethost.cpp10
-rw-r--r--src/modules/m_setname.cpp7
-rw-r--r--src/users.cpp34
5 files changed, 13 insertions, 43 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index 4d45bd016..6bd448409 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -129,8 +129,6 @@ ModResult Module::OnCheckKey(User*, Channel*, const std::string&) { DetachEvent(
ModResult Module::OnCheckLimit(User*, Channel*) { DetachEvent(I_OnCheckLimit); return MOD_RES_PASSTHRU; }
ModResult Module::OnCheckChannelBan(User*, Channel*) { DetachEvent(I_OnCheckChannelBan); return MOD_RES_PASSTHRU; }
ModResult Module::OnCheckBan(User*, Channel*, const std::string&) { DetachEvent(I_OnCheckBan); return MOD_RES_PASSTHRU; }
-ModResult Module::OnPreChangeHost(LocalUser*, const std::string&) { DetachEvent(I_OnPreChangeHost); return MOD_RES_PASSTHRU; }
-ModResult Module::OnPreChangeRealName(LocalUser*, const std::string&) { DetachEvent(I_OnPreChangeRealName); return MOD_RES_PASSTHRU; }
ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPreTopicChange); return MOD_RES_PASSTHRU; }
ModResult Module::OnCheckPassword(const std::string&, const std::string&, const std::string&) { DetachEvent(I_OnCheckPassword); return MOD_RES_PASSTHRU; }
void Module::OnPostConnect(User*) { DetachEvent(I_OnPostConnect); }
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index 590bdb2d7..e45832dce 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -68,7 +68,8 @@ public:
if (IS_LOCAL(dest))
{
- if ((dest->ChangeDisplayedHost(parameters[1])) && (!user->server->IsService()))
+ dest->ChangeDisplayedHost(parameters[1]);
+ if (!user->server->IsService())
{
ServerInstance->SNO.WriteGlobalSno('a', user->nick+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->GetDisplayedHost());
}
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index 00bd92580..c20c22e3f 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -55,13 +55,9 @@ public:
}
}
- if (user->ChangeDisplayedHost(parameters[0]))
- {
- ServerInstance->SNO.WriteGlobalSno('a', user->nick+" used SETHOST to change their displayed host to "+user->GetDisplayedHost());
- return CmdResult::SUCCESS;
- }
-
- return CmdResult::FAILURE;
+ user->ChangeDisplayedHost(parameters[0]);
+ ServerInstance->SNO.WriteGlobalSno('a', user->nick+" used SETHOST to change their displayed host to "+user->GetDisplayedHost());
+ return CmdResult::SUCCESS;
}
};
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index 0d50b3882..455632641 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -55,12 +55,7 @@ public:
return CmdResult::FAILURE;
}
- if (!user->ChangeRealName(parameters[0]))
- {
- fail.SendIfCap(user, &cap, this, "CANNOT_CHANGE_REALNAME", "Unable to change your real name");
- return CmdResult::FAILURE;
- }
-
+ user->ChangeRealName(parameters[0]);
if (notifyopers)
ServerInstance->SNO.WriteGlobalSno('a', "{} used SETNAME to change their real name to '{}'",
user->nick, parameters[0]);
diff --git a/src/users.cpp b/src/users.cpp
index 16267a94d..3e288b4e2 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -903,38 +903,21 @@ bool User::SharesChannelWith(User* other) const
return false;
}
-bool User::ChangeRealName(const std::string& real)
+void User::ChangeRealName(const std::string& real)
{
if (!this->realname.compare(real))
- return true;
+ return;
- if (IS_LOCAL(this))
- {
- ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnPreChangeRealName, MOD_RESULT, (IS_LOCAL(this), real));
- if (MOD_RESULT == MOD_RES_DENY)
- return false;
- }
FOREACH_MOD(OnChangeRealName, (this, real));
+
this->realname.assign(real, 0, ServerInstance->Config->Limits.MaxReal);
this->realname.shrink_to_fit();
-
- return true;
}
-bool User::ChangeDisplayedHost(const std::string& shost)
+void User::ChangeDisplayedHost(const std::string& shost)
{
if (GetDisplayedHost() == shost)
- return true;
-
- LocalUser* luser = IS_LOCAL(this);
- if (luser)
- {
- ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnPreChangeHost, MOD_RESULT, (luser, shost));
- if (MOD_RESULT == MOD_RES_DENY)
- return false;
- }
+ return;
FOREACH_MOD(OnChangeHost, (this, shost));
@@ -948,8 +931,6 @@ bool User::ChangeDisplayedHost(const std::string& shost)
if (IS_LOCAL(this) && connected != User::CONN_NONE)
this->WriteNumeric(RPL_YOURDISPLAYEDHOST, this->GetDisplayedHost(), "is now your displayed host");
-
- return true;
}
void User::ChangeRealHost(const std::string& host, bool resetdisplay)
@@ -1028,10 +1009,10 @@ void User::ChangeRealUser(const std::string& newuser, bool resetdisplay)
FOREACH_MOD(OnPostChangeRealUser, (this));
}
-bool User::ChangeDisplayedUser(const std::string& newuser)
+void User::ChangeDisplayedUser(const std::string& newuser)
{
if (GetDisplayedUser() == newuser)
- return true;
+ return;
FOREACH_MOD(OnChangeUser, (this, newuser));
@@ -1042,7 +1023,6 @@ bool User::ChangeDisplayedUser(const std::string& newuser)
this->displayuser.shrink_to_fit();
this->InvalidateCache();
- return true;
}
void User::PurgeEmptyChannels()