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
This commit is contained in:
Michael Vetter
2020-02-17 08:44:26 +01:00
parent 36713a2ed7
commit 86bcadcbe3
7 changed files with 47 additions and 6 deletions

View File

@@ -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.");
@@ -7809,6 +7810,19 @@ cmd_otr_answer(ProfWin *window, const char *const command, gchar **args)
#endif
}
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)
{