Added Requested Attributes sending and receiving support to
[silc.git] / lib / silcclient / idlist.c
index f20efc260bbb325f945cc4fb8bdd8706e00ac4ed..82a2e05120b6b4c654c4347827b06a5f66986895 100644 (file)
@@ -547,6 +547,7 @@ SILC_CLIENT_CMD_FUNC(get_client_by_id_callback)
 void silc_client_get_client_by_id_resolve(SilcClient client,
                                          SilcClientConnection conn,
                                          SilcClientID *client_id,
+                                         SilcBuffer attributes,
                                          SilcGetClientCallback completion,
                                          void *context)
 {
@@ -569,7 +570,9 @@ void silc_client_get_client_by_id_resolve(SilcClient client,
   /* Send the command */
   idp = silc_id_payload_encode(client_id, SILC_ID_CLIENT);
   silc_client_command_send(client, conn, SILC_COMMAND_WHOIS, conn->cmd_ident,
-                          1, 4, idp->data, idp->len);
+                          2, 3, attributes ? attributes->data : NULL,
+                          attributes ? attributes->len : 0,
+                          4, idp->data, idp->len);
   silc_buffer_free(idp);
 
   /* Add pending callback */
@@ -646,9 +649,14 @@ void silc_client_update_client(SilcClient client,
 
   SILC_LOG_DEBUG(("Start"));
 
-  if (!client_entry->username && username)
-    silc_parse_userfqdn(username, &client_entry->username, 
+  if ((!client_entry->username || !client_entry->hostname) && username) {
+    silc_free(client_entry->username);
+    silc_free(client_entry->hostname);
+    client_entry->username = NULL;
+    client_entry->hostname = NULL;
+    silc_parse_userfqdn(username, &client_entry->username,
                        &client_entry->hostname);
+  }
   if (!client_entry->realname && userinfo)
     client_entry->realname = strdup(userinfo);
   if (!client_entry->nickname && nickname) {