about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorPierre Mazière <pierre.maziere@gmx.com>2020-06-12 09:19:14 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-06-25 15:03:04 +0200
commitc56d530b67d09267eb46cba029217e4b84b32cef (patch)
tree57121308b6c03de165e8fb9bb8dd4af405d3f477 /src/config
parent7e652f4ca0f5dd26c841137ac15e23e74f9cc920 (diff)
downloadprofani-tty-c56d530b67d09267eb46cba029217e4b84b32cef.tar.gz
Replace /urlopen with /url and adapt /executable
/urlopen is replaced by /url with the following sub commands:
/url open <url>
/url save <url> [<path>]

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
Diffstat (limited to 'src/config')
-rw-r--r--src/config/preferences.c19
-rw-r--r--src/config/preferences.h1
2 files changed, 17 insertions, 3 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index a3a90692..7187460a 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -64,6 +64,7 @@
 #define PREF_GROUP_OMEMO "omemo"
 #define PREF_GROUP_MUC "muc"
 #define PREF_GROUP_PLUGINS "plugins"
+#define PREF_GROUP_EXECUTABLES "executables"
 
 #define INPBLOCK_DEFAULT 1000
 
@@ -1855,9 +1856,11 @@ _get_group(preference_t pref)
         case PREF_GRLOG:
         case PREF_LOG_ROTATE:
         case PREF_LOG_SHARED:
+            return PREF_GROUP_LOGGING;
         case PREF_AVATAR_CMD:
         case PREF_URL_OPEN_CMD:
-            return PREF_GROUP_LOGGING;
+        case PREF_URL_SAVE_CMD:
+            return PREF_GROUP_EXECUTABLES;
         case PREF_AUTOAWAY_CHECK:
         case PREF_AUTOAWAY_MODE:
         case PREF_AUTOAWAY_MESSAGE:
@@ -2147,7 +2150,9 @@ _get_key(preference_t pref)
         case PREF_MAM:
             return "mam";
         case PREF_URL_OPEN_CMD:
-            return "urlopen.cmd";
+            return "url.open.cmd";
+        case PREF_URL_SAVE_CMD:
+            return "url.save.cmd";
         default:
             return NULL;
     }
@@ -2284,8 +2289,9 @@ _get_default_string(preference_t pref)
         case PREF_COLOR_NICK:
             return "false";
         case PREF_AVATAR_CMD:
-        case PREF_URL_OPEN_CMD:
             return "xdg-open";
+        case PREF_URL_SAVE_CMD:
+            return "curl -o %p %u";
         default:
             return NULL;
     }
@@ -2296,8 +2302,15 @@ _get_default_string(preference_t pref)
 static char**
 _get_default_string_list(preference_t pref)
 {
+    char **str_array = NULL;
+
     switch (pref)
     {
+        case PREF_URL_OPEN_CMD:
+            str_array = g_malloc0(3);
+            str_array[0] = g_strdup("false");
+            str_array[1] = g_strdup("xdg-open %u");
+            return str_array;
         default:
             return NULL;
     }
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 4c9b7bd8..1823097a 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -172,6 +172,7 @@ typedef enum {
     PREF_SLASH_GUARD,
     PREF_MAM,
     PREF_URL_OPEN_CMD,
+    PREF_URL_SAVE_CMD,
 } preference_t;
 
 typedef struct prof_alias_t {