X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_away.cpp;h=33e140beb978a02ba9a8cef246295d0f30f5610f;hb=3f971b447fae258a92f2cc6645497cce93f1c04e;hp=dd708edfc1bd81c5568ad94a8e64c73d7299d6cb;hpb=e4acbc95b8b6cd5b28d38a2242c02e8ff4991e4a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index dd708edfc..33e140beb 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -21,19 +21,31 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) /** Handle /AWAY */ -CmdResult CommandAway::Handle (const char** parameters, int pcnt, User *user) +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; }