Support for SILC 1.2 INVITE and BAN commands. Client supports
[silc.git] / apps / silcd / idlist.c
index 900092bfbdf7cebd6b0eab200b404cbbb07cb910..6a4d5f767068236bdd717a67a06bbd02beccebcf 100644 (file)
@@ -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) {