updates.
[silc.git] / lib / silcclient / idlist.c
index 9141372c26f46d93883183041680aefca810e8e1..8ec66929aaea090d5f666ae26e1a251d04fbfaef 100644 (file)
@@ -20,6 +20,7 @@
 /* $Id$ */
 
 #include "clientlibincludes.h"
+#include "client_internal.h"
 
 typedef struct {
   SilcClientCommandContext cmd;
@@ -215,8 +216,10 @@ SILC_CLIENT_CMD_FUNC(get_clients_list_callback)
     SILC_GET16_MSB(idp_len, client_id_list->data + 2);
     idp_len += 4;
     client_id = silc_id_payload_parse_id(client_id_list->data, idp_len);
-    if (!client_id)
+    if (!client_id) {
+      silc_buffer_pull(client_id_list, idp_len);
       continue;
+    }
 
     /* Get the client entry */
     if (silc_idcache_find_by_id_one_ext(i->conn->client_cache, 
@@ -294,8 +297,10 @@ void silc_client_get_clients_by_list(SilcClient client,
     SILC_GET16_MSB(idp_len, client_id_list->data + 2);
     idp_len += 4;
     client_id = silc_id_payload_parse_id(client_id_list->data, idp_len);
-    if (!client_id)
+    if (!client_id) {
+      silc_buffer_pull(client_id_list, idp_len);
       continue;
+    }
 
     /* Check if we have this client cached already. */
     id_cache = NULL;
@@ -631,6 +636,7 @@ void silc_client_update_client(SilcClient client,
 /* Deletes the client entry and frees all memory. */
 
 void silc_client_del_client_entry(SilcClient client, 
+                                 SilcClientConnection conn,
                                  SilcClientEntry client_entry)
 {
   SILC_LOG_DEBUG(("Start"));
@@ -640,11 +646,13 @@ void silc_client_del_client_entry(SilcClient client,
   silc_free(client_entry->realname);
   silc_free(client_entry->server);
   silc_free(client_entry->id);
+  silc_free(client_entry->fingerprint);
   if (client_entry->send_key)
     silc_cipher_free(client_entry->send_key);
   if (client_entry->receive_key)
     silc_cipher_free(client_entry->receive_key);
   silc_free(client_entry->key);
+  silc_client_ftp_session_free_client(conn, client_entry);
   silc_free(client_entry);
 }
 
@@ -654,7 +662,7 @@ bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
                            SilcClientEntry client_entry)
 {
   bool ret = silc_idcache_del_by_context(conn->client_cache, client_entry);
-  silc_client_del_client_entry(client, client_entry);
+  silc_client_del_client_entry(client, conn, client_entry);
   return ret;
 }
 
@@ -909,7 +917,7 @@ void silc_client_nickname_format(SilcClient client,
 
   len = 0;
   for (i = 0; i < clients_count; i++)
-    if (clients[i]->valid)
+    if (clients[i]->valid && clients[i] != client_entry)
       len++;
   if (!len)
     return;