Fixed nickname setting with 1.3 protocol version.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 24 Apr 2007 17:27:49 +0000 (17:27 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 24 Apr 2007 17:27:49 +0000 (17:27 +0000)
Ignore error notify for local client entry.

lib/silcclient/client.c
lib/silcclient/client_connect.c
lib/silcclient/client_entry.c
lib/silcclient/client_notify.c
lib/silcclient/client_register.c

index 37f757fe77baf17414557223490bb39c3aefe4ec..af9954973c2fe549e5d468e73e561bd7f58aba03 100644 (file)
@@ -22,9 +22,6 @@
 #include "silcclient.h"
 #include "client_internal.h"
 
-/************************** Types and definitions ***************************/
-
-
 /************************ Static utility functions **************************/
 
 /* Connection machine FSM destructor.  This will finish the thread where
@@ -42,7 +39,8 @@ static void silc_client_connection_destructor(SilcFSM fsm,
   /* Delete connection */
   silc_client_del_connection(conn->client, conn);
 
-  /* Finish the thread were this machine was running */
+  /* Finish the thread were this machine was running.  Its destructor is the
+     silc_client_connection_finished. */
   silc_fsm_finish(thread);
 }
 
index 765eba24d629094210fb6a3f756465ee5b702538..ee8eb611afc96518485687ad98edfcdfe64f012d 100644 (file)
@@ -260,6 +260,8 @@ static void silc_client_rekey_completion(SilcSKE ske,
                                 conn->remote_host,
                                 silc_ske_map_status(status));
 
+    silc_ske_free(conn->internal->ske);
+    conn->internal->ske = NULL;
     silc_fsm_finish(fsm);
     return;
   }
@@ -790,5 +792,6 @@ SILC_FSM_STATE(silc_client_st_rekey)
     SILC_FSM_CALL(conn->internal->op = silc_ske_rekey_responder(
                                                    conn->internal->ske,
                                                    conn->stream,
-                                                   conn->internal->rekey));
+                                                   conn->internal->rekey,
+                                                   NULL));
 }
index b799d82d200427f1db5f0b77367aac0443b1dd8c..0835408a6d8854f4e01b8f0e964b3456f043dc20 100644 (file)
@@ -157,6 +157,8 @@ SilcDList silc_client_get_clients_local_ext(SilcClient client,
     return NULL;
   }
 
+  SILC_LOG_DEBUG(("Found %d clients", silc_dlist_count(clients)));
+
   silc_dlist_start(clients);
   return clients;
 }
index 07d2589a85233c3d1e284fbd19f1dc4868e7432b..12d22a8be7f0e88d3502d4afade8373898c2789f 100644 (file)
@@ -1492,7 +1492,7 @@ SILC_FSM_STATE(silc_client_notify_error)
     if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
       goto out;
     client_entry = silc_client_get_client_by_id(client, conn, &id.u.client_id);
-    if (client_entry) {
+    if (client_entry && client_entry != conn->local_entry) {
       silc_client_remove_from_channels(client, conn, client_entry);
       silc_client_del_client(client, conn, client_entry);
       silc_client_unref_client(client, conn, client_entry);
index b021abc6c0f6eb0e1734fce15b3321b717277d76..9bf29987c7a0332ffa724633527d771c151d469b 100644 (file)
@@ -78,6 +78,7 @@ SILC_FSM_STATE(silc_client_new_id)
   SilcClientConnection conn = fsm_context;
   SilcClient client = conn->client;
   SilcPacket packet = state_context;
+  char *nick;
   SilcID id;
 
   if (conn->local_id)
@@ -92,9 +93,15 @@ SILC_FSM_STATE(silc_client_new_id)
   SILC_LOG_DEBUG(("New ID %s", silc_id_render(&id.u.client_id,
                                              SILC_ID_CLIENT)));
 
+  /* From SILC protocol version 1.3, nickname is in NEW_CLIENT packet */
+  if (conn->internal->remote_version >= 13)
+    nick = (conn->internal->params.nickname ?
+           conn->internal->params.nickname : client->username);
+  else
+    nick = client->username;
+
   /* Create local client entry */
-  conn->local_entry = silc_client_add_client(client, conn,
-                                            client->username,
+  conn->local_entry = silc_client_add_client(client, conn, nick,
                                             client->username,
                                             client->realname,
                                             &id.u.client_id, 0);