about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_ac.c13
-rw-r--r--src/command/cmd_defs.c6
-rw-r--r--src/command/cmd_funcs.c7
-rw-r--r--src/config/preferences.c3
-rw-r--r--src/config/preferences.h1
-rw-r--r--src/ui/console.c6
6 files changed, 33 insertions, 3 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 7d170d10..4d6c1d90 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -206,6 +206,7 @@ static Autocomplete inpblock_ac;
 static Autocomplete receipts_ac;
 static Autocomplete pgp_ac;
 static Autocomplete pgp_log_ac;
+static Autocomplete pgp_sendfile_ac;
 static Autocomplete tls_ac;
 static Autocomplete titlebar_ac;
 static Autocomplete titlebar_show_ac;
@@ -788,12 +789,17 @@ cmd_ac_init(void)
     autocomplete_add(pgp_ac, "end");
     autocomplete_add(pgp_ac, "log");
     autocomplete_add(pgp_ac, "char");
+    autocomplete_add(pgp_ac, "sendfile");
 
     pgp_log_ac = autocomplete_new();
     autocomplete_add(pgp_log_ac, "on");
     autocomplete_add(pgp_log_ac, "off");
     autocomplete_add(pgp_log_ac, "redact");
 
+    pgp_sendfile_ac = autocomplete_new();
+    autocomplete_add(pgp_sendfile_ac, "on");
+    autocomplete_add(pgp_sendfile_ac, "off");
+
     tls_ac = autocomplete_new();
     autocomplete_add(tls_ac, "allow");
     autocomplete_add(tls_ac, "always");
@@ -1229,6 +1235,7 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(receipts_ac);
     autocomplete_reset(pgp_ac);
     autocomplete_reset(pgp_log_ac);
+    autocomplete_reset(pgp_sendfile_ac);
     autocomplete_reset(tls_ac);
     autocomplete_reset(titlebar_ac);
     autocomplete_reset(titlebar_show_ac);
@@ -1374,6 +1381,7 @@ cmd_ac_uninit(void)
     autocomplete_free(receipts_ac);
     autocomplete_free(pgp_ac);
     autocomplete_free(pgp_log_ac);
+    autocomplete_free(pgp_sendfile_ac);
     autocomplete_free(tls_ac);
     autocomplete_free(titlebar_ac);
     autocomplete_free(titlebar_show_ac);
@@ -2274,6 +2282,11 @@ _pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous)
         return found;
     }
 
+    found = autocomplete_param_with_ac(input, "/pgp sendfile", pgp_sendfile_ac, TRUE, previous);
+    if (found) {
+        return found;
+    }
+
 #ifdef HAVE_LIBGPGME
     gboolean result;
     gchar **args = parse_args(input, 2, 3, &result);
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 3897efc1..1e655a26 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -1657,7 +1657,8 @@ static struct cmd_t command_defs[] =
             "/pgp start [<contact>]",
             "/pgp end",
             "/pgp log on|off|redact",
-            "/pgp char <char>")
+            "/pgp char <char>",
+            "/pgp sendfile on|off")
         CMD_DESC(
             "Open PGP commands to manage keys, and perform PGP encryption during chat sessions. "
             "See the /account command to set your own PGP key.")
@@ -1670,7 +1671,8 @@ static struct cmd_t command_defs[] =
             { "end",                      "End PGP encrypted chat with the current recipient." },
             { "log on|off",               "Enable or disable plaintext logging of PGP encrypted messages." },
             { "log redact",               "Log PGP encrypted messages, but replace the contents with [redacted]. This is the default." },
-            { "char <char>",              "Set the character to be displayed next to PGP encrypted messages." })
+            { "char <char>",              "Set the character to be displayed next to PGP encrypted messages." },
+            { "sendfile on|off",          "Allow /sendfile to send unencrypted files while otherwise using PGP session."})
         CMD_EXAMPLES(
             "/pgp log off",
             "/pgp setkey buddy@buddychat.org BA19CACE5A9592C5",
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index e93397cb..7bc8a027 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -4818,7 +4818,7 @@ cmd_sendfile(ProfWin *window, const char *const command, gchar **args)
             assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
 
             if ((chatwin->is_omemo && !prefs_get_boolean(PREF_OMEMO_SENDFILE))
-                    || (chatwin->pgp_send)
+                    || (chatwin->pgp_send && !prefs_get_boolean(PREF_PGP_SENDFILE))
                     || (chatwin->is_otr && !prefs_get_boolean(PREF_OTR_SENDFILE))) {
                 cons_show_error("Uploading '%s' failed: Encrypted file uploads not yet implemented!", filename);
                 win_println(window, THEME_ERROR, '-', "Sending encrypted files via http_upload is not possible yet.");
@@ -7337,6 +7337,11 @@ cmd_pgp(ProfWin *window, const char *const command, gchar **args)
         return TRUE;
     }
 
+    if (g_strcmp0(args[0], "sendfile") == 0) {
+        _cmd_set_boolean_preference(args[1], command, "Sending unencrypted files using /sendfile while otherwise using PGP", PREF_PGP_SENDFILE);
+        return TRUE;
+    }
+
     cons_bad_cmd_usage(command);
     return TRUE;
 #else
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 085aa910..52ce5ca9 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -1793,6 +1793,7 @@ _get_group(preference_t pref)
         case PREF_OTR_SENDFILE:
             return PREF_GROUP_OTR;
         case PREF_PGP_LOG:
+        case PREF_PGP_SENDFILE:
             return PREF_GROUP_PGP;
         case PREF_BOOKMARK_INVITE:
         case PREF_ROOM_LIST_CACHE:
@@ -2003,6 +2004,8 @@ _get_key(preference_t pref)
             return "titlebar.muc.title";
         case PREF_PGP_LOG:
             return "log";
+        case PREF_PGP_SENDFILE:
+            return "sendfile";
         case PREF_TLS_CERTPATH:
             return "tls.certpath";
         case PREF_TLS_SHOW:
diff --git a/src/config/preferences.h b/src/config/preferences.h
index d850df5c..4d04fd7d 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -142,6 +142,7 @@ typedef enum {
     PREF_ENC_WARN,
     PREF_TITLEBAR_MUC_TITLE,
     PREF_PGP_LOG,
+    PREF_PGP_SENDFILE,
     PREF_TLS_CERTPATH,
     PREF_TLS_SHOW,
     PREF_LASTACTIVITY,
diff --git a/src/ui/console.c b/src/ui/console.c
index 4877725d..c0abbc36 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -2098,6 +2098,12 @@ cons_show_pgp_prefs(void)
     char ch = prefs_get_pgp_char();
     cons_show("PGP char (/pgp char)     : %c", ch);
 
+    if (prefs_get_boolean(PREF_PGP_SENDFILE)) {
+        cons_show("Allow sending unencrypted files via /sendfile while otherwise using PGP (/pgp sendfile): ON");
+    } else {
+        cons_show("Allow sending unencrypted files via /sendfile while otherwise using PGP (/pgp sendfile): OFF");
+    }
+
     cons_alert();
 }