-void silc_server_command_##func(void *context)
-
-/* Checks for pending commands */
-#define SILC_SERVER_COMMAND_CHECK_PENDING(ctx) \
-do { \
- if (silc_command_pending) { \
- SilcServerCommandPending *r; \
- SilcCommand cmd; \
- \
- cmd = silc_command_get(payload); \
- for (r = silc_command_pending; r; r = r->next) { \
- if (r->reply_cmd == cmd) { \
- ctx->context = r->context; \
- ctx->callback = r->callback; \
- break; \
- } \
- } \
- } \
-} while(0)
-
-/* Executed pending command */
-#define SILC_SERVER_COMMAND_EXEC_PENDING(ctx, cmd) \
-do { \
- if (ctx->callback) { \
- (*ctx->callback)(ctx->context); \
- silc_server_command_pending_del(cmd); \
- } \
+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 { \
+ int _i; \
+ for (_i = 0; _i < ctx->callbacks_count; _i++) \
+ if (ctx->callbacks[_i].callback) \
+ (*ctx->callbacks[_i].callback)(ctx->callbacks[_i].context, ctx); \
+ silc_server_command_pending_del(ctx->server, cmd, ctx->ident); \