summaryrefslogtreecommitdiff
path: root/src/cmd_notice.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-06 17:21:59 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-06 17:21:59 +0000
commit4cf0ae1308fe98757de42ffbe391e61844ac9e0a (patch)
tree76cf38a7afd4d31b6345561442bdee4692c5a847 /src/cmd_notice.cpp
parent29f296665d0625883d13d2c979cba702c952f5ec (diff)
Command result codes. This isnt finished yet, still got to do most of the modules, and alter CallCommandHandler
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5149 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/cmd_notice.cpp')
-rw-r--r--src/cmd_notice.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index 7cd53aa3d..d018e1eb2 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -27,7 +27,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_notice(Instance);
}
-void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
userrec *dest;
chanrec *chan;
@@ -35,14 +35,14 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
user->idle_lastmsg = ServerInstance->Time();
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
- return;
+ return CMD_SUCCESS;
if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->ULine(user->server))))
{
int MOD_RESULT = 0;
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,(void*)parameters[0],TYPE_SERVER,temp,0));
if (MOD_RESULT)
- return;
+ return CMD_FAILURE;
parameters[1] = (char*)temp.c_str();
// notice to server mask
const char* servermask = parameters[0] + 1;
@@ -51,7 +51,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
user->NoticeAll("%s",parameters[1]);
}
FOREACH_MOD(I_OnUserMessage,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0));
- return;
+ return CMD_SUCCESS;
}
char status = 0;
if ((*parameters[0] == '@') || (*parameters[0] == '%') || (*parameters[0] == '+'))
@@ -69,12 +69,12 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
{
user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
- return;
+ return CMD_FAILURE;
}
if ((chan->modes[CM_MODERATED]) && (chan->GetStatus(user) < STATUS_VOICE))
{
user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
- return;
+ return CMD_FAILURE;
}
}
@@ -83,14 +83,14 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,chan,TYPE_CHANNEL,temp,status));
if (MOD_RESULT) {
- return;
+ return CMD_FAILURE;
}
parameters[1] = (char*)temp.c_str();
if (temp == "")
{
user->WriteServ("412 %s No text to send", user->nick);
- return;
+ return CMD_FAILURE;
}
chan->WriteAllExceptSender(user, status, "NOTICE %s :%s", chan->name, parameters[1]);
@@ -101,8 +101,9 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
/* no such nick/channel */
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
- return;
+ return CMD_SUCCESS;
}
dest = ServerInstance->FindNick(parameters[0]);
@@ -113,7 +114,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,dest,TYPE_USER,temp,0));
if (MOD_RESULT) {
- return;
+ return CMD_FAILURE;
}
parameters[1] = (char*)temp.c_str();
@@ -129,5 +130,10 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
/* no such nick/channel */
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
+
}
+