1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

Fix check of IRC ignore when channel is specified in ignore (problem with PRIVMSG queries)

This commit is contained in:
Sebastien Helleu
2010-03-29 12:25:28 +02:00
parent 485e884751
commit 88853df080
4 changed files with 28 additions and 12 deletions
+11 -3
View File
@@ -182,7 +182,7 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
*/
int
irc_ignore_check (struct t_irc_server *server, struct t_irc_channel *channel,
irc_ignore_check (struct t_irc_server *server, const char *channel,
const char *nick, const char *host)
{
struct t_irc_ignore *ptr_ignore;
@@ -215,8 +215,16 @@ irc_ignore_check (struct t_irc_server *server, struct t_irc_channel *channel,
channel_match = 1;
else
{
channel_match = (weechat_strcasecmp (ptr_ignore->channel,
channel->name) == 0);
if (irc_channel_is_channel (channel))
{
channel_match = (weechat_strcasecmp (ptr_ignore->channel,
channel) == 0);
}
else if (nick)
{
channel_match = (weechat_strcasecmp (ptr_ignore->channel,
nick) == 0);
}
}
if (server_match && channel_match)
+2 -2
View File
@@ -47,8 +47,8 @@ extern struct t_irc_ignore *irc_ignore_new (const char *mask,
const char *server,
const char *channel);
extern int irc_ignore_check (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *nick, const char *host);
const char *channel, const char *nick,
const char *host);
extern void irc_ignore_free (struct t_irc_ignore *ignore);
extern void irc_ignore_free_all ();
extern int irc_ignore_add_to_infolist (struct t_infolist *infolist,
+6 -3
View File
@@ -934,7 +934,8 @@ IRC_PROTOCOL_CALLBACK(nick)
}
else
{
if (!irc_ignore_check (server, ptr_channel, nick, host))
if (!irc_ignore_check (server, ptr_channel->name,
nick, host))
{
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command, NULL),
@@ -1489,7 +1490,7 @@ IRC_PROTOCOL_CALLBACK(quit)
if (ptr_nick || (weechat_strcasecmp (ptr_channel->name, nick) == 0))
{
/* display quit message */
if (!irc_ignore_check (server, ptr_channel, nick, host))
if (!irc_ignore_check (server, ptr_channel->name, nick, host))
{
local_quit = (strcmp (nick, server->nick) == 0);
ptr_nick_speaking = NULL;
@@ -3977,7 +3978,9 @@ irc_protocol_recv_command (struct t_irc_server *server,
ptr_channel = NULL;
if (msg_channel)
ptr_channel = irc_channel_search (server, msg_channel);
message_ignored = irc_ignore_check (server, ptr_channel, nick, host);
message_ignored = irc_ignore_check (server,
(ptr_channel) ? ptr_channel->name : msg_channel,
nick, host);
/* send signal with received command, even if command is ignored */
irc_server_send_signal (server, "irc_raw_in", msg_command, irc_message);
+9 -4
View File
@@ -1082,7 +1082,7 @@ void
irc_server_parse_message (const char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
const char *pos, *pos2, *pos3, *pos4;
const char *pos, *pos2, *pos3, *pos4, *pos5;
if (nick)
*nick = NULL;
@@ -1170,6 +1170,7 @@ irc_server_parse_message (const char *message, char **nick, char **host,
}
if (pos3)
{
pos4 = pos3;
pos3++;
while (pos3[0] == ' ')
{
@@ -1177,15 +1178,19 @@ irc_server_parse_message (const char *message, char **nick, char **host,
}
if (irc_channel_is_channel (pos3))
{
pos4 = strchr (pos3, ' ');
pos5 = strchr (pos3, ' ');
if (channel)
{
if (pos4)
*channel = weechat_strndup (pos3, pos4 - pos3);
if (pos5)
*channel = weechat_strndup (pos3, pos5 - pos3);
else
*channel = strdup (pos3);
}
}
else if (channel && !*channel)
{
*channel = weechat_strndup (pos2, pos4 - pos2);
}
}
}
}