about summary refs log tree commit diff stats
path: root/src/command/cmd_funcs.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-17 08:57:35 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-17 08:57:35 +0100
commit7d596d8cef0c453ab2a4c57a7e5d51634e31af25 (patch)
tree14ec65a27e0735aec5ee068b641b51700dcef9ef /src/command/cmd_funcs.c
parent86bcadcbe3806439ca2039b39af08afd4db70429 (diff)
downloadprofani-tty-7d596d8cef0c453ab2a4c57a7e5d51634e31af25.tar.gz
Make /sendfile in PGP session configurable
`/pgp sendfile on` allows unencrypted file transfer in an PGP session.

Regards https://github.com/profanity-im/profanity/pull/1270
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r--src/command/cmd_funcs.c7
1 files changed, 6 insertions, 1 deletions
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