Save the user limit in the JOIN and CMODE command replies and
authorPekka Riikonen <priikone@silcnet.org>
Sat, 28 Feb 2004 15:18:19 +0000 (15:18 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 28 Feb 2004 15:18:19 +0000 (15:18 +0000)
in CMODE_CHANGE notify.

CHANGES
lib/doc/command_reply_args.html
lib/silcclient/client_notify.c
lib/silcclient/command_reply.c
lib/silcclient/silcclient.h

diff --git a/CHANGES b/CHANGES
index d929e9e2baac193db4a31da4f89a24df662f78ab..62257243ba9bd40fed94686c6c7a309644891219 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,14 @@ Sat Feb 28 16:25:09 EET 2004  Pekka Riikonen <priikone@silcnet.org>
          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 <priikone@silcnet.org>
 
        * Fixed the JOIN command calling when called with both
index fa9019b08ed3c8be09d54d3c956d99d70ef239cc..5d2843f4198ab30b2fa86fe853946f32d14c74bd 100644 (file)
@@ -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
 </td>
 </tr>
 
@@ -294,7 +294,8 @@ Argument List Payload where each argument includes one Public Key
 Payload.
 </td>
 <td width="50%"><small>SilcChannelEntry channel, SilcUInt32 mode,
-SilcPublicKey founder_key, SilcBuffer channel_pubkeys
+SilcPublicKey founder_key, SilcBuffer channel_pubkeys,
+SilcUint32 user_limit
 </td>
 </tr>
 
index 3f92685326e0561003f087e2ab5e793530501b51..5c2639eb03e8e9cb2d7992ece2cdf1e322d750f3 100644 (file)
@@ -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)
index 4e226e810d6bdfeb5e631bb6af61b6a873a7c49e..d79e6329836e925c79757125a68f11c2744fb1e1 100644 (file)
@@ -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);
 
index 5fa200659e29521f255bda1358054ec128865bac..4fbff8eb094a79adb6ebd6446636e3bf3a91d873 100644 (file)
@@ -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. */