X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_swhois.cpp;h=80c7ddd3b13d8054dc5ddc587890c6d02b572489;hb=28dcc1f9e017152f03b0d9bfbcc494260b015a0a;hp=81abde6f77c2e82aeb004750fe3fdf91be01e377;hpb=8c71a2a6304f0d77aa7738e04a44f366a158cadd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 81abde6f7..80c7ddd3b 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -43,7 +43,7 @@ class CommandSwhois : public Command { User* dest = ServerInstance->FindNick(parameters[0]); - if ((!dest) || (IS_SERVER(dest))) // allow setting swhois using SWHOIS before reg + if (!dest) // allow setting swhois using SWHOIS before reg { user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; @@ -81,26 +81,28 @@ class CommandSwhois : public Command }; -class ModuleSWhois : public Module +class ModuleSWhois : public Module, public Whois::LineEventListener { CommandSwhois cmd; public: - ModuleSWhois() : cmd(this) + ModuleSWhois() + : Whois::LineEventListener(this) + , cmd(this) { } // :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games. - ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text) CXX11_OVERRIDE + ModResult OnWhoisLine(Whois::Context& whois, unsigned int& numeric, std::string& text) CXX11_OVERRIDE { /* We use this and not OnWhois because this triggers for remote, too */ if (numeric == 312) { /* Insert our numeric before 312 */ - std::string* swhois = cmd.swhois.get(dest); + std::string* swhois = cmd.swhois.get(whois.GetTarget()); if (swhois) { - ServerInstance->SendWhoisLine(user, dest, 320, "%s :%s", dest->nick.c_str(), swhois->c_str()); + whois.SendLine(320, ":%s", swhois->c_str()); } }