X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=lib%2Fsilcclient%2Fcommand_reply.c;h=ede887535fdcdc97b6219d0c8d73f11b45867021;hp=29e05e73fe086b419299d922f1e196da594b2cfa;hb=805fddcf6431e784f9f77114782a90c9d12f9cbe;hpb=e9374395ec9747bddd3ea0bfd3e5a17717e97b31 diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index 29e05e73..ede88753 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -1113,6 +1113,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); @@ -1174,7 +1197,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; } @@ -1212,7 +1235,6 @@ SILC_FSM_STATE(silc_client_command_reply_join) /* Add clients we received in the reply to the channel */ for (i = 0; i < list_count; i++) { SilcUInt16 idp_len; - SilcUInt32 mode; SilcID id; SilcClientEntry client_entry; @@ -1489,6 +1511,20 @@ SILC_FSM_STATE(silc_client_command_reply_cmode) silc_client_command_callback(cmd, channel, mode, public_key, channel->channel_pubkeys, channel->user_limit); + silc_rwlock_wrlock(channel->internal.lock); + + /* If founder key changed, update it */ + if (public_key && + (!channel->founder_key || + !silc_pkcs_public_key_compare(public_key, channel->founder_key))) { + if (channel->founder_key) + silc_pkcs_public_key_free(channel->founder_key); + channel->founder_key = public_key; + public_key = NULL; + } + + silc_rwlock_unlock(channel->internal.lock); + out: silc_client_unref_channel(client, conn, channel); if (public_key)