updates.
[silc.git] / apps / silcd / command.h
index f8b7a5fe20088bef9c6b6de4a2ad3874b7637fb5..7d884e169c84c1853dc7c1df79e94a55c6d8584a 100644 (file)
@@ -73,7 +73,7 @@ typedef struct SilcServerCommandPendingStruct {
   SilcCommandCb callback;
   SilcServerPendingDestructor destructor;
   void *context;
-  unsigned short ident;
+  uint16 ident;
   struct SilcServerCommandPendingStruct *next;
 } SilcServerCommandPending;
 
@@ -85,15 +85,21 @@ typedef struct SilcServerCommandPendingStruct {
 #define SILC_SERVER_CMD(func, cmd, flags) \
 { silc_server_command_##func, SILC_COMMAND_##cmd, flags }
 
-/* Macro used to declare command functions */
+/* Macro used to declare command functions. The `context' will be the
+   SilcServerCommandContext and the `context2' is the 
+   SilcServerCommandReplyContext if this function is called from the
+   command reply as pending command callback. Otherwise `context2' 
+   is NULL. */
 #define SILC_SERVER_CMD_FUNC(func) \
-void silc_server_command_##func(void *context)
-
-/* Executed pending command */
-#define SILC_SERVER_PENDING_EXEC(ctx, cmd)                             \
-do {                                                                   \
-  if (ctx->callback)                                                   \
-    (*ctx->callback)(ctx->context);                                    \
+void silc_server_command_##func(void *context, void *context2)
+
+/* Executed pending command. The first argument to the callback function
+   is the user specified context. The second argument is always the
+   SilcServerCommandReply context. */
+#define SILC_SERVER_PENDING_EXEC(ctx, cmd)     \
+do {                                           \
+  if (ctx->callback)                           \
+    (*ctx->callback)(ctx->context, ctx);       \
 } while(0)
 
 /* Execute destructor for pending command */
@@ -114,17 +120,17 @@ SilcServerCommandContext
 silc_server_command_dup(SilcServerCommandContext ctx);
 void silc_server_command_pending(SilcServer server,
                                 SilcCommand reply_cmd,
-                                unsigned short ident,
+                                uint16 ident,
                                 SilcServerPendingDestructor destructor,
                                 SilcCommandCb callback,
                                 void *context);
 void silc_server_command_pending_del(SilcServer server,
                                     SilcCommand reply_cmd,
-                                    unsigned short ident);
+                                    uint16 ident);
 int silc_server_command_pending_check(SilcServer server,
                                      SilcServerCommandReplyContext ctx,
                                      SilcCommand command, 
-                                     unsigned short ident);
+                                     uint16 ident);
 SILC_SERVER_CMD_FUNC(whois);
 SILC_SERVER_CMD_FUNC(whowas);
 SILC_SERVER_CMD_FUNC(identify);
@@ -148,12 +154,12 @@ SILC_SERVER_CMD_FUNC(cmode);
 SILC_SERVER_CMD_FUNC(cumode);
 SILC_SERVER_CMD_FUNC(kick);
 SILC_SERVER_CMD_FUNC(ignore);
-SILC_SERVER_CMD_FUNC(restart);
+SILC_SERVER_CMD_FUNC(ban);
 SILC_SERVER_CMD_FUNC(close);
 SILC_SERVER_CMD_FUNC(shutdown);
 SILC_SERVER_CMD_FUNC(silcoper);
 SILC_SERVER_CMD_FUNC(leave);
 SILC_SERVER_CMD_FUNC(users);
-SILC_SERVER_CMD_FUNC(ban);
+SILC_SERVER_CMD_FUNC(getkey);
 
 #endif