X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_hostchange.cpp;h=d270c74d456d021aa9c25f0207a3f08144c3d940;hb=d54fd9b1e6b31f69332a9241b5f17330c0ad61e0;hp=0a9ea8ccc045846899590a45eb7415b9520a38ff;hpb=fea1a27cb96a114f698eedcf90401b78406108fb;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 0a9ea8ccc..d270c74d4 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -24,6 +24,8 @@ using namespace std; /* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */ + + class Host : public classbase { public: @@ -37,17 +39,17 @@ class ModuleHostChange : public Module { private: - Server *Srv; + ConfigReader *Conf; hostchanges_t hostchanges; std::string MySuffix; public: - ModuleHostChange(Server* Me) + ModuleHostChange(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - Conf = new ConfigReader; + + Conf = new ConfigReader(ServerInstance); OnRehash(""); } @@ -58,7 +60,7 @@ class ModuleHostChange : public Module Priority Prioritize() { - return (Priority)Srv->PriorityAfter("m_cloaking.so"); + return (Priority)ServerInstance->PriorityAfter("m_cloaking.so"); } void Implements(char* List) @@ -69,7 +71,7 @@ class ModuleHostChange : public Module virtual void OnRehash(const std::string ¶meter) { DELETE(Conf); - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); MySuffix = Conf->ReadValue("host","suffix",0); for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++) { @@ -99,7 +101,7 @@ class ModuleHostChange : public Module { for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++) { - if (Srv->MatchText(std::string(user->ident)+"@"+std::string(user->host),i->first)) + if (ServerInstance->MatchText(std::string(user->ident)+"@"+std::string(user->host),i->first)) { Host* h = (Host*)i->second; // host of new user matches a hostchange tag's mask @@ -134,7 +136,8 @@ class ModuleHostChange : public Module if (newhost != "") { user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your virtual host: " + newhost); - Srv->ChangeHost(user,newhost); + if (!user->ChangeDisplayedHost(newhost.c_str())) + user->WriteServ("NOTICE "+std::string(user->nick)+" :Could not set your virtual host: " + newhost); return; } } @@ -155,7 +158,7 @@ class ModuleHostChangeFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleHostChange(Me); }