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-19 00:45:57 +00:00
commit 12417828fa
14 changed files with 457 additions and 87 deletions

View File

@ -274,9 +274,10 @@ static struct cmd_t command_defs[] =
CMD_SYN( CMD_SYN(
"/roster", "/roster",
"/roster online", "/roster online",
"/roster show [offline|resource|empty]", "/roster show [offline|resource|presence|status|empty|count|priority]",
"/roster hide [offline|resource|empty]", "/roster hide [offline|resource|presence|status|empty|count|priority]",
"/roster by group|presence|none", "/roster by group|presence|none",
"/roster order name|presence"
"/roster size <percent>", "/roster size <percent>",
"/roster add <jid> [<nick>]", "/roster add <jid> [<nick>]",
"/roster remove <jid>", "/roster remove <jid>",
@ -291,14 +292,24 @@ static struct cmd_t command_defs[] =
{ "show", "Show the roster panel." }, { "show", "Show the roster panel." },
{ "show offline", "Show offline contacts in the roster panel." }, { "show offline", "Show offline contacts in the roster panel." },
{ "show resource", "Show contact's connected resources in the roster panel." }, { "show resource", "Show contact's connected resources in the roster panel." },
{ "show presence", "Show contact's presence in the roster panel." },
{ "show status", "Show contact's status message in the roster panel." },
{ "show empty", "When grouping by presence, show empty presence groups." }, { "show empty", "When grouping by presence, show empty presence groups." },
{ "show count", "Show number of contacts in group/presence." },
{ "show priority", "Show resource priority." },
{ "hide", "Hide the roster panel." }, { "hide", "Hide the roster panel." },
{ "hide offline", "Hide offline contacts in the roster panel." }, { "hide offline", "Hide offline contacts in the roster panel." },
{ "hide resource", "Hide contact's connected resources in the roster panel." }, { "hide resource", "Hide contact's connected resources in the roster panel." },
{ "hide presence", "Hide contact's presence in the roster panel." },
{ "hide status", "Hide contact's status message in the roster panel." },
{ "hide empty", "When grouping by presence, hide empty presence groups." }, { "hide empty", "When grouping by presence, hide empty presence groups." },
{ "hide count", "Hide number of contacts in group/presence." },
{ "hide priority", "Hide resource priority." },
{ "by group", "Group contacts in the roster panel by roster group." }, { "by group", "Group contacts in the roster panel by roster group." },
{ "by presence", "Group contacts in the roster panel by presence." }, { "by presence", "Group contacts in the roster panel by presence." },
{ "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 presence", "Order roster items by presence, and then by name." },
{ "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)." },
{ "add <jid> [<nick>]", "Add a new item to the roster." }, { "add <jid> [<nick>]", "Add a new item to the roster." },
{ "remove <jid>", "Removes an item from the roster." }, { "remove <jid>", "Removes an item from the roster." },
@ -1767,6 +1778,7 @@ static Autocomplete wins_ac;
static Autocomplete roster_ac; static Autocomplete roster_ac;
static Autocomplete roster_option_ac; static Autocomplete roster_option_ac;
static Autocomplete roster_by_ac; static Autocomplete roster_by_ac;
static Autocomplete roster_order_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;
@ -2010,18 +2022,27 @@ cmd_init(void)
autocomplete_add(roster_ac, "show"); autocomplete_add(roster_ac, "show");
autocomplete_add(roster_ac, "hide"); autocomplete_add(roster_ac, "hide");
autocomplete_add(roster_ac, "by"); autocomplete_add(roster_ac, "by");
autocomplete_add(roster_ac, "order");
autocomplete_add(roster_ac, "size"); autocomplete_add(roster_ac, "size");
roster_option_ac = autocomplete_new(); roster_option_ac = autocomplete_new();
autocomplete_add(roster_option_ac, "offline"); autocomplete_add(roster_option_ac, "offline");
autocomplete_add(roster_option_ac, "resource"); 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, "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");
autocomplete_add(roster_by_ac, "presence"); autocomplete_add(roster_by_ac, "presence");
autocomplete_add(roster_by_ac, "none"); autocomplete_add(roster_by_ac, "none");
roster_order_ac = autocomplete_new();
autocomplete_add(roster_order_ac, "name");
autocomplete_add(roster_order_ac, "presence");
roster_remove_all_ac = autocomplete_new(); roster_remove_all_ac = autocomplete_new();
autocomplete_add(roster_remove_all_ac, "contacts"); autocomplete_add(roster_remove_all_ac, "contacts");
@ -2276,6 +2297,7 @@ cmd_uninit(void)
autocomplete_free(roster_ac); autocomplete_free(roster_ac);
autocomplete_free(roster_option_ac); autocomplete_free(roster_option_ac);
autocomplete_free(roster_by_ac); autocomplete_free(roster_by_ac);
autocomplete_free(roster_order_ac);
autocomplete_free(roster_remove_all_ac); autocomplete_free(roster_remove_all_ac);
autocomplete_free(group_ac); autocomplete_free(group_ac);
autocomplete_free(bookmark_ac); autocomplete_free(bookmark_ac);
@ -2462,6 +2484,7 @@ cmd_reset_autocomplete(ProfWin *window)
autocomplete_reset(roster_ac); autocomplete_reset(roster_ac);
autocomplete_reset(roster_option_ac); autocomplete_reset(roster_option_ac);
autocomplete_reset(roster_by_ac); autocomplete_reset(roster_by_ac);
autocomplete_reset(roster_order_ac);
autocomplete_reset(roster_remove_all_ac); autocomplete_reset(roster_remove_all_ac);
autocomplete_reset(group_ac); autocomplete_reset(group_ac);
autocomplete_reset(titlebar_ac); autocomplete_reset(titlebar_ac);
@ -2875,6 +2898,10 @@ _roster_autocomplete(ProfWin *window, const char *const input)
if (result) { if (result) {
return result; return result;
} }
result = autocomplete_param_with_ac(input, "/roster order", roster_order_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

@ -1320,13 +1320,13 @@ _who_roster(ProfWin *window, const char *const command, gchar **args)
cons_show(""); cons_show("");
GSList *list = NULL; GSList *list = NULL;
if (group) { if (group) {
list = roster_get_group(group); list = roster_get_group(group, ROSTER_ORD_NAME, TRUE);
if (list == NULL) { if (list == NULL) {
cons_show("No such group: %s.", group); cons_show("No such group: %s.", group);
return; return;
} }
} else { } else {
list = roster_get_contacts(); list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
if (list == NULL) { if (list == NULL) {
cons_show("No contacts in roster."); cons_show("No contacts in roster.");
return; return;
@ -1628,7 +1628,7 @@ cmd_group(ProfWin *window, const char *const command, gchar **args)
return TRUE; return TRUE;
} }
GSList *list = roster_get_group(group); GSList *list = roster_get_group(group, ROSTER_ORD_NAME, TRUE);
cons_show_roster_group(group, list); cons_show_roster_group(group, list);
return TRUE; return TRUE;
} }
@ -1711,7 +1711,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
return TRUE; return TRUE;
} }
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
cons_show_roster(list); cons_show_roster(list);
g_slist_free(list); g_slist_free(list);
return TRUE; return TRUE;
@ -1773,6 +1773,20 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "presence") == 0) {
cons_show("Roster presence enabled");
prefs_set_boolean(PREF_ROSTER_PRESENCE, TRUE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "status") == 0) {
cons_show("Roster status enabled");
prefs_set_boolean(PREF_ROSTER_STATUS, TRUE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "empty") == 0) { } else if (g_strcmp0(args[1], "empty") == 0) {
cons_show("Roster empty enabled"); cons_show("Roster empty enabled");
prefs_set_boolean(PREF_ROSTER_EMPTY, TRUE); prefs_set_boolean(PREF_ROSTER_EMPTY, TRUE);
@ -1780,6 +1794,20 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "count") == 0) {
cons_show("Roster count enabled");
prefs_set_boolean(PREF_ROSTER_COUNT, TRUE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "priority") == 0) {
cons_show("Roster priority enabled");
prefs_set_boolean(PREF_ROSTER_PRIORITY, TRUE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else { } else {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
return TRUE; return TRUE;
@ -1806,6 +1834,20 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "presence") == 0) {
cons_show("Roster presence disabled");
prefs_set_boolean(PREF_ROSTER_PRESENCE, FALSE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "status") == 0) {
cons_show("Roster status disabled");
prefs_set_boolean(PREF_ROSTER_STATUS, FALSE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "empty") == 0) { } else if (g_strcmp0(args[1], "empty") == 0) {
cons_show("Roster empty disabled"); cons_show("Roster empty disabled");
prefs_set_boolean(PREF_ROSTER_EMPTY, FALSE); prefs_set_boolean(PREF_ROSTER_EMPTY, FALSE);
@ -1813,6 +1855,20 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster(); rosterwin_roster();
} }
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "count") == 0) {
cons_show("Roster count disabled");
prefs_set_boolean(PREF_ROSTER_COUNT, FALSE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "priority") == 0) {
cons_show("Roster priority disabled");
prefs_set_boolean(PREF_ROSTER_PRIORITY, FALSE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else { } else {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
return TRUE; return TRUE;
@ -1844,6 +1900,26 @@ 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
} else if (g_strcmp0(args[0], "order") == 0) {
if (g_strcmp0(args[1], "name") == 0) {
cons_show("Ordering roster by name");
prefs_set_string(PREF_ROSTER_ORDER, "name");
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "presence") == 0) {
cons_show("Ordering roster by presence");
prefs_set_string(PREF_ROSTER_ORDER, "presence");
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else {
cons_bad_cmd_usage(command);
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) {
@ -1883,7 +1959,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
return TRUE; return TRUE;
} }
GSList *all = roster_get_contacts(); GSList *all = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
GSList *curr = all; GSList *curr = all;
while (curr) { while (curr) {
PContact contact = curr->data; PContact contact = curr->data;

View File

@ -597,8 +597,13 @@ _get_group(preference_t pref)
case PREF_ROSTER: case PREF_ROSTER:
case PREF_ROSTER_OFFLINE: case PREF_ROSTER_OFFLINE:
case PREF_ROSTER_RESOURCE: case PREF_ROSTER_RESOURCE:
case PREF_ROSTER_PRESENCE:
case PREF_ROSTER_STATUS:
case PREF_ROSTER_EMPTY: case PREF_ROSTER_EMPTY:
case PREF_ROSTER_BY: case PREF_ROSTER_BY:
case PREF_ROSTER_ORDER:
case PREF_ROSTER_COUNT:
case PREF_ROSTER_PRIORITY:
case PREF_RESOURCE_TITLE: case PREF_RESOURCE_TITLE:
case PREF_RESOURCE_MESSAGE: case PREF_RESOURCE_MESSAGE:
case PREF_ENC_WARN: case PREF_ENC_WARN:
@ -768,10 +773,20 @@ _get_key(preference_t pref)
return "roster.offline"; return "roster.offline";
case PREF_ROSTER_RESOURCE: case PREF_ROSTER_RESOURCE:
return "roster.resource"; return "roster.resource";
case PREF_ROSTER_PRESENCE:
return "roster.presence";
case PREF_ROSTER_STATUS:
return "roster.status";
case PREF_ROSTER_EMPTY: case PREF_ROSTER_EMPTY:
return "roster.empty"; return "roster.empty";
case PREF_ROSTER_BY: case PREF_ROSTER_BY:
return "roster.by"; return "roster.by";
case PREF_ROSTER_ORDER:
return "roster.order";
case PREF_ROSTER_COUNT:
return "roster.count";
case PREF_ROSTER_PRIORITY:
return "roster.priority";
case PREF_RESOURCE_TITLE: case PREF_RESOURCE_TITLE:
return "resource.title"; return "resource.title";
case PREF_RESOURCE_MESSAGE: case PREF_RESOURCE_MESSAGE:
@ -822,8 +837,9 @@ _get_default_boolean(preference_t pref)
case PREF_RESOURCE_MESSAGE: case PREF_RESOURCE_MESSAGE:
case PREF_ROSTER: case PREF_ROSTER:
case PREF_ROSTER_OFFLINE: case PREF_ROSTER_OFFLINE:
case PREF_ROSTER_RESOURCE:
case PREF_ROSTER_EMPTY: case PREF_ROSTER_EMPTY:
case PREF_ROSTER_COUNT:
case PREF_ROSTER_PRIORITY:
case PREF_TLS_SHOW: case PREF_TLS_SHOW:
case PREF_LASTACTIVITY: case PREF_LASTACTIVITY:
return TRUE; return TRUE;
@ -853,6 +869,8 @@ _get_default_string(preference_t pref)
return "all"; return "all";
case PREF_ROSTER_BY: case PREF_ROSTER_BY:
return "presence"; return "presence";
case PREF_ROSTER_ORDER:
return "presence";
case PREF_TIME_CONSOLE: case PREF_TIME_CONSOLE:
return "%H:%M:%S"; return "%H:%M:%S";
case PREF_TIME_CHAT: case PREF_TIME_CHAT:

View File

@ -64,8 +64,13 @@ typedef enum {
PREF_ROSTER_SIZE, PREF_ROSTER_SIZE,
PREF_ROSTER_OFFLINE, PREF_ROSTER_OFFLINE,
PREF_ROSTER_RESOURCE, PREF_ROSTER_RESOURCE,
PREF_ROSTER_PRESENCE,
PREF_ROSTER_STATUS,
PREF_ROSTER_EMPTY, PREF_ROSTER_EMPTY,
PREF_ROSTER_BY, PREF_ROSTER_BY,
PREF_ROSTER_ORDER,
PREF_ROSTER_COUNT,
PREF_ROSTER_PRIORITY,
PREF_MUC_PRIVILEGES, PREF_MUC_PRIVILEGES,
PREF_PRESENCE, PREF_PRESENCE,
PREF_WRAP, PREF_WRAP,

View File

@ -458,8 +458,13 @@ _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.presence", PREF_ROSTER_PRESENCE);
_set_boolean_preference("roster.status", PREF_ROSTER_STATUS);
_set_boolean_preference("roster.empty", PREF_ROSTER_EMPTY); _set_boolean_preference("roster.empty", PREF_ROSTER_EMPTY);
_set_string_preference("roster.by", PREF_ROSTER_BY); _set_string_preference("roster.by", PREF_ROSTER_BY);
_set_string_preference("roster.order", PREF_ROSTER_ORDER);
_set_boolean_preference("roster.count", PREF_ROSTER_COUNT);
_set_boolean_preference("roster.priority", PREF_ROSTER_PRIORITY);
if (g_key_file_has_key(theme, "ui", "roster.size", NULL)) { if (g_key_file_has_key(theme, "ui", "roster.size", NULL)) {
gint roster_size = g_key_file_get_integer(theme, "ui", "roster.size", NULL); gint roster_size = g_key_file_get_integer(theme, "ui", "roster.size", NULL);
prefs_set_roster_size(roster_size); prefs_set_roster_size(roster_size);

View File

@ -67,7 +67,8 @@ static gboolean _key_equals(void *key1, void *key2);
static gboolean _datetimes_equal(GDateTime *dt1, GDateTime *dt2); static gboolean _datetimes_equal(GDateTime *dt1, GDateTime *dt2);
static void _replace_name(const char *const current_name, const char *const new_name, const char *const barejid); static void _replace_name(const char *const current_name, const char *const new_name, const char *const barejid);
static void _add_name_and_barejid(const char *const name, const char *const barejid); static void _add_name_and_barejid(const char *const name, const char *const barejid);
static gint _compare_contacts(PContact a, PContact b); static gint _compare_name(PContact a, PContact b);
static gint _compare_presence(PContact a, PContact b);
void void
roster_clear(void) roster_clear(void)
@ -373,7 +374,7 @@ roster_get_contacts_by_presence(const char *const presence)
while (g_hash_table_iter_next(&iter, &key, &value)) { while (g_hash_table_iter_next(&iter, &key, &value)) {
PContact contact = (PContact)value; PContact contact = (PContact)value;
if (g_strcmp0(p_contact_presence(contact), presence) == 0) { if (g_strcmp0(p_contact_presence(contact), presence) == 0) {
result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_contacts); result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_name);
} }
} }
@ -382,16 +383,29 @@ roster_get_contacts_by_presence(const char *const presence)
} }
GSList* GSList*
roster_get_contacts(void) roster_get_contacts(roster_ord_t order, gboolean include_offline)
{ {
GSList *result = NULL; GSList *result = NULL;
GHashTableIter iter; GHashTableIter iter;
gpointer key; gpointer key;
gpointer value; gpointer value;
GCompareFunc cmp_func;
if (order == ROSTER_ORD_PRESENCE) {
cmp_func = (GCompareFunc) _compare_presence;
} else {
cmp_func = (GCompareFunc) _compare_name;
}
g_hash_table_iter_init(&iter, contacts); g_hash_table_iter_init(&iter, contacts);
while (g_hash_table_iter_next(&iter, &key, &value)) { while (g_hash_table_iter_next(&iter, &key, &value)) {
result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_contacts); PContact contact = value;
const char *presence = p_contact_presence(contact);
if (!include_offline && (g_strcmp0(presence, "offline") == 0)) {
continue;
}
result = g_slist_insert_sorted(result, value, cmp_func);
} }
// return all contact structs // return all contact structs
@ -409,7 +423,7 @@ roster_get_contacts_online(void)
g_hash_table_iter_init(&iter, contacts); g_hash_table_iter_init(&iter, contacts);
while (g_hash_table_iter_next(&iter, &key, &value)) { while (g_hash_table_iter_next(&iter, &key, &value)) {
if(strcmp(p_contact_presence(value), "offline")) if(strcmp(p_contact_presence(value), "offline"))
result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_contacts); result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_name);
} }
// return all contact structs // return all contact structs
@ -447,18 +461,31 @@ roster_fulljid_autocomplete(const char *const search_str)
} }
GSList* GSList*
roster_get_nogroup(void) roster_get_nogroup(roster_ord_t order, gboolean include_offline)
{ {
GSList *result = NULL; GSList *result = NULL;
GHashTableIter iter; GHashTableIter iter;
gpointer key; gpointer key;
gpointer value; gpointer value;
GCompareFunc cmp_func;
if (order == ROSTER_ORD_PRESENCE) {
cmp_func = (GCompareFunc) _compare_presence;
} else {
cmp_func = (GCompareFunc) _compare_name;
}
g_hash_table_iter_init(&iter, contacts); g_hash_table_iter_init(&iter, contacts);
while (g_hash_table_iter_next(&iter, &key, &value)) { while (g_hash_table_iter_next(&iter, &key, &value)) {
PContact contact = value;
const char *presence = p_contact_presence(contact);
if (!include_offline && (g_strcmp0(presence, "offline") == 0)) {
continue;
}
GSList *groups = p_contact_groups(value); GSList *groups = p_contact_groups(value);
if (groups == NULL) { if (groups == NULL) {
result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_contacts); result = g_slist_insert_sorted(result, value, cmp_func);
} }
} }
@ -467,19 +494,32 @@ roster_get_nogroup(void)
} }
GSList* GSList*
roster_get_group(const char *const group) roster_get_group(const char *const group, roster_ord_t order, gboolean include_offline)
{ {
GSList *result = NULL; GSList *result = NULL;
GHashTableIter iter; GHashTableIter iter;
gpointer key; gpointer key;
gpointer value; gpointer value;
GCompareFunc cmp_func;
if (order == ROSTER_ORD_PRESENCE) {
cmp_func = (GCompareFunc) _compare_presence;
} else {
cmp_func = (GCompareFunc) _compare_name;
}
g_hash_table_iter_init(&iter, contacts); g_hash_table_iter_init(&iter, contacts);
while (g_hash_table_iter_next(&iter, &key, &value)) { while (g_hash_table_iter_next(&iter, &key, &value)) {
PContact contact = value;
const char *presence = p_contact_presence(contact);
if (!include_offline && (g_strcmp0(presence, "offline") == 0)) {
continue;
}
GSList *groups = p_contact_groups(value); GSList *groups = p_contact_groups(value);
while (groups) { while (groups) {
if (strcmp(groups->data, group) == 0) { if (strcmp(groups->data, group) == 0) {
result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_contacts); result = g_slist_insert_sorted(result, value, cmp_func);
break; break;
} }
groups = g_slist_next(groups); groups = g_slist_next(groups);
@ -560,7 +600,7 @@ _add_name_and_barejid(const char *const name, const char *const barejid)
} }
static gint static gint
_compare_contacts(PContact a, PContact b) _compare_name(PContact a, PContact b)
{ {
const char * utf8_str_a = NULL; const char * utf8_str_a = NULL;
const char * utf8_str_b = NULL; const char * utf8_str_b = NULL;
@ -580,3 +620,43 @@ _compare_contacts(PContact a, PContact b)
return result; return result;
} }
static gint
_get_presence_weight(const char *presence)
{
if (g_strcmp0(presence, "chat") == 0) {
return 0;
} else if (g_strcmp0(presence, "online") == 0) {
return 1;
} else if (g_strcmp0(presence, "away") == 0) {
return 2;
} else if (g_strcmp0(presence, "xa") == 0) {
return 3;
} else if (g_strcmp0(presence, "dnd") == 0) {
return 4;
} else { // offline
return 5;
}
}
static gint
_compare_presence(PContact a, PContact b)
{
const char *presence_a = p_contact_presence(a);
const char *presence_b = p_contact_presence(b);
// if presence different, order by presence
if (g_strcmp0(presence_a, presence_b) != 0) {
int weight_a = _get_presence_weight(presence_a);
int weight_b = _get_presence_weight(presence_b);
if (weight_a < weight_b) {
return -1;
} else {
return 1;
}
// otherwise order by name
} else {
return _compare_name(a, b);
}
}

View File

@ -40,6 +40,11 @@
#include "resource.h" #include "resource.h"
#include "contact.h" #include "contact.h"
typedef enum {
ROSTER_ORD_NAME,
ROSTER_ORD_PRESENCE
} roster_ord_t;
void roster_clear(void); void roster_clear(void);
gboolean roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity); gboolean roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity);
PContact roster_get_contact(const char *const barejid); PContact roster_get_contact(const char *const barejid);
@ -54,17 +59,17 @@ void roster_update(const char *const barejid, const char *const name, GSList *gr
gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription,
gboolean pending_out); gboolean pending_out);
char* roster_barejid_from_name(const char *const name); char* roster_barejid_from_name(const char *const name);
GSList* roster_get_contacts(void); GSList* roster_get_contacts(roster_ord_t order, gboolean include_offline);
GSList* roster_get_contacts_online(void); GSList* roster_get_contacts_online(void);
gboolean roster_has_pending_subscriptions(void); gboolean roster_has_pending_subscriptions(void);
char* roster_contact_autocomplete(const char *const search_str); char* roster_contact_autocomplete(const char *const search_str);
char* roster_fulljid_autocomplete(const char *const search_str); char* roster_fulljid_autocomplete(const char *const search_str);
GSList* roster_get_group(const char *const group); GSList* roster_get_group(const char *const group, roster_ord_t order, gboolean include_offline);
GSList* roster_get_groups(void); GSList* roster_get_groups(void);
char* roster_group_autocomplete(const char *const search_str); char* roster_group_autocomplete(const char *const search_str);
char* roster_barejid_autocomplete(const char *const search_str); char* roster_barejid_autocomplete(const char *const search_str);
GSList* roster_get_contacts_by_presence(const char *const presence); GSList* roster_get_contacts_by_presence(const char *const presence);
GSList* roster_get_nogroup(void); GSList* roster_get_nogroup(roster_ord_t order, gboolean include_offline);
char* roster_get_msg_display_name(const char *const barejid, const char *const resource); char* roster_get_msg_display_name(const char *const barejid, const char *const resource);
#endif #endif

View File

@ -527,7 +527,7 @@ void
cons_show_sent_subs(void) cons_show_sent_subs(void)
{ {
if (roster_has_pending_subscriptions()) { if (roster_has_pending_subscriptions()) {
GSList *contacts = roster_get_contacts(); GSList *contacts = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
PContact contact = NULL; PContact contact = NULL;
cons_show("Awaiting subscription responses from:"); cons_show("Awaiting subscription responses from:");
GSList *curr = contacts; GSList *curr = contacts;
@ -1207,15 +1207,39 @@ cons_roster_setting(void)
else else
cons_show("Roster resource (/roster) : hide"); cons_show("Roster resource (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_PRESENCE))
cons_show("Roster presence (/roster) : show");
else
cons_show("Roster presence (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_STATUS))
cons_show("Roster status (/roster) : show");
else
cons_show("Roster status (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_EMPTY)) if (prefs_get_boolean(PREF_ROSTER_EMPTY))
cons_show("Roster empty (/roster) : show"); cons_show("Roster empty (/roster) : show");
else else
cons_show("Roster empty (/roster) : hide"); cons_show("Roster empty (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_COUNT))
cons_show("Roster count (/roster) : show");
else
cons_show("Roster count (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_PRIORITY))
cons_show("Roster priority (/roster) : show");
else
cons_show("Roster priority (/roster) : hide");
char *by = prefs_get_string(PREF_ROSTER_BY); char *by = prefs_get_string(PREF_ROSTER_BY);
cons_show("Roster by (/roster) : %s", by); cons_show("Roster by (/roster) : %s", by);
prefs_free_string(by); prefs_free_string(by);
char *order = prefs_get_string(PREF_ROSTER_ORDER);
cons_show("Roster order (/roster) : %s", order);
prefs_free_string(order);
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);
} }

View File

@ -42,42 +42,112 @@
#include "config/preferences.h" #include "config/preferences.h"
#include "roster_list.h" #include "roster_list.h"
static void
_rosterwin_presence(ProfLayoutSplit *layout, int indent, theme_item_t colour, const char *presence, const char *status)
{
// don't show presence for offline contacts
gboolean is_offline = g_strcmp0(presence, "offline") == 0;
if (is_offline) {
return;
}
char *by = prefs_get_string(PREF_ROSTER_BY);
gboolean by_presence = g_strcmp0(by, "presence") == 0;
// show only status when grouped by presence
if (by_presence) {
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
wattron(layout->subwin, theme_attrs(colour));
GString *msg = g_string_new(" ");
while (indent > 0) {
g_string_append(msg, " ");
indent--;
}
g_string_append_printf(msg, "\"%s\"", status);
win_printline_nowrap(layout->subwin, msg->str);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
}
// show both presence and status when not grouped by presence
} else {
wattron(layout->subwin, theme_attrs(colour));
GString *msg = g_string_new(" ");
while (indent > 0) {
g_string_append(msg, " ");
indent--;
}
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
g_string_append(msg, presence);
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, " \"%s\"", status);
}
} else if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, "\"%s\"", status);
}
win_printline_nowrap(layout->subwin, msg->str);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
}
}
static void
_rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
{
GList *resources = p_contact_get_available_resources(contact);
if (resources) {
GList *curr_resource = resources;
while (curr_resource) {
Resource *resource = curr_resource->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(" ");
g_string_append(msg, resource->name);
if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) {
g_string_append_printf(msg, " [%d]", resource->priority);
}
win_printline_nowrap(layout->subwin, msg->str);
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, 6, resource_presence_colour, resource_presence, resource->status);
}
curr_resource = g_list_next(curr_resource);
}
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) {
const char *presence = p_contact_presence(contact);
const char *status = p_contact_status(contact);
theme_item_t presence_colour = theme_main_presence_attrs(presence);
_rosterwin_presence(layout, 4, presence_colour, presence, status);
}
g_list_free(resources);
}
static void static void
_rosterwin_contact(ProfLayoutSplit *layout, PContact contact) _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
{ {
const char *name = p_contact_name_or_jid(contact); const char *name = p_contact_name_or_jid(contact);
const char *presence = p_contact_presence(contact); const char *presence = p_contact_presence(contact);
const char *status = p_contact_status(contact);
if ((g_strcmp0(presence, "offline") != 0) || ((g_strcmp0(presence, "offline") == 0) && theme_item_t presence_colour = theme_main_presence_attrs(presence);
(prefs_get_boolean(PREF_ROSTER_OFFLINE)))) {
theme_item_t presence_colour = theme_main_presence_attrs(presence);
wattron(layout->subwin, theme_attrs(presence_colour)); wattron(layout->subwin, theme_attrs(presence_colour));
GString *msg = g_string_new(" "); GString *msg = g_string_new(" ");
g_string_append(msg, name); g_string_append(msg, name);
win_printline_nowrap(layout->subwin, msg->str); win_printline_nowrap(layout->subwin, msg->str);
g_string_free(msg, TRUE); g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour)); wattroff(layout->subwin, theme_attrs(presence_colour));
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) { if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
GList *resources = p_contact_get_available_resources(contact); _rosterwin_resource(layout, contact);
GList *curr_resource = resources; } else if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) {
while (curr_resource) { _rosterwin_presence(layout, 4, presence_colour, presence, status);
Resource *resource = curr_resource->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(" ");
g_string_append(msg, resource->name);
win_printline_nowrap(layout->subwin, msg->str);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(resource_presence_colour));
curr_resource = g_list_next(curr_resource);
}
g_list_free(resources);
}
} }
} }
@ -89,7 +159,12 @@ _rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const prese
// if this group has contacts, or if we want to show empty groups // if this group has contacts, or if we want to show empty groups
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) { if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_printline_nowrap(layout->subwin, title); GString *title_str = g_string_new(title);
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title_str, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title_str->str);
g_string_free(title_str, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
} }
@ -107,15 +182,27 @@ _rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const prese
static void static void
_rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group) _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
{ {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); GSList *contacts = NULL;
GString *title = g_string_new(" -");
g_string_append(title, group); char *order = prefs_get_string(PREF_ROSTER_ORDER);
win_printline_nowrap(layout->subwin, title->str); gboolean offline = prefs_get_boolean(PREF_ROSTER_OFFLINE);
g_string_free(title, TRUE); if (g_strcmp0(order, "presence") == 0) {
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); contacts = roster_get_group(group, ROSTER_ORD_PRESENCE, offline);
} else {
contacts = roster_get_group(group, ROSTER_ORD_NAME, offline);
}
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GString *title = g_string_new(" -");
g_string_append(title, group);
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title->str);
g_string_free(title, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GSList *contacts = roster_get_group(group);
if (contacts) {
GSList *curr_contact = contacts; GSList *curr_contact = contacts;
while (curr_contact) { while (curr_contact) {
PContact contact = curr_contact->data; PContact contact = curr_contact->data;
@ -129,10 +216,24 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
static void static void
_rosterwin_contacts_by_no_group(ProfLayoutSplit *layout) _rosterwin_contacts_by_no_group(ProfLayoutSplit *layout)
{ {
GSList *contacts = roster_get_nogroup(); GSList *contacts = NULL;
if (contacts) {
char *order = prefs_get_string(PREF_ROSTER_ORDER);
gboolean offline = prefs_get_boolean(PREF_ROSTER_OFFLINE);
if (g_strcmp0(order, "presence") == 0) {
contacts = roster_get_nogroup(ROSTER_ORD_PRESENCE, offline);
} else {
contacts = roster_get_nogroup(ROSTER_ORD_NAME, offline);
}
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_printline_nowrap(layout->subwin, " -no group"); GString *title = g_string_new(" -no group");
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title->str);
g_string_free(title, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GSList *curr_contact = contacts; GSList *curr_contact = contacts;
@ -175,14 +276,28 @@ rosterwin_roster(void)
g_slist_free_full(groups, free); g_slist_free_full(groups, free);
_rosterwin_contacts_by_no_group(layout); _rosterwin_contacts_by_no_group(layout);
} else { } else {
GSList *contacts = roster_get_contacts(); GSList *contacts = NULL;
char *order = prefs_get_string(PREF_ROSTER_ORDER);
gboolean offline = prefs_get_boolean(PREF_ROSTER_OFFLINE);
if (g_strcmp0(order, "presence") == 0) {
contacts = roster_get_contacts(ROSTER_ORD_PRESENCE, offline);
} else {
contacts = roster_get_contacts(ROSTER_ORD_NAME, offline);
}
werase(layout->subwin);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GString *title = g_string_new(" -Roster");
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title->str);
g_string_free(title, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
if (contacts) { if (contacts) {
werase(layout->subwin);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_printline_nowrap(layout->subwin, " -Roster");
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GSList *curr_contact = contacts; GSList *curr_contact = contacts;
while (curr_contact) { while (curr_contact) {
PContact contact = curr_contact->data; PContact contact = curr_contact->data;

View File

@ -55,7 +55,7 @@ void cmd_roster_shows_roster_when_no_args(void **state)
roster_init(); roster_init();
roster_add("bob@server.org", "bob", NULL, "both", FALSE); roster_add("bob@server.org", "bob", NULL, "both", FALSE);
GSList *roster = roster_get_contacts(); GSList *roster = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
expect_memory(cons_show_roster, list, roster, sizeof(roster)); expect_memory(cons_show_roster, list, roster, sizeof(roster));

View File

@ -12,7 +12,7 @@
void empty_list_when_none_added(void **state) void empty_list_when_none_added(void **state)
{ {
roster_init(); roster_init();
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
assert_null(list); assert_null(list);
roster_clear(); roster_clear();
roster_free(); roster_free();
@ -22,7 +22,7 @@ void contains_one_element(void **state)
{ {
roster_init(); roster_init();
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
assert_int_equal(1, g_slist_length(list)); assert_int_equal(1, g_slist_length(list));
roster_clear(); roster_clear();
roster_free(); roster_free();
@ -32,7 +32,7 @@ void first_element_correct(void **state)
{ {
roster_init(); roster_init();
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
PContact james = list->data; PContact james = list->data;
assert_string_equal("James", p_contact_barejid(james)); assert_string_equal("James", p_contact_barejid(james));
@ -45,7 +45,7 @@ void contains_two_elements(void **state)
roster_init(); roster_init();
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
roster_add("Dave", NULL, NULL, NULL, FALSE); roster_add("Dave", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
assert_int_equal(2, g_slist_length(list)); assert_int_equal(2, g_slist_length(list));
roster_clear(); roster_clear();
@ -57,7 +57,7 @@ void first_and_second_elements_correct(void **state)
roster_init(); roster_init();
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
roster_add("Dave", NULL, NULL, NULL, FALSE); roster_add("Dave", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
PContact first = list->data; PContact first = list->data;
PContact second = (g_slist_next(list))->data; PContact second = (g_slist_next(list))->data;
@ -74,7 +74,7 @@ void contains_three_elements(void **state)
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE); roster_add("Bob", NULL, NULL, NULL, FALSE);
roster_add("Dave", NULL, NULL, NULL, FALSE); roster_add("Dave", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
assert_int_equal(3, g_slist_length(list)); assert_int_equal(3, g_slist_length(list));
roster_clear(); roster_clear();
@ -87,7 +87,7 @@ void first_three_elements_correct(void **state)
roster_add("Bob", NULL, NULL, NULL, FALSE); roster_add("Bob", NULL, NULL, NULL, FALSE);
roster_add("Dave", NULL, NULL, NULL, FALSE); roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
PContact bob = list->data; PContact bob = list->data;
PContact dave = (g_slist_next(list))->data; PContact dave = (g_slist_next(list))->data;
PContact james = (g_slist_next(g_slist_next(list)))->data; PContact james = (g_slist_next(g_slist_next(list)))->data;
@ -106,7 +106,7 @@ void add_twice_at_beginning_adds_once(void **state)
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
roster_add("Dave", NULL, NULL, NULL, FALSE); roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE); roster_add("Bob", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
PContact first = list->data; PContact first = list->data;
PContact second = (g_slist_next(list))->data; PContact second = (g_slist_next(list))->data;
PContact third = (g_slist_next(g_slist_next(list)))->data; PContact third = (g_slist_next(g_slist_next(list)))->data;
@ -126,7 +126,7 @@ void add_twice_in_middle_adds_once(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE); roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE); roster_add("Bob", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
PContact first = list->data; PContact first = list->data;
PContact second = (g_slist_next(list))->data; PContact second = (g_slist_next(list))->data;
PContact third = (g_slist_next(g_slist_next(list)))->data; PContact third = (g_slist_next(g_slist_next(list)))->data;
@ -146,7 +146,7 @@ void add_twice_at_end_adds_once(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE); roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE); roster_add("Bob", NULL, NULL, NULL, FALSE);
roster_add("James", NULL, NULL, NULL, FALSE); roster_add("James", NULL, NULL, NULL, FALSE);
GSList *list = roster_get_contacts(); GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
PContact first = list->data; PContact first = list->data;
PContact second = (g_slist_next(list))->data; PContact second = (g_slist_next(list))->data;
PContact third = (g_slist_next(g_slist_next(list)))->data; PContact third = (g_slist_next(g_slist_next(list)))->data;

View File

@ -73,10 +73,15 @@ statuses.chat=all
statuses.muc=all statuses.muc=all
roster=true roster=true
roster.offline=true roster.offline=true
roster.resource=false roster.resource=true
roster.by=presence roster.presence=true
roster.size=25 roster.status=true
roster.empty=true roster.empty=true
roster.by=group
roster.order=presence
roster.count=true
roster.priority=true
roster.size=25
occupants=true occupants=true
occupants.size=15 occupants.size=15
occupants.jid=false occupants.jid=false

View File

@ -21,9 +21,14 @@ occupants.jid=true
roster=true roster=true
roster.offline=true roster.offline=true
roster.resource=true roster.resource=true
roster.by=presence roster.presence=true
roster.size=25 roster.status=true
roster.empty=true roster.empty=true
roster.by=presence
roster.order=presence
roster.count=true
roster.priority=true
roster.size=25
privileges=true privileges=true
presence=true presence=true
intype=true intype=true

View File

@ -20,9 +20,14 @@ occupants.size=15
roster=true roster=true
roster.offline=false roster.offline=false
roster.resource=false roster.resource=false
roster.by=presence roster.presence=false
roster.size=25 roster.status=false
roster.empty=false roster.empty=false
roster.by=none
roster.order=presence
roster.count=false
roster.priority=false
roster.size=25
privileges=false privileges=false
presence=false presence=false
intype=false intype=false