aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_hostcycle.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-06-29 16:29:56 +0100
committerGravatar Sadie Powell2023-06-29 17:01:25 +0100
commit29705306f21d713c2928d8896f48a3cbb640eacc (patch)
tree5642409ba5a61ab578eb84a11cce5ba81e493187 /src/modules/m_hostcycle.cpp
parentMerge branch 'insp3' into master. (diff)
Retain the "real" username properly like we do for hostnames.
This introduces the concept of a real username. This value comes from either the initial USER message or from an ident lookup. Doing this allows us to use it for bans through vidents and cloaking web client users using their remote username. While changing this I also changed all of the uses of "ident" other than RFC 1413 lookups and some compatibility cases to refer to usernames as user(name) instead of ident. Our use of ident in these places was incorrect as that only refers to the RFC 1413 response and is not commonly used in the way we used it by any other IRC server implementations.
Diffstat (limited to 'src/modules/m_hostcycle.cpp')
-rw-r--r--src/modules/m_hostcycle.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/modules/m_hostcycle.cpp b/src/modules/m_hostcycle.cpp
index 4ce91034a..7e13ab283 100644
--- a/src/modules/m_hostcycle.cpp
+++ b/src/modules/m_hostcycle.cpp
@@ -27,13 +27,12 @@ class ModuleHostCycle final
{
Cap::Reference chghostcap;
const std::string quitmsghost;
- const std::string quitmsgident;
+ const std::string quitmsguser;
- /** Send fake quit/join/mode messages for host or ident cycle.
- */
- void DoHostCycle(User* user, const std::string& newident, const std::string& newhost, const std::string& reason)
+ // Sends a fake quit/join/mode messages for hostame or username cycle.
+ void DoHostCycle(User* user, const std::string& newuser, const std::string& newhost, const std::string& reason)
{
- // The user has the original ident/host at the time this function is called
+ // The user has the original username/hostname at the time this function is called
ClientProtocol::Messages::Quit quitmsg(user, reason);
ClientProtocol::Event quitevent(ServerInstance->GetRFCEvents().quit, quitmsg);
@@ -64,7 +63,7 @@ class ModuleHostCycle final
}
}
- std::string newfullhost = user->nick + "!" + newident + "@" + newhost;
+ const std::string newfullhost = user->nick + "!" + newuser + "@" + newhost;
for (auto* memb : include_chans)
{
@@ -94,21 +93,21 @@ class ModuleHostCycle final
public:
ModuleHostCycle()
- : Module(VF_VENDOR, "Sends a fake disconnection and reconnection when a user's username (ident) or hostname changes to allow clients to update their internal caches.")
+ : Module(VF_VENDOR, "Sends a fake disconnection and reconnection when a user's username or hostname changes to allow clients to update their internal caches.")
, chghostcap(this, "chghost")
- , quitmsghost("Changing host")
- , quitmsgident("Changing ident")
+ , quitmsghost("Changing hostname")
+ , quitmsguser("Changing username")
{
}
- void OnChangeIdent(User* user, const std::string& newident) override
+ void OnChangeUser(User* user, const std::string& newuser) override
{
- DoHostCycle(user, newident, user->GetDisplayedHost(), quitmsgident);
+ DoHostCycle(user, newuser, user->GetDisplayedHost(), quitmsguser);
}
void OnChangeHost(User* user, const std::string& newhost) override
{
- DoHostCycle(user, user->ident, newhost, quitmsghost);
+ DoHostCycle(user, user->GetDisplayedUser(), newhost, quitmsghost);
}
};