summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h8
-rw-r--r--src/cmd_notice.cpp2
-rw-r--r--src/cmd_privmsg.cpp2
-rw-r--r--src/users.cpp4
4 files changed, 10 insertions, 6 deletions
diff --git a/include/users.h b/include/users.h
index 709f4b739..1cdd53e80 100644
--- a/include/users.h
+++ b/include/users.h
@@ -842,11 +842,15 @@ class userrec : public connection
*/
bool ChangeName(const char* gecos);
- /** Send a notice to all local users from this user
+ /** Send a command to all local users from this user
+ * The command given must be able to send text with the
+ * first parameter as a servermask (e.g. $*), so basically
+ * you should use PRIVMSG or NOTICE.
+ * @param command the command to send
* @param text The text format string to send
* @param ... Format arguments
*/
- void NoticeAll(char* text, ...);
+ void SendAll(const char* command, char* text, ...);
/** Compile a channel list for this user, and send it to the user 'source'
* Used internally by WHOIS
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index df0e518b0..8d0aecef0 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -47,7 +47,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
const char* servermask = parameters[0] + 1;
if (match(ServerInstance->Config->ServerName,servermask))
{
- user->NoticeAll("%s",parameters[1]);
+ user->SendAll("NOTICE", "%s", parameters[1]);
}
FOREACH_MOD(I_OnUserMessage,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,exempt_list));
return CMD_SUCCESS;
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index abf46814a..26e63dfb9 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -49,7 +49,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
const char* servermask = parameters[0] + 1;
if (match(ServerInstance->Config->ServerName,servermask))
{
- ServerInstance->ServerPrivmsgAll("%s",parameters[1]);
+ user->SendAll("PRIVMSG", "%s", parameters[1]);
}
FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,except_list));
return CMD_SUCCESS;
diff --git a/src/users.cpp b/src/users.cpp
index 7d653e52f..55aa7c1ed 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1716,7 +1716,7 @@ bool userrec::ChangeIdent(const char* newident)
return true;
}
-void userrec::NoticeAll(char* text, ...)
+void userrec::SendAll(const char* command, char* text, ...)
{
char textbuffer[MAXBUF];
char formatbuffer[MAXBUF];
@@ -1726,7 +1726,7 @@ void userrec::NoticeAll(char* text, ...)
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(formatbuffer,MAXBUF,":%s NOTICE $* :%s", this->GetFullHost(), textbuffer);
+ snprintf(formatbuffer,MAXBUF,":%s %s $* :%s", this->GetFullHost(), command, textbuffer);
std::string fmt = formatbuffer;
for (std::vector<userrec*>::const_iterator i = ServerInstance->local_users.begin(); i != ServerInstance->local_users.end(); i++)