udpates.
authorPekka Riikonen <priikone@silcnet.org>
Thu, 20 Sep 2001 17:50:13 +0000 (17:50 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 20 Sep 2001 17:50:13 +0000 (17:50 +0000)
CHANGES
TODO
apps/silcd/command_reply.c
apps/silcd/idlist.c
lib/silcclient/command.c
lib/silcclient/command_reply.c
lib/silcclient/idlist.h

diff --git a/CHANGES b/CHANGES
index 8f3b05b4a3ff8303e2a2a4cf13f41a62403386ac..7f1b85754cc0fd59ecf11b7b54404d224081e2b7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+Thu Sep 20 18:04:12 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
+
+       * When processing JOIN command reply in server check that if
+         the channel exists in our global list we'll move it the local
+         list.  Affected file silcd/command_reply.c.
+
+       * Fixed the check whether client is joined on the channel already
+         in JOIN command.  Affected file lib/silcclient/command.c.
+
+       * Fixed the JOIN command reply to check whether the channel
+         already exists.  Affected file lib/silcclient/command_reply.c.
+
 Wed Sep 19 22:58:32 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Added silc_ske_status_string to map the SKE error numbers
 Wed Sep 19 22:58:32 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Added silc_ske_status_string to map the SKE error numbers
diff --git a/TODO b/TODO
index 6ff015e301b6d05aac03ff56927c1f7c771433b8..e7ee0e7b0fedfd41230005f758ce5e66d1b20eae 100644 (file)
--- a/TODO
+++ b/TODO
@@ -46,6 +46,9 @@ TODO/bugs In SILC Server
 
  o Add perhaps /var/run/silcd.pid for PID information for the server.
 
 
  o Add perhaps /var/run/silcd.pid for PID information for the server.
 
+ o The backup router support described in the protocol specification
+   should be done at some point.
+
  o Add a timeout to handling incmoing JOIN commands.  It should be 
    enforced that JOIN command is executed only once in a second or two
    seconds.  Now it is possible to accept n incoming JOIN commands
  o Add a timeout to handling incmoing JOIN commands.  It should be 
    enforced that JOIN command is executed only once in a second or two
    seconds.  Now it is possible to accept n incoming JOIN commands
@@ -53,8 +56,10 @@ TODO/bugs In SILC Server
    each JOIN command will create and distribute the new channel key
    to everybody on the channel.
 
    each JOIN command will create and distribute the new channel key
    to everybody on the channel.
 
- o The backup router support described in the protocol specification
-   should be done at some point.
+ o Add support for sending the LIST command to primary router on normal
+   server to receive all the created channels.  Currently the command
+   returns only the channels the server knows about.  The protocol spec
+   does not prohibit of sending the LIST to the router.
 
  o Incomplete IPv6 support:
 
 
  o Incomplete IPv6 support:
 
index c4add0a4d64cc3a5438beb3c27c7b005d1b466e4..5ac3cb09f1f5481f3aef482667d0191476422034 100644 (file)
@@ -798,6 +798,13 @@ SILC_SERVER_CMD_REPLY_FUNC(join)
                    (created == 0 ? "existing" : "created"), channel_name,
                    silc_id_render(id, SILC_ID_CHANNEL)));
 
                    (created == 0 ? "existing" : "created"), channel_name,
                    silc_id_render(id, SILC_ID_CHANNEL)));
 
+    /* If the channel is found from global list we must move it to the
+       local list. */
+    entry = silc_idlist_find_channel_by_name(server->global_list, 
+                                            channel_name, &cache);
+    if (entry)
+      silc_idlist_del_channel(server->global_list, entry);
+
     /* Add the channel to our local list. */
     entry = silc_idlist_add_channel(server->local_list, strdup(channel_name), 
                                    SILC_CHANNEL_MODE_NONE, id, 
     /* Add the channel to our local list. */
     entry = silc_idlist_add_channel(server->local_list, strdup(channel_name), 
                                    SILC_CHANNEL_MODE_NONE, id, 
index 5788e65656a497a5f81c1e9e62998b0af0c1f612..894bdc6ed19fda346ffc4506dd2174cb2afebbbe 100644 (file)
@@ -281,10 +281,8 @@ int silc_idlist_del_server(SilcIDList id_list, SilcServerEntry entry)
        return FALSE;
 
     /* Free data */
        return FALSE;
 
     /* Free data */
-    if (entry->server_name)
-      silc_free(entry->server_name);
-    if (entry->id)
-      silc_free(entry->id);
+    silc_free(entry->server_name);
+    silc_free(entry->id);
 
     memset(entry, 'F', sizeof(*entry));
     silc_free(entry);
 
     memset(entry, 'F', sizeof(*entry));
     silc_free(entry);
@@ -352,14 +350,10 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
        return FALSE;
 
     /* Free data */
        return FALSE;
 
     /* Free data */
-    if (entry->nickname)
-      silc_free(entry->nickname);
-    if (entry->username)
-      silc_free(entry->username);
-    if (entry->userinfo)
-      silc_free(entry->userinfo);
-    if (entry->id)
-      silc_free(entry->id);
+    silc_free(entry->nickname);
+    silc_free(entry->username);
+    silc_free(entry->userinfo);
+    silc_free(entry->id);
 
     memset(entry, 'F', sizeof(*entry));
     silc_free(entry);
 
     memset(entry, 'F', sizeof(*entry));
     silc_free(entry);
@@ -622,24 +616,18 @@ int silc_idlist_del_channel(SilcIDList id_list, SilcChannelEntry entry)
        return FALSE;
 
     /* Free data */
        return FALSE;
 
     /* Free data */
-    if (entry->channel_name)
-      silc_free(entry->channel_name);
-    if (entry->id)
-      silc_free(entry->id);
-    if (entry->topic)
-      silc_free(entry->topic);
+    silc_free(entry->channel_name);
+    silc_free(entry->id);
+    silc_free(entry->topic);
     if (entry->channel_key)
       silc_cipher_free(entry->channel_key);
     if (entry->key) {
       memset(entry->key, 0, entry->key_len / 8);
       silc_free(entry->key);
     }
     if (entry->channel_key)
       silc_cipher_free(entry->channel_key);
     if (entry->key) {
       memset(entry->key, 0, entry->key_len / 8);
       silc_free(entry->key);
     }
-    if (entry->cipher)
-      silc_free(entry->cipher);
-    if (entry->hmac_name)
-      silc_free(entry->hmac_name);
-    if (entry->rekey)
-      silc_free(entry->rekey);
+    silc_free(entry->cipher);
+    silc_free(entry->hmac_name);
+    silc_free(entry->rekey);
 
     /* Free all client entrys from the users list. The silc_hash_table_free
        will free all the entries so they are not freed at the foreach 
 
     /* Free all client entrys from the users list. The silc_hash_table_free
        will free all the entries so they are not freed at the foreach 
index b23149360466262c0d358472f4e2ea6c4aad8b95..efb1765f42179f86526c53acc320b17ae4fea9b4 100644 (file)
@@ -966,8 +966,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],
 
   /* 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);
 
 
   idp = silc_id_payload_encode(conn->local_id, SILC_ID_CLIENT);
 
@@ -2012,6 +2015,7 @@ SILC_CLIENT_CMD_FUNC(leave)
   }
 
   channel = (SilcChannelEntry)id_cache->context;
   }
 
   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);
 
   /* Send LEAVE command to the server */
   idp = silc_id_payload_encode(id_cache->id, SILC_ID_CHANNEL);
index 228dce57f1cddb43724a392b7a504b73e4b009e4..575ba3483b8873a43773fbecd4e279ad120e8fde 100644 (file)
@@ -963,6 +963,11 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
   /* Get topic */
   topic = silc_argument_get_arg_type(cmd->args, 10, NULL);
 
   /* Get topic */
   topic = silc_argument_get_arg_type(cmd->args, 10, NULL);
 
+  /* If we have the channel entry, remove it and create a new one */
+  channel = silc_client_get_channel(cmd->client, conn, channel_name);
+  if (channel)
+    silc_client_del_channel(cmd->client, conn, channel);
+
   /* Save received Channel ID. This actually creates the channel */
   channel = silc_client_new_channel_id(cmd->client, cmd->sock, channel_name, 
                                       mode, idp);
   /* Save received Channel ID. This actually creates the channel */
   channel = silc_client_new_channel_id(cmd->client, cmd->sock, channel_name, 
                                       mode, idp);
index 0dc48f8f316e19e90c329bcd8c139dcb86506268..08b9cc6fd883c8960a415f6a90d67d41a51401b1 100644 (file)
@@ -66,7 +66,7 @@ typedef struct SilcChannelEntryStruct {
   char *channel_name;
   SilcChannelID *id;
   uint32 mode;
   char *channel_name;
   SilcChannelID *id;
   uint32 mode;
-  int on_channel;
+  bool on_channel;
 
   /* Joined clients */
   SilcList clients;
 
   /* Joined clients */
   SilcList clients;