Merged from silc_1_0_branch.
[silc.git] / apps / silcd / idlist.c
index 6a4d5f767068236bdd717a67a06bbd02beccebcf..9acdd06844330fd6b2e7f93baaa55d344aa68687 100644 (file)
@@ -227,7 +227,7 @@ silc_idlist_find_server_by_conn(SilcIDList id_list, char *hostname,
     
     if (sock && ((sock->hostname && !strcasecmp(sock->hostname, hostname)) ||
                 (sock->ip && !strcasecmp(sock->ip, hostname)))
-       && sock->port == port)
+       && server->id->port == htons(port))
       break;
 
     id_cache = NULL;
@@ -295,8 +295,10 @@ int silc_idlist_del_server(SilcIDList id_list, SilcServerEntry entry)
     if (!silc_idcache_del_by_context(id_list->servers, entry))
       return FALSE;
 
-    SILC_LOG_DEBUG(("Deleting server %s", entry->server_name ?
-                   entry->server_name : ""));
+    SILC_LOG_DEBUG(("Deleting server %s id %s", entry->server_name ?
+                   entry->server_name : "",
+                   entry->id ?
+                   silc_id_render(entry->id, SILC_ID_SERVER) : ""));
 
     /* Free data */
     silc_free(entry->server_name);
@@ -654,10 +656,6 @@ static void silc_idlist_del_channel_foreach(void *key, void *context,
 int silc_idlist_del_channel(SilcIDList id_list, SilcChannelEntry entry)
 {
   if (entry) {
-    SilcHashTableList htl;
-    SilcBuffer tmp;
-    SilcUInt32 type;
-
     /* Remove from cache */
     if (!silc_idcache_del_by_context(id_list->channels, entry))
       return FALSE;
@@ -676,31 +674,10 @@ int silc_idlist_del_channel(SilcIDList id_list, SilcChannelEntry entry)
     silc_free(entry->id);
     silc_free(entry->topic);
 
-    if (entry->invite_list) {
-      silc_hash_table_list(entry->invite_list, &htl);
-      while (silc_hash_table_get(&htl, (void **)&type, (void **)&tmp)) {
-       if (type == 1) {
-         silc_free((char *)tmp);
-         continue;
-       }
-       silc_buffer_free(tmp);
-      }
-      silc_hash_table_list_reset(&htl);
+    if (entry->invite_list)
       silc_hash_table_free(entry->invite_list);
-    }
-
-    if (entry->ban_list) {
-      silc_hash_table_list(entry->ban_list, &htl);
-      while (silc_hash_table_get(&htl, (void **)&type, (void **)&tmp)) {
-       if (type == 1) {
-         silc_free((char *)tmp);
-         continue;
-       }
-       silc_buffer_free(tmp);
-      }
-      silc_hash_table_list_reset(&htl);
+    if (entry->ban_list)
       silc_hash_table_free(entry->ban_list);
-    }
 
     if (entry->channel_key)
       silc_cipher_free(entry->channel_key);