- *clients = silc_realloc(*clients,
- (silc_idcache_list_count(list) + *clients_count) *
- sizeof(**clients));
-
- i = 0;
- silc_idcache_list_first(list, &id_cache);
- (*clients)[i++] = (SilcClientEntry)id_cache->context;
-
- while (silc_idcache_list_next(list, &id_cache))
- (*clients)[i++] = (SilcClientEntry)id_cache->context;
-
- silc_idcache_list_free(list);
-
- *clients_count += i;
-
- return TRUE;
-}
-
-/* Finds client by nickname hash. */
-
-SilcClientEntry
-silc_idlist_find_client_by_hash(SilcIDList id_list, char *nickname,
- SilcHash md5hash, SilcIDCacheEntry *ret_entry)
-{
- SilcIDCacheList list = NULL;
- SilcIDCacheEntry id_cache = NULL;
- SilcClientEntry client = NULL;
- unsigned char hash[32];
-
- SILC_LOG_DEBUG(("Client by hash"));
-
- silc_hash_make(md5hash, nickname, strlen(nickname), hash);
-
- if (!silc_idcache_find_by_id(id_list->clients, SILC_ID_CACHE_ANY,
- SILC_ID_CLIENT, &list))
- return NULL;
-
- if (!silc_idcache_list_first(list, &id_cache)) {
- silc_idcache_list_free(list);
- return NULL;
+ /* If server is specified, narrow the search with it. */
+ if (server) {
+ silc_list_start(list);
+ while ((id_cache = silc_list_get(list))) {
+ client_entry = id_cache->context;
+ if (!client_entry->servername)
+ continue;
+ if (!silc_utf8_strcasecmp(client_entry->servername, server))
+ silc_list_del(list, id_cache);
+ }