If channel user list could not be resolved or was not even
authorPekka Riikonen <priikone@silcnet.org>
Thu, 15 Nov 2007 15:33:10 +0000 (15:33 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 15 Nov 2007 15:33:10 +0000 (15:33 +0000)
        closely fully resolved, report it to application.

CHANGES.TOOLKIT
lib/silcclient/command_reply.c
lib/silcclient/silcclient.h

index 572909ff34edbc1ed1d775c4056f5d01cb4bf5ab..2ef30cf3fd19b2d0c6ff9f1da3ef5f43a2503f9b 100644 (file)
@@ -6,6 +6,10 @@ Thu Nov 15 16:45:48 EET 2007 Pekka Riikonen <priikone@silcnet.org>
        * Report packet engine errors to client application.  Affected
          file is lib/silcclient/client.c.
 
+       * If channel user list could not be resolved or was not even
+         closely fully resolved, report it to application.  Affected
+         file is lib/silcclient/command_reply.c.
+
 Tue Nov 13 18:24:56 EET 2007 Pekka Riikonen <priikone@silcnet.org>
 
        * Added missing channel unreferencing in CMODE, CUMODE,
index d3c9f89ec429931ea51dacbb5a5b84f3733e8826..ee71a4264b0c6fa3d7f107fd98fc2a72661bfa02 100644 (file)
@@ -1111,6 +1111,29 @@ silc_client_command_reply_join_resolved(SilcClient client,
 {
   SilcClientCommandContext cmd = context;
   SilcChannelEntry channel = cmd->context;
+  SilcCommandPayload payload = silc_fsm_get_state_context(&cmd->thread);
+  SilcArgumentPayload args = silc_command_get_args(payload);
+  SilcUInt32 list_count;
+  unsigned char *tmp;
+  char msg[512];
+
+  if (!clients) {
+    silc_snprintf(msg, sizeof(msg), "Error resolving channel %s user list",
+                 channel->channel_name);
+    SAY(client, conn, SILC_CLIENT_MESSAGE_COMMAND_ERROR, msg);
+  } else {
+    tmp = silc_argument_get_arg_type(args, 12, NULL);
+    if (tmp) {
+      SILC_GET32_MSB(list_count, tmp);
+      if (list_count - silc_dlist_count(clients) > 5) {
+       silc_snprintf(msg, sizeof(msg),
+                     "Channel %s user list was not fully resolved. "
+                     "The channel may not be fully synced.",
+                     channel->channel_name);
+       SAY(client, conn, SILC_CLIENT_MESSAGE_WARNING, msg);
+      }
+    }
+  }
 
   channel->internal.resolve_cmd_ident = 0;
   silc_client_unref_channel(client, conn, channel);
@@ -1172,7 +1195,7 @@ SILC_FSM_STATE(silc_client_command_reply_join)
 
   /* Get the list count */
   tmp = silc_argument_get_arg_type(args, 12, &len);
-  if (!tmp) {
+  if (!tmp || len != 4) {
     ERROR_CALLBACK(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
     goto out;
   }
index 6f28ab962a4ab3e2dc2bdba3e97ac1c19ba8ca5f..1edc5e90a12c98db512d5caf4524bb0dac9857c5 100644 (file)
@@ -1391,7 +1391,7 @@ SilcUInt16 silc_client_command_call(SilcClient client,
  *
  *    If FALSE is returned in this function this callback will not be called
  *    again for `command' even if there are more comand replies.  By returning
- *    FALSE the caller my stop the command reply handling when needed.
+ *    FALSE the caller may stop the command reply handling when needed.
  *
  ***/
 typedef SilcBool (*SilcClientCommandReply)(SilcClient client,