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;
name, info, NULL, 0);
}
+ if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING)
+ client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
+
/* Notify application */
COMMAND_REPLY((ARGS, client_entry, name, info));
break;
/* 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);
+
+ 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);
SilcClientEntry client_entry;
SilcChannelEntry channel;
SilcChannelUser chu;
- unsigned char *tmp, *id;
+ unsigned char *modev, *tmp, *id;
uint32 len, mode;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
}
/* Get channel mode */
- tmp = silc_argument_get_arg_type(cmd->args, 2, NULL);
- if (!tmp) {
+ modev = silc_argument_get_arg_type(cmd->args, 2, NULL);
+ if (!modev) {
COMMAND_REPLY_ERROR;
goto out;
}
client_entry = (SilcClientEntry)id_cache->context;
/* Save the mode */
- SILC_GET32_MSB(mode, tmp);
+ SILC_GET32_MSB(mode, modev);
+ silc_list_start(channel->clients);
while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
if (chu->client == client_entry) {
chu->mode = mode;
if (!id_cache || !((SilcClientEntry)id_cache->context)->username ||
!((SilcClientEntry)id_cache->context)->realname) {
+
+ if (id_cache && id_cache->context) {
+ SilcClientEntry client_entry = (SilcClientEntry)id_cache->context;
+ if (client_entry->status & SILC_CLIENT_STATUS_RESOLVING) {
+ client_entry->status &= ~SILC_CLIENT_STATUS_RESOLVING;
+ silc_buffer_pull(client_id_list, idp_len);
+ silc_buffer_pull(client_mode_list, 4);
+ continue;
+ }
+ client_entry->status |= SILC_CLIENT_STATUS_RESOLVING;
+ }
+
/* No we don't have it (or it is incomplete in information), query
it from the server. Assemble argument table that will be sent
for the WHOIS command later. */
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;