From 4d3f87f2f076bd332fa73f878fe198b7a94671b5 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Thu, 15 Nov 2007 15:33:10 +0000 Subject: [PATCH] If channel user list could not be resolved or was not even closely fully resolved, report it to application. --- CHANGES.TOOLKIT | 4 ++++ lib/silcclient/command_reply.c | 25 ++++++++++++++++++++++++- lib/silcclient/silcclient.h | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGES.TOOLKIT b/CHANGES.TOOLKIT index 572909ff..2ef30cf3 100644 --- a/CHANGES.TOOLKIT +++ b/CHANGES.TOOLKIT @@ -6,6 +6,10 @@ Thu Nov 15 16:45:48 EET 2007 Pekka Riikonen * 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 * Added missing channel unreferencing in CMODE, CUMODE, diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index d3c9f89e..ee71a426 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -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; } diff --git a/lib/silcclient/silcclient.h b/lib/silcclient/silcclient.h index 6f28ab96..1edc5e90 100644 --- a/lib/silcclient/silcclient.h +++ b/lib/silcclient/silcclient.h @@ -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, -- 2.24.0