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.
This commit is contained in:
committed by
Michael Vetter
parent
056b19eb91
commit
e1ed012f72
@@ -466,13 +466,13 @@ call_external(gchar** argv, gchar** std_out, gchar** std_err)
|
|||||||
|
|
||||||
if (!is_successful) {
|
if (!is_successful) {
|
||||||
gchar* cmd = g_strjoinv(" ", argv);
|
gchar* cmd = g_strjoinv(" ", argv);
|
||||||
log_error("could not spawn '%s' with error '%s'", cmd, spawn_error->message);
|
log_error("Spawning '%s' failed with with error '%s'", cmd, spawn_error ? spawn_error->message : "Unknown, spawn_error is NULL");
|
||||||
|
;
|
||||||
|
|
||||||
g_error_free(spawn_error);
|
g_error_free(spawn_error);
|
||||||
g_free(cmd);
|
g_free(cmd);
|
||||||
}
|
} else {
|
||||||
else {
|
is_successful = g_spawn_check_exit_status(wait_status, &exit_error);
|
||||||
is_successful = g_spawn_check_wait_status(wait_status, &exit_error);
|
|
||||||
|
|
||||||
if (!is_successful) {
|
if (!is_successful) {
|
||||||
gchar* cmd = g_strjoinv(" ", argv);
|
gchar* cmd = g_strjoinv(" ", argv);
|
||||||
|
|||||||
@@ -339,10 +339,20 @@ _avatar_request_item_result_handler(xmpp_stanza_t* const stanza, void* const use
|
|||||||
|
|
||||||
// if we shall open it
|
// if we shall open it
|
||||||
if (g_hash_table_contains(shall_open, from_attr)) {
|
if (g_hash_table_contains(shall_open, from_attr)) {
|
||||||
gchar* argv[] = { prefs_get_string(PREF_AVATAR_CMD), filename->str, NULL };
|
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)) {
|
if (!call_external(argv, NULL, NULL)) {
|
||||||
cons_show_error("Unable to display avatar: check the logs for more information.");
|
cons_show_error("Unable to display avatar: check the logs for more information.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_strfreev(argv);
|
||||||
|
}
|
||||||
|
|
||||||
g_hash_table_remove(shall_open, from_attr);
|
g_hash_table_remove(shall_open, from_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user