aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c15
-rw-r--r--src/command/cmd_defs.c7
-rw-r--r--src/command/cmd_funcs.c29
-rw-r--r--src/command/cmd_funcs.h1
4 files changed, 40 insertions, 12 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 1a29c9cc..89c2c931 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -234,7 +234,6 @@ static Autocomplete pgp_log_ac;
static Autocomplete pgp_sendfile_ac;
static Autocomplete ox_ac;
static Autocomplete ox_log_ac;
-static Autocomplete ox_sendfile_ac;
#endif
static Autocomplete tls_ac;
static Autocomplete titlebar_ac;
@@ -317,6 +316,7 @@ cmd_ac_init(void)
#endif
#ifdef HAVE_LIBGPGME
autocomplete_add(prefs_ac, "pgp");
+ autocomplete_add(prefs_ac, "ox");
#endif
#ifdef HAVE_OMEMO
autocomplete_add(prefs_ac, "omemo");
@@ -889,10 +889,14 @@ cmd_ac_init(void)
autocomplete_add(ox_ac, "end");
autocomplete_add(ox_ac, "log");
autocomplete_add(ox_ac, "char");
- autocomplete_add(ox_ac, "sendfile");
autocomplete_add(ox_ac, "announce");
autocomplete_add(ox_ac, "discover");
autocomplete_add(ox_ac, "request");
+
+ ox_log_ac = autocomplete_new();
+ autocomplete_add(ox_log_ac, "on");
+ autocomplete_add(ox_log_ac, "off");
+ autocomplete_add(ox_log_ac, "redact");
#endif
tls_ac = autocomplete_new();
@@ -1443,6 +1447,7 @@ cmd_ac_reset(ProfWin* window)
autocomplete_reset(pgp_log_ac);
autocomplete_reset(pgp_sendfile_ac);
autocomplete_reset(ox_ac);
+ autocomplete_reset(ox_log_ac);
#endif
autocomplete_reset(tls_ac);
autocomplete_reset(titlebar_ac);
@@ -1606,7 +1611,6 @@ cmd_ac_uninit(void)
autocomplete_free(pgp_sendfile_ac);
autocomplete_free(ox_ac);
autocomplete_free(ox_log_ac);
- autocomplete_free(ox_sendfile_ac);
#endif
autocomplete_free(tls_ac);
autocomplete_free(titlebar_ac);
@@ -2617,11 +2621,6 @@ _ox_autocomplete(ProfWin* window, const char* const input, gboolean previous)
return found;
}
- found = autocomplete_param_with_ac(input, "/ox sendfile", ox_sendfile_ac, TRUE, previous);
- if (found) {
- return found;
- }
-
if (strncmp(input, "/ox announce ", 13) == 0) {
return cmd_ac_complete_filepath(input, "/ox announce", previous);
}
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index b816ddcc..8c8af70f 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -1715,7 +1715,8 @@ static struct cmd_t command_defs[] = {
#ifdef HAVE_LIBGPGME
{ "/ox",
parse_args, 1, 3, NULL,
- CMD_NOSUBFUNCS
+ CMD_SUBFUNCS(
+ { "log", cmd_ox_log })
CMD_MAINFUNC(cmd_ox)
CMD_TAGS(
CMD_TAG_CHAT,
@@ -1727,7 +1728,6 @@ static struct cmd_t command_defs[] = {
"/ox end",
"/ox log on|off|redact",
"/ox char <char>",
- "/ox sendfile on|off",
"/ox announce <file>",
"/ox discover <jid>",
"/ox request <jid> <keyid>")
@@ -1746,8 +1746,7 @@ static struct cmd_t command_defs[] = {
{ "char <char>", "Set the character to be displayed next to PGP encrypted messages." },
{ "announce <file>", "Announce a public key by pushing it on the XMPP Server" },
{ "discover <jid>", "Discover public keys of a jid. The OpenPGP Key IDs will be displayed" },
- { "request <jid> <keyid>", "Request public key. See /ox discover to to get available key IDs." },
- { "sendfile on|off", "Allow /sendfile to send unencrypted files while otherwise using PGP." })
+ { "request <jid> <keyid>", "Request public key. See /ox discover to to get available key IDs." })
CMD_EXAMPLES(
"/ox log off",
"/ox start odin@valhalla.edda",
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index f1fa37f1..f5f2bc90 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -1743,6 +1743,10 @@ cmd_prefs(ProfWin* window, const char* const command, gchar** args)
cons_show("");
cons_show_omemo_prefs();
cons_show("");
+ } else if (strcmp(args[0], "ox") == 0) {
+ cons_show("");
+ cons_show_ox_prefs();
+ cons_show("");
} else {
cons_bad_cmd_usage(command);
}
@@ -7725,6 +7729,31 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
}
return TRUE;
}
+
+gboolean
+cmd_ox_log(ProfWin* window, const char* const command, gchar** args)
+{
+ char* choice = args[1];
+ if (g_strcmp0(choice, "on") == 0) {
+ prefs_set_string(PREF_OX_LOG, "on");
+ cons_show("OX messages will be logged as plaintext.");
+ if (!prefs_get_boolean(PREF_CHLOG)) {
+ cons_show("Chat logging is currently disabled, use '/logging chat on' to enable.");
+ }
+ } else if (g_strcmp0(choice, "off") == 0) {
+ prefs_set_string(PREF_OX_LOG, "off");
+ cons_show("OX message logging disabled.");
+ } else if (g_strcmp0(choice, "redact") == 0) {
+ prefs_set_string(PREF_OX_LOG, "redact");
+ cons_show("OX messages will be logged as '[redacted]'.");
+ if (!prefs_get_boolean(PREF_CHLOG)) {
+ cons_show("Chat logging is currently disabled, use '/logging chat on' to enable.");
+ }
+ } else {
+ cons_bad_cmd_usage(command);
+ }
+ return TRUE;
+}
#endif // HAVE_LIBGPGME
gboolean
diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h
index 41074720..d0a6a543 100644
--- a/src/command/cmd_funcs.h
+++ b/src/command/cmd_funcs.h
@@ -110,6 +110,7 @@ gboolean cmd_notify(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_pgp(ProfWin* window, const char* const command, gchar** args);
#ifdef HAVE_LIBGPGME
gboolean cmd_ox(ProfWin* window, const char* const command, gchar** args);
+gboolean cmd_ox_log(ProfWin* window, const char* const command, gchar** args);
#endif // HAVE_LIBGPGME
gboolean cmd_outtype(ProfWin* window, const char* const command, gchar** args);
gboolean cmd_prefs(ProfWin* window, const char* const command, gchar** args);