* ---------------------------------------------------
*/
-#include <stdlib.h>
-#include <string>
+#include "inspircd.h"
#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "inspircd.h"
/* $ModDesc: Forces connecting clients to send a PONG message back to the server before they can complete their connection */
class ModuleWaitPong : public Module
{
- InspIRCd* Instance;
bool sendsnotice;
bool killonbadreply;
const char* extenstr;
public:
ModuleWaitPong(InspIRCd* Me)
- : Module::Module(Me), Instance(Me), extenstr("waitpong_pingstr")
+ : Module(Me), extenstr("waitpong_pingstr")
{
OnRehash(NULL,"");
}
virtual void OnRehash(userrec* user, const std::string ¶m)
{
- ConfigReader Conf(Instance);
+ ConfigReader Conf(ServerInstance);
sendsnotice = Conf.ReadFlag("waitpong", "sendsnotice", 0);
{
if(command == "PONG")
{
- ServerInstance->Log(DEBUG,"PONG command");
char* pingrpl;
user->GetExt(extenstr, pingrpl);
if(pingrpl)
{
- ServerInstance->Log(DEBUG,"PONG command - has extend");
if(strcmp(pingrpl, parameters[0]) == 0)
{
- ServerInstance->Log(DEBUG,"PONG command - pong matches ping ");
DELETE(pingrpl);
user->Shrink(extenstr);
return 1;
}
else
{
- ServerInstance->Log(DEBUG,"PONG command - pong doesnt match ping");
if(killonbadreply)
userrec::QuitUser(ServerInstance, user, "Incorrect ping reply for registration");
return 1;
}
}
}
-
- ServerInstance->Log(DEBUG,"PONG command - fall through");
return 0;
}
virtual bool OnCheckReady(userrec* user)
{
- ServerInstance->Log(DEBUG,"PONG command - oncheckready");
char* pingrpl;
return (!user->GetExt(extenstr, pingrpl));
}
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleWaitPongFactory;
}