+ for (i = 0; i < clients_count; i++) {
+ client_entry = clients[i];
+
+ if (!client_entry)
+ continue;
+
+ /* If requested attributes is set then we always resolve the client
+ information, if not then check whether the entry is complete or not
+ and decide whether we need to resolve or not. */
+ if (!query->attrs) {
+ if ((client_entry->nickname && client_entry->username &&
+ client_entry->userinfo) ||
+ !(client_entry->data.status & SILC_IDLIST_STATUS_REGISTERED)) {
+
+ /* Check if cannot query this anyway, so take next one */
+ if (!client_entry->router)
+ continue;
+
+ /* If we are router, client is local to us, or client is on channel
+ we do not need to resolve the client information. */
+ if (server->server_type != SILC_SERVER || SILC_IS_LOCAL(client_entry)
+ || silc_hash_table_count(client_entry->channels))
+ continue;
+ }
+ }
+
+ /* When requested attributes is present and local client is detached
+ we cannot send the command to the client, we'll reply on behalf of
+ the client instead. */
+ if (query->attrs && SILC_IS_LOCAL(client_entry) &&
+ client_entry->mode & SILC_UMODE_DETACHED)
+ continue;
+
+ /* Resolve the detailed client information. If client is local we
+ know that attributes were present and we will resolve directly
+ from the client. Otherwise resolve from client's owner. */
+ silc_server_query_resolve(server, query,
+ (SILC_IS_LOCAL(client_entry) ?
+ client_entry->connection :
+ client_entry->router->connection),
+ client_entry);
+ }