Added /room <affiliation> command

This commit is contained in:
James Booth
2014-10-01 00:46:58 +01:00
parent 5879f497ad
commit c90f4a37a3
7 changed files with 107 additions and 6 deletions

View File

@@ -542,6 +542,29 @@ muc_occupants_by_role(const char * const room, muc_role_t role)
}
}
GSList *
muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliation)
{
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) {
GSList *result = NULL;
GHashTableIter iter;
gpointer key;
gpointer value;
g_hash_table_iter_init(&iter, chat_room->roster);
while (g_hash_table_iter_next(&iter, &key, &value)) {
Occupant *occupant = (Occupant *)value;
if (occupant->affiliation == affiliation) {
result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_occupants);
}
}
return result;
} else {
return NULL;
}
}
/*
* Remove the old_nick from the roster, and flag that a pending nickname change
* is in progress