* ---------------------------------------------------
*/
-#include <stdio.h>
-#include <string>
+#include "inspircd.h"
#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "inspircd.h"
-
/* $ModDesc: Provides support for the SETHOST command */
/** Handle /SETHOST
class cmd_sethost : public command_t
{
private:
- char*& hostmap;
+ char* hostmap;
public:
- cmd_sethost (InspIRCd* Instance, char*& hmap) : command_t(Instance,"SETHOST",'o',1), hostmap(hmap)
+ cmd_sethost (InspIRCd* Instance, char* hmap) : command_t(Instance,"SETHOST",'o',1), hostmap(hmap)
{
this->source = "m_sethost.so";
syntax = "<new-hostname>";
class ModuleSetHost : public Module
{
cmd_sethost* mycommand;
- char* hostmap;
+ char hostmap[256];
public:
ModuleSetHost(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
- hostmap = new char[256];
- OnRehash("");
+ OnRehash(NULL,"");
mycommand = new cmd_sethost(ServerInstance, hostmap);
ServerInstance->AddCommand(mycommand);
}
List[I_OnRehash] = 1;
}
- void OnRehash(const std::string ¶meter)
+ void OnRehash(userrec* user, const std::string ¶meter)
{
ConfigReader Conf(ServerInstance);
std::string hmap = Conf.ReadValue("hostname", "charmap", 0);
if (hmap.empty())
hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789";
- memset(&hostmap, 0, sizeof(hostmap));
+ memset(&hostmap, 0, 255);
for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
hostmap[(unsigned char)*n] = 1;
}
virtual ~ModuleSetHost()
{
- delete[] hostmap;
}
virtual Version GetVersion()
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSetHostFactory;
}