Remove channel entry in LEAVE command reply, not when sending LEAVE.
[silc.git] / lib / silcclient / command.c
index 4796c3bce389a51e59309cf72cd63c05b4a306c9..557a539c9c8186daa7d4e62a3c345c43372dd95f 100644 (file)
@@ -2327,7 +2327,6 @@ SILC_CLIENT_CMD_FUNC(leave)
   SilcClientCommandContext cmd = (SilcClientCommandContext)context;
   SilcClientConnection conn = cmd->conn;
   SilcChannelEntry channel;
-  SilcChannelUser chu;
   SilcBuffer buffer, idp;
   char *name;
 
@@ -2361,14 +2360,6 @@ SILC_CLIENT_CMD_FUNC(leave)
     goto out;
   }
 
-  /* Remove us from channel */
-  chu = silc_client_on_channel(channel, conn->local_entry);
-  if (chu) {
-    silc_hash_table_del(chu->client->channels, chu->channel);
-    silc_hash_table_del(chu->channel->user_list, chu->client);
-    silc_free(chu);
-  }
-
   /* Send LEAVE command to the server */
   idp = silc_id_payload_encode(channel->id, SILC_ID_CHANNEL);
   buffer = silc_command_payload_encode_va(SILC_COMMAND_LEAVE, 0, 1,
@@ -2384,8 +2375,6 @@ SILC_CLIENT_CMD_FUNC(leave)
   if (conn->current_channel == channel)
     conn->current_channel = NULL;
 
-  silc_client_del_channel(cmd->client, cmd->conn, channel);
-
  out:
   silc_client_command_free(cmd);
 }