Handle command reply lists in threads.
[silc.git] / lib / silcclient / client_channel.c
index 28cc6147099f53b100bb654e1ef5af0a11bfb30a..51fc85471d11a358d2be3727a237c9bfc60957de 100644 (file)
@@ -47,6 +47,8 @@ SilcBool silc_client_send_channel_message(SilcClient client,
     return FALSE;
   if (flags & SILC_MESSAGE_FLAG_SIGNED && !hash)
     return FALSE;
+  if (conn->internal->disconnected)
+    return FALSE;
 
   chu = silc_client_on_channel(channel, conn->local_entry);
   if (!chu) {
@@ -200,6 +202,13 @@ SILC_FSM_STATE(silc_client_channel_message)
     return SILC_FSM_CONTINUE;
   }
 
+  /* Check that user is on channel */
+  if (!silc_client_on_channel(channel, client_entry)) {
+    /** User not on channel */
+    silc_fsm_next(fsm, silc_client_channel_message_error);
+    return SILC_FSM_CONTINUE;
+  }
+
   /* If there is no channel private key then just decrypt the message
      with the channel key. If private keys are set then just go through
      all private keys and check what decrypts correctly. */
@@ -763,6 +772,4 @@ void silc_client_empty_channel(SilcClient client,
     silc_free(chu);
   }
   silc_hash_table_list_reset(&htl);
-
-  silc_hash_table_free(channel->user_list);
 }