* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
- *
- * Written by Craig Edwards, Craig McLure, and others.
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
* This program is free but copyrighted software; see
* the file COPYING for details.
*
* ---------------------------------------------------
*/
-using namespace std;
-
#include <stdio.h>
#include "users.h"
#include "channels.h"
#include "modules.h"
+#include "inspircd.h"
/* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
-class Host
+/** Holds information on a host set by m_hostchange
+ */
+class Host : public classbase
{
public:
std::string action;
{
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;
- OnRehash("");
+ Conf = new ConfigReader(ServerInstance);
+ OnRehash(NULL,"");
}
virtual ~ModuleHostChange()
{
- delete Conf;
+ DELETE(Conf);
}
Priority Prioritize()
{
- return (Priority)Srv->PriorityAfter("m_cloaking.so");
+ return (Priority)ServerInstance->PriorityAfter("m_cloaking.so");
}
void Implements(char* List)
List[I_OnRehash] = List[I_OnUserConnect] = 1;
}
- virtual void OnRehash(std::string parameter)
+ virtual void OnRehash(userrec* user, const std::string ¶meter)
{
- delete Conf;
- Conf = new ConfigReader;
+ DELETE(Conf);
+ Conf = new ConfigReader(ServerInstance);
MySuffix = Conf->ReadValue("host","suffix",0);
for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
{
- delete i->second;
+ DELETE(i->second);
}
hostchanges.clear();
for (int index = 0; index < Conf->Enumerate("hostchange"); index++)
{
// 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);
}