From bc079b007dbef41db8082f3e668a5e131bd60300 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 17 Feb 2013 13:27:36 +0100 Subject: irc: unmask smart filtered join if nick speaks in channel some minutes after the join, new option irc.look.smart_filter_join_unmask (task #12405) The nick changes are tracked and will be unmasked with the join. Events triggering the unmask of join are: a message (can be CTCP), a notice or an update of topic. --- src/plugins/irc/irc-upgrade.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'src/plugins/irc/irc-upgrade.c') diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c index e262c88de..3a9568a06 100644 --- a/src/plugins/irc/irc-upgrade.c +++ b/src/plugins/irc/irc-upgrade.c @@ -284,8 +284,10 @@ irc_upgrade_read_cb (void *data, int object_id, struct t_infolist *infolist) { - int flags, sock, size, i, index; - char *buf, option_name[64]; + int flags, sock, size, i, index, nicks_count; + long number; + time_t join_time; + char *buf, option_name[64], **nicks, *nick_join, *pos, *error; const char *buffer_name, *str, *nick; struct t_irc_nick *ptr_nick; struct t_irc_redirect *ptr_redirect; @@ -482,6 +484,38 @@ irc_upgrade_read_cb (void *data, option_name)); index++; } + str = weechat_infolist_string (infolist, "join_smart_filtered"); + if (str) + { + nicks = weechat_string_split (str, ",", 0, 0, + &nicks_count); + if (nicks) + { + for (i = 0; i < nicks_count; i++) + { + pos = strchr (nicks[i], ':'); + if (pos) + { + nick_join = weechat_strndup (nicks[i], + pos - nicks[i]); + if (nick_join) + { + error = NULL; + number = strtol (pos + 1, &error, 10); + if (error && !error[0]) + { + join_time = (time_t)number; + irc_channel_join_smart_filtered_add (irc_upgrade_current_channel, + nick_join, + join_time); + } + free (nick_join); + } + } + } + weechat_string_free_split (nicks); + } + } } } break; -- cgit v1.2.3