1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-11-22 17:49:44 +00:00
commit a0d40bf0e9
11 changed files with 258 additions and 162 deletions

View File

@ -278,12 +278,13 @@ static struct cmd_t command_defs[] =
"/roster hide [offline|resource|presence|status|empty|count|priority]", "/roster hide [offline|resource|presence|status|empty|count|priority]",
"/roster by group|presence|none", "/roster by group|presence|none",
"/roster order name|presence", "/roster order name|presence",
"/roster char header <char>|none", "/roster header char <char>|none",
"/roster char contact <char>|none", "/roster presence indent <indent>",
"/roster char resource <char>|none", "/roster contact char <char>|none",
"/roster indent contact <indent>", "/roster contact indent <indent>",
"/roster indent resource <indent>", "/roster resource char <char>|none",
"/roster indent presence <indent>", "/roster resource indent <indent>",
"/roster resource join on|off",
"/roster size <percent>", "/roster size <percent>",
"/roster wrap on|off", "/roster wrap on|off",
"/roster add <jid> [<nick>]", "/roster add <jid> [<nick>]",
@ -317,15 +318,16 @@ static struct cmd_t command_defs[] =
{ "by none", "No grouping in the roster panel." }, { "by none", "No grouping in the roster panel." },
{ "order name", "Order roster items by name only." }, { "order name", "Order roster items by name only." },
{ "order presence", "Order roster items by presence, and then by name." }, { "order presence", "Order roster items by presence, and then by name." },
{ "char header <char>", "Prefix roster headers with specificed character." }, { "header char <char>", "Prefix roster headers with specificed character." },
{ "char header none", "Remove roster header character prefix." }, { "header char none", "Remove roster header character prefix." },
{ "char contact <char>", "Prefix roster contacts with specificed character." }, { "contact char <char>", "Prefix roster contacts with specificed character." },
{ "char contact none", "Remove roster contact character prefix." }, { "contact char none", "Remove roster contact character prefix." },
{ "char resource <char>", "Prefix roster resources with specificed character." }, { "contact indent <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
{ "char resource none", "Remove roster resource character prefix." }, { "resource char <char>", "Prefix roster resources with specificed character." },
{ "indent contact <indent>", "Indent contact line by <indent> spaces (0 to 10)." }, { "resource char none", "Remove roster resource character prefix." },
{ "indent resource <indent>", "Indent resource line by <indent> spaces (0 to 10)." }, { "resource indent <indent>", "Indent resource line by <indent> spaces (0 to 10)." },
{ "indent presence <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." }, { "resource join on|off", "Join resource with previous line when only one available resource." },
{ "presence indent <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." },
{ "size <precent>", "Percentage of the screen taken up by the roster (1-99)." }, { "size <precent>", "Percentage of the screen taken up by the roster (1-99)." },
{ "wrap on|off", "Enabled or disanle line wrapping in roster panel." }, { "wrap on|off", "Enabled or disanle line wrapping in roster panel." },
{ "add <jid> [<nick>]", "Add a new item to the roster." }, { "add <jid> [<nick>]", "Add a new item to the roster." },
@ -1793,12 +1795,14 @@ static Autocomplete disco_ac;
static Autocomplete close_ac; static Autocomplete close_ac;
static Autocomplete wins_ac; static Autocomplete wins_ac;
static Autocomplete roster_ac; static Autocomplete roster_ac;
static Autocomplete roster_char_ac; static Autocomplete roster_show_ac;
static Autocomplete roster_char_none_ac;
static Autocomplete roster_indent_ac;
static Autocomplete roster_option_ac;
static Autocomplete roster_by_ac; static Autocomplete roster_by_ac;
static Autocomplete roster_order_ac; static Autocomplete roster_order_ac;
static Autocomplete roster_header_ac;
static Autocomplete roster_contact_ac;
static Autocomplete roster_resource_ac;
static Autocomplete roster_presence_ac;
static Autocomplete roster_char_ac;
static Autocomplete roster_remove_all_ac; static Autocomplete roster_remove_all_ac;
static Autocomplete group_ac; static Autocomplete group_ac;
static Autocomplete bookmark_ac; static Autocomplete bookmark_ac;
@ -2044,31 +2048,38 @@ cmd_init(void)
autocomplete_add(roster_ac, "by"); autocomplete_add(roster_ac, "by");
autocomplete_add(roster_ac, "order"); autocomplete_add(roster_ac, "order");
autocomplete_add(roster_ac, "size"); autocomplete_add(roster_ac, "size");
autocomplete_add(roster_ac, "char");
autocomplete_add(roster_ac, "indent");
autocomplete_add(roster_ac, "wrap"); autocomplete_add(roster_ac, "wrap");
autocomplete_add(roster_ac, "header");
autocomplete_add(roster_ac, "contact");
autocomplete_add(roster_ac, "resource");
autocomplete_add(roster_ac, "presence");
roster_header_ac = autocomplete_new();
autocomplete_add(roster_header_ac, "char");
roster_contact_ac = autocomplete_new();
autocomplete_add(roster_contact_ac, "char");
autocomplete_add(roster_contact_ac, "indent");
roster_resource_ac = autocomplete_new();
autocomplete_add(roster_resource_ac, "char");
autocomplete_add(roster_resource_ac, "indent");
autocomplete_add(roster_resource_ac, "join");
roster_presence_ac = autocomplete_new();
autocomplete_add(roster_presence_ac, "indent");
roster_char_ac = autocomplete_new(); roster_char_ac = autocomplete_new();
autocomplete_add(roster_char_ac, "header"); autocomplete_add(roster_char_ac, "none");
autocomplete_add(roster_char_ac, "contact");
autocomplete_add(roster_char_ac, "resource");
roster_char_none_ac = autocomplete_new(); roster_show_ac = autocomplete_new();
autocomplete_add(roster_char_none_ac, "none"); autocomplete_add(roster_show_ac, "offline");
autocomplete_add(roster_show_ac, "resource");
roster_indent_ac = autocomplete_new(); autocomplete_add(roster_show_ac, "presence");
autocomplete_add(roster_indent_ac, "contact"); autocomplete_add(roster_show_ac, "status");
autocomplete_add(roster_indent_ac, "resource"); autocomplete_add(roster_show_ac, "empty");
autocomplete_add(roster_indent_ac, "presence"); autocomplete_add(roster_show_ac, "count");
autocomplete_add(roster_show_ac, "priority");
roster_option_ac = autocomplete_new();
autocomplete_add(roster_option_ac, "offline");
autocomplete_add(roster_option_ac, "resource");
autocomplete_add(roster_option_ac, "presence");
autocomplete_add(roster_option_ac, "status");
autocomplete_add(roster_option_ac, "empty");
autocomplete_add(roster_option_ac, "count");
autocomplete_add(roster_option_ac, "priority");
roster_by_ac = autocomplete_new(); roster_by_ac = autocomplete_new();
autocomplete_add(roster_by_ac, "group"); autocomplete_add(roster_by_ac, "group");
@ -2331,10 +2342,12 @@ cmd_uninit(void)
autocomplete_free(close_ac); autocomplete_free(close_ac);
autocomplete_free(wins_ac); autocomplete_free(wins_ac);
autocomplete_free(roster_ac); autocomplete_free(roster_ac);
autocomplete_free(roster_header_ac);
autocomplete_free(roster_contact_ac);
autocomplete_free(roster_resource_ac);
autocomplete_free(roster_presence_ac);
autocomplete_free(roster_char_ac); autocomplete_free(roster_char_ac);
autocomplete_free(roster_char_none_ac); autocomplete_free(roster_show_ac);
autocomplete_free(roster_indent_ac);
autocomplete_free(roster_option_ac);
autocomplete_free(roster_by_ac); autocomplete_free(roster_by_ac);
autocomplete_free(roster_order_ac); autocomplete_free(roster_order_ac);
autocomplete_free(roster_remove_all_ac); autocomplete_free(roster_remove_all_ac);
@ -2521,10 +2534,12 @@ cmd_reset_autocomplete(ProfWin *window)
autocomplete_reset(close_ac); autocomplete_reset(close_ac);
autocomplete_reset(wins_ac); autocomplete_reset(wins_ac);
autocomplete_reset(roster_ac); autocomplete_reset(roster_ac);
autocomplete_reset(roster_header_ac);
autocomplete_reset(roster_contact_ac);
autocomplete_reset(roster_resource_ac);
autocomplete_reset(roster_presence_ac);
autocomplete_reset(roster_char_ac); autocomplete_reset(roster_char_ac);
autocomplete_reset(roster_char_none_ac); autocomplete_reset(roster_show_ac);
autocomplete_reset(roster_indent_ac);
autocomplete_reset(roster_option_ac);
autocomplete_reset(roster_by_ac); autocomplete_reset(roster_by_ac);
autocomplete_reset(roster_order_ac); autocomplete_reset(roster_order_ac);
autocomplete_reset(roster_remove_all_ac); autocomplete_reset(roster_remove_all_ac);
@ -2912,15 +2927,19 @@ static char*
_roster_autocomplete(ProfWin *window, const char *const input) _roster_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
result = autocomplete_param_with_ac(input, "/roster char header", roster_char_none_ac, TRUE); result = autocomplete_param_with_ac(input, "/roster header char", roster_char_ac, TRUE);
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_ac(input, "/roster char contact", roster_char_none_ac, TRUE); result = autocomplete_param_with_ac(input, "/roster contact char", roster_char_ac, TRUE);
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_ac(input, "/roster char resource", roster_char_none_ac, TRUE); result = autocomplete_param_with_ac(input, "/roster resource char", roster_char_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_func(input, "/roster resource join", prefs_autocomplete_boolean_choice);
if (result) { if (result) {
return result; return result;
} }
@ -2940,11 +2959,11 @@ _roster_autocomplete(ProfWin *window, const char *const input)
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_ac(input, "/roster show", roster_option_ac, TRUE); result = autocomplete_param_with_ac(input, "/roster show", roster_show_ac, TRUE);
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_ac(input, "/roster hide", roster_option_ac, TRUE); result = autocomplete_param_with_ac(input, "/roster hide", roster_show_ac, TRUE);
if (result) { if (result) {
return result; return result;
} }
@ -2956,18 +2975,26 @@ _roster_autocomplete(ProfWin *window, const char *const input)
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_ac(input, "/roster char", roster_char_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster indent", roster_indent_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_func(input, "/roster wrap", prefs_autocomplete_boolean_choice); result = autocomplete_param_with_func(input, "/roster wrap", prefs_autocomplete_boolean_choice);
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_ac(input, "/roster header", roster_header_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster contact", roster_contact_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster resource", roster_resource_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster presence", roster_presence_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster", roster_ac, TRUE); result = autocomplete_param_with_ac(input, "/roster", roster_ac, TRUE);
if (result) { if (result) {
return result; return result;

View File

@ -1761,9 +1761,9 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
return res; return res;
} }
// set header character // header settings
} else if (g_strcmp0(args[0], "char") == 0) { } else if (g_strcmp0(args[0], "header") == 0) {
if (g_strcmp0(args[1], "header") == 0) { if (g_strcmp0(args[1], "char") == 0) {
if (!args[2]) { if (!args[2]) {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
} else if (g_strcmp0(args[2], "none") == 0) { } else if (g_strcmp0(args[2], "none") == 0) {
@ -1775,7 +1775,14 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
cons_show("Roster header char set to %c.", args[2][0]); cons_show("Roster header char set to %c.", args[2][0]);
rosterwin_roster(); rosterwin_roster();
} }
} else if (g_strcmp0(args[1], "contact") == 0) { } else {
cons_bad_cmd_usage(command);
}
return TRUE;
// contact settings
} else if (g_strcmp0(args[0], "contact") == 0) {
if (g_strcmp0(args[1], "char") == 0) {
if (!args[2]) { if (!args[2]) {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
} else if (g_strcmp0(args[2], "none") == 0) { } else if (g_strcmp0(args[2], "none") == 0) {
@ -1787,26 +1794,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
cons_show("Roster contact char set to %c.", args[2][0]); cons_show("Roster contact char set to %c.", args[2][0]);
rosterwin_roster(); rosterwin_roster();
} }
} else if (g_strcmp0(args[1], "resource") == 0) { } else if (g_strcmp0(args[1], "indent") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else if (g_strcmp0(args[2], "none") == 0) {
prefs_clear_roster_resource_char();
cons_show("Roster resource char removed.");
rosterwin_roster();
} else {
prefs_set_roster_resource_char(args[2][0]);
cons_show("Roster resource char set to %c.", args[2][0]);
rosterwin_roster();
}
} else {
cons_bad_cmd_usage(command);
}
return TRUE;
// set indentations
} else if (g_strcmp0(args[0], "indent") == 0) {
if (g_strcmp0(args[1], "contact") == 0) {
if (!args[2]) { if (!args[2]) {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
} else { } else {
@ -1822,7 +1810,26 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
free(err_msg); free(err_msg);
} }
} }
} else if (g_strcmp0(args[1], "resource") == 0) { } else {
cons_bad_cmd_usage(command);
}
return TRUE;
// resource settings
} else if (g_strcmp0(args[0], "resource") == 0) {
if (g_strcmp0(args[1], "char") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else if (g_strcmp0(args[2], "none") == 0) {
prefs_clear_roster_resource_char();
cons_show("Roster resource char removed.");
rosterwin_roster();
} else {
prefs_set_roster_resource_char(args[2][0]);
cons_show("Roster resource char set to %c.", args[2][0]);
rosterwin_roster();
}
} else if (g_strcmp0(args[1], "indent") == 0) {
if (!args[2]) { if (!args[2]) {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
} else { } else {
@ -1838,7 +1845,18 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
free(err_msg); free(err_msg);
} }
} }
} else if (g_strcmp0(args[1], "presence") == 0) { } else if (g_strcmp0(args[1], "join") == 0) {
int res = _cmd_set_boolean_preference(args[2], command, "Roster join", PREF_ROSTER_RESOURCE_JOIN);
rosterwin_roster();
return res;
} else {
cons_bad_cmd_usage(command);
}
return TRUE;
// presence settings
} else if (g_strcmp0(args[0], "presence") == 0) {
if (g_strcmp0(args[1], "indent") == 0) {
if (!args[2]) { if (!args[2]) {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
} else { } else {
@ -1982,6 +2000,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
return TRUE; return TRUE;
} }
// roster grouping // roster grouping
} else if (g_strcmp0(args[0], "by") == 0) { } else if (g_strcmp0(args[0], "by") == 0) {
if (g_strcmp0(args[1], "group") == 0) { if (g_strcmp0(args[1], "group") == 0) {
@ -2009,6 +2028,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
return TRUE; return TRUE;
} }
// roster item order // roster item order
} else if (g_strcmp0(args[0], "order") == 0) { } else if (g_strcmp0(args[0], "order") == 0) {
if (g_strcmp0(args[1], "name") == 0) { if (g_strcmp0(args[1], "name") == 0) {
@ -2029,6 +2049,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
return TRUE; return TRUE;
} }
// add contact // add contact
} else if (strcmp(args[0], "add") == 0) { } else if (strcmp(args[0], "add") == 0) {
if (conn_status != JABBER_CONNECTED) { if (conn_status != JABBER_CONNECTED) {

View File

@ -767,6 +767,7 @@ _get_group(preference_t pref)
case PREF_ROSTER_COUNT: case PREF_ROSTER_COUNT:
case PREF_ROSTER_PRIORITY: case PREF_ROSTER_PRIORITY:
case PREF_ROSTER_WRAP: case PREF_ROSTER_WRAP:
case PREF_ROSTER_RESOURCE_JOIN:
case PREF_RESOURCE_TITLE: case PREF_RESOURCE_TITLE:
case PREF_RESOURCE_MESSAGE: case PREF_RESOURCE_MESSAGE:
case PREF_ENC_WARN: case PREF_ENC_WARN:
@ -952,6 +953,8 @@ _get_key(preference_t pref)
return "roster.priority"; return "roster.priority";
case PREF_ROSTER_WRAP: case PREF_ROSTER_WRAP:
return "roster.wrap"; return "roster.wrap";
case PREF_ROSTER_RESOURCE_JOIN:
return "roster.resource.join";
case PREF_RESOURCE_TITLE: case PREF_RESOURCE_TITLE:
return "resource.title"; return "resource.title";
case PREF_RESOURCE_MESSAGE: case PREF_RESOURCE_MESSAGE:
@ -1005,6 +1008,7 @@ _get_default_boolean(preference_t pref)
case PREF_ROSTER_EMPTY: case PREF_ROSTER_EMPTY:
case PREF_ROSTER_COUNT: case PREF_ROSTER_COUNT:
case PREF_ROSTER_PRIORITY: case PREF_ROSTER_PRIORITY:
case PREF_ROSTER_RESOURCE_JOIN:
case PREF_TLS_SHOW: case PREF_TLS_SHOW:
case PREF_LASTACTIVITY: case PREF_LASTACTIVITY:
return TRUE; return TRUE;

View File

@ -72,6 +72,7 @@ typedef enum {
PREF_ROSTER_COUNT, PREF_ROSTER_COUNT,
PREF_ROSTER_PRIORITY, PREF_ROSTER_PRIORITY,
PREF_ROSTER_WRAP, PREF_ROSTER_WRAP,
PREF_ROSTER_RESOURCE_JOIN,
PREF_MUC_PRIVILEGES, PREF_MUC_PRIVILEGES,
PREF_PRESENCE, PREF_PRESENCE,
PREF_WRAP, PREF_WRAP,

View File

@ -458,6 +458,7 @@ _load_preferences(void)
_set_boolean_preference("roster", PREF_ROSTER); _set_boolean_preference("roster", PREF_ROSTER);
_set_boolean_preference("roster.offline", PREF_ROSTER_OFFLINE); _set_boolean_preference("roster.offline", PREF_ROSTER_OFFLINE);
_set_boolean_preference("roster.resource", PREF_ROSTER_RESOURCE); _set_boolean_preference("roster.resource", PREF_ROSTER_RESOURCE);
_set_boolean_preference("roster.resource.join", PREF_ROSTER_RESOURCE_JOIN);
_set_boolean_preference("roster.presence", PREF_ROSTER_PRESENCE); _set_boolean_preference("roster.presence", PREF_ROSTER_PRESENCE);
_set_boolean_preference("roster.status", PREF_ROSTER_STATUS); _set_boolean_preference("roster.status", PREF_ROSTER_STATUS);
_set_boolean_preference("roster.empty", PREF_ROSTER_EMPTY); _set_boolean_preference("roster.empty", PREF_ROSTER_EMPTY);
@ -476,6 +477,8 @@ _load_preferences(void)
prefs_set_roster_header_char(ch[0]); prefs_set_roster_header_char(ch[0]);
g_free(ch); g_free(ch);
} }
} else {
prefs_clear_roster_header_char();
} }
if (g_key_file_has_key(theme, "ui", "roster.contact.char", NULL)) { if (g_key_file_has_key(theme, "ui", "roster.contact.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "roster.contact.char", NULL); gchar *ch = g_key_file_get_string(theme, "ui", "roster.contact.char", NULL);
@ -483,6 +486,8 @@ _load_preferences(void)
prefs_set_roster_contact_char(ch[0]); prefs_set_roster_contact_char(ch[0]);
g_free(ch); g_free(ch);
} }
} else {
prefs_clear_roster_contact_char();
} }
if (g_key_file_has_key(theme, "ui", "roster.resource.char", NULL)) { if (g_key_file_has_key(theme, "ui", "roster.resource.char", NULL)) {
gchar *ch = g_key_file_get_string(theme, "ui", "roster.resource.char", NULL); gchar *ch = g_key_file_get_string(theme, "ui", "roster.resource.char", NULL);
@ -490,6 +495,8 @@ _load_preferences(void)
prefs_set_roster_resource_char(ch[0]); prefs_set_roster_resource_char(ch[0]);
g_free(ch); g_free(ch);
} }
} else {
prefs_clear_roster_resource_char();
} }
if (g_key_file_has_key(theme, "ui", "roster.contact.indent", NULL)) { if (g_key_file_has_key(theme, "ui", "roster.contact.indent", NULL)) {
gint contact_indent = g_key_file_get_integer(theme, "ui", "roster.contact.indent", NULL); gint contact_indent = g_key_file_get_integer(theme, "ui", "roster.contact.indent", NULL);

View File

@ -1202,16 +1202,48 @@ cons_roster_setting(void)
else else
cons_show("Roster offline (/roster) : hide"); cons_show("Roster offline (/roster) : hide");
char header_ch = prefs_get_roster_header_char();
if (header_ch)
cons_show("Roster header char (/roster) : %c", header_ch);
else
cons_show("Roster header char (/roster) : none");
char contact_ch = prefs_get_roster_contact_char();
if (contact_ch)
cons_show("Roster contact char (/roster) : %c", contact_ch);
else
cons_show("Roster contact char (/roster) : none");
gint contact_indent = prefs_get_roster_contact_indent();
cons_show("Roster contact indent (/roster) : %d", contact_indent);
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) if (prefs_get_boolean(PREF_ROSTER_RESOURCE))
cons_show("Roster resource (/roster) : show"); cons_show("Roster resource (/roster) : show");
else else
cons_show("Roster resource (/roster) : hide"); cons_show("Roster resource (/roster) : hide");
char resource_ch = prefs_get_roster_resource_char();
if (resource_ch)
cons_show("Roster resource char (/roster) : %c", resource_ch);
else
cons_show("Roster resource char (/roster) : none");
gint resource_indent = prefs_get_roster_resource_indent();
cons_show("Roster resource indent (/roster) : %d", resource_indent);
if (prefs_get_boolean(PREF_ROSTER_RESOURCE_JOIN))
cons_show("Roster resource join (/roster) : on");
else
cons_show("Roster resource join (/roster) : off");
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) if (prefs_get_boolean(PREF_ROSTER_PRESENCE))
cons_show("Roster presence (/roster) : show"); cons_show("Roster presence (/roster) : show");
else else
cons_show("Roster presence (/roster) : hide"); cons_show("Roster presence (/roster) : hide");
gint presence_indent = prefs_get_roster_presence_indent();
cons_show("Roster presence indent (/roster) : %d", presence_indent);
if (prefs_get_boolean(PREF_ROSTER_STATUS)) if (prefs_get_boolean(PREF_ROSTER_STATUS))
cons_show("Roster status (/roster) : show"); cons_show("Roster status (/roster) : show");
else else
@ -1243,33 +1275,6 @@ cons_roster_setting(void)
int size = prefs_get_roster_size(); int size = prefs_get_roster_size();
cons_show("Roster size (/roster) : %d", size); cons_show("Roster size (/roster) : %d", size);
char header_ch = prefs_get_roster_header_char();
if (header_ch)
cons_show("Roster header char (/roster) : %c", header_ch);
else
cons_show("Roster header char (/roster) : none");
char contact_ch = prefs_get_roster_contact_char();
if (contact_ch)
cons_show("Roster contact char (/roster) : %c", contact_ch);
else
cons_show("Roster contact char (/roster) : none");
char resource_ch = prefs_get_roster_resource_char();
if (resource_ch)
cons_show("Roster resource char (/roster) : %c", resource_ch);
else
cons_show("Roster resource char (/roster) : none");
gint contact_indent = prefs_get_roster_contact_indent();
cons_show("Roster contact indent (/roster) : %d", contact_indent);
gint resource_indent = prefs_get_roster_resource_indent();
cons_show("Roster resource indent (/roster) : %d", resource_indent);
gint presence_indent = prefs_get_roster_presence_indent();
cons_show("Roster presence indent (/roster) : %d", presence_indent);
if (prefs_get_boolean(PREF_ROSTER_WRAP)) if (prefs_get_boolean(PREF_ROSTER_WRAP))
cons_show("Roster wrap (/roster) : ON"); cons_show("Roster wrap (/roster) : ON");
else else

