5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2003 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
21 #include "silcincludes.h"
22 #include "silcstatus.h"
24 /* Returns arguments by the status type. */
26 SilcUInt32 silc_status_get_args(SilcStatus status,
27 SilcArgumentPayload args,
28 void **ret_arg1, void **ret_arg2)
33 assert(ret_arg1 && ret_arg2);
35 num = silc_argument_get_arg_num(args);
43 case SILC_STATUS_ERR_NO_SUCH_NICK:
44 case SILC_STATUS_ERR_NO_SUCH_CHANNEL:
45 case SILC_STATUS_ERR_NO_SUCH_SERVER:
46 case SILC_STATUS_ERR_NO_SUCH_SERVICE:
47 case SILC_STATUS_ERR_UNKNOWN_ALGORITHM:
48 tmp = silc_argument_get_arg_type(args, 2, &len);
51 *ret_arg1 = silc_memdup(tmp, len);
57 case SILC_STATUS_ERR_NO_SUCH_CLIENT_ID:
58 case SILC_STATUS_ERR_BAD_CLIENT_ID:
59 case SILC_STATUS_ERR_NO_SUCH_SERVER_ID:
60 case SILC_STATUS_ERR_BAD_SERVER_ID:
61 case SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID:
62 case SILC_STATUS_ERR_BAD_CHANNEL_ID:
63 case SILC_STATUS_ERR_NOT_ON_CHANNEL:
64 case SILC_STATUS_ERR_CHANNEL_IS_FULL:
65 case SILC_STATUS_ERR_NOT_INVITED:
66 case SILC_STATUS_ERR_BANNED_FROM_CHANNEL:
67 case SILC_STATUS_ERR_NO_CHANNEL_PRIV:
68 case SILC_STATUS_ERR_NO_CHANNEL_FOPRIV:
69 tmp = silc_argument_get_arg_type(args, 2, &len);
72 *ret_arg1 = silc_id_payload_parse_id(tmp, len, NULL);
78 case SILC_STATUS_ERR_USER_NOT_ON_CHANNEL:
79 case SILC_STATUS_ERR_USER_ON_CHANNEL:
80 tmp = silc_argument_get_arg_type(args, 2, &len);
83 *ret_arg1 = silc_id_payload_parse_id(tmp, len, NULL);
87 tmp = silc_argument_get_arg_type(args, 3, &len);
90 *ret_arg2 = silc_id_payload_parse_id(tmp, len, NULL);