diff options
author | Peter Powell <petpow@saberuk.com> | 2017-12-03 13:51:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-03 13:51:36 +0000 |
commit | 96cc8bf4813877724d011531da1923aa457d8542 (patch) | |
tree | ba6e1e77f12929928bd42065e81eb4070b3dd714 /src/modules | |
parent | 8c8fa250015e0df20d09ba8bc0f1110b89786f91 (diff) | |
parent | c18edeeea37d81dfdefe4f8a9d57a5d153da8e5b (diff) |
Merge pull request #1417 from B00mX0r/master+fix_1416
Fix m_cloaking umode desync
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_cloaking.cpp | 19 |
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 |