1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Added /prefs otr

This commit is contained in:
James Booth 2014-05-11 13:32:59 +01:00
parent ddbb4872b3
commit 015780662e
4 changed files with 44 additions and 33 deletions

View File

@ -955,6 +955,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");

View File

@ -653,6 +653,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);
}

View File

@ -1075,9 +1075,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 +1090,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 +1104,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 +1260,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 +1269,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 +1364,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 +1435,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 +1775,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;

View File

@ -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);