1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

xep-0084: add /avatar help and autocompletion

This commit is contained in:
Michael Vetter 2019-12-18 13:37:42 +01:00
parent 3f58aba2bd
commit 3fdeb52f1c
2 changed files with 21 additions and 3 deletions

View File

@ -112,6 +112,7 @@ static char* _invite_autocomplete(ProfWin *window, const char *const input, gboo
static char* _status_autocomplete(ProfWin *window, const char *const input, gboolean previous);
static char* _logging_autocomplete(ProfWin *window, const char *const input, gboolean previous);
static char* _color_autocomplete(ProfWin *window, const char *const input, gboolean previous);
static char* _avatar_autocomplete(ProfWin *window, const char *const input, gboolean previous);
static char* _script_autocomplete_func(const char *const prefix, gboolean previous);
@ -1608,6 +1609,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
g_hash_table_insert(ac_funcs, "/logging", _logging_autocomplete);
g_hash_table_insert(ac_funcs, "/color", _color_autocomplete);
g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
int len = strlen(input);
char parsed[len+1];
@ -3619,3 +3621,19 @@ _color_autocomplete(ProfWin *window, const char *const input, gboolean previous)
return NULL;
}
static char*
_avatar_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
char *result = NULL;
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED) {
result = autocomplete_param_with_func(input, "/avatar", roster_barejid_autocomplete, previous);
if (result) {
return result;
}
}
return NULL;
}

View File

@ -2320,11 +2320,11 @@ static struct cmd_t command_defs[] =
CMD_TAGS(
CMD_TAG_CHAT)
CMD_SYN(
"/color nick")
"/avatar <barejid>")
CMD_DESC(
"Not ready")
"Download avatar for a certain contact.")
CMD_ARGS(
{ "nick", "Not ready"})
{ "<barejid>", "JID to download avatar from."})
CMD_NOEXAMPLES
},
};