X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_away.cpp;h=33e140beb978a02ba9a8cef246295d0f30f5610f;hb=3f971b447fae258a92f2cc6645497cce93f1c04e;hp=ffddbba44162f0db17dd499400687a457dcbc239;hpb=dd36852a52e8541306b76c5b88bce8ab9b36654c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index ffddbba44..33e140beb 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -23,17 +23,29 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) */ CmdResult CommandAway::Handle (const char* const* parameters, int pcnt, User *user) { + int MOD_RESULT = 0; + if ((pcnt) && (*parameters[0])) { + FOREACH_RESULT(I_OnSetAway, OnSetAway(user, parameters[0])); + + if (MOD_RESULT != 0 && !IS_LOCAL(user)) + return CMD_FAILURE; + + user->awaytime = ServerInstance->Time(); strlcpy(user->awaymsg,parameters[0],MAXAWAY); - user->WriteServ("306 %s :You have been marked as being away",user->nick); - FOREACH_MOD(I_OnSetAway,OnSetAway(user)); + user->WriteNumeric(306, "%s :You have been marked as being away",user->nick); } else { + FOREACH_RESULT(I_OnSetAway, OnSetAway(user, "")); + + if (MOD_RESULT != 0 && !IS_LOCAL(user)) + return CMD_FAILURE; + *user->awaymsg = 0; - user->WriteServ("305 %s :You are no longer marked as being away",user->nick); - FOREACH_MOD(I_OnCancelAway,OnCancelAway(user)); + user->WriteNumeric(305, "%s :You are no longer marked as being away",user->nick); } + return CMD_SUCCESS; }