updates.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 17 Nov 2001 23:34:28 +0000 (23:34 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 17 Nov 2001 23:34:28 +0000 (23:34 +0000)
CHANGES
apps/silcd/command.c
includes/silcincludes.h
lib/silcclient/client_channel.c
lib/silcutil/silcbuffer.h

diff --git a/CHANGES b/CHANGES
index cdb6e907bf5e1716218a5e532ade70450c610e9e..e37638fd1a8c26229eae691f67a9bfcd4ef708a8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,10 @@
+Sun Nov 18 01:34:41 EET 2001  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed silc_client_channel_message to not try to decrypt
+         the message twice if it resolved the destination client
+         information.  This could cause of dropping one channel
+         message.  Affected file lib/silcclient/client_channel.c.
+
 Wed Nov 14 23:44:56 EET 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Added silc_client_run_one into lib/silcclient/silcapi.h and
index 64fa02a22f1021eb648a5cd95f2648bb68ed844f..80e4ed3637990b488b26cca096e25e2190f2c852 100644 (file)
@@ -1937,22 +1937,9 @@ static int silc_server_command_bad_chars(char *nick)
       return TRUE;
     if (nick[i] <= 32) return TRUE;
     if (nick[i] == ' ') return TRUE;
-    if (nick[i] == '\\') return TRUE;
-    if (nick[i] == '\"') return TRUE;
     if (nick[i] == '*') return TRUE;
     if (nick[i] == '?') return TRUE;
     if (nick[i] == ',') return TRUE;
-    if (nick[i] == '@') return TRUE;
-    if (nick[i] == ':') return TRUE;
-    if (nick[i] == '/') return TRUE;
-    if (nick[i] == '[') return TRUE;
-    if (nick[i] == '[') return TRUE;
-    if (nick[i] == '(') return TRUE;
-    if (nick[i] == ')') return TRUE;
-    if (nick[i] == '{') return TRUE;
-    if (nick[i] == '}') return TRUE;
-    if (nick[i] == '<') return TRUE;
-    if (nick[i] == '>') return TRUE;
   }
 
   return FALSE;
index 4484d57675950b4f0f7f1e5be438c644379673bc..3520afd1942b25da8988d39ff9d2fc9115f9ba05 100644 (file)
@@ -211,8 +211,10 @@ typedef uint32 * void *;
 #endif
 
 #ifndef bool
+#ifndef CXX
 #define bool unsigned char
 #endif
+#endif
 
 /* Generic global SILC includes */
 #include "bitmove.h"
index 440c6999db9dc455bf59e0a35d00f57dd03d7c7f..aeb0ed85756cf223076c4963b08b708b61cea3e3 100644 (file)
@@ -155,17 +155,41 @@ void silc_client_send_channel_message(SilcClient client,
   silc_free(id_string);
 }
 
+typedef struct {
+  SilcChannelMessagePayload payload;
+  SilcChannelID *channel_id;
+} *SilcChannelClientResolve;
+
 static void silc_client_channel_message_cb(SilcClient client,
                                           SilcClientConnection conn,
                                           SilcClientEntry *clients,
                                           uint32 clients_count,
                                           void *context)
 {
-  SilcPacketContext *packet = (SilcPacketContext *)context;
+  SilcChannelClientResolve res = (SilcChannelClientResolve)context;
+
+  if (clients_count == 1) {
+    SilcIDCacheEntry id_cache = NULL;
+    SilcChannelEntry channel;
+    unsigned char *message;
 
-  if (clients)
-    silc_client_channel_message(client, conn->sock, packet);
-  silc_packet_context_free(packet);
+    if (!silc_idcache_find_by_id_one(conn->channel_cache, res->channel_id, 
+                                    &id_cache))
+      goto out;
+
+    channel = (SilcChannelEntry)id_cache->context;
+    message = silc_channel_message_get_data(res->payload, NULL);
+    
+    /* Pass the message to application */
+    client->ops->channel_message(client, conn, clients[0], channel,
+                                silc_channel_message_get_flags(res->payload),
+                                message);
+  }
+
+ out:
+  silc_channel_message_payload_free(res->payload);
+  silc_free(res->channel_id);
+  silc_free(res);
 }
 
 /* Process received message to a channel (or from a channel, really). This
@@ -257,9 +281,14 @@ void silc_client_channel_message(SilcClient client,
 
   if (!found) {
     /* Resolve the client info */
+    SilcChannelClientResolve res = silc_calloc(1, sizeof(*res));
+    res->payload = payload;
+    res->channel_id = id;
     silc_client_get_client_by_id_resolve(client, conn, client_id,
                                         silc_client_channel_message_cb,
-                                        silc_packet_context_dup(packet));
+                                        res);
+    payload = NULL;
+    id = NULL;
     goto out;
   }
 
index a6ca1897e2fc3444e7650aa4566874a2da303b04..9b35e922cc05328b5d4e6efbf7db455cd5586280 100644 (file)
@@ -196,7 +196,7 @@ unsigned char *silc_buffer_pull(SilcBuffer sb, uint32 len)
   unsigned char *old_data = sb->data;
 
 #ifdef SILC_DEBUG
-  assert(len <= (sb->tail - sb->data));
+  assert(len <= (uint32)(sb->tail - sb->data));
 #endif
 
   sb->data += len;
@@ -260,7 +260,7 @@ unsigned char *silc_buffer_pull_tail(SilcBuffer sb, uint32 len)
   unsigned char *old_tail = sb->tail;
 
 #ifdef SILC_DEBUG
-  assert((sb->end - sb->tail) >= len);
+  assert((uint32)(sb->end - sb->tail) >= len);
 #endif
 
   sb->tail += len;
@@ -318,7 +318,7 @@ unsigned char *silc_buffer_put_head(SilcBuffer sb,
                                    uint32 len)
 {
 #ifdef SILC_DEBUG
-  assert((sb->data - sb->head) >= len);
+  assert((uint32)(sb->data - sb->head) >= len);
 #endif
   return (unsigned char *)memcpy(sb->head, data, len);
 }
@@ -340,7 +340,7 @@ unsigned char *silc_buffer_put(SilcBuffer sb,
                               uint32 len)
 {
 #ifdef SILC_DEBUG
-  assert((sb->tail - sb->data) >= len);
+  assert((uint32)(sb->tail - sb->data) >= len);
 #endif
   return (unsigned char *)memcpy(sb->data, data, len);
 }
@@ -362,7 +362,7 @@ unsigned char *silc_buffer_put_tail(SilcBuffer sb,
                                    uint32 len)
 {
 #ifdef SILC_DEBUG
-  assert((sb->end - sb->tail) >= len);
+  assert((uint32)(sb->end - sb->tail) >= len);
 #endif
   return (unsigned char *)memcpy(sb->tail, data, len);
 }