updates
[silc.git] / lib / silcclient / client_channel.c
index 814dea43b6c03b942ea56fab22ddac58bbaf09fd..4f89d7270b01458f2fc23a81516c8d4aab10d099 100644 (file)
@@ -177,6 +177,16 @@ static void silc_client_channel_message_cb(SilcClient client,
     if (!channel)
       goto out;
 
+    /* If this client is not on channel, add it there since it clearly
+       is there. */
+    if (!silc_client_on_channel(channel, clients[0])) {
+      SilcChannelUser chu = silc_calloc(1, sizeof(*chu));
+      chu->client = clients[0];
+      chu->channel = channel;
+      silc_hash_table_add(channel->user_list, clients[0], chu);
+      silc_hash_table_add(clients[0]->channels, channel, chu);
+    }
+
     message = silc_channel_message_get_data(res->payload, NULL);
     
     /* Pass the message to application */
@@ -241,14 +251,16 @@ void silc_client_channel_message(SilcClient client,
        we will use the old key in decryption. If that fails too then we
        cannot do more and will drop the packet. */
     if (!payload) {
-      if (!channel->old_channel_key)
+      if (!channel->old_channel_key) {
        goto out;
+      }
 
       payload = silc_channel_message_payload_parse(buffer->data, buffer->len, 
                                                   channel->old_channel_key,
                                                   channel->old_hmac);
-      if (!payload)
+      if (!payload) {
        goto out;
+      }
     }
   } else if (channel->private_keys) {
     SilcChannelPrivateKey entry;