}
/* Generate new channel key as protocol dictates */
- if (!created || !channel->channel_key)
+ if ((!created && silc_list_count(channel->user_list) > 0) ||
+ !channel->channel_key)
silc_server_create_channel_key(server, channel, 0);
/* Send the channel key. This is broadcasted to the channel but is not
sent to the client who is joining to the channel. */
silc_server_send_channel_key(server, NULL, channel,
server->server_type == SILC_ROUTER ?
- FALSE : server->standalone);
+ FALSE : !server->standalone);
/* Join the client to the channel by adding it to channel's user list.
Add also the channel to client entry's channels list for fast cross-
to the client who joined the channel. */
silc_server_send_channel_key(server, target_client->connection, channel,
server->server_type == SILC_ROUTER ?
- FALSE : server->standalone);
+ FALSE : !server->standalone);
out:
silc_server_command_free(cmd);
unsigned int tmp_len;
unsigned int port = SILC_PORT;
- SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CONNECT, cmd, 0, 0);
+ SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CONNECT, cmd, 1, 2);
if (!client || cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
goto out;
unsigned char *name;
unsigned int port = SILC_PORT;
- SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CLOSE, cmd, 0, 0);
+ SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CLOSE, cmd, 1, 2);
if (!client || cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
goto out;