* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2008 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
{
Conf = new ConfigReader(ServerInstance);
+ Implementation eventlist[] = { I_OnPostConnect, I_OnRehash };
+ ServerInstance->Modules->Attach(eventlist, this, 2);
}
- void Implements(char* List)
- {
- List[I_OnPostConnect] = List[I_OnRehash] = 1;
- }
virtual void OnRehash(User* user, const std::string ¶meter)
{
- DELETE(Conf);
+ delete Conf;
Conf = new ConfigReader(ServerInstance);
}
virtual ~ModuleModesOnConnect()
{
- DELETE(Conf);
+ delete Conf;
}
virtual Version GetVersion()
{
- return Version(1,1,0,1,VF_VENDOR,API_VERSION);
+ return Version(1,2,0,1,VF_VENDOR,API_VERSION);
}
virtual void OnPostConnect(User* user)
if (!ThisModes.empty())
{
std::string buf;
- stringstream ss(ThisModes);
+ std::stringstream ss(ThisModes);
- vector<string> tokens;
+ std::vector<std::string> tokens;
// split ThisUserModes into modes and mode params
while (ss >> buf)
tokens.push_back(buf);
- int size = tokens.size() + 1;
- const char** modes = new const char*[size];
- modes[0] = user->nick;
- modes[1] = tokens[0].c_str();
+ std::vector<std::string> modes;
+ modes.push_back(user->nick);
+ modes.push_back(tokens[0]);
if (tokens.size() > 1)
{
// process mode params
- int i = 2;
for (unsigned int k = 1; k < tokens.size(); k++)
{
- modes[i] = tokens[k].c_str();
- i++;
+ modes.push_back(tokens[k]);
}
}
- ServerInstance->Parser->CallHandler("MODE", modes, size, user);
- delete [] modes;
+ ServerInstance->Parser->CallHandler("MODE", modes, user);
}
break;
}