updates.
[silc.git] / apps / silcd / command.c
index 2361f87fe565b1c6d9532c38c73c568f3a3a51b1..1e59ea7ff3c5929286547a00cd7257b76be83e2b 100644 (file)
@@ -1893,14 +1893,15 @@ static void silc_server_command_join_channel(SilcServer server,
   }
 
   /* 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-
@@ -2962,7 +2963,7 @@ SILC_SERVER_CMD_FUNC(kick)
      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);
@@ -2988,7 +2989,7 @@ SILC_SERVER_CMD_FUNC(connect)
   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;
@@ -3048,7 +3049,7 @@ SILC_SERVER_CMD_FUNC(close)
   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;