Added PREF_OTR_POLICY to preferences.c -> key -> otr.policy

Added default value "manual" to PREF_OTR_POLICy -> preferences.c
Modified help string to reflect otr_policy, started checks on cmd_otr
This commit is contained in:
lightb
2014-04-19 04:00:41 -04:00
parent 3303376b42
commit 02b77cfa4e
4 changed files with 15 additions and 2 deletions

View File

@@ -594,8 +594,8 @@ static struct cmd_t command_defs[] =
{ "/otr",
cmd_otr, parse_args, 1, 2, NULL,
{ "/otr gen|myfp|theirfp|start|end|trust|untrust|log|warn|libver", "Off The Record encryption commands.",
{ "/otr gen|myfp|theirfp|start|end|trust|untrust|log|warn|libver",
{ "/otr gen|myfp|theirfp|start|end|trust|untrust|log|warn|libver|policy", "Off The Record encryption commands.",
{ "/otr gen|myfp|theirfp|start|end|trust|untrust|log|warn|libver|policy",
"-------------------------------------------------------------",
"gen - Generate your private key.",
"myfp - Show your fingerprint.",
@@ -607,6 +607,7 @@ static struct cmd_t command_defs[] =
"log - How to log OTR messages, options are 'on', 'off' and 'redact', with redaction being the default.",
"warn - Show when unencrypted messaging is being used in the title bar, options are 'on' and 'off' with 'on' being the default.",
"libver - Show which version of the libotr library is being used.",
"policy - manual, opportunistic or always.",
NULL } } },
{ "/outtype",

View File

@@ -2609,6 +2609,13 @@ cmd_otr(gchar **args, struct cmd_help_t help)
char *version = otr_libotr_version();
cons_show("Using libotr version %s", version);
return TRUE;
} else if (strcmp(args[0], "policy") == 0) {
char *choice = args[1];
if (g_strcmp0(choice, "manual") == 0) {
prefs_set_string(PREF_OTR_POLICY, "manual");
cons_show("OTR policy is now set to: manual");
}
return TRUE;
}
if (jabber_get_connection_status() != JABBER_CONNECTED) {