From 26263349a5f6416cd604c533a220270759abf91a Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 28 Feb 2004 15:18:19 +0000 Subject: [PATCH] Save the user limit in the JOIN and CMODE command replies and in CMODE_CHANGE notify. --- CHANGES | 8 ++++++++ lib/doc/command_reply_args.html | 5 +++-- lib/silcclient/client_notify.c | 5 +++++ lib/silcclient/command_reply.c | 14 ++++++++++++-- lib/silcclient/silcclient.h | 1 + 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index d929e9e2..62257243 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,14 @@ Sat Feb 28 16:25:09 EET 2004 Pekka Riikonen operation. Affected files are lib/silcclient/silcclient.h and client_channel.c. + * Fixed wrong arg type for user limit in CMODE command reply. + Affected file silcd/command.c. + + * The user limit is now taken and saved to SilcClientEntry in + JOIN and CMODE command replies and in CMODE_CHANGE notify. + Affected files lib/silcclient/silcclient.h, command_reply.c + and client_notify.c. + Fri Feb 27 11:25:26 CET 2004 Pekka Riikonen * Fixed the JOIN command calling when called with both diff --git a/lib/doc/command_reply_args.html b/lib/doc/command_reply_args.html index fa9019b0..5d2843f4 100644 --- a/lib/doc/command_reply_args.html +++ b/lib/doc/command_reply_args.html @@ -261,7 +261,7 @@ keys, it may be NULL. SilcUInt32 channel_mode, int ignored, SilcBuffer key_payload, NULL, NULL, char *topic, char *hmac_name, SilcUInt32 list_count, SilcBuffer client_id_list, SilcBuffer client_mode_list, SilcPublicKey founder_key, -SilcBuffer channel_pubkeys +SilcBuffer channel_pubkeys, SilcUint32 user_limit @@ -294,7 +294,8 @@ Argument List Payload where each argument includes one Public Key Payload. SilcChannelEntry channel, SilcUInt32 mode, -SilcPublicKey founder_key, SilcBuffer channel_pubkeys +SilcPublicKey founder_key, SilcBuffer channel_pubkeys, +SilcUint32 user_limit diff --git a/lib/silcclient/client_notify.c b/lib/silcclient/client_notify.c index 3f926853..5c2639eb 100644 --- a/lib/silcclient/client_notify.c +++ b/lib/silcclient/client_notify.c @@ -844,6 +844,11 @@ void silc_client_notify_by_server(SilcClient client, founder_key = NULL; } + /* Get user limit */ + tmp = silc_argument_get_arg_type(args, 8, &tmp_len); + if (tmp && tmp_len == 4) + SILC_GET32_MSB(channel->user_limit, tmp); + /* Get the channel public key that was added or removed */ tmp = silc_argument_get_arg_type(args, 7, &tmp_len); if (tmp) diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index 4e226e81..d79e6329 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -1136,6 +1136,11 @@ SILC_CLIENT_CMD_REPLY_FUNC(join) silc_pkcs_public_key_payload_decode(tmp, len, &channel->founder_key); } + /* Get user limit */ + tmp = silc_argument_get_arg_type(cmd->args, 17, &len); + if (tmp && len == 4) + SILC_GET32_MSB(channel->user_limit, tmp); + /* Get channel public key list */ tmp = silc_argument_get_arg_type(cmd->args, 16, &len); if (tmp) @@ -1151,7 +1156,7 @@ SILC_CLIENT_CMD_REPLY_FUNC(join) keyp ? keyp->head : NULL, NULL, NULL, topic, hmac, list_count, client_id_list, client_mode_list, channel->founder_key, - tmp ? &chpklist : NULL)); + tmp ? &chpklist : NULL, channel->user_limit)); out: SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_JOIN); @@ -1307,6 +1312,11 @@ SILC_CLIENT_CMD_REPLY_FUNC(cmode) public_key = NULL; } + /* Get user limit */ + tmp = silc_argument_get_arg_type(cmd->args, 6, &len); + if (tmp && len == 4) + SILC_GET32_MSB(channel->user_limit, tmp); + /* Get channel public key(s) */ tmp = silc_argument_get_arg_type(cmd->args, 5, &len); if (tmp) @@ -1314,7 +1324,7 @@ SILC_CLIENT_CMD_REPLY_FUNC(cmode) /* Notify application */ COMMAND_REPLY((SILC_ARGS, channel, mode, public_key, - tmp ? &channel_pubkeys : NULL)); + tmp ? &channel_pubkeys : NULL, channel->user_limit)); silc_free(channel_id); diff --git a/lib/silcclient/silcclient.h b/lib/silcclient/silcclient.h index 5fa20065..4fbff8eb 100644 --- a/lib/silcclient/silcclient.h +++ b/lib/silcclient/silcclient.h @@ -258,6 +258,7 @@ struct SilcChannelEntryStruct { SilcUInt32 mode; /* Channel mode, ChannelModes. */ char *topic; /* Current topic, may be NULL */ SilcPublicKey founder_key; /* Founder key, may be NULL */ + SilcUInt32 user_limit; /* User limit on channel */ /* All clients that has joined this channel. The key to the table is the SilcClientEntry and the context is SilcChannelUser context. */ -- 2.24.0