/* $ModDesc: Provides masking of user hostnames */
-extern InspIRCd* ServerInstance;
+
/* The four core functions - F1 is optimized somewhat */
class CloakUser : public ModeHandler
{
- Server* Srv;
+
std::string prefix;
word32 key1;
word32 key2;
// else, they have an ip
b = std::string(ra) + "." + prefix + ".cloak";
}
- log(DEBUG,"cloak: allocated "+b);
+ ServerInstance->Log(DEBUG,"cloak: allocated "+b);
dest->ChangeDisplayedHost(b.c_str());
}
void DoRehash()
{
- ConfigReader Conf;
+ ConfigReader Conf(ServerInstance);
key1 = key2 = key3 = key4 = 0;
key1 = Conf.ReadInteger("cloak","key1",0,false);
key2 = Conf.ReadInteger("cloak","key2",0,false);
class ModuleCloaking : public Module
{
private:
- Server *Srv;
+
CloakUser* cu;
public:
cu = new CloakUser(ServerInstance);
/* Register it with the core */
- Srv->AddMode(cu, 'x');
+ ServerInstance->AddMode(cu, 'x');
OnRehash("");
}
virtual ~ModuleCloaking()
{
+ ServerInstance->Modes->DelMode(cu);
DELETE(cu);
}
{
// returns the version number of the module to be
// listed in /MODULES
- return Version(1,0,0,2,VF_STATIC|VF_VENDOR);
+ return Version(1,0,0,2,VF_COMMON|VF_VENDOR);
}
virtual void OnRehash(const std::string ¶meter)
const char* modes[2]; // only two parameters
modes[0] = user->nick; // first parameter is the nick
modes[1] = "+x"; // second parameter is the mode
- Srv->SendMode(modes,2,user); // send these, forming the command "MODE <nick> +x"
+ ServerInstance->SendMode(modes,2,user); // send these, forming the command "MODE <nick> +x"
}
};