updates.
[silc.git] / lib / silcclient / client_notify.c
index b272e242d5e413bea56d30ed7c4d595da0365824..64ad2658cfead157f2ecfb3dd774e8f14d0ceeca 100644 (file)
@@ -312,7 +312,7 @@ void silc_client_notify_by_server(SilcClient client,
       res->context = client;
       res->sock = silc_socket_dup(conn->sock);
       res->packet = silc_id_dup(client_id, SILC_ID_CLIENT);
-      silc_schedule_task_add(client->schedule, 0,
+      silc_schedule_task_add(client->schedule, conn->sock->sock,
                             silc_client_notify_check_client, res,
                             (5 + (silc_rng_get_rn16(client->rng) % 29)),
                             0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
@@ -741,8 +741,11 @@ void silc_client_notify_by_server(SilcClient client,
     /* Find target Client entry */
     client_entry2 = 
       silc_client_get_client_by_id(client, conn, client_id);
-    if (!client_entry2)
+    if (!client_entry2) {
+      silc_client_notify_by_server_resolve(client, conn, packet, 
+                                          SILC_ID_CLIENT, client_id);
       goto out;
+    }
 
     /* Get channel entry */
     channel_id = silc_id_str2id(packet->dst_id, packet->dst_id_len,
@@ -814,7 +817,8 @@ void silc_client_notify_by_server(SilcClient client,
       goto out;
 
     /* Replace the Channel ID */
-    silc_client_replace_channel_id(client, conn, channel, channel_id);
+    if (silc_client_replace_channel_id(client, conn, channel, channel_id))
+      channel_id = NULL;
 
     /* Notify application */
     client->internal->ops->notify(client, conn, type, channel, channel);
@@ -898,7 +902,7 @@ void silc_client_notify_by_server(SilcClient client,
        res->context = client;
        res->sock = silc_socket_dup(conn->sock);
        res->packet = silc_id_dup(client_entry->id, SILC_ID_CLIENT);
-       silc_schedule_task_add(client->schedule, 0,
+       silc_schedule_task_add(client->schedule, conn->sock->sock,
                               silc_client_notify_check_client, res,
                               (5 + (silc_rng_get_rn16(client->rng) % 529)),
                               0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
@@ -1144,6 +1148,10 @@ void silc_client_notify_by_server(SilcClient client,
       if (tmp && notify == SILC_NOTIFY_TYPE_NICK_CHANGE &&
          !silc_hash_table_count(client_entry->channels))
        silc_client_del_client(client, conn, client_entry);
+      else if (notify == SILC_NOTIFY_TYPE_SIGNOFF ||
+              notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF ||
+              notify == SILC_NOTIFY_TYPE_KILLED)
+       silc_client_del_client(client, conn, client_entry);
     }
     break;