xep-0084/avatar: add option to open avatar directly

Change:
`/avatar me@somewhere.org` -> `/avatar get me@somewhere.org`

New:
`/avatar cmd feh`
`/avatar open me@somewhere.org`

Implement https://github.com/profanity-im/profanity/issues/1281
This commit is contained in:
Michael Vetter
2020-03-10 07:12:13 +01:00
parent 7e62d458ee
commit 52e7e596aa
9 changed files with 88 additions and 9 deletions

View File

@@ -8733,7 +8733,19 @@ cmd_color(ProfWin *window, const char *const command, gchar **args)
gboolean
cmd_avatar(ProfWin *window, const char *const command, gchar **args)
{
avatar_get_by_nick(args[0]);
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
}
if (g_strcmp0(args[0], "get") == 0) {
avatar_get_by_nick(args[1], false);
} else if (g_strcmp0(args[0], "open") == 0) {
avatar_get_by_nick(args[1], true);
} else if (g_strcmp0(args[0], "cmd") == 0) {
prefs_set_string(PREF_AVATAR_CMD, args[1]);
cons_show("Avatar cmd set to: %s", args[1]);
}
return TRUE;
}