updates.
[silc.git] / lib / silcclient / command.c
index b23149360466262c0d358472f4e2ea6c4aad8b95..781607e3ae676af4807153be70907c11804b9638 100644 (file)
@@ -704,6 +704,9 @@ SILC_CLIENT_CMD_FUNC(quit)
   q->client = cmd->client;
   q->conn = cmd->conn;
 
+  /* Sleep for a while */
+  sleep(2);
+
   /* We quit the connection with little timeout */
   silc_schedule_task_add(cmd->client->schedule, cmd->conn->sock->sock,
                         silc_client_command_quit_cb, (void *)q,
@@ -966,8 +969,11 @@ SILC_CLIENT_CMD_FUNC(join)
 
   /* See if we have joined to the requested channel already */
   if (silc_idcache_find_by_name_one(conn->channel_cache, cmd->argv[1],
-                                   &id_cache))
-    goto out;
+                                   &id_cache)) {
+    SilcChannelEntry channel = (SilcChannelEntry)id_cache->context;
+    if (channel->on_channel)
+      goto out;
+  }
 
   idp = silc_id_payload_encode(conn->local_id, SILC_ID_CLIENT);
 
@@ -1446,6 +1452,7 @@ SILC_CLIENT_CMD_FUNC(cumode)
   }
   
   /* Get the current mode */
+  silc_list_start(channel->clients);
   while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
     if (chu->client == client_entry) {
       mode = chu->mode;
@@ -1510,7 +1517,8 @@ SILC_CLIENT_CMD_FUNC(cumode)
 
   /* Send the command packet. We support sending only one mode at once
      that requires an argument. */
-  buffer = silc_command_payload_encode_va(SILC_COMMAND_CUMODE, 0, 4, 
+  buffer = silc_command_payload_encode_va(SILC_COMMAND_CUMODE, 0, 
+                                         auth ? 4 : 3, 
                                          1, chidp->data, chidp->len, 
                                          2, modebuf, 4,
                                          3, clidp->data, clidp->len,
@@ -2012,6 +2020,7 @@ SILC_CLIENT_CMD_FUNC(leave)
   }
 
   channel = (SilcChannelEntry)id_cache->context;
+  channel->on_channel = FALSE;
 
   /* Send LEAVE command to the server */
   idp = silc_id_payload_encode(id_cache->id, SILC_ID_CHANNEL);