Remove /omemo sendfile

This commit is contained in:
William Wennerström
2020-06-28 15:26:13 +02:00
parent f4ab1ca9e7
commit 9d58472c8c
7 changed files with 556 additions and 593 deletions

View File

@@ -193,7 +193,6 @@ static Autocomplete otr_sendfile_ac;
static Autocomplete omemo_ac; static Autocomplete omemo_ac;
static Autocomplete omemo_log_ac; static Autocomplete omemo_log_ac;
static Autocomplete omemo_policy_ac; static Autocomplete omemo_policy_ac;
static Autocomplete omemo_sendfile_ac;
#endif #endif
static Autocomplete connect_property_ac; static Autocomplete connect_property_ac;
static Autocomplete tls_property_ac; static Autocomplete tls_property_ac;
@@ -683,7 +682,6 @@ cmd_ac_init(void)
autocomplete_add(omemo_ac, "clear_device_list"); autocomplete_add(omemo_ac, "clear_device_list");
autocomplete_add(omemo_ac, "policy"); autocomplete_add(omemo_ac, "policy");
autocomplete_add(omemo_ac, "char"); autocomplete_add(omemo_ac, "char");
autocomplete_add(omemo_ac, "sendfile");
omemo_log_ac = autocomplete_new(); omemo_log_ac = autocomplete_new();
autocomplete_add(omemo_log_ac, "on"); autocomplete_add(omemo_log_ac, "on");
@@ -694,10 +692,6 @@ cmd_ac_init(void)
autocomplete_add(omemo_policy_ac, "manual"); autocomplete_add(omemo_policy_ac, "manual");
autocomplete_add(omemo_policy_ac, "automatic"); autocomplete_add(omemo_policy_ac, "automatic");
autocomplete_add(omemo_policy_ac, "always"); autocomplete_add(omemo_policy_ac, "always");
omemo_sendfile_ac = autocomplete_new();
autocomplete_add(omemo_sendfile_ac, "on");
autocomplete_add(omemo_sendfile_ac, "off");
#endif #endif
connect_property_ac = autocomplete_new(); connect_property_ac = autocomplete_new();
@@ -1292,7 +1286,6 @@ cmd_ac_reset(ProfWin* window)
autocomplete_reset(omemo_ac); autocomplete_reset(omemo_ac);
autocomplete_reset(omemo_log_ac); autocomplete_reset(omemo_log_ac);
autocomplete_reset(omemo_policy_ac); autocomplete_reset(omemo_policy_ac);
autocomplete_reset(omemo_sendfile_ac);
#endif #endif
autocomplete_reset(connect_property_ac); autocomplete_reset(connect_property_ac);
autocomplete_reset(tls_property_ac); autocomplete_reset(tls_property_ac);
@@ -1450,7 +1443,6 @@ cmd_ac_uninit(void)
autocomplete_free(omemo_ac); autocomplete_free(omemo_ac);
autocomplete_free(omemo_log_ac); autocomplete_free(omemo_log_ac);
autocomplete_free(omemo_policy_ac); autocomplete_free(omemo_policy_ac);
autocomplete_free(omemo_sendfile_ac);
#endif #endif
autocomplete_free(connect_property_ac); autocomplete_free(connect_property_ac);
autocomplete_free(tls_property_ac); autocomplete_free(tls_property_ac);
@@ -2510,11 +2502,6 @@ _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous)
return found; return found;
} }
found = autocomplete_param_with_ac(input, "/omemo sendfile", omemo_sendfile_ac, TRUE, previous);
if (found) {
return found;
}
jabber_conn_status_t conn_status = connection_get_status(); jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED) { if (conn_status == JABBER_CONNECTED) {

View File

@@ -2285,8 +2285,7 @@ static struct cmd_t command_defs[] = {
{ "fingerprint", cmd_omemo_fingerprint }, { "fingerprint", cmd_omemo_fingerprint },
{ "char", cmd_omemo_char }, { "char", cmd_omemo_char },
{ "policy", cmd_omemo_policy }, { "policy", cmd_omemo_policy },
{ "clear_device_list", cmd_omemo_clear_device_list }, { "clear_device_list", cmd_omemo_clear_device_list })
{ "sendfile", cmd_omemo_sendfile })
CMD_NOMAINFUNC CMD_NOMAINFUNC
CMD_TAGS( CMD_TAGS(
CMD_TAG_CHAT, CMD_TAG_CHAT,
@@ -2300,7 +2299,6 @@ static struct cmd_t command_defs[] = {
"/omemo fingerprint [<contact>]", "/omemo fingerprint [<contact>]",
"/omemo char <char>", "/omemo char <char>",
"/omemo policy manual|automatic|always", "/omemo policy manual|automatic|always",
"/omemo sendfile on|off",
"/omemo clear_device_list") "/omemo clear_device_list")
CMD_DESC( CMD_DESC(
"OMEMO commands to manage keys, and perform encryption during chat sessions.") "OMEMO commands to manage keys, and perform encryption during chat sessions.")
@@ -2315,7 +2313,6 @@ static struct cmd_t command_defs[] = {
{ "policy manual", "Set the global OMEMO policy to manual, OMEMO sessions must be started manually." }, { "policy manual", "Set the global OMEMO policy to manual, OMEMO sessions must be started manually." },
{ "policy automatic", "Set the global OMEMO policy to opportunistic, an OMEMO session will be attempted upon starting a conversation." }, { "policy automatic", "Set the global OMEMO policy to opportunistic, an OMEMO session will be attempted upon starting a conversation." },
{ "policy always", "Set the global OMEMO policy to always, an error will be displayed if an OMEMO session cannot be initiated upon starting a conversation." }, { "policy always", "Set the global OMEMO policy to always, an error will be displayed if an OMEMO session cannot be initiated upon starting a conversation." },
{ "sendfile on|off", "Allow /sendfile to send unencrypted files while in an OMEMO session." },
{ "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back."}) { "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back."})
CMD_EXAMPLES( CMD_EXAMPLES(
"/omemo gen", "/omemo gen",

View File

@@ -4858,7 +4858,7 @@ cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
#ifdef HAVE_OMEMO #ifdef HAVE_OMEMO
if (chatwin->is_omemo && !prefs_get_boolean(PREF_OMEMO_SENDFILE)) { if (chatwin->is_omemo) {
// Create temporary file for writing ciphertext. // Create temporary file for writing ciphertext.
int tmpfd; int tmpfd;
@@ -8831,19 +8831,6 @@ cmd_omemo_policy(ProfWin* window, const char* const command, gchar** args)
#endif #endif
} }
gboolean
cmd_omemo_sendfile(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_OMEMO
_cmd_set_boolean_preference(args[1], command, "Sending unencrypted files in an OMEMO session via /sendfile", PREF_OMEMO_SENDFILE);
return TRUE;
#else
cons_show("This version of Profanity has not been built with OMEMO support enabled");
return TRUE;
#endif
}
gboolean gboolean
cmd_save(ProfWin *window, const char *const command, gchar **args) cmd_save(ProfWin *window, const char *const command, gchar **args)
{ {

View File

@@ -128,6 +128,7 @@ gboolean cmd_status_get(ProfWin* window, const char* const command, gchar** args
gboolean cmd_status_set(ProfWin *window, const char *const command, gchar **args); gboolean cmd_status_set(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_sub(ProfWin *window, const char *const command, gchar **args); gboolean cmd_sub(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_theme(ProfWin *window, const char *const command, gchar **args); gboolean cmd_theme(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_tiny(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_wintitle(ProfWin *window, const char *const command, gchar **args); gboolean cmd_wintitle(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_vercheck(ProfWin *window, const char *const command, gchar **args); gboolean cmd_vercheck(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_who(ProfWin *window, const char *const command, gchar **args); gboolean cmd_who(ProfWin *window, const char *const command, gchar **args);
@@ -223,7 +224,6 @@ gboolean cmd_omemo_trust(ProfWin* window, const char* const command, gchar** arg
gboolean cmd_omemo_untrust(ProfWin *window, const char *const command, gchar **args); gboolean cmd_omemo_untrust(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_policy(ProfWin *window, const char *const command, gchar **args); gboolean cmd_omemo_policy(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_clear_device_list(ProfWin *window, const char *const command, gchar **args); gboolean cmd_omemo_clear_device_list(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_sendfile(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_save(ProfWin *window, const char *const command, gchar **args); gboolean cmd_save(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_reload(ProfWin *window, const char *const command, gchar **args); gboolean cmd_reload(ProfWin *window, const char *const command, gchar **args);

View File

@@ -1790,7 +1790,8 @@ _save_prefs(void)
static const char* static const char*
_get_group(preference_t pref) _get_group(preference_t pref)
{ {
switch (pref) { switch (pref)
{
case PREF_CLEAR_PERSIST_HISTORY: case PREF_CLEAR_PERSIST_HISTORY:
case PREF_SPLASH: case PREF_SPLASH:
case PREF_BEEP: case PREF_BEEP:
@@ -1925,7 +1926,6 @@ _get_group(preference_t pref)
return PREF_GROUP_PLUGINS; return PREF_GROUP_PLUGINS;
case PREF_OMEMO_LOG: case PREF_OMEMO_LOG:
case PREF_OMEMO_POLICY: case PREF_OMEMO_POLICY:
case PREF_OMEMO_SENDFILE:
return PREF_GROUP_OMEMO; return PREF_GROUP_OMEMO;
default: default:
return NULL; return NULL;
@@ -1937,7 +1937,8 @@ _get_group(preference_t pref)
static const char* static const char*
_get_key(preference_t pref) _get_key(preference_t pref)
{ {
switch (pref) { switch (pref)
{
case PREF_CLEAR_PERSIST_HISTORY: case PREF_CLEAR_PERSIST_HISTORY:
return "clear.persist_history"; return "clear.persist_history";
case PREF_SPLASH: case PREF_SPLASH:
@@ -2172,8 +2173,6 @@ _get_key(preference_t pref)
return "log"; return "log";
case PREF_OMEMO_POLICY: case PREF_OMEMO_POLICY:
return "policy"; return "policy";
case PREF_OMEMO_SENDFILE:
return "sendfile";
case PREF_CORRECTION_ALLOW: case PREF_CORRECTION_ALLOW:
return "correction.allow"; return "correction.allow";
case PREF_AVATAR_CMD: case PREF_AVATAR_CMD:

View File

@@ -165,7 +165,6 @@ typedef enum {
PREF_STATUSBAR_ROOM, PREF_STATUSBAR_ROOM,
PREF_OMEMO_LOG, PREF_OMEMO_LOG,
PREF_OMEMO_POLICY, PREF_OMEMO_POLICY,
PREF_OMEMO_SENDFILE,
PREF_OCCUPANTS_WRAP, PREF_OCCUPANTS_WRAP,
PREF_CORRECTION_ALLOW, PREF_CORRECTION_ALLOW,
PREF_AVATAR_CMD, PREF_AVATAR_CMD,

View File

@@ -2192,13 +2192,7 @@ cons_show_omemo_prefs(void)
cons_show("OMEMO char (/omemo char) : %s", ch); cons_show("OMEMO char (/omemo char) : %s", ch);
free(ch); free(ch);
if (prefs_get_boolean(PREF_OMEMO_SENDFILE)) { cons_alert();
cons_show("Allow sending unencrypted files in an OMEMO session via /sendfile (/omemo sendfile): ON");
} else {
cons_show("Allow sending unencrypted files in an OMEMO session via /sendfile (/omemo sendfile): OFF");
}
cons_alert(NULL);
} }
void void