degesch: add nickname autocompletion
This commit is contained in:
parent
2ef7323f26
commit
7c9a1f50da
17
degesch.c
17
degesch.c
|
@ -5330,7 +5330,22 @@ static void
|
|||
complete_nicknames (struct app_context *ctx, struct completion *data,
|
||||
const char *word, struct str_vector *output)
|
||||
{
|
||||
// TODO; if (data->location == 0) --> add colons to nicknames
|
||||
if (ctx->current_buffer->type != BUFFER_CHANNEL)
|
||||
return;
|
||||
struct channel *channel = ctx->current_buffer->channel;
|
||||
|
||||
// XXX: this is a bit hackish and doesn't respect server case mapping
|
||||
char *mask = xstrdup_printf ("%s*", word);
|
||||
LIST_FOR_EACH (struct channel_user, iter, channel->users)
|
||||
{
|
||||
const char *nickname = iter->user->nickname;
|
||||
if (fnmatch (mask, nickname, 0))
|
||||
continue;
|
||||
str_vector_add_owned (output, data->location == 0
|
||||
? xstrdup_printf ("%s:", nickname)
|
||||
: xstrdup (nickname));
|
||||
}
|
||||
free (mask);
|
||||
}
|
||||
|
||||
static char **
|
||||
|
|
Loading…
Reference in New Issue