Implemented roster grouped by presence

This commit is contained in:
James Booth
2014-11-12 23:19:07 +00:00
parent 7e360dc35a
commit 15d0f679f6
4 changed files with 122 additions and 62 deletions

View File

@@ -265,6 +265,26 @@ roster_barejid_from_name(const char * const name)
return g_hash_table_lookup(name_to_barejid, name);
}
GSList *
roster_get_contacts_by_presence(const char * const presence)
{
GSList *result = NULL;
GHashTableIter iter;
gpointer key;
gpointer value;
g_hash_table_iter_init(&iter, contacts);
while (g_hash_table_iter_next(&iter, &key, &value)) {
PContact contact = (PContact)value;
if (g_strcmp0(p_contact_presence(contact), presence) == 0) {
result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_contacts);
}
}
// resturn all contact structs
return result;
}
GSList *
roster_get_contacts(void)
{