- /* Remove the old cache entry and create a new one */
- silc_idcache_del_by_context(global ? server->global_list->clients :
- server->local_list->clients, client, NULL);
- silc_idcache_add(global ? server->global_list->clients :
- server->local_list->clients, nickname, client->id,
- client);
+ /* If client is global and is not on any channel then add that we'll
+ expire the entry after a while. */
+ if (global) {
+ client = silc_idlist_find_client_by_id(server->global_list, client->id,
+ FALSE, &cache);
+ if (client && !silc_hash_table_count(client->channels)) {
+ client->data.created = silc_time();
+ silc_dlist_del(server->expired_clients, client);
+ silc_dlist_add(server->expired_clients, client);
+ }