mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Merge branch 'master' into plugins
Conflicts: src/command/command.c
This commit is contained in:
commit
69916c2cc5
@ -738,6 +738,7 @@ static struct cmd_t command_defs[] =
|
||||
"password : Password for the account, note this is currently stored in plaintext if set.",
|
||||
"muc : The default MUC chat service to use.",
|
||||
"nick : The default nickname to use when joining chat rooms.",
|
||||
"otr : Override global OTR policy for this account: manual, opportunistic or always.",
|
||||
"",
|
||||
"The clear command may use one of the following for 'property'.",
|
||||
"password : Clears the password for the account.",
|
||||
@ -962,6 +963,7 @@ cmd_init(void)
|
||||
autocomplete_add(prefs_ac, "log");
|
||||
autocomplete_add(prefs_ac, "conn");
|
||||
autocomplete_add(prefs_ac, "presence");
|
||||
autocomplete_add(prefs_ac, "otr");
|
||||
|
||||
notify_ac = autocomplete_new();
|
||||
autocomplete_add(notify_ac, "message");
|
||||
@ -1034,9 +1036,11 @@ cmd_init(void)
|
||||
autocomplete_add(account_set_ac, "password");
|
||||
autocomplete_add(account_set_ac, "muc");
|
||||
autocomplete_add(account_set_ac, "nick");
|
||||
autocomplete_add(account_set_ac, "otr");
|
||||
|
||||
account_clear_ac = autocomplete_new();
|
||||
autocomplete_add(account_clear_ac, "password");
|
||||
autocomplete_add(account_clear_ac, "otr");
|
||||
|
||||
close_ac = autocomplete_new();
|
||||
autocomplete_add(close_ac, "read");
|
||||
@ -1381,7 +1385,7 @@ cmd_execute_default(const char * const inp)
|
||||
char *plugin_message = plugins_on_message_send(recipient_jid, inp);
|
||||
|
||||
#ifdef PROF_HAVE_LIBOTR
|
||||
if ((strcmp(prefs_get_string(PREF_OTR_POLICY), "always") == 0) && !otr_is_secure(recipient)) {
|
||||
if ((strcmp(otr_get_policy(recipient), "always") == 0) && !otr_is_secure(recipient)) {
|
||||
cons_show_error("Failed to send message. Please check OTR policy");
|
||||
return TRUE;
|
||||
}
|
||||
@ -2011,15 +2015,25 @@ _account_autocomplete(char *input, int *size)
|
||||
gboolean result = FALSE;
|
||||
|
||||
input[*size] = '\0';
|
||||
gchar **args = parse_args(input, 3, 3, &result);
|
||||
gchar **args = parse_args(input, 3, 4, &result);
|
||||
|
||||
if ((strncmp(input, "/account set", 12) == 0) && (result == TRUE)) {
|
||||
GString *beginning = g_string_new("/account set ");
|
||||
g_string_append(beginning, args[1]);
|
||||
found = autocomplete_param_with_ac(input, size, beginning->str, account_set_ac);
|
||||
g_string_free(beginning, TRUE);
|
||||
if (found != NULL) {
|
||||
return found;
|
||||
if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "otr")) == 0) {
|
||||
g_string_append(beginning, " ");
|
||||
g_string_append(beginning, args[2]);
|
||||
found = autocomplete_param_with_ac(input, size, beginning->str, otr_policy_ac);
|
||||
g_string_free(beginning, TRUE);
|
||||
if (found != NULL) {
|
||||
return found;
|
||||
}
|
||||
} else {
|
||||
found = autocomplete_param_with_ac(input, size, beginning->str, account_set_ac);
|
||||
g_string_free(beginning, TRUE);
|
||||
if (found != NULL) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,6 +266,16 @@ cmd_account(gchar **args, struct cmd_help_t help)
|
||||
accounts_set_muc_nick(account_name, value);
|
||||
cons_show("Updated muc nick for account %s: %s", account_name, value);
|
||||
cons_show("");
|
||||
} else if (strcmp(property, "otr") == 0) {
|
||||
if ((g_strcmp0(value, "manual") != 0)
|
||||
&& (g_strcmp0(value, "opportunistic") != 0)
|
||||
&& (g_strcmp0(value, "always") != 0)) {
|
||||
cons_show("OTR policy must be one of: manual, opportunistic or always.");
|
||||
} else {
|
||||
accounts_set_otr_policy(account_name, value);
|
||||
cons_show("Updated OTR policy for account %s: %s", account_name, value);
|
||||
cons_show("");
|
||||
}
|
||||
} else if (strcmp(property, "status") == 0) {
|
||||
if (!valid_resource_presence_string(value) && (strcmp(value, "last") != 0)) {
|
||||
cons_show("Invalid status: %s", value);
|
||||
@ -332,6 +342,10 @@ cmd_account(gchar **args, struct cmd_help_t help)
|
||||
accounts_clear_password(account_name);
|
||||
cons_show("Removed password for account %s", account_name);
|
||||
cons_show("");
|
||||
} else if (strcmp(property, "otr") == 0) {
|
||||
accounts_clear_otr(account_name);
|
||||
cons_show("OTR policy removed for account %s", account_name);
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Invalid property: %s", property);
|
||||
cons_show("");
|
||||
@ -654,6 +668,10 @@ cmd_prefs(gchar **args, struct cmd_help_t help)
|
||||
cons_show("");
|
||||
cons_show_presence_prefs();
|
||||
cons_show("");
|
||||
} else if (strcmp(args[0], "otr") == 0) {
|
||||
cons_show("");
|
||||
cons_show_otr_prefs();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
}
|
||||
@ -992,7 +1010,7 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
||||
cons_show_error("Failed to encrypt and send message,");
|
||||
}
|
||||
} else {
|
||||
char *policy = prefs_get_string(PREF_OTR_POLICY);
|
||||
char *policy = otr_get_policy(usr_jid);
|
||||
|
||||
if (strcmp(policy, "always") == 0) {
|
||||
cons_show_error("Failed to send message. Please check OTR policy");
|
||||
|
@ -34,7 +34,7 @@ account_new(const gchar * const name, const gchar * const jid,
|
||||
int port, const gchar * const resource, const gchar * const last_presence,
|
||||
const gchar * const login_presence, int priority_online, int priority_chat,
|
||||
int priority_away, int priority_xa, int priority_dnd,
|
||||
const gchar * const muc_service, const gchar * const muc_nick)
|
||||
const gchar * const muc_service, const gchar * const muc_nick, const gchar * const otr_policy)
|
||||
{
|
||||
ProfAccount *new_account = malloc(sizeof(ProfAccount));
|
||||
|
||||
@ -111,6 +111,12 @@ account_new(const gchar * const name, const gchar * const jid,
|
||||
new_account->muc_nick = strdup(muc_nick);
|
||||
}
|
||||
|
||||
if (otr_policy != NULL) {
|
||||
new_account->otr_policy = strdup(otr_policy);
|
||||
} else {
|
||||
new_account->otr_policy = NULL;
|
||||
}
|
||||
|
||||
return new_account;
|
||||
}
|
||||
|
||||
@ -137,7 +143,7 @@ account_free(ProfAccount *account)
|
||||
free(account->login_presence);
|
||||
free(account->muc_service);
|
||||
free(account->muc_nick);
|
||||
free(account->otr_policy);
|
||||
free(account);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -42,6 +42,7 @@ typedef struct prof_account_t {
|
||||
gchar *muc_service;
|
||||
gchar *muc_nick;
|
||||
gboolean enabled;
|
||||
gchar *otr_policy;
|
||||
} ProfAccount;
|
||||
|
||||
ProfAccount* account_new(const gchar * const name, const gchar * const jid,
|
||||
@ -49,7 +50,7 @@ ProfAccount* account_new(const gchar * const name, const gchar * const jid,
|
||||
int port, const gchar * const resource, const gchar * const last_presence,
|
||||
const gchar * const login_presence, int priority_online, int priority_chat,
|
||||
int priority_away, int priority_xa, int priority_dnd,
|
||||
const gchar * const muc_service, const gchar * const muc_nick);
|
||||
const gchar * const muc_service, const gchar * const muc_nick, const gchar * const otr_policy);
|
||||
|
||||
char* account_create_full_jid(ProfAccount *account);
|
||||
|
||||
|
@ -50,7 +50,8 @@ static gchar *string_keys[] = {
|
||||
"presence.last",
|
||||
"presence.login",
|
||||
"muc.service",
|
||||
"muc.nick"
|
||||
"muc.nick",
|
||||
"otr.policy"
|
||||
};
|
||||
|
||||
static void _fix_legacy_accounts(const char * const account_name);
|
||||
@ -212,10 +213,15 @@ _accounts_get_account(const char * const name)
|
||||
gchar *muc_service = g_key_file_get_string(accounts, name, "muc.service", NULL);
|
||||
gchar *muc_nick = g_key_file_get_string(accounts, name, "muc.nick", NULL);
|
||||
|
||||
gchar *otr_policy = NULL;
|
||||
if (g_key_file_has_key(accounts, name, "otr.policy", NULL)) {
|
||||
otr_policy = g_key_file_get_string(accounts, name, "otr.policy", NULL);
|
||||
}
|
||||
|
||||
ProfAccount *new_account = account_new(name, jid, password, enabled,
|
||||
server, port, resource, last_presence, login_presence,
|
||||
priority_online, priority_chat, priority_away, priority_xa,
|
||||
priority_dnd, muc_service, muc_nick);
|
||||
priority_dnd, muc_service, muc_nick, otr_policy);
|
||||
|
||||
g_free(jid);
|
||||
g_free(password);
|
||||
@ -225,6 +231,7 @@ _accounts_get_account(const char * const name)
|
||||
g_free(login_presence);
|
||||
g_free(muc_service);
|
||||
g_free(muc_nick);
|
||||
g_free(otr_policy);
|
||||
|
||||
return new_account;
|
||||
}
|
||||
@ -382,6 +389,15 @@ _accounts_clear_password(const char * const account_name)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_accounts_clear_otr(const char * const account_name)
|
||||
{
|
||||
if (accounts_account_exists(account_name)) {
|
||||
g_key_file_remove_key(accounts, account_name, "otr.policy", NULL);
|
||||
_save_accounts();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_accounts_set_muc_service(const char * const account_name, const char * const value)
|
||||
{
|
||||
@ -400,6 +416,15 @@ _accounts_set_muc_nick(const char * const account_name, const char * const value
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_accounts_set_otr_policy(const char * const account_name, const char * const value)
|
||||
{
|
||||
if (accounts_account_exists(account_name)) {
|
||||
g_key_file_set_string(accounts, account_name, "otr.policy", value);
|
||||
_save_accounts();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_accounts_set_priority_online(const char * const account_name, const gint value)
|
||||
{
|
||||
@ -660,6 +685,7 @@ accounts_init_module(void)
|
||||
accounts_set_password = _accounts_set_password;
|
||||
accounts_set_muc_service = _accounts_set_muc_service;
|
||||
accounts_set_muc_nick = _accounts_set_muc_nick;
|
||||
accounts_set_otr_policy = _accounts_set_otr_policy;
|
||||
accounts_set_last_presence = _accounts_set_last_presence;
|
||||
accounts_set_login_presence = _accounts_set_login_presence;
|
||||
accounts_get_last_presence = _accounts_get_last_presence;
|
||||
@ -672,5 +698,6 @@ accounts_init_module(void)
|
||||
accounts_set_priority_all = _accounts_set_priority_all;
|
||||
accounts_get_priority_for_presence_type = _accounts_get_priority_for_presence_type;
|
||||
accounts_clear_password = _accounts_clear_password;
|
||||
accounts_clear_otr = _accounts_clear_otr;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ void (*accounts_set_resource)(const char * const account_name, const char * cons
|
||||
void (*accounts_set_password)(const char * const account_name, const char * const value);
|
||||
void (*accounts_set_muc_service)(const char * const account_name, const char * const value);
|
||||
void (*accounts_set_muc_nick)(const char * const account_name, const char * const value);
|
||||
void (*accounts_set_otr_policy)(const char * const account_name, const char * const value);
|
||||
void (*accounts_set_last_presence)(const char * const account_name, const char * const value);
|
||||
void (*accounts_set_login_presence)(const char * const account_name, const char * const value);
|
||||
resource_presence_t (*accounts_get_login_presence)(const char * const account_name);
|
||||
@ -65,5 +66,6 @@ void (*accounts_set_priority_all)(const char * const account_name, const gint va
|
||||
gint (*accounts_get_priority_for_presence_type)(const char * const account_name,
|
||||
resource_presence_t presence_type);
|
||||
void (*accounts_clear_password)(const char * const account_name);
|
||||
void (*accounts_clear_otr)(const char * const account_name);
|
||||
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@
|
||||
#define PREF_GROUP_PRESENCE "presence"
|
||||
#define PREF_GROUP_CONNECTION "connection"
|
||||
#define PREF_GROUP_ALIAS "alias"
|
||||
#define PREF_GROUP_OTR_POLICY "policy"
|
||||
#define PREF_GROUP_OTR "otr"
|
||||
|
||||
static gchar *prefs_loc;
|
||||
static GKeyFile *prefs;
|
||||
@ -79,6 +79,27 @@ prefs_load(void)
|
||||
g_error_free(err);
|
||||
}
|
||||
|
||||
// move pre 0.4.1 OTR preferences to [otr] group
|
||||
err = NULL;
|
||||
gboolean ui_otr_warn = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "otr.warn", &err);
|
||||
if (!err) {
|
||||
g_key_file_set_boolean(prefs, PREF_GROUP_OTR, _get_key(PREF_OTR_WARN), ui_otr_warn);
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_UI, "otr.warn", NULL);
|
||||
}
|
||||
err = NULL;
|
||||
gchar *ui_otr_log = g_key_file_get_string(prefs, PREF_GROUP_LOGGING, "otr", &err);
|
||||
if (!err) {
|
||||
g_key_file_set_string(prefs, PREF_GROUP_OTR, _get_key(PREF_OTR_LOG), ui_otr_log);
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_LOGGING, "otr", NULL);
|
||||
}
|
||||
err = NULL;
|
||||
gchar *ui_otr_policy = g_key_file_get_string(prefs, "policy", "otr.policy", &err);
|
||||
if (!err) {
|
||||
g_key_file_set_string(prefs, PREF_GROUP_OTR, _get_key(PREF_OTR_POLICY), ui_otr_policy);
|
||||
g_key_file_remove_group(prefs, "policy", NULL);
|
||||
}
|
||||
_save_prefs();
|
||||
|
||||
boolean_choice_ac = autocomplete_new();
|
||||
autocomplete_add(boolean_choice_ac, "on");
|
||||
autocomplete_add(boolean_choice_ac, "off");
|
||||
@ -387,7 +408,6 @@ _get_group(preference_t pref)
|
||||
case PREF_STATUSES_CONSOLE:
|
||||
case PREF_STATUSES_CHAT:
|
||||
case PREF_STATUSES_MUC:
|
||||
case PREF_OTR_WARN:
|
||||
return PREF_GROUP_UI;
|
||||
case PREF_STATES:
|
||||
case PREF_OUTTYPE:
|
||||
@ -399,18 +419,19 @@ _get_group(preference_t pref)
|
||||
return PREF_GROUP_NOTIFICATIONS;
|
||||
case PREF_CHLOG:
|
||||
case PREF_GRLOG:
|
||||
case PREF_OTR_LOG:
|
||||
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:
|
||||
return PREF_GROUP_PRESENCE;
|
||||
case PREF_CONNECT_ACCOUNT:
|
||||
return PREF_GROUP_CONNECTION;
|
||||
case PREF_OTR_WARN:
|
||||
case PREF_OTR_LOG:
|
||||
case PREF_OTR_POLICY:
|
||||
return PREF_GROUP_OTR;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@ -472,11 +493,11 @@ _get_key(preference_t pref)
|
||||
case PREF_CONNECT_ACCOUNT:
|
||||
return "account";
|
||||
case PREF_OTR_LOG:
|
||||
return "otr";
|
||||
return "log";
|
||||
case PREF_OTR_WARN:
|
||||
return "otr.warn";
|
||||
return "warn";
|
||||
case PREF_OTR_POLICY:
|
||||
return "otr.policy";
|
||||
return "policy";
|
||||
case PREF_LOG_ROTATE:
|
||||
return "rotate";
|
||||
case PREF_LOG_SHARED:
|
||||
|
@ -61,10 +61,10 @@ typedef enum {
|
||||
PREF_AUTOAWAY_MODE,
|
||||
PREF_AUTOAWAY_MESSAGE,
|
||||
PREF_CONNECT_ACCOUNT,
|
||||
PREF_OTR_LOG,
|
||||
PREF_OTR_WARN,
|
||||
PREF_LOG_ROTATE,
|
||||
PREF_LOG_SHARED,
|
||||
PREF_OTR_LOG,
|
||||
PREF_OTR_WARN,
|
||||
PREF_OTR_POLICY
|
||||
} preference_t;
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "roster_list.h"
|
||||
#include "contact.h"
|
||||
#include "ui/ui.h"
|
||||
#include "config/preferences.h"
|
||||
|
||||
#define PRESENCE_ONLINE 1
|
||||
#define PRESENCE_OFFLINE 0
|
||||
@ -515,6 +516,21 @@ _otr_get_their_fingerprint(const char * const recipient)
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
_otr_get_policy(const char * const recipient)
|
||||
{
|
||||
// check account setting
|
||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
||||
if (account->otr_policy != NULL) {
|
||||
account_free(account);
|
||||
return account->otr_policy;
|
||||
}
|
||||
account_free(account);
|
||||
|
||||
// check global setting
|
||||
return prefs_get_string(PREF_OTR_POLICY);
|
||||
}
|
||||
|
||||
static char *
|
||||
_otr_encrypt_message(const char * const to, const char * const message)
|
||||
{
|
||||
@ -596,4 +612,5 @@ otr_init_module(void)
|
||||
otr_smp_secret = _otr_smp_secret;
|
||||
otr_smp_question = _otr_smp_question;
|
||||
otr_smp_answer = _otr_smp_answer;
|
||||
otr_get_policy = _otr_get_policy;
|
||||
}
|
||||
|
@ -63,4 +63,6 @@ char * (*otr_decrypt_message)(const char * const from, const char * const messag
|
||||
|
||||
void (*otr_free_message)(char *message);
|
||||
|
||||
char * (*otr_get_policy)(const char * const recipient);
|
||||
|
||||
#endif
|
||||
|
@ -240,7 +240,7 @@ handle_incoming_message(char *from, char *message, gboolean priv)
|
||||
gboolean was_decrypted = FALSE;
|
||||
char *newmessage;
|
||||
|
||||
char *policy = prefs_get_string(PREF_OTR_POLICY);
|
||||
char *policy = otr_get_policy(from);
|
||||
char *whitespace_base = strstr(message,OTRL_MESSAGE_TAG_BASE);
|
||||
|
||||
if (!priv) {
|
||||
|
@ -885,6 +885,9 @@ _cons_show_account(ProfAccount *account)
|
||||
if (account->muc_nick != NULL) {
|
||||
cons_show ("muc nick : %s", account->muc_nick);
|
||||
}
|
||||
if (account->otr_policy != NULL) {
|
||||
cons_show ("OTR policy : %s", account->otr_policy);
|
||||
}
|
||||
if (account->last_presence != NULL) {
|
||||
cons_show ("Last presence : %s", account->last_presence);
|
||||
}
|
||||
@ -1075,9 +1078,9 @@ _cons_statuses_setting(void)
|
||||
char *chat = prefs_get_string(PREF_STATUSES_CHAT);
|
||||
char *muc = prefs_get_string(PREF_STATUSES_MUC);
|
||||
|
||||
cons_show("Console statuses (/statuses) : %s", console);
|
||||
cons_show("Chat win statuses (/statuses) : %s", chat);
|
||||
cons_show("Chat room statuses (/statuses) : %s", muc);
|
||||
cons_show("Console statuses (/statuses) : %s", console);
|
||||
cons_show("Chat statuses (/statuses) : %s", chat);
|
||||
cons_show("MUC statuses (/statuses) : %s", muc);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1090,16 +1093,6 @@ _cons_titlebar_setting(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_otrwarn_setting(void)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_OTR_WARN)) {
|
||||
cons_show("Warn non-OTR (/otr warn) : ON");
|
||||
} else {
|
||||
cons_show("Warn non-OTR (/otr warn) : OFF");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_show_ui_prefs(void)
|
||||
{
|
||||
@ -1114,7 +1107,6 @@ _cons_show_ui_prefs(void)
|
||||
cons_mouse_setting();
|
||||
cons_statuses_setting();
|
||||
cons_titlebar_setting();
|
||||
cons_otrwarn_setting();
|
||||
|
||||
if (wins_is_current(console)) {
|
||||
win_update_virtual(console);
|
||||
@ -1271,20 +1263,6 @@ _cons_grlog_setting(void)
|
||||
cons_show("Groupchat logging (/grlog) : OFF");
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_otr_log_setting(void)
|
||||
{
|
||||
char *value = prefs_get_string(PREF_OTR_LOG);
|
||||
|
||||
if (strcmp(value, "on") == 0) {
|
||||
cons_show("OTR logging (/otr log) : ON");
|
||||
} else if (strcmp(value, "off") == 0) {
|
||||
cons_show("OTR logging (/otr log) : OFF");
|
||||
} else {
|
||||
cons_show("OTR logging (/otr log) : Redacted");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_show_log_prefs(void)
|
||||
{
|
||||
@ -1294,7 +1272,6 @@ _cons_show_log_prefs(void)
|
||||
cons_log_setting();
|
||||
cons_chlog_setting();
|
||||
cons_grlog_setting();
|
||||
cons_otr_log_setting();
|
||||
|
||||
if (wins_is_current(console)) {
|
||||
win_update_virtual(console);
|
||||
@ -1390,6 +1367,38 @@ _cons_show_connection_prefs(void)
|
||||
cons_alert();
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_show_otr_prefs(void)
|
||||
{
|
||||
ProfWin *console = wins_get_console();
|
||||
cons_show("OTR preferences:");
|
||||
cons_show("");
|
||||
|
||||
char *policy_value = prefs_get_string(PREF_OTR_POLICY);
|
||||
cons_show("OTR policy (/otr policy) : %s", policy_value);
|
||||
|
||||
if (prefs_get_boolean(PREF_OTR_WARN)) {
|
||||
cons_show("Warn non-OTR (/otr warn) : ON");
|
||||
} else {
|
||||
cons_show("Warn non-OTR (/otr warn) : OFF");
|
||||
}
|
||||
|
||||
char *log_value = prefs_get_string(PREF_OTR_LOG);
|
||||
|
||||
if (strcmp(log_value, "on") == 0) {
|
||||
cons_show("OTR logging (/otr log) : ON");
|
||||
} else if (strcmp(log_value, "off") == 0) {
|
||||
cons_show("OTR logging (/otr log) : OFF");
|
||||
} else {
|
||||
cons_show("OTR logging (/otr log) : Redacted");
|
||||
}
|
||||
|
||||
if (wins_is_current(console)) {
|
||||
win_update_virtual(console);
|
||||
}
|
||||
cons_alert();
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_show_themes(GSList *themes)
|
||||
{
|
||||
@ -1429,6 +1438,8 @@ _cons_prefs(void)
|
||||
cons_show("");
|
||||
cons_show_connection_prefs();
|
||||
cons_show("");
|
||||
cons_show_otr_prefs();
|
||||
cons_show("");
|
||||
|
||||
if (wins_is_current(console)) {
|
||||
win_update_virtual(console);
|
||||
@ -1767,11 +1778,10 @@ console_init_module(void)
|
||||
cons_log_setting = _cons_log_setting;
|
||||
cons_chlog_setting = _cons_chlog_setting;
|
||||
cons_grlog_setting = _cons_grlog_setting;
|
||||
cons_otr_log_setting = _cons_otr_log_setting;
|
||||
cons_otrwarn_setting = _cons_otrwarn_setting;
|
||||
cons_show_log_prefs = _cons_show_log_prefs;
|
||||
cons_autoaway_setting = _cons_autoaway_setting;
|
||||
cons_show_presence_prefs = _cons_show_presence_prefs;
|
||||
cons_show_otr_prefs = _cons_show_otr_prefs;
|
||||
cons_reconnect_setting = _cons_reconnect_setting;
|
||||
cons_autoping_setting = _cons_autoping_setting;
|
||||
cons_priority_setting = _cons_priority_setting;
|
||||
|
@ -196,6 +196,7 @@ void (*cons_show_chat_prefs)(void);
|
||||
void (*cons_show_log_prefs)(void);
|
||||
void (*cons_show_presence_prefs)(void);
|
||||
void (*cons_show_connection_prefs)(void);
|
||||
void (*cons_show_otr_prefs)(void);
|
||||
void (*cons_show_account)(ProfAccount *account);
|
||||
void (*cons_debug)(const char * const msg, ...);
|
||||
void (*cons_show_time)(void);
|
||||
@ -246,8 +247,6 @@ void (*cons_history_setting)(void);
|
||||
void (*cons_log_setting)(void);
|
||||
void (*cons_chlog_setting)(void);
|
||||
void (*cons_grlog_setting)(void);
|
||||
void (*cons_otr_log_setting)(void);
|
||||
void (*cons_otrwarn_setting)(void);
|
||||
void (*cons_autoaway_setting)(void);
|
||||
void (*cons_reconnect_setting)(void);
|
||||
void (*cons_autoping_setting)(void);
|
||||
|
@ -40,7 +40,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
|
||||
mock_accounts_get_account();
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL,
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
gchar *args[] = { NULL };
|
||||
|
||||
mock_connection_status(JABBER_CONNECTED);
|
||||
@ -119,7 +119,7 @@ void cmd_account_show_shows_account_when_exists(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "show", "account_name", NULL };
|
||||
ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL,
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
|
||||
accounts_get_account_return(account);
|
||||
|
||||
|
@ -424,7 +424,7 @@ void cmd_connect_asks_password_when_not_in_account(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "jabber_org", NULL };
|
||||
ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL,
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
|
||||
mock_connection_status(JABBER_DISCONNECTED);
|
||||
|
||||
@ -448,7 +448,7 @@ void cmd_connect_shows_message_when_connecting_with_account(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "jabber_org", NULL };
|
||||
ProfAccount *account = account_new("jabber_org", "user@jabber.org", "password",
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
|
||||
mock_connection_status(JABBER_DISCONNECTED);
|
||||
|
||||
@ -472,7 +472,7 @@ void cmd_connect_connects_with_account(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "jabber_org", NULL };
|
||||
ProfAccount *account = account_new("jabber_org", "me@jabber.org", "password",
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
|
||||
mock_connection_status(JABBER_DISCONNECTED);
|
||||
|
||||
|
@ -98,7 +98,7 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { room, "nick", nick, NULL };
|
||||
ProfAccount *account = account_new(account_name, "user@server.org", NULL,
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL);
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL);
|
||||
|
||||
muc_init();
|
||||
|
||||
@ -124,7 +124,7 @@ void cmd_join_uses_supplied_nick(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { room, "nick", nick, NULL };
|
||||
ProfAccount *account = account_new(account_name, "user@server.org", NULL,
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
|
||||
muc_init();
|
||||
|
||||
@ -150,7 +150,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { room, NULL };
|
||||
ProfAccount *account = account_new(account_name, "user@server.org", NULL,
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick);
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL);
|
||||
|
||||
muc_init();
|
||||
|
||||
@ -179,7 +179,7 @@ void cmd_join_uses_password_when_supplied(void **state)
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { room, "password", password, NULL };
|
||||
ProfAccount *account = account_new(account_name, "user@server.org", NULL,
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick);
|
||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL);
|
||||
|
||||
muc_init();
|
||||
|
||||
|
@ -325,7 +325,7 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state)
|
||||
gchar *args[] = { "gen", NULL };
|
||||
char *account_name = "myaccount";
|
||||
ProfAccount *account = account_new(account_name, "me@jabber.org", NULL,
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
|
||||
stub_cons_show();
|
||||
mock_connection_status(JABBER_CONNECTED);
|
||||
|
Loading…
Reference in New Issue
Block a user