View File

@ -128,8 +128,36 @@ _rosterwin_presence(ProfLayoutSplit *layout, theme_item_t colour, const char *pr
static void static void
_rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_indent) _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_indent)
{ {
gboolean join = prefs_get_boolean(PREF_ROSTER_RESOURCE_JOIN);
GList *resources = p_contact_get_available_resources(contact); GList *resources = p_contact_get_available_resources(contact);
if (resources) { if (resources) {
if (join && (g_list_length(resources) == 1)) {
Resource *resource = resources->data;
const char *resource_presence = string_from_resource_presence(resource->presence);
theme_item_t resource_presence_colour = theme_main_presence_attrs(resource_presence);
wattron(layout->subwin, theme_attrs(resource_presence_colour));
GString *msg = g_string_new("");
char ch = prefs_get_roster_resource_char();
if (ch) {
g_string_append_printf(msg, "%c", ch);
} else {
g_string_append(msg, " ");
}
g_string_append(msg, resource->name);
if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) {
g_string_append_printf(msg, " %d", resource->priority);
}
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
win_sub_print(layout->subwin, msg->str, FALSE, wrap, 0);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(resource_presence_colour));
if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) {
_rosterwin_presence(layout, resource_presence_colour, resource_presence, resource->status, current_indent);
}
} else {
int resource_indent = prefs_get_roster_resource_indent(); int resource_indent = prefs_get_roster_resource_indent();
if (resource_indent > 0) { if (resource_indent > 0) {
current_indent += resource_indent; current_indent += resource_indent;
@ -168,6 +196,7 @@ _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_inde
curr_resource = g_list_next(curr_resource); curr_resource = g_list_next(curr_resource);
} }
}
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) { } else if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) {
const char *presence = p_contact_presence(contact); const char *presence = p_contact_presence(contact);
const char *status = p_contact_status(contact); const char *status = p_contact_status(contact);

View File

@ -73,22 +73,23 @@ statuses.chat=
statuses.muc= statuses.muc=
roster= roster=
roster.offline= roster.offline=
roster.resource=
roster.presence=
roster.status=
roster.empty= roster.empty=
roster.by= roster.by=
roster.order= roster.order=
roster.count= roster.count=
roster.priority= roster.priority=
roster.size= roster.size=
roster.wrap=
roster.header.char= roster.header.char=
roster.contact.char= roster.contact.char=
roster.resource.char=
roster.contact.indent= roster.contact.indent=
roster.resource=
roster.resource.char=
roster.resource.indent= roster.resource.indent=
roster.resource.join=
roster.presence=
roster.presence.indent= roster.presence.indent=
roster.wrap= roster.status=
occupants= occupants=
occupants.size= occupants.size=
occupants.jid= occupants.jid=

View File

@ -71,22 +71,24 @@ resource.message=true
statuses.console=all statuses.console=all
statuses.chat=all statuses.chat=all
statuses.muc=all statuses.muc=all
roster.by=presence
roster.offline=true
roster.empty=false
roster.presence=true
roster.order=presence
roster.status=true
roster.resource=true
roster.priority=false
roster=true roster=true
roster.offline=true
roster.empty=true
roster.by=group
roster.order=presence
roster.count=true roster.count=true
roster.priority=true
roster.size=25 roster.size=25
roster.contact.indent=1
roster.resource.indent=2
roster.presence.indent=-1
roster.header.char=@
roster.wrap=true roster.wrap=true
roster.header.char=@
roster.contact.indent=1
roster.resource=true
roster.resource.char=/
roster.resource.indent=1
roster.resource.join=true
roster.presence=true
roster.presence.indent=-1
roster.status=true
occupants=true occupants=true
occupants.size=15 occupants.size=15
occupants.jid=false occupants.jid=false

View File

@ -20,22 +20,23 @@ occupants.size=15
occupants.jid=true occupants.jid=true
roster=true roster=true
roster.offline=true roster.offline=true
roster.resource=true
roster.presence=true
roster.status=true
roster.empty=true roster.empty=true
roster.by=presence roster.by=presence
roster.order=presence roster.order=presence
roster.count=true roster.count=true
roster.priority=true roster.priority=true
roster.size=25 roster.size=25
roster.header.char=-
roster.contact.char=-
roster.resource.char=-
roster.contact.indent=2
roster.resource.indent=2
roster.presence.indent=2
roster.wrap=true roster.wrap=true
roster.header.char=@
roster.contact.char=-
roster.contact.indent=1
roster.resource=true
roster.resource.char=/
roster.resource.indent=1
roster.resource.join=false
roster.presence=true
roster.presence.indent=1
roster.status=true
privileges=true privileges=true
presence=true presence=true
intype=true intype=true

View File

@ -19,19 +19,17 @@ occupants=true
occupants.size=15 occupants.size=15
roster=true roster=true
roster.offline=false roster.offline=false
roster.resource=false
roster.presence=false
roster.status=false
roster.empty=false roster.empty=false
roster.by=none roster.by=none
roster.order=presence roster.order=presence
roster.count=false roster.count=false
roster.priority=false roster.priority=false
roster.size=25 roster.size=25
roster.contact.indent=0
roster.resource.indent=0
roster.presence.indent=-1
roster.wrap=false roster.wrap=false
roster.contact.indent=0
roster.resource=false
roster.presence=false
roster.status=false
privileges=false privileges=false
presence=false presence=false
intype=false intype=false