summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-upgrade.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-02-17 13:27:36 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-02-17 13:27:36 +0100
commitbc079b007dbef41db8082f3e668a5e131bd60300 (patch)
tree7f19e0187ec5cbd555a720186c1c4372e52f68b7 /src/plugins/irc/irc-upgrade.c
parent6e3f6270d1af8863b9fa602732e83d6f139df8a8 (diff)
downloadweechat-bc079b007dbef41db8082f3e668a5e131bd60300.zip
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.
Diffstat (limited to 'src/plugins/irc/irc-upgrade.c')
-rw-r--r--src/plugins/irc/irc-upgrade.c38
1 files changed, 36 insertions, 2 deletions
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;