Skip to content

Commit

Permalink
irc: fix duplicate nick completion when someone rejoins the channel w…
Browse files Browse the repository at this point in the history
…ith same nick but a different case (bug #38841)
  • Loading branch information
flashcode committed Apr 28, 2013
1 parent 4b1d876 commit cf8a125
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ChangeLog
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.1-dev, 2013-04-23
v0.4.1-dev, 2013-04-28


This document lists all changes for each version.
Expand Down Expand Up @@ -51,6 +51,8 @@ Version 0.4.1 (under dev!)
list with arguments inside), guile >= 2.0 is now required (bug #38350)
* guile: fix crash on calls to callbacks during load of script (bug #38343)
* guile: fix compilation with guile 2.0
* irc: fix duplicate nick completion when someone rejoins the channel with same
nick but a different case (bug #38841)
* irc: add support of UHNAMES (capability "userhost-in-names") (task #9353)
* irc: add tag "irc_nick_back" for messages displayed in private buffer when a
nick is back on server (task #12576)
Expand Down
32 changes: 32 additions & 0 deletions src/plugins/irc/irc-channel.c
Expand Up @@ -591,6 +591,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.
*
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/irc/irc-channel.h
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/irc/irc-protocol.c
Expand Up @@ -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))
Expand Down

0 comments on commit cf8a125

Please sign in to comment.