X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_helpop.cpp;h=d07898c90801c0a199c9e6bfd24f8d9ebe0ee8a9;hb=357d190074ee58809b31ea0c08543566168bddf6;hp=a2fead6307aae21c9d2ddb421480e95deb1319e5;hpb=fd0fa86da89ab4cefa778307088ef2552a05a170;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index a2fead630..d07898c90 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -55,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); @@ -82,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; } @@ -106,16 +104,7 @@ class ModuleHelpop : public Module { } - void init() CXX11_OVERRIDE - { - ReadConfig(); - ServerInstance->Modules->AddService(ho); - ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnRehash, I_OnWhois }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - - void ReadConfig() + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { helpop_map.clear(); @@ -148,16 +137,11 @@ class ModuleHelpop : public Module } - void OnRehash(User* user) CXX11_OVERRIDE - { - ReadConfig(); - } - void OnWhois(User* src, User* dst) CXX11_OVERRIDE { if (dst->IsModeSet(ho)) { - ServerInstance->SendWhoisLine(src, dst, 310, src->nick+" "+dst->nick+" :is available for help."); + ServerInstance->SendWhoisLine(src, dst, 310, dst->nick+" :is available for help."); } }