From e1ed012f72495e2d2bdd10520eb943fbba932ed4 Mon Sep 17 00:00:00 2001 From: nandesu-utils <70854931+nandesu-utils@users.noreply.github.com> Date: Thu, 25 Aug 2022 00:10:22 +0300 Subject: support for formatting in avatar executable in before it just used the input command line as it was but this fixes this by adding formatting using `format_call_external_argv` which is already used in `url open` executable. --- src/xmpp/avatar.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/xmpp') diff --git a/src/xmpp/avatar.c b/src/xmpp/avatar.c index 9345ba3a..fb3b01ea 100644 --- a/src/xmpp/avatar.c +++ b/src/xmpp/avatar.c @@ -339,10 +339,20 @@ _avatar_request_item_result_handler(xmpp_stanza_t* const stanza, void* const use // if we shall open it if (g_hash_table_contains(shall_open, from_attr)) { - gchar* argv[] = { prefs_get_string(PREF_AVATAR_CMD), filename->str, NULL }; - if (!call_external(argv, NULL, NULL)) { - cons_show_error("Unable to display avatar: check the logs for more information."); + gchar* cmdtemplate = prefs_get_string(PREF_AVATAR_CMD); + + if (cmdtemplate == NULL) { + cons_show_error("No default `avatar open` command found in executables preferences."); + } else { + gchar** argv = format_call_external_argv(cmdtemplate, NULL, filename->str); + + if (!call_external(argv, NULL, NULL)) { + cons_show_error("Unable to display avatar: check the logs for more information."); + } + + g_strfreev(argv); } + g_hash_table_remove(shall_open, from_attr); } -- cgit 1.4.1-2-gfad0