summaryrefslogtreecommitdiff
path: root/src/modules/m_cloaking.cpp
diff options
context:
space:
mode:
authorB00mX0r <b00mx0r@aureus.pw>2017-11-25 11:53:42 -0800
committerB00mX0r <b00mx0r@aureus.pw>2017-11-26 16:28:39 -0800
commitc18edeeea37d81dfdefe4f8a9d57a5d153da8e5b (patch)
tree2c0f10a74ac2755adc37e57128a3a1f81972010b /src/modules/m_cloaking.cpp
parentfa95bb4b0d5aed9204d469a36946a9839a7ffaa2 (diff)
Fix m_cloaking umode syncing
Servers will now correctly show whether a remote user has +x or not.
Diffstat (limited to 'src/modules/m_cloaking.cpp')
-rw-r--r--src/modules/m_cloaking.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index a1e4d1af7..e5f912c95 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -42,14 +42,18 @@ static const char base32[] = "0123456789abcdefghijklmnopqrstuv";
class CloakUser : public ModeHandler
{
public:
+ bool active;
LocalStringExt ext;
std::string debounce_uid;
time_t debounce_ts;
int debounce_count;
CloakUser(Module* source)
- : ModeHandler(source, "cloak", 'x', PARAM_NONE, MODETYPE_USER),
- ext("cloaked_host", ExtensionItem::EXT_USER, source), debounce_ts(0), debounce_count(0)
+ : ModeHandler(source, "cloak", 'x', PARAM_NONE, MODETYPE_USER)
+ , active(false)
+ , ext("cloaked_host", ExtensionItem::EXT_USER, source)
+ , debounce_ts(0)
+ , debounce_count(0)
{
}
@@ -63,6 +67,8 @@ class CloakUser : public ModeHandler
*/
if (!user)
{
+ // Remote setters broadcast mode before host while local setters do the opposite, so this takes that into account
+ active = IS_LOCAL(source) ? adding : !adding;
dest->SetMode(this, adding);
return MODEACTION_ALLOW;
}
@@ -146,7 +152,11 @@ class ModuleCloaking : public Module
unsigned int domainparts;
dynamic_reference<HashProvider> Hash;
- ModuleCloaking() : cu(this), mode(MODE_OPAQUE), ck(this), Hash(this, "hash/md5")
+ ModuleCloaking()
+ : cu(this)
+ , mode(MODE_OPAQUE)
+ , ck(this)
+ , Hash(this, "hash/md5")
{
}
@@ -300,11 +310,12 @@ class ModuleCloaking : public Module
// mode change, we will call SetMode back to true AFTER the host change is done.
void OnChangeHost(User* u, const std::string& host) CXX11_OVERRIDE
{
- if (u->IsModeSet(cu))
+ if (u->IsModeSet(cu) && !cu.active)
{
u->SetMode(cu, false);
u->WriteCommand("MODE", "-" + ConvToStr(cu.GetModeChar()));
}
+ cu.active = false;
}
Version GetVersion() CXX11_OVERRIDE