From ea16b0634808b18d93637df5e524dca2a6db8512 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 5 Dec 2013 19:47:51 +0100 Subject: [PATCH] irc: fix ignore on a host without nick --- ChangeLog | 1 + src/plugins/irc/irc-ignore.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a60545132..f298ac2a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -49,6 +49,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * aspell: fix detection of nicks with non-alphanumeric chars * guile: disable guile gmp allocator (fix crash on unload of relay plugin) (bug #40628) +* irc: fix ignore on a host without nick * irc: use color code 0x1F (`ctrl-_`) for underlined text in input line (same code as messages) (bug #40756) * irc: use color code 0x16 (`ctrl-V`) for reverse video in messages diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c index d37fdc345..c5da2e781 100644 --- a/src/plugins/irc/irc-ignore.c +++ b/src/plugins/irc/irc-ignore.c @@ -177,6 +177,7 @@ irc_ignore_check (struct t_irc_server *server, const char *channel, { struct t_irc_ignore *ptr_ignore; int server_match, channel_match; + char *pos; if (!server) return 0; @@ -223,8 +224,20 @@ irc_ignore_check (struct t_irc_server *server, const char *channel, { if (nick && (regexec (ptr_ignore->regex_mask, nick, 0, NULL, 0) == 0)) return 1; - if (host && (regexec (ptr_ignore->regex_mask, host, 0, NULL, 0) == 0)) - return 1; + if (host) + { + if (regexec (ptr_ignore->regex_mask, host, 0, NULL, 0) == 0) + return 1; + if (!strchr (ptr_ignore->mask, '!')) + { + pos = strchr (host, '!'); + if (pos && (regexec (ptr_ignore->regex_mask, pos + 1, + 0, NULL, 0) == 0)) + { + return 1; + } + } + } } }