X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_helpop.cpp;h=d07898c90801c0a199c9e6bfd24f8d9ebe0ee8a9;hb=357d190074ee58809b31ea0c08543566168bddf6;hp=60c23f45bd44820c39b5e01496a804551c535a1c;hpb=0fa8cdd7b87779e3517e296689703f1d7a7c86df;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 60c23f45b..d07898c90 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -21,8 +21,6 @@ */ -/* $ModDesc: Provides the /HELPOP command for useful information */ - #include "inspircd.h" static std::map helpop_map; @@ -57,17 +55,15 @@ class CommandHelpop : public Command if (parameter == "index") { /* iterate over all helpop items */ - user->WriteServ("290 %s :HELPOP topic index", user->nick.c_str()); + user->WriteNumeric(290, ":HELPOP topic index"); for (std::map::iterator iter = helpop_map.begin(); iter != helpop_map.end(); iter++) - { - user->WriteServ("292 %s : %s", user->nick.c_str(), iter->first.c_str()); - } - user->WriteServ("292 %s :*** End of HELPOP topic index", user->nick.c_str()); + user->WriteNumeric(292, ": %s", iter->first.c_str()); + user->WriteNumeric(292, ":*** End of HELPOP topic index"); } else { - user->WriteServ("290 %s :*** HELPOP for %s", user->nick.c_str(), parameter.c_str()); - user->WriteServ("292 %s : -", user->nick.c_str()); + user->WriteNumeric(290, ":*** HELPOP for %s", parameter.c_str()); + user->WriteNumeric(292, ": -"); std::map::iterator iter = helpop_map.find(parameter); @@ -84,13 +80,13 @@ class CommandHelpop : public Command { // Writing a blank line will not work with some clients if (token.empty()) - user->WriteServ("292 %s : ", user->nick.c_str()); + user->WriteNumeric(292, ": "); else - user->WriteServ("292 %s :%s", user->nick.c_str(), token.c_str()); + user->WriteNumeric(292, ":%s", token.c_str()); } - user->WriteServ("292 %s : -", user->nick.c_str()); - user->WriteServ("292 %s :*** End of HELPOP", user->nick.c_str()); + user->WriteNumeric(292, ": -"); + user->WriteNumeric(292, ":*** End of HELPOP"); } return CMD_SUCCESS; } @@ -98,7 +94,6 @@ class CommandHelpop : public Command class ModuleHelpop : public Module { - private: std::string h_file; CommandHelpop cmd; Helpop ho; @@ -109,16 +104,7 @@ class ModuleHelpop : public Module { } - void init() - { - ReadConfig(); - ServerInstance->Modules->AddService(ho); - ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnRehash, I_OnWhois }; - ServerInstance->Modules->Attach(eventlist, this, 2); - } - - void ReadConfig() + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { helpop_map.clear(); @@ -151,20 +137,15 @@ class ModuleHelpop : public Module } - void OnRehash(User* user) - { - ReadConfig(); - } - - void OnWhois(User* src, User* dst) + void OnWhois(User* src, User* dst) CXX11_OVERRIDE { - if (dst->IsModeSet('h')) + if (dst->IsModeSet(ho)) { - ServerInstance->SendWhoisLine(src, dst, 310, std::string(src->nick)+" "+std::string(dst->nick)+" :is available for help."); + ServerInstance->SendWhoisLine(src, dst, 310, dst->nick+" :is available for help."); } } - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides the /HELPOP command for useful information", VF_VENDOR); }