1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added /otr policy to commands (still need to add autocomplete stuff?)

This commit is contained in:
lightb 2014-04-19 04:18:53 -04:00
parent 02b77cfa4e
commit a687e3f6b4
3 changed files with 21 additions and 2 deletions

View File

@ -2610,11 +2610,28 @@ cmd_otr(gchar **args, struct cmd_help_t help)
cons_show("Using libotr version %s", version);
return TRUE;
} else if (strcmp(args[0], "policy") == 0) {
if (args[1] == NULL) {
char *policy = prefs_get_string(PREF_OTR_POLICY);
cons_show("OTR policy is now set to: %s", policy);
return TRUE;
}
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");
}
} else
if (g_strcmp0(choice, "opportunistic") == 0) {
prefs_set_string(PREF_OTR_POLICY, "opportunistic");
cons_show("OTR policy is now set to: opportunistic");
} else
if (g_strcmp0(choice, "always") == 0) {
prefs_set_string(PREF_OTR_POLICY, "always");
cons_show("OTR policy is now set to: always");
} else
{
cons_show("OTR policy can be set to: manual, opportunistic or always.");
}
return TRUE;
}

View File

@ -45,6 +45,7 @@
#define PREF_GROUP_PRESENCE "presence"
#define PREF_GROUP_CONNECTION "connection"
#define PREF_GROUP_ALIAS "alias"
#define PREF_GROUP_OTR_POLICY "policy"
static gchar *prefs_loc;
static GKeyFile *prefs;
@ -396,6 +397,8 @@ _get_group(preference_t pref)
case PREF_LOG_ROTATE:
case PREF_LOG_SHARED:
return PREF_GROUP_LOGGING;
case PREF_OTR_POLICY:
return PREF_GROUP_OTR_POLICY;
case PREF_AUTOAWAY_CHECK:
case PREF_AUTOAWAY_MODE:
case PREF_AUTOAWAY_MESSAGE:

View File

@ -421,7 +421,6 @@ _otr_get_their_fingerprint(const char * const recipient)
static char *
_otr_encrypt_message(const char * const to, const char * const message)
{
return NULL;
char *newmessage = NULL;
gcry_error_t err = otrlib_encrypt_message(user_state, &ops, jid, to, message, &newmessage);