Fix PRIVMSG/NOTICE handler Send_Message(): don't forward NOTICE as PRIVMSG.

This commit is contained in:
Alexander Barton 2008-08-16 18:26:19 +02:00
parent d93030ad27
commit 71e9ac486f
1 changed files with 15 additions and 10 deletions

View File

@ -39,8 +39,11 @@ static char UNUSED id[] = "$Id: irc.c,v 1.132 2008/01/15 22:28:14 fw Exp $";
static char *Option_String PARAMS((CONN_ID Idx)); static char *Option_String PARAMS((CONN_ID Idx));
static bool Send_Message PARAMS((CLIENT *Client, REQUEST *Req, int ForceType, bool SendErrors)); static bool Send_Message PARAMS((CLIENT *Client, REQUEST *Req, int ForceType,
static bool Send_Message_Mask PARAMS((CLIENT *from, char *targetMask, char *message, bool SendErrors)); bool SendErrors));
static bool Send_Message_Mask PARAMS((CLIENT *from, char *command,
char *targetMask, char *message,
bool SendErrors));
GLOBAL bool GLOBAL bool
@ -445,13 +448,14 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
if (Client_Conn(from) > NONE) { if (Client_Conn(from) > NONE) {
Conn_UpdateIdle(Client_Conn(from)); Conn_UpdateIdle(Client_Conn(from));
} }
if (!IRC_WriteStrClientPrefix(cl, from, "PRIVMSG %s :%s", if (!IRC_WriteStrClientPrefix(cl, from, "%s %s :%s",
Client_ID(cl), Req->argv[1])) Req->command, Client_ID(cl),
Req->argv[1]))
return DISCONNECTED; return DISCONNECTED;
} else if (strchr("$#", currentTarget[0]) } else if (strchr("$#", currentTarget[0])
&& strchr(currentTarget, '.')) { && strchr(currentTarget, '.')) {
/* targetmask */ /* targetmask */
if (!Send_Message_Mask(from, currentTarget, if (!Send_Message_Mask(from, Req->command, currentTarget,
Req->argv[1], SendErrors)) Req->argv[1], SendErrors))
return DISCONNECTED; return DISCONNECTED;
} else if ((chan = Channel_Search(currentTarget))) { } else if ((chan = Channel_Search(currentTarget))) {
@ -474,7 +478,8 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
static bool static bool
Send_Message_Mask(CLIENT * from, char * targetMask, char * message, bool SendErrors) Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
char * message, bool SendErrors)
{ {
CLIENT *cl; CLIENT *cl;
bool client_match; bool client_match;
@ -495,8 +500,8 @@ Send_Message_Mask(CLIENT * from, char * targetMask, char * message, bool SendErr
continue; continue;
client_match = MatchCaseInsensitive(mask, Client_Hostname(cl)); client_match = MatchCaseInsensitive(mask, Client_Hostname(cl));
if (client_match) if (client_match)
if (!IRC_WriteStrClientPrefix(cl, from, "PRIVMSG %s :%s", if (!IRC_WriteStrClientPrefix(cl, from, "%s %s :%s",
Client_ID(cl), message)) command, Client_ID(cl), message))
return false; return false;
} }
} else { } else {
@ -506,8 +511,8 @@ Send_Message_Mask(CLIENT * from, char * targetMask, char * message, bool SendErr
client_match = MatchCaseInsensitive(mask, client_match = MatchCaseInsensitive(mask,
Client_ID(Client_Introducer(cl))); Client_ID(Client_Introducer(cl)));
if (client_match) if (client_match)
if (!IRC_WriteStrClientPrefix(cl, from, "PRIVMSG %s :%s", if (!IRC_WriteStrClientPrefix(cl, from, "%s %s :%s",
Client_ID(cl), message)) command, Client_ID(cl), message))
return false; return false;
} }
} }