X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_die.cpp;h=7f0a81df814ce12ce99a8d2ab720985d14c3f049;hb=bfdf503e5204ba17479084e688a3605dbc9007a2;hp=d9aecb4be4dc4490614268954a037c2d44191887;hpb=6c9a69cbad71e15788cc4d5757b5ee7d311bff70;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp index d9aecb4be..7f0a81df8 100644 --- a/src/cmd_die.cpp +++ b/src/cmd_die.cpp @@ -11,12 +11,13 @@ * --------------------------------------------------- */ +#include "inspircd.h" #include "configreader.h" #include "users.h" #include "commands/cmd_die.h" #include "exitcodes.h" -extern "C" command_t* init_command(InspIRCd* Instance) +extern "C" DllExport command_t* init_command(InspIRCd* Instance) { return new cmd_die(Instance); } @@ -27,22 +28,9 @@ CmdResult cmd_die::Handle (const char** parameters, int pcnt, userrec *user) { if (!strcmp(parameters[0],ServerInstance->Config->diepass)) { - ServerInstance->Log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, ServerInstance->Config->DieDelay); - - /* This would just be WriteOpers(), but as we just sleep() and then die then the write buffers never get flushed. - * so we iterate the oper list, writing the message and immediately trying to flush their write buffer. - */ - - for (std::vector::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++) - { - userrec* a = *i; - - if (IS_LOCAL(a) && (a->modes[UM_SERVERNOTICE])) - { - a->WriteServ("NOTICE %s :*** DIE command from %s!%s@%s, terminating...", a->nick, a->nick, a->ident, a->host); - a->FlushWriteBuf(); - } - } + std::string diebuf = std::string("*** DIE command from ") + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating in " + ConvToStr(ServerInstance->Config->DieDelay) + " seconds."; + ServerInstance->Log(SPARSE, diebuf); + ServerInstance->SendError(diebuf); if (ServerInstance->Config->DieDelay) sleep(ServerInstance->Config->DieDelay);