* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
LocalStringExt ext;
public:
- ModuleWaitPong(InspIRCd* Me)
- : Module(Me), ext("waitpong_pingstr", this)
+ ModuleWaitPong()
+ : ext("waitpong_pingstr", this)
{
OnRehash(NULL);
Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash };
void OnRehash(User* user)
{
- ConfigReader Conf(ServerInstance);
+ ConfigReader Conf;
sendsnotice = Conf.ReadFlag("waitpong", "sendsnotice", 0);
killonbadreply = true;
}
- std::string RandString()
+ ModResult OnUserRegister(LocalUser* user)
{
- char out[11];
- for(unsigned int i = 0; i < 10; i++)
- out[i] = ((rand() % 26) + 65);
- out[10] = '\0';
-
- return out;
- }
-
- ModResult OnUserRegister(User* user)
- {
- std::string pingrpl = RandString();
+ std::string pingrpl = ServerInstance->GenRandomStr(10);
user->Write("PING :%s", pingrpl.c_str());
return MOD_RES_PASSTHRU;
}
- ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User* user, bool validated, const std::string &original_line)
+ ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, LocalUser* user, bool validated, const std::string &original_line)
{
if (command == "PONG")
{
return MOD_RES_PASSTHRU;
}
- ModResult OnCheckReady(User* user)
+ ModResult OnCheckReady(LocalUser* user)
{
return ext.get(user) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}