-/* Pending callbcak that will be called after the NICK command was
- replied by the server. This sets the nickname if there were no
- errors. */
-
-SILC_CLIENT_CMD_FUNC(nick_change)
-{
- SilcClientCommandContext cmd = (SilcClientCommandContext)context;
- SilcClientConnection conn = cmd->conn;
- SilcClientCommandReplyContext reply =
- (SilcClientCommandReplyContext)context2;
- SilcStatus status;
-
- silc_command_get_status(reply->payload, &status, NULL);
- if (status == SILC_STATUS_OK) {
- /* Set the nickname */
- silc_idcache_del_by_context(conn->client_cache, conn->local_entry);
- if (conn->nickname)
- silc_free(conn->nickname);
- conn->nickname = strdup(cmd->argv[1]);
- conn->local_entry->nickname = conn->nickname;
- silc_client_nickname_format(cmd->client, conn, conn->local_entry);
- silc_idcache_add(conn->client_cache, strdup(cmd->argv[1]),
- conn->local_entry->id, conn->local_entry, 0, NULL);
- COMMAND(SILC_STATUS_OK);
- } else {
- COMMAND_ERROR(status);
- }
-
- silc_client_command_free(cmd);
-}
-