SilcServerCommandReplyContext ctx;
SilcCommandPayload payload;
SilcCommand command;
- SilcUInt16 ident;
SILC_LOG_DEBUG(("Start"));
ctx->sock = silc_socket_dup(sock);
ctx->payload = payload;
ctx->args = silc_command_get_args(ctx->payload);
- ident = silc_command_get_ident(ctx->payload);
+ ctx->ident = silc_command_get_ident(ctx->payload);
/* Check for pending commands and mark to be exeucted */
ctx->callbacks =
- silc_server_command_pending_check(server, ctx,
- silc_command_get(ctx->payload),
- ident, &ctx->callbacks_count);
+ silc_server_command_pending_check(server, silc_command_get(ctx->payload),
+ ctx->ident, &ctx->callbacks_count);
/* Execute command reply */
command = silc_command_get(ctx->payload);
client = silc_idlist_add_client(server->global_list, nick,
strdup(username),
strdup(realname), client_id,
- cmd->sock->user_data, NULL,
- time(NULL) + 300);
+ cmd->sock->user_data, NULL, 0);
if (!client) {
SILC_LOG_ERROR(("Could not add new client to the ID Cache"));
return FALSE;
/* Create new cache entry */
silc_idcache_add(global ? server->global_list->clients :
server->local_list->clients, nick, client->id,
- client, 0, &cache);
+ client, 0, NULL);
silc_free(client_id);
}
silc_server_save_user_channels(server, cmd->sock, client, NULL, NULL);
}
- if (cache)
- /* If client is global and is not on any channel then add that we'll
- expire the entry after a while. */
- if (global && !silc_hash_table_count(client->channels))
+ /* If client is global and is not on any channel then add that we'll
+ expire the entry after a while. */
+ if (global) {
+ silc_idlist_find_client_by_id(server->global_list, client->id,
+ FALSE, &cache);
+ if (!silc_hash_table_count(client->channels))
cache->expire = time(NULL) + 300;
+ else
+ cache->expire = 0;
+ }
}
if (fingerprint && flen == sizeof(client->data.fingerprint))
return FALSE;
}
+ client->data.status |= SILC_IDLIST_STATUS_RESOLVED;
+ client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
client->servername = servername;
} else {
silc_free(client->nickname);
silc_free(client->username);
+ silc_free(client->servername);
client->nickname = nick;
client->username = strdup(username);
client->servername = servername;
+ client->data.status |= SILC_IDLIST_STATUS_RESOLVED;
+ client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
/* Remove the old cache entry and create a new one */
silc_idcache_del_by_context(global ? server->global_list->clients :
client, 0, NULL);
}
+ /* If client is global and is not on any channel then add that we'll
+ expire the entry after a while. */
+ if (global) {
+ silc_idlist_find_client_by_id(server->global_list, client->id,
+ FALSE, &cache);
+ if (!silc_hash_table_count(client->channels))
+ cache->expire = SILC_ID_CACHE_EXPIRE_DEF;
+ else
+ cache->expire = 0;
+ }
+
silc_free(client_id);
return TRUE;
}
out:
+ silc_server_command_process_error(cmd, error);
SILC_SERVER_PENDING_EXEC(cmd, SILC_COMMAND_WHOWAS);
+ silc_server_command_reply_free(cmd);
+ return;
+
err:
+ silc_server_command_process_error(cmd, error);
silc_server_command_reply_free(cmd);
}
global. */
client = silc_idlist_add_client(server->global_list, nick,
info ? strdup(info) : NULL, NULL,
- client_id, cmd->sock->user_data, NULL,
- time(NULL) + 300);
+ client_id, cmd->sock->user_data,
+ NULL, time(NULL) + 300);
if (!client) {
SILC_LOG_ERROR(("Could not add new client to the ID Cache"));
goto error;
client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
if (name) {
- /* If client is global and is not on any channel then add that we'll
- expire the entry after a while. */
- if (global && !silc_hash_table_count(client->channels) &&
- server->server_type == SILC_SERVER)
- expire = time(NULL) + 300;
-
/* Add new cache entry */
silc_idcache_add(global ? server->global_list->clients :
server->local_list->clients, nick, client->id,
client, expire, NULL);
}
+ /* If client is global and is not on any channel then add that we'll
+ expire the entry after a while. */
+ if (global && server->server_type == SILC_SERVER) {
+ SilcIDCacheEntry cache = NULL;
+ silc_idlist_find_client_by_id(server->global_list, client->id,
+ FALSE, &cache);
+ if (!silc_hash_table_count(client->channels))
+ cache->expire = time(NULL) + 300;
+ else
+ cache->expire = 0;
+ }
+
silc_free(client_id);
}