From 3e825325b8c09efccd7c1b5c30e226bc68ecb57d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 22 May 2001 00:38:07 +0000 Subject: [PATCH] nick completion: don't add the same nick to completion list twice. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1515 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/chat-completion.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c index 654e8f31..3cbcbf02 100644 --- a/src/fe-common/core/chat-completion.c +++ b/src/fe-common/core/chat-completion.c @@ -393,7 +393,11 @@ static GList *completion_nicks_nonstrict(CHANNEL_REC *channel, tnick = g_strconcat(rec->nick, suffix, NULL); if (completion_lowercase) g_strdown(tnick); - list = g_list_append(list, tnick); + + if (glist_find_icase_string(list, tnick) == NULL) + list = g_list_append(list, tnick); + else + g_free(tnick); } } @@ -429,11 +433,14 @@ static GList *completion_channel_nicks(CHANNEL_REC *channel, const char *nick, NICK_REC *rec = tmp->data; if (g_strncasecmp(rec->nick, nick, len) == 0 && - glist_find_icase_string(list, rec->nick) == NULL && rec != channel->ownnick) { str = g_strconcat(rec->nick, suffix, NULL); - if (completion_lowercase) g_strdown(str); - list = g_list_append(list, str); + if (completion_lowercase) + g_strdown(str); + if (glist_find_icase_string(list, str) == NULL) + list = g_list_append(list, str); + else + g_free(str); } } g_slist_free(nicks);