about summary refs log tree commit diff stats
path: root/src/tools/http_download.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/http_download.c')
-rw-r--r--src/tools/http_download.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/http_download.c b/src/tools/http_download.c
index d14ab0e8..ef7e2906 100644
--- a/src/tools/http_download.c
+++ b/src/tools/http_download.c
@@ -47,6 +47,7 @@
 #include <gio/gio.h>
 #include <pthread.h>
 #include <assert.h>
+#include <errno.h>
 
 #include "profanity.h"
 #include "event/client_events.h"
@@ -187,6 +188,25 @@ http_file_get(void* userdata)
     download_processes = g_slist_remove(download_processes, download);
     pthread_mutex_unlock(&lock);
 
+    if (download->cmd_template != NULL) {
+        gchar** argv = format_call_external_argv(download->cmd_template,
+                                                 download->url,
+                                                 download->filename);
+
+        // TODO(wstrm): Log the error.
+        if (!call_external(argv, NULL, NULL)) {
+            http_print_transfer_update(download->window, download->url,
+                                       "Downloading '%s' failed: Unable to call "
+                                       "command '%s' with file at '%s' (%s).",
+                                       download->url,
+                                       download->cmd_template,
+                                       download->filename,
+                                       "TODO(wstrm): Log the error");
+        }
+
+        g_strfreev(argv);
+    }
+
     free(download->url);
     free(download->filename);
     free(download);