uint16 ident;
/* Get command reply payload from packet */
- payload = silc_command_payload_parse(buffer);
+ payload = silc_command_payload_parse(buffer->data, buffer->len);
if (!payload) {
/* Silently ignore bad reply packet */
SILC_LOG_DEBUG(("Bad command reply packet"));
char *realname = NULL;
uint32 idle = 0, mode = 0;
SilcBuffer channels = NULL;
+ unsigned char *fingerprint;
+ uint32 fingerprint_len;
argc = silc_argument_get_arg_num(cmd->args);
if (tmp)
SILC_GET32_MSB(idle, tmp);
+ fingerprint = silc_argument_get_arg_type(cmd->args, 9, &fingerprint_len);
+
/* Check if we have this client cached already. */
if (!silc_idcache_find_by_id_one_ext(conn->client_cache, (void *)client_id,
NULL, NULL,
silc_free(client_id);
}
+ if (fingerprint && !client_entry->fingerprint) {
+ client_entry->fingerprint =
+ silc_calloc(fingerprint_len,
+ sizeof(*client_entry->fingerprint));
+ memcpy(client_entry->fingerprint, fingerprint, fingerprint_len);
+ client_entry->fingerprint_len = fingerprint_len;
+ }
+
if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING)
client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
/* Notify application */
if (!cmd->callback)
COMMAND_REPLY((ARGS, client_entry, nickname, username, realname,
- channels, mode, idle));
+ channels, mode, idle, fingerprint));
if (channels)
silc_buffer_free(channels);
}
out:
- SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_WHOIS);
- SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_WHOIS);
+ SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_WHOWAS);
+ SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_WHOWAS);
silc_client_command_reply_free(cmd);
}
COMMAND_REPLY_ERROR;
return;
}
- idp = silc_id_payload_parse_data(id_data, len);
+ idp = silc_id_payload_parse(id_data, len);
if (!idp) {
COMMAND_REPLY_ERROR;
return;
/* Add server to cache */
silc_idcache_add(conn->server_cache, server_entry->server_name,
- server_entry->server_id, (void *)server_entry, FALSE);
+ server_entry->server_id, (void *)server_entry,
+ 0, NULL);
} else {
server_entry = (SilcServerEntry)id_cache->context;
}
/* Take received Client ID */
tmp = silc_argument_get_arg_type(cmd->args, 2, &len);
- idp = silc_id_payload_parse_data(tmp, len);
+ idp = silc_id_payload_parse(tmp, len);
if (!idp) {
COMMAND_REPLY_ERROR;
goto out;
silc_client_receive_new_id(cmd->client, cmd->sock, idp);
/* Notify application */
+ SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_NICK);
COMMAND_REPLY((ARGS, conn->local_entry));
+ SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_NICK);
+ silc_client_command_reply_free(cmd);
+ return;
out:
SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_NICK);
/* Add it to the cache */
silc_idcache_add(conn->server_cache, server->server_name,
- server->server_id, (void *)server, FALSE);
+ server->server_id, (void *)server, 0, NULL);
+
+ if (SILC_ID_SERVER_COMPARE(server_id, conn->remote_id))
+ goto out;
} else {
server = (SilcServerEntry)id_cache->context;
}
curtime = time(NULL);
id = silc_id_str2id(cmd->packet->src_id, cmd->packet->src_id_len,
cmd->packet->src_id_type);
- if (!id) {
+ if (!id || !conn->ping) {
COMMAND_REPLY_ERROR;
goto out;
}
for (i = 0; i < conn->ping_count; i++) {
+ if (!conn->ping[i].dest_id)
+ continue;
if (SILC_ID_SERVER_COMPARE(conn->ping[i].dest_id, id)) {
diff = curtime - conn->ping[i].start_time;
cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
- "%s", silc_client_command_status_message(status));
+ if (status != SILC_STATUS_ERR_USER_ON_CHANNEL)
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
}
silc_free(channel_name);
goto out;
}
- idp = silc_id_payload_parse_data(tmp, len);
+ idp = silc_id_payload_parse(tmp, len);
if (!idp) {
COMMAND_REPLY_ERROR;
silc_free(channel_name);
COMMAND_REPLY_ERROR;
goto out;
}
- idp = silc_id_payload_parse_data(tmp, len);
+ idp = silc_id_payload_parse(tmp, len);
if (!idp) {
COMMAND_REPLY_ERROR;
goto out;