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 2016-01-31 00:44:10 +00:00
commit 42b1918ea0
4 changed files with 456 additions and 568 deletions

View File

@ -493,41 +493,6 @@ roster_fulljid_autocomplete(const char *const search_str)
return autocomplete_complete(roster->fulljid_ac, search_str, TRUE);
}
GSList*
roster_get_nogroup(roster_ord_t order, gboolean include_offline)
{
assert(roster != NULL);
GSList *result = NULL;
GHashTableIter iter;
gpointer key;
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, roster->contacts);
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);
if (groups == NULL) {
result = g_slist_insert_sorted(result, value, cmp_func);
}
}
// return all contact structs
return result;
}
GSList*
roster_get_group(const char *const group, roster_ord_t order, gboolean include_offline)
{
@ -554,6 +519,11 @@ roster_get_group(const char *const group, roster_ord_t order, gboolean include_o
}
GSList *groups = p_contact_groups(value);
if (group == NULL) {
if (groups == NULL) {
result = g_slist_insert_sorted(result, value, cmp_func);
}
} else {
while (groups) {
if (strcmp(groups->data, group) == 0) {
result = g_slist_insert_sorted(result, value, cmp_func);
@ -562,6 +532,7 @@ roster_get_group(const char *const group, roster_ord_t order, gboolean include_o
groups = g_slist_next(groups);
}
}
}
// return all contact structs
return result;

View File

@ -69,7 +69,6 @@ GSList* roster_get_groups(void);
char* roster_group_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_nogroup(roster_ord_t order, gboolean include_offline);
char* roster_get_msg_display_name(const char *const barejid, const char *const resource);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -622,7 +622,9 @@ int main(int argc, char* argv[]) {
unit_test(remove_text_multi_value_removes_when_one),
unit_test(remove_text_multi_value_removes_when_many),
unit_test(clears_chat_sessions),
unit_test_setup_teardown(clears_chat_sessions,
load_preferences,
close_preferences),
};
return run_tests(all_tests);