X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_swhois.cpp;h=ef5c5c35f14c9c6bddd1ddacabd774dc1e049118;hb=83137d5f9274832f152acc7d19de3cb0897f9630;hp=6d813ae9ae171abf3408a36e177e56b72f52cbb7;hpb=4426a2fc448f332e42a7e6ff778e5047bb588c98;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 6d813ae9a..ef5c5c35f 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -21,14 +21,14 @@ class CommandSwhois : public Command { public: - CommandSwhois (InspIRCd* Instance) : Command(Instance,"SWHOIS",'o',2) + CommandSwhois (InspIRCd* Instance) : Command(Instance,"SWHOIS","o",2) { this->source = "m_swhois.so"; syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - CmdResult Handle(const char** parameters, int pcnt, User* user) + CmdResult Handle(const char* const* parameters, int pcnt, User* user) { User* dest = ServerInstance->FindNick(parameters[0]); @@ -38,12 +38,6 @@ class CommandSwhois : public Command return CMD_FAILURE; } - if (!*parameters[1]) - { - user->WriteServ("NOTICE %s :*** SWHOIS: Whois line must be specified", user->nick); - return CMD_FAILURE; - } - std::string line; for (int i = 1; i < pcnt; i++) { @@ -59,7 +53,6 @@ class CommandSwhois : public Command if (text) { // We already had it set... - if (!ServerInstance->ULine(user->server)) // Ulines set SWHOISes silently ServerInstance->SNO->WriteToSnoMask('A', "%s used SWHOIS to set %s's extra whois from '%s' to '%s'", user->nick, dest->nick, text->c_str(), line.c_str()); @@ -89,6 +82,13 @@ class CommandSwhois : public Command Event event((char*)metadata,(Module*)this,"send_metadata"); event.Send(ServerInstance); delete metadata; + + // If it's an empty swhois, unset it (not ideal, but ok) + if (text->empty()) + { + dest->Shrink("swhois"); + delete text; + } return CMD_LOCALONLY; } @@ -204,13 +204,13 @@ class ModuleSWhois : public Module std::string* text; if (!dest->GetExt("swhois", text)) { - std::string* text = new std::string(extdata); - dest->Extend("swhois",text); + std::string* text2 = new std::string(extdata); + dest->Extend("swhois",text2); } } } - virtual void OnPostCommand(const std::string &command, const char **params, int pcnt, User *user, CmdResult result, const std::string &original_line) + virtual void OnPostCommand(const std::string &command, const char* const* params, int pcnt, User *user, CmdResult result, const std::string &original_line) { if ((command != "OPER") || (result != CMD_SUCCESS)) return;