Added STATS command. Patch by Ville Räsänen.
[silc.git] / lib / silcclient / command_reply.c
index 10ca6f960fa3b9f3e1d98fd7a2e543480ef5a6dd..5772d41493df95e08f45791e0f42a8daaaa40f76 100644 (file)
@@ -432,8 +432,12 @@ silc_client_command_reply_identify_save(SilcClientCommandReplyContext cmd,
          COMMAND_REPLY_ERROR;
        return;
       }
+    } else {
+      silc_client_update_server(client, conn, server_entry, name, info);
     }
 
+    server_entry->resolve_cmd_ident = 0;
+
     /* Notify application */
     if (notify)
       COMMAND_REPLY((ARGS, server_entry, name, info));
@@ -826,6 +830,38 @@ SILC_CLIENT_CMD_REPLY_FUNC(info)
   silc_client_command_reply_free(cmd);
 }
 
+/* Received reply to STATS command. */
+
+SILC_CLIENT_CMD_REPLY_FUNC(stats)
+{
+  SilcClientCommandReplyContext cmd = (SilcClientCommandReplyContext)context;
+  SilcClientConnection conn = (SilcClientConnection)cmd->sock->user_data;
+  unsigned char *tmp, *buf = NULL;
+  SilcUInt32 len, buf_len = 0;
+
+  if (cmd->error != SILC_STATUS_OK) {
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_get_status_message(cmd->error));
+    COMMAND_REPLY_ERROR;
+    goto out;
+  }
+
+  /* Get server ID */
+  tmp = silc_argument_get_arg_type(cmd->args, 2, &len);
+  if (!tmp)
+    goto out;
+
+  /* Get statistics structure */
+  buf = silc_argument_get_arg_type(cmd->args, 3, &buf_len);
+
+  /* Notify application */
+  COMMAND_REPLY((ARGS, buf, buf_len));
+
+ out:
+  SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_STATS);
+  silc_client_command_reply_free(cmd);
+}
+
 /* Received reply to PING command. The reply time is shown to user. */
 
 SILC_CLIENT_CMD_REPLY_FUNC(ping)
@@ -905,7 +941,7 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
   }
 
   argc = silc_argument_get_arg_num(cmd->args);
-  if (argc < 7 || argc > 15) {
+  if (argc < 7) {
     SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
        "Cannot join channel: Bad reply packet");
     COMMAND_REPLY_ERROR;