updates.
[silc.git] / lib / silcclient / command_reply.h
index 2b7acf7f346ee42578a4d2cceec007f2a1899350..8c3951a495f9af5d37e07eab0fc4732f09ca8022 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
 
-  Copyright (C) 1997 - 2000 Pekka Riikonen
+  Copyright (C) 1997 - 2001 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -39,8 +39,10 @@ typedef struct {
   SilcPacketContext *packet;
 
   /* If defined this executes the pending command. */
+  SilcClientPendingDestructor destructor;
+  SilcCommandCb callback;
   void *context;
-  SilcClientCommandCallback callback;
+  uint16 ident;
 } *SilcClientCommandReplyContext;
 
 /* Macros */
@@ -53,27 +55,21 @@ typedef struct {
 #define SILC_CLIENT_CMD_REPLY_FUNC(func) \
 void silc_client_command_reply_##func(void *context)
 
-/* Macro used to execute command replies */
-#define SILC_CLIENT_COMMAND_REPLY_EXEC(ctx)            \
-do {                                                   \
-  SilcClientCommandReply *cmd;                         \
-                                                       \
-  for (cmd = silc_command_reply_list; cmd->cb; cmd++)  \
-    if (cmd->cmd == silc_command_get(ctx->payload)) {  \
-      cmd->cb(ctx);                                    \
-      break;                                           \
-    }                                                  \
-                                                       \
-  if (cmd == NULL) {                                   \
-    silc_free(ctx);                                    \
-    return;                                            \
-  }                                                    \
-} while(0)
+/* Status message structure. Messages are defined below. */
+typedef struct {
+  SilcCommandStatus status;
+  char *message;
+} SilcCommandStatusMessage;
+
+/* Status messages returned by the server */
+#define STAT(x) SILC_STATUS_ERR_##x
+extern const SilcCommandStatusMessage silc_command_status_messages[];
 
 /* Prototypes */
 void silc_client_command_reply_process(SilcClient client,
                                       SilcSocketConnection sock,
                                       SilcPacketContext *packet);
+char *silc_client_command_status_message(SilcCommandStatus status);
 SILC_CLIENT_CMD_REPLY_FUNC(whois);
 SILC_CLIENT_CMD_REPLY_FUNC(whowas);
 SILC_CLIENT_CMD_REPLY_FUNC(identify);
@@ -81,7 +77,6 @@ SILC_CLIENT_CMD_REPLY_FUNC(nick);
 SILC_CLIENT_CMD_REPLY_FUNC(list);
 SILC_CLIENT_CMD_REPLY_FUNC(topic);
 SILC_CLIENT_CMD_REPLY_FUNC(invite);
-SILC_CLIENT_CMD_REPLY_FUNC(quit);
 SILC_CLIENT_CMD_REPLY_FUNC(kill);
 SILC_CLIENT_CMD_REPLY_FUNC(info);
 SILC_CLIENT_CMD_REPLY_FUNC(links);
@@ -97,11 +92,12 @@ SILC_CLIENT_CMD_REPLY_FUNC(umode);
 SILC_CLIENT_CMD_REPLY_FUNC(cmode);
 SILC_CLIENT_CMD_REPLY_FUNC(cumode);
 SILC_CLIENT_CMD_REPLY_FUNC(kick);
-SILC_CLIENT_CMD_REPLY_FUNC(restart);
+SILC_CLIENT_CMD_REPLY_FUNC(ban);
 SILC_CLIENT_CMD_REPLY_FUNC(close);
-SILC_CLIENT_CMD_REPLY_FUNC(die);
+SILC_CLIENT_CMD_REPLY_FUNC(shutdown);
 SILC_CLIENT_CMD_REPLY_FUNC(silcoper);
 SILC_CLIENT_CMD_REPLY_FUNC(leave);
 SILC_CLIENT_CMD_REPLY_FUNC(users);
+SILC_CLIENT_CMD_REPLY_FUNC(getkey);
 
 #endif