- Server* Srv;
- public:
- cmd_swhois(Server* server) : command_t("SWHOIS",'o',2)
- {
- this->Srv = server;
- this->source = "m_swhois.so";
- }
-
- void Handle(char** parameters, int pcnt, userrec* user)
- {
- userrec* dest = Srv->FindNick(std::string(parameters[0]));
- if(dest)
- {
- std::string line;
- for(int i = 1; i < pcnt; i++)
- {
- if (i != 1)
- line.append(" ");
-
- line.append(parameters[i]);
- }
-
- std::string* text;
- dest->GetExt("swhois", text);
-
- if(text)
- {
- // We already had it set...
-
- if (!Srv->IsUlined(user->server))
- // Ulines set SWHOISes silently
- WriteOpers("*** %s used SWHOIS to set %s's extra whois from '%s' to '%s'", user->nick, dest->nick, text->c_str(), line.c_str());
-
- dest->Shrink("swhois");
- DELETE(text);
- }
- else if(!Srv->IsUlined(user->server))
- {
- // Ulines set SWHOISes silently
- WriteOpers("*** %s used SWHOIS to set %s's extra whois to '%s'", user->nick, dest->nick, line.c_str());
- }
-
- text = new std::string(line);
- dest->Extend("swhois", (char*)text);
- }
- }