X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_cloaking.cpp;h=bef4e94b82ab2982937dcb85cd0541238a640dda;hb=c202dea024542b9c6c6b771bb9a3a081d9eacdc5;hp=ccc98e557e7ca96e99ff5b26c0c4b8c6c55ca25e;hpb=4b41feea830fc84e8c1b2fd0982f3e8d8840af96;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index ccc98e557..bef4e94b8 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -26,8 +26,6 @@ #include "inspircd.h" #include "modules/hash.h" -/* $ModDesc: Provides masking of user hostnames */ - enum CloakMode { /** 2.0 cloak of "half" of the hostname plus the full IP hash */ @@ -65,7 +63,7 @@ class CloakUser : public ModeHandler */ if (!user) { - dest->SetMode('x',adding); + dest->SetMode(this, adding); return MODEACTION_ALLOW; } @@ -82,7 +80,7 @@ class CloakUser : public ModeHandler debounce_ts = ServerInstance->Time(); } - if (adding == user->IsModeSet('x')) + if (adding == user->IsModeSet(this)) return MODEACTION_DENY; /* don't allow this user to spam modechanges */ @@ -102,7 +100,7 @@ class CloakUser : public ModeHandler if (cloak) { user->ChangeDisplayedHost(cloak->c_str()); - user->SetMode('x',true); + user->SetMode(this, true); return MODEACTION_ALLOW; } else @@ -113,7 +111,7 @@ class CloakUser : public ModeHandler /* User is removing the mode, so restore their real host * and make it match the displayed one. */ - user->SetMode('x',false); + user->SetMode(this, false); user->ChangeDisplayedHost(user->host.c_str()); return MODEACTION_ALLOW; } @@ -150,14 +148,9 @@ class ModuleCloaking : public Module void init() CXX11_OVERRIDE { - OnRehash(NULL); - ServerInstance->Modules->AddService(cu); ServerInstance->Modules->AddService(ck); ServerInstance->Modules->AddService(cu.ext); - - Implementation eventlist[] = { I_OnRehash, I_OnCheckBan, I_OnUserConnect, I_OnChangeHost }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } /** This function takes a domain name string and returns just the last two domain parts, @@ -312,10 +305,10 @@ 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('x')) + if (u->IsModeSet(cu)) { - u->SetMode('x', false); - u->WriteServ("MODE %s -x", u->nick.c_str()); + u->SetMode(cu, false); + u->WriteServ("MODE %s -%c", u->nick.c_str(), cu.GetModeChar()); } } @@ -336,7 +329,7 @@ class ModuleCloaking : public Module return Version("Provides masking of user hostnames", VF_COMMON|VF_VENDOR, testcloak); } - void OnRehash(User* user) CXX11_OVERRIDE + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("cloak"); prefix = tag->getString("prefix");