mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added OTR preferences to /account show commmand
This commit is contained in:
parent
9dda7036a9
commit
fc3046782a
@ -522,24 +522,20 @@ _otr_get_policy(const char * const recipient)
|
||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
||||
// check contact specific setting
|
||||
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
||||
cons_debug("Using contact setting manual");
|
||||
account_free(account);
|
||||
return "manual";
|
||||
}
|
||||
if (g_list_find_custom(account->otr_opportunistic, recipient, (GCompareFunc)g_strcmp0)) {
|
||||
cons_debug("Using contact setting opportunistic");
|
||||
account_free(account);
|
||||
return "opportunistic";
|
||||
}
|
||||
if (g_list_find_custom(account->otr_always, recipient, (GCompareFunc)g_strcmp0)) {
|
||||
cons_debug("Using contact setting always");
|
||||
account_free(account);
|
||||
return "always";
|
||||
}
|
||||
|
||||
// check default account setting
|
||||
if (account->otr_policy != NULL) {
|
||||
cons_debug("Using account setting %s", account->otr_policy);
|
||||
char *result;
|
||||
if (g_strcmp0(account->otr_policy, "manual") == 0) {
|
||||
result = "manual";
|
||||
@ -556,7 +552,6 @@ _otr_get_policy(const char * const recipient)
|
||||
account_free(account);
|
||||
|
||||
// check global setting
|
||||
cons_debug("Using global setting %s", prefs_get_string(PREF_OTR_POLICY));
|
||||
return prefs_get_string(PREF_OTR_POLICY);
|
||||
}
|
||||
|
||||
|
@ -862,39 +862,77 @@ _cons_show_account(ProfAccount *account)
|
||||
cons_show("");
|
||||
cons_show("Account %s:", account->name);
|
||||
if (account->enabled) {
|
||||
cons_show ("enabled : TRUE");
|
||||
cons_show ("enabled : TRUE");
|
||||
} else {
|
||||
cons_show ("enabled : FALSE");
|
||||
cons_show ("enabled : FALSE");
|
||||
}
|
||||
cons_show ("jid : %s", account->jid);
|
||||
cons_show ("jid : %s", account->jid);
|
||||
if (account->password != NULL) {
|
||||
cons_show ("password : [redacted]");
|
||||
cons_show ("password : [redacted]");
|
||||
}
|
||||
if (account->resource != NULL) {
|
||||
cons_show ("resource : %s", account->resource);
|
||||
cons_show ("resource : %s", account->resource);
|
||||
}
|
||||
if (account->server != NULL) {
|
||||
cons_show ("server : %s", account->server);
|
||||
cons_show ("server : %s", account->server);
|
||||
}
|
||||
if (account->port != 0) {
|
||||
cons_show ("port : %d", account->port);
|
||||
cons_show ("port : %d", account->port);
|
||||
}
|
||||
if (account->muc_service != NULL) {
|
||||
cons_show ("muc service : %s", account->muc_service);
|
||||
cons_show ("muc service : %s", account->muc_service);
|
||||
}
|
||||
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);
|
||||
cons_show ("muc nick : %s", account->muc_nick);
|
||||
}
|
||||
if (account->last_presence != NULL) {
|
||||
cons_show ("Last presence : %s", account->last_presence);
|
||||
cons_show ("Last presence : %s", account->last_presence);
|
||||
}
|
||||
if (account->login_presence != NULL) {
|
||||
cons_show ("Login presence : %s", account->login_presence);
|
||||
cons_show ("Login presence : %s", account->login_presence);
|
||||
}
|
||||
cons_show ("Priority : chat:%d, online:%d, away:%d, xa:%d, dnd:%d",
|
||||
|
||||
if (account->otr_policy != NULL) {
|
||||
cons_show ("OTR policy : %s", account->otr_policy);
|
||||
}
|
||||
if (g_list_length(account->otr_manual) > 0) {
|
||||
GString *manual = g_string_new("OTR manual : ");
|
||||
GList *curr = account->otr_manual;
|
||||
while (curr != NULL) {
|
||||
g_string_append(manual, curr->data);
|
||||
if (curr->next != NULL) {
|
||||
g_string_append(manual, ", ");
|
||||
}
|
||||
curr = curr->next;
|
||||
}
|
||||
cons_show(manual->str);
|
||||
}
|
||||
if (g_list_length(account->otr_opportunistic) > 0) {
|
||||
GString *opportunistic = g_string_new("OTR opportunistic : ");
|
||||
GList *curr = account->otr_opportunistic;
|
||||
while (curr != NULL) {
|
||||
g_string_append(opportunistic, curr->data);
|
||||
if (curr->next != NULL) {
|
||||
g_string_append(opportunistic, ", ");
|
||||
}
|
||||
curr = curr->next;
|
||||
}
|
||||
cons_show(opportunistic->str);
|
||||
}
|
||||
if (g_list_length(account->otr_always) > 0) {
|
||||
GString *always = g_string_new("OTR always : ");
|
||||
GList *curr = account->otr_always;
|
||||
while (curr != NULL) {
|
||||
g_string_append(always, curr->data);
|
||||
if (curr->next != NULL) {
|
||||
g_string_append(always, ", ");
|
||||
}
|
||||
curr = curr->next;
|
||||
}
|
||||
cons_show(always->str);
|
||||
}
|
||||
|
||||
cons_show ("Priority : chat:%d, online:%d, away:%d, xa:%d, dnd:%d",
|
||||
account->priority_chat, account->priority_online, account->priority_away,
|
||||
account->priority_xa, account->priority_dnd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user