summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-04-28 13:34:44 +0200
committerSebastien Helleu <flashcode@flashtux.org>2013-04-28 13:34:44 +0200
commitcf8a125ef233bff8315f28540753f50cad279663 (patch)
tree8b724977fd42e03a659e2ad729aa6a20494e2a35 /src
parent4b1d87640c7b70abc5e23aca045795aa0499bd52 (diff)
downloadweechat-cf8a125ef233bff8315f28540753f50cad279663.zip
irc: fix duplicate nick completion when someone rejoins the channel with same nick but a different case (bug #38841)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-channel.c32
-rw-r--r--src/plugins/irc/irc-channel.h3
-rw-r--r--src/plugins/irc/irc-protocol.c3
3 files changed, 38 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 931c24f24..302ca69a6 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -592,6 +592,38 @@ irc_channel_nick_speaking_rename (struct t_irc_channel *channel,
}
/*
+ * Renames a nick speaking on a channel if it is already in list.
+ */
+
+void
+irc_channel_nick_speaking_rename_if_present (struct t_irc_server *server,
+ struct t_irc_channel *channel,
+ const char *nick_name)
+{
+ struct t_weelist_item *ptr_item;
+ int i, j, list_size;
+
+ for (i = 0; i < 2; i++)
+ {
+ if (channel->nicks_speaking[i])
+ {
+ list_size = weechat_list_size (channel->nicks_speaking[i]);
+ for (j = 0; j < list_size; j++)
+ {
+ ptr_item = weechat_list_get (channel->nicks_speaking[i], j);
+ if (ptr_item
+ && (irc_server_strcasecmp (server,
+ weechat_list_string (ptr_item),
+ nick_name) == 0))
+ {
+ weechat_list_set (ptr_item, nick_name);
+ }
+ }
+ }
+ }
+}
+
+/*
* Searches for a nick speaking time on a channel.
*
* Returns pointer to nick speaking time, NULL if not found.
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 1e76b06fb..24465be5b 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -108,6 +108,9 @@ extern void irc_channel_nick_speaking_add (struct t_irc_channel *channel,
extern void irc_channel_nick_speaking_rename (struct t_irc_channel *channel,
const char *old_nick,
const char *new_nick);
+extern void irc_channel_nick_speaking_rename_if_present (struct t_irc_server *server,
+ struct t_irc_channel *channel,
+ const char *nick_name);
extern struct t_irc_channel_speaking *irc_channel_nick_speaking_time_search (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *nick_name,
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 8cea4fcb8..15ce86d10 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -568,6 +568,9 @@ IRC_PROTOCOL_CALLBACK(join)
/* add nick in channel */
ptr_nick = irc_nick_new (server, ptr_channel, nick, address, NULL, 0);
+ /* rename the nick if it was in list with a different case */
+ irc_channel_nick_speaking_rename_if_present (server, ptr_channel, nick);
+
if (!ignored)
{
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))