aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-06-21 21:42:58 +0100
committerJames Booth <boothj5@gmail.com>2015-06-21 21:42:58 +0100
commit3d2f999efb9995e003f0d18dba059357721b272a (patch)
tree6ee40c60c550eead99a51de119c5d9e8f579b6b4 /src/command
parent446027b9505342c09f62f6d7a279c65a0d1db107 (diff)
downloadprofani-tty-3d2f999efb9995e003f0d18dba059357721b272a.tar.gz
Added PGP logging preferences
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c35
-rw-r--r--src/command/commands.c23
2 files changed, 49 insertions, 9 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 05ca9737..ac8b1deb 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -869,15 +869,18 @@ static struct cmd_t command_defs[] =
NULL } } },
{ "/pgp",
- cmd_pgp, parse_args, 1, 3, NULL,
- { "/pgp keys|libver|fps|start [contact]", "Open PGP.",
- { "/pgp keys|libver|fps|start [contact]",
- "------------------------------------",
- "Open PGP.",
- "keys : List private keys."
- "libver : Show which version of the libgpgme library is being used.",
- "fps : Show received fingerprints.",
- "start [contact] : Start PGP encrypted chat, current contact will be used if not specified.",
+ cmd_pgp, parse_args, 1, 2, NULL,
+ { "/pgp command [args..]", "Open PGP commands.",
+ { "/pgp command [args..]",
+ "---------------------",
+ "Open PGP commands.",
+ "",
+ "keys : List private keys."
+ "libver : Show which version of the libgpgme library is being used.",
+ "fps : Show received fingerprints.",
+ "start [contact] : Start PGP encrypted chat, current contact will be used if not specified.",
+ "end : End PGP encrypted chat with the current recipient.",
+ "log on|off|redact : OTR message logging, default: redact.",
NULL } } },
{ "/otr",
@@ -1236,6 +1239,7 @@ static Autocomplete resource_ac;
static Autocomplete inpblock_ac;
static Autocomplete receipts_ac;
static Autocomplete pgp_ac;
+static Autocomplete pgp_log_ac;
/*
* Initialise command autocompleter and history
@@ -1609,6 +1613,12 @@ cmd_init(void)
autocomplete_add(pgp_ac, "libver");
autocomplete_add(pgp_ac, "start");
autocomplete_add(pgp_ac, "end");
+ autocomplete_add(pgp_ac, "log");
+
+ pgp_log_ac = autocomplete_new();
+ autocomplete_add(pgp_log_ac, "on");
+ autocomplete_add(pgp_log_ac, "off");
+ autocomplete_add(pgp_log_ac, "redact");
}
void
@@ -1669,6 +1679,7 @@ cmd_uninit(void)
autocomplete_free(inpblock_ac);
autocomplete_free(receipts_ac);
autocomplete_free(pgp_ac);
+ autocomplete_free(pgp_log_ac);
}
gboolean
@@ -1842,6 +1853,7 @@ cmd_reset_autocomplete(ProfWin *window)
autocomplete_reset(inpblock_ac);
autocomplete_reset(receipts_ac);
autocomplete_reset(pgp_ac);
+ autocomplete_reset(pgp_log_ac);
if (window->type == WIN_CHAT) {
ProfChatWin *chatwin = (ProfChatWin*)window;
@@ -2485,6 +2497,11 @@ _pgp_autocomplete(ProfWin *window, const char * const input)
return found;
}
+ found = autocomplete_param_with_ac(input, "/pgp log", pgp_log_ac, TRUE);
+ if (found) {
+ return found;
+ }
+
found = autocomplete_param_with_ac(input, "/pgp", pgp_ac, TRUE);
if (found) {
return found;
diff --git a/src/command/commands.c b/src/command/commands.c
index 03a3f9f6..38f15a74 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -4145,6 +4145,29 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
+ if (g_strcmp0(args[0], "log") == 0) {
+ char *choice = args[1];
+ if (g_strcmp0(choice, "on") == 0) {
+ prefs_set_string(PREF_PGP_LOG, "on");
+ cons_show("PGP messages will be logged as plaintext.");
+ if (!prefs_get_boolean(PREF_CHLOG)) {
+ cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
+ }
+ } else if (g_strcmp0(choice, "off") == 0) {
+ prefs_set_string(PREF_PGP_LOG, "off");
+ cons_show("PGP message logging disabled.");
+ } else if (g_strcmp0(choice, "redact") == 0) {
+ prefs_set_string(PREF_PGP_LOG, "redact");
+ cons_show("PGP messages will be logged as '[redacted]'.");
+ if (!prefs_get_boolean(PREF_CHLOG)) {
+ cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
+ }
+ } else {
+ cons_show("Usage: %s", help.usage);
+ }
+ return TRUE;
+ }
+
if (g_strcmp0(args[0], "keys") == 0) {
GSList *keys = p_gpg_list_keys();
if (!keys) {