updates.
[silc.git] / lib / silcclient / command_reply.c
index 575ba3483b8873a43773fbecd4e279ad120e8fde..e6a778690a7d84683012b96fcf41eb9063d49a6b 100644 (file)
@@ -293,6 +293,9 @@ silc_client_command_reply_whois_save(SilcClientCommandReplyContext cmd,
     silc_free(client_id);
   }
 
+  if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING)
+    client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
+
   /* Notify application */
   if (!cmd->callback)
     COMMAND_REPLY((ARGS, client_entry, nickname, username, realname, 
@@ -386,8 +389,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(whowas)
   }
 
  out:
-  SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_WHOIS);
-  SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_WHOIS);
+  SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_WHOWAS);
+  SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_WHOWAS);
   silc_client_command_reply_free(cmd);
 }
 
@@ -451,6 +454,9 @@ silc_client_command_reply_identify_save(SilcClientCommandReplyContext cmd,
                                name, info, NULL, 0);
     }
 
+    if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING)
+      client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
+
     /* Notify application */
     COMMAND_REPLY((ARGS, client_entry, name, info));
     break;
@@ -1261,7 +1267,7 @@ SILC_CLIENT_CMD_REPLY_FUNC(cumode)
   SilcClientEntry client_entry;
   SilcChannelEntry channel;
   SilcChannelUser chu;
-  unsigned char *tmp, *id;
+  unsigned char *modev, *tmp, *id;
   uint32 len, mode;
   
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
@@ -1273,8 +1279,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(cumode)
   }
   
   /* Get channel mode */
-  tmp = silc_argument_get_arg_type(cmd->args, 2, NULL);
-  if (!tmp) {
+  modev = silc_argument_get_arg_type(cmd->args, 2, NULL);
+  if (!modev) {
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1325,7 +1331,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(cumode)
   client_entry = (SilcClientEntry)id_cache->context;
 
   /* Save the mode */
-  SILC_GET32_MSB(mode, tmp);
+  SILC_GET32_MSB(mode, modev);
+  silc_list_start(channel->clients);
   while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
     if (chu->client == client_entry) {
       chu->mode = mode;
@@ -1695,6 +1702,18 @@ SILC_CLIENT_CMD_REPLY_FUNC(users)
 
     if (!id_cache || !((SilcClientEntry)id_cache->context)->username ||
        !((SilcClientEntry)id_cache->context)->realname) {
+
+      if (id_cache && id_cache->context) {
+       SilcClientEntry client_entry = (SilcClientEntry)id_cache->context;
+       if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING) {
+         client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
+         silc_buffer_pull(client_id_list, idp_len);
+         silc_buffer_pull(client_mode_list, 4);
+         continue;
+       }
+       client_entry->status |= SILC_CLIENT_STATUS_RESOLVING;
+      }
+
       /* No we don't have it (or it is incomplete in information), query
         it from the server. Assemble argument table that will be sent
         for the WHOIS command later. */