X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_conn_waitpong.cpp;h=f2e9590c81ece0598613f0c73e28360d5cf0d2df;hb=a032cd90ad5582914759e226085efee5aae1a1ef;hp=1367874dae2d82bd69bb4a28873d031a81815c0c;hpb=4b41feea830fc84e8c1b2fd0982f3e8d8840af96;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 1367874da..f2e9590c8 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -24,8 +24,6 @@ #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 { bool sendsnotice; @@ -34,19 +32,11 @@ class ModuleWaitPong : public Module public: ModuleWaitPong() - : ext("waitpong_pingstr", this) - { - } - - void init() CXX11_OVERRIDE + : ext("waitpong_pingstr", ExtensionItem::EXT_USER, this) { - ServerInstance->Modules->AddService(ext); - OnRehash(NULL); - Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - void OnRehash(User* user) CXX11_OVERRIDE + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("waitpong"); sendsnotice = tag->getBool("sendsnotice", true); @@ -56,8 +46,10 @@ class ModuleWaitPong : public Module ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE { std::string pingrpl = ServerInstance->GenRandomStr(10); - - user->Write("PING :%s", pingrpl.c_str()); + { + ClientProtocol::Messages::Ping pingmsg(pingrpl); + user->Send(ServerInstance->GetRFCEvents().ping, pingmsg); + } if(sendsnotice) user->WriteNotice("*** If you are having problems connecting due to ping timeouts, please type /quote PONG " + pingrpl + " or /raw PONG " + pingrpl + " now."); @@ -66,7 +58,7 @@ class ModuleWaitPong : public Module return MOD_RES_PASSTHRU; } - ModResult OnPreCommand(std::string &command, std::vector ¶meters, LocalUser* user, bool validated, const std::string &original_line) CXX11_OVERRIDE + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE { if (command == "PONG") {