+/* Finds client entry from cache by Client ID. If the entry is not found
+ from the cache this function can query it from the server. */
+
+SilcClientEntry silc_idlist_get_client_by_id(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientID *client_id,
+ int query)
+{
+ SilcIDCacheEntry id_cache;
+
+ /* Find ID from cache */
+ if (!silc_idcache_find_by_id_one(conn->client_cache, client_id,
+ SILC_ID_CLIENT, &id_cache)) {
+ if (!query) {
+ return NULL;
+ } else {
+ SilcBuffer idp = silc_id_payload_encode(client_id, SILC_ID_CLIENT);
+ silc_client_send_command(client, conn, SILC_COMMAND_WHOIS, 1,
+ 2, idp->data, idp->len);
+ return NULL;
+ }
+ }
+
+ return (SilcClientEntry)id_cache->context;
+}
+