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:44:26 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-17 08:51:43 +0100
commit86bcadcbe3806439ca2039b39af08afd4db70429 (patch)
tree65cdedab59a065e06be84cc40e286a033308a13c /src/command/cmd_funcs.c
parent36713a2ed73368cf1892ce1fa43bb74106657391 (diff)
downloadprofani-tty-86bcadcbe3806439ca2039b39af08afd4db70429.tar.gz
Make /sendfile in OTR session configurable
`/otr sendfile on` allows unencrypted file transfer in an OMEMO 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.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index e5c540c3..e93397cb 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -4819,7 +4819,7 @@ cmd_sendfile(ProfWin *window, const char *const command, gchar **args)
 
             if ((chatwin->is_omemo && !prefs_get_boolean(PREF_OMEMO_SENDFILE))
                     || (chatwin->pgp_send)
-                    || (chatwin->is_otr)) {
+                    || (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.");
                 free(filename);
@@ -4829,7 +4829,8 @@ cmd_sendfile(ProfWin *window, const char *const command, gchar **args)
         }
         case WIN_PRIVATE:
         {
-            break; //we don't support encryption in private muc windows anyway
+            //we don't support encryption in private muc windows
+            break;
         }
         default:
 			cons_show_error("Unsupported window for file transmission.");
@@ -7810,6 +7811,19 @@ cmd_otr_answer(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
+cmd_otr_sendfile(ProfWin *window, const char *const command, gchar **args)
+{
+#ifdef HAVE_LIBOTR
+    _cmd_set_boolean_preference(args[1], command, "Sending unencrypted files in an OTR session via /sendfile", PREF_OTR_SENDFILE);
+
+    return TRUE;
+#else
+    cons_show("This version of Profanity has not been built with OTR support enabled");
+    return TRUE;
+#endif
+}
+
+gboolean
 cmd_command_list(ProfWin *window, const char *const command, gchar **args)
 {
     jabber_conn_status_t conn_status = connection_get_status();