Support for SILC 1.2 INVITE and BAN commands. Client supports
[silc.git] / apps / silcd / idlist.c
index 883319034af96adfdf022ebde913794e5ea572c1..6a4d5f767068236bdd717a67a06bbd02beccebcf 100644 (file)
@@ -90,13 +90,13 @@ void silc_idlist_del_data(void *entry)
 
 SILC_TASK_CALLBACK_GLOBAL(silc_idlist_purge)
 {
+  SilcServer server = app_context;
   SilcIDListPurge i = (SilcIDListPurge)context;
 
   SILC_LOG_DEBUG(("Purging cache"));
 
   silc_idcache_purge(i->cache);
-  silc_schedule_task_add(i->schedule, 0, 
-                        silc_idlist_purge,
+  silc_schedule_task_add(server->schedule, 0, silc_idlist_purge,
                         (void *)i, i->timeout, 0,
                         SILC_TASK_TIMEOUT, SILC_TASK_PRI_LOW);
 }
@@ -376,6 +376,7 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
     silc_free(entry->username);
     silc_free(entry->userinfo);
     silc_free(entry->id);
+    silc_free(entry->attrs);
     silc_hash_table_free(entry->channels);
 
     memset(entry, 'F', sizeof(*entry));
@@ -575,6 +576,7 @@ void silc_idlist_client_destructor(SilcIDCache cache,
     silc_free(client->username);
     silc_free(client->userinfo);
     silc_free(client->id);
+    silc_free(client->attrs);
     silc_hash_table_free(client->channels);
 
     memset(client, 'A', sizeof(*client));
@@ -652,6 +654,10 @@ 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;
@@ -669,6 +675,33 @@ int silc_idlist_del_channel(SilcIDList id_list, SilcChannelEntry entry)
     silc_free(entry->channel_name);
     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);
+      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);
+      silc_hash_table_free(entry->ban_list);
+    }
+
     if (entry->channel_key)
       silc_cipher_free(entry->channel_key);
     if (entry->key) {