about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-09-06 12:56:11 +0200
committerGitHub <noreply@github.com>2022-09-06 12:56:11 +0200
commit359e2614ff40467306e519931be27f52ac2fe2b1 (patch)
treeb79cc956bf779f7cb965431efb1f5e528ceb3ef2 /src/xmpp
parent0864bc68d7037abd41cf75901ffaa0cd8bceb04d (diff)
parente1ed012f72495e2d2bdd10520eb943fbba932ed4 (diff)
downloadprofani-tty-359e2614ff40467306e519931be27f52ac2fe2b1.tar.gz
Merge pull request #1748 from nandesu-utils/fix/issue1742
Fix https://github.com/profanity-im/profanity/issues/1742
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/avatar.c16
1 files changed, 13 insertions, 3 deletions
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);
     }