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());
|
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
||||||
// check contact specific setting
|
// check contact specific setting
|
||||||
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
||||||
cons_debug("Using contact setting manual");
|
|
||||||
account_free(account);
|
account_free(account);
|
||||||
return "manual";
|
return "manual";
|
||||||
}
|
}
|
||||||
if (g_list_find_custom(account->otr_opportunistic, recipient, (GCompareFunc)g_strcmp0)) {
|
if (g_list_find_custom(account->otr_opportunistic, recipient, (GCompareFunc)g_strcmp0)) {
|
||||||
cons_debug("Using contact setting opportunistic");
|
|
||||||
account_free(account);
|
account_free(account);
|
||||||
return "opportunistic";
|
return "opportunistic";
|
||||||
}
|
}
|
||||||
if (g_list_find_custom(account->otr_always, recipient, (GCompareFunc)g_strcmp0)) {
|
if (g_list_find_custom(account->otr_always, recipient, (GCompareFunc)g_strcmp0)) {
|
||||||
cons_debug("Using contact setting always");
|
|
||||||
account_free(account);
|
account_free(account);
|
||||||
return "always";
|
return "always";
|
||||||
}
|
}
|
||||||
|
|
||||||
// check default account setting
|
// check default account setting
|
||||||
if (account->otr_policy != NULL) {
|
if (account->otr_policy != NULL) {
|
||||||
cons_debug("Using account setting %s", account->otr_policy);
|
|
||||||
char *result;
|
char *result;
|
||||||
if (g_strcmp0(account->otr_policy, "manual") == 0) {
|
if (g_strcmp0(account->otr_policy, "manual") == 0) {
|
||||||
result = "manual";
|
result = "manual";
|
||||||
@ -556,7 +552,6 @@ _otr_get_policy(const char * const recipient)
|
|||||||
account_free(account);
|
account_free(account);
|
||||||
|
|
||||||
// check global setting
|
// check global setting
|
||||||
cons_debug("Using global setting %s", prefs_get_string(PREF_OTR_POLICY));
|
|
||||||
return prefs_get_string(PREF_OTR_POLICY);
|
return prefs_get_string(PREF_OTR_POLICY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,15 +885,53 @@ _cons_show_account(ProfAccount *account)
|
|||||||
if (account->muc_nick != NULL) {
|
if (account->muc_nick != NULL) {
|
||||||
cons_show ("muc nick : %s", account->muc_nick);
|
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) {
|
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) {
|
if (account->login_presence != NULL) {
|
||||||
cons_show ("Login presence : %s", account->login_presence);
|
cons_show ("Login presence : %s", account->login_presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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",
|
cons_show ("Priority : chat:%d, online:%d, away:%d, xa:%d, dnd:%d",
|
||||||
account->priority_chat, account->priority_online, account->priority_away,
|
account->priority_chat, account->priority_online, account->priority_away,
|
||||||
account->priority_xa, account->priority_dnd);
|
account->priority_xa, account->priority_dnd);
|
||||||
|
Loading…
Reference in New Issue
Block a user