X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcclient%2Fcommand_reply.h;h=e07fcccbfb1649cb3ea0a6c20020408081f5c91e;hb=d1e71f42379e8b5cd0748a7aeae8561b02cfe53d;hp=c2e4e641f01e8036faeea094d6bab11e778b4eea;hpb=c62f4fe7f1d0c717d3bb37fc01fb691b089838c1;p=silc.git diff --git a/lib/silcclient/command_reply.h b/lib/silcclient/command_reply.h index c2e4e641..e07fcccb 100644 --- a/lib/silcclient/command_reply.h +++ b/lib/silcclient/command_reply.h @@ -1,10 +1,10 @@ /* - command_reply.h + command_reply.h Author: Pekka Riikonen - Copyright (C) 1997 - 2001 Pekka Riikonen + Copyright (C) 1997 - 2005 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 @@ -51,16 +51,30 @@ struct SilcClientCommandReplyContextStruct { /* Macros */ -/* Command reply operation that is called at the end of all command replys. +/* Command reply operation that is called at the end of all command replys. Usage: COMMAND_REPLY((ARGS, argument1, argument2, etc...)), */ #define COMMAND_REPLY(args) cmd->client->internal->ops->command_reply args -#define ARGS cmd->client, cmd->sock->user_data, \ +#define SILC_ARGS cmd->client, cmd->sock->user_data, \ cmd->payload, TRUE, silc_command_get(cmd->payload), cmd->status /* Error reply to application. Usage: COMMAND_REPLY_ERROR; */ -#define COMMAND_REPLY_ERROR cmd->client->internal->ops-> \ - command_reply(cmd->client, cmd->sock->user_data, cmd->payload, \ - FALSE, silc_command_get(cmd->payload), cmd->status) +#define COMMAND_REPLY_ERROR(error) \ +do { \ + if (cmd->status == SILC_STATUS_OK) { \ + cmd->client->internal->ops-> \ + command_reply(cmd->client, cmd->sock->user_data, cmd->payload, \ + FALSE, silc_command_get(cmd->payload), error); \ + } else { \ + void *arg1 = NULL, *arg2 = NULL; \ + silc_status_get_args(cmd->status, cmd->args, &arg1, &arg2); \ + cmd->client->internal->ops-> \ + command_reply(cmd->client, cmd->sock->user_data, cmd->payload, \ + FALSE, silc_command_get(cmd->payload), cmd->status, \ + arg1, arg2); \ + silc_free(arg1); \ + silc_free(arg2); \ + } \ +} while(0) /* Macro used to declare command reply functions */ #define SILC_CLIENT_CMD_REPLY_FUNC(func) \ @@ -97,6 +111,7 @@ SILC_CLIENT_CMD_REPLY_FUNC(silcoper); SILC_CLIENT_CMD_REPLY_FUNC(leave); SILC_CLIENT_CMD_REPLY_FUNC(users); SILC_CLIENT_CMD_REPLY_FUNC(getkey); +SILC_CLIENT_CMD_REPLY_FUNC(service); SILC_CLIENT_CMD_REPLY_FUNC(quit); /* Internal command reply functions */