/* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
+/** Holds information on a host set by m_hostchange
+ */
class Host : public classbase
{
public:
{
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("");
}
Priority Prioritize()
{
- return (Priority)Srv->PriorityAfter("m_cloaking.so");
+ return (Priority)ServerInstance->PriorityAfter("m_cloaking.so");
}
void Implements(char* List)
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++)
{
{
// returns the version number of the module to be
// listed in /MODULES
- return Version(1,0,0,1,VF_VENDOR);
+ return Version(1,1,0,1,VF_VENDOR,API_VERSION);
}
virtual void OnUserConnect(userrec* user)
{
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
}
if (newhost != "")
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :Setting your virtual host: " + newhost);
- Srv->ChangeHost(user,newhost);
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your virtual host: " + newhost);
+ if (!user->ChangeDisplayedHost(newhost.c_str()))
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Could not set your virtual host: " + newhost);
return;
}
}
{
}
- virtual Module * CreateModule(Server* Me)
+ virtual Module * CreateModule(InspIRCd* Me)
{
return new ModuleHostChange(Me);
}