xC: fix autocomplete in server buffers

This commit is contained in:
Přemysl Eric Janouch 2022-09-20 17:33:37 +02:00
parent 9327333813
commit 8a689c98b4
Signed by: p
GPG Key ID: A0420B94F92B9493

5
xC.c
View File

@ -13581,16 +13581,17 @@ static void
complete_nicknames (struct buffer *buffer, struct completion *data, complete_nicknames (struct buffer *buffer, struct completion *data,
const char *word, struct strv *output) const char *word, struct strv *output)
{ {
size_t word_len = strlen (word);
if (buffer->type == BUFFER_SERVER) if (buffer->type == BUFFER_SERVER)
{ {
struct user *self_user = buffer->server->irc_user; struct user *self_user = buffer->server->irc_user;
if (self_user) if (self_user && !irc_server_strncmp (buffer->server,
word, self_user->nickname, word_len))
strv_append (output, self_user->nickname); strv_append (output, self_user->nickname);
} }
if (buffer->type != BUFFER_CHANNEL) if (buffer->type != BUFFER_CHANNEL)
return; return;
size_t word_len = strlen (word);
LIST_FOR_EACH (struct channel_user, iter, buffer->channel->users) LIST_FOR_EACH (struct channel_user, iter, buffer->channel->users)
{ {
const char *nickname = iter->user->nickname; const char *nickname = iter->user->nickname;