diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-30 14:26:01 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-30 14:26:01 +0000 |
commit | e2f4bf3a135e6b23fea21b2628c2c830de29cdec (patch) | |
tree | f65396b2731efe96f631a6104912480139e1a797 /src/commands | |
parent | d65f2c382531e2fd747f21f14b6b4d6c9659ca64 (diff) |
Merge OnCancelAway and OnSetAway, add param awaymsg to OnSetAway (blank when cancelling), and change return type to int so modules can block away messages by returning nonzero.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9223 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/cmd_away.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index 2ca2df7db..c49813b52 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -23,17 +23,28 @@ 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; + strlcpy(user->awaymsg,parameters[0],MAXAWAY); user->WriteNumeric(306, "%s :You have been marked as being away",user->nick); - FOREACH_MOD(I_OnSetAway,OnSetAway(user)); } else { + FOREACH_RESULT(I_OnSetAway, OnSetAway(user, "")); + + if (MOD_RESULT != 0 && !IS_LOCAL(user)) + return CMD_FAILURE; + *user->awaymsg = 0; user->WriteNumeric(305, "%s :You are no longer marked as being away",user->nick); - FOREACH_MOD(I_OnCancelAway,OnCancelAway(user)); } + return CMD_SUCCESS; } |