- if (!cmd->pending) {
- /* Send USERS command to the server */
- idp = silc_id_payload_encode(id_cache->id, SILC_ID_CHANNEL);
- buffer = silc_command_payload_encode_va(SILC_COMMAND_USERS,
- ++conn->cmd_ident, 1,
- 1, idp->data, idp->len);
- silc_client_packet_send(cmd->client, conn->sock, SILC_PACKET_COMMAND,
- NULL, 0, NULL, NULL, buffer->data,
- buffer->len, TRUE);
- silc_buffer_free(buffer);
- silc_buffer_free(idp);
+ /* Find client entry */
+ client_entry = silc_idlist_get_client(client, conn, nickname, cmd->argv[1],
+ FALSE);
+ if (!client_entry) {
+ /* Check whether user requested server actually */
+ server_entry = silc_client_get_server(client, conn, cmd->argv[1]);
+
+ if (!server_entry) {
+ /* No. what ever user wants we don't have it, so resolve it. We
+ will try to resolve both client and server, one of them is
+ bound to be wrong. */
+
+ /* This will send the IDENTIFY command */
+ silc_idlist_get_client(client, conn, nickname, cmd->argv[1], TRUE);
+ silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY,
+ conn->cmd_ident,
+ silc_client_command_destructor,
+ silc_client_command_getkey,
+ silc_client_command_dup(cmd));
+
+ /* This sends the INFO command to resolve the server. */
+ silc_client_send_command(client, conn, SILC_COMMAND_INFO,
+ ++conn->cmd_ident, 1,
+ 1, cmd->argv[1], cmd->argv_lens[1]);
+ silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY,
+ conn->cmd_ident,
+ silc_client_command_destructor,
+ silc_client_command_getkey,
+ silc_client_command_dup(cmd));
+
+ cmd->pending = 1;
+ silc_free(nickname);
+ return;
+ }