Пример #1
0
        private static void AuthChallengeRequestCallback(IAuthClient client, Ban clientBan)
        {
            if (clientBan != null)
            {
                if (clientBan.IPMinimum != 0 && clientBan.IPMaximum != 0)
                {
                    if (clientBan.Expires <= DateTime.Now)
                    {
                        // remove the ban since it's expired
                        client.Server.EnqueueTask(QueryFactory.CreateNonResultQuery(clientBan.DeleteAndFlush));
                    }
                    else
                    {
                        OnLoginError(client, AccountStatus.Failure);
                        return;
                    }
                }
            }

            if (client.Server.IsAccountLoggedIn(client.CurrentUser))
            {
                OnLoginError(client, AccountStatus.AccountInUse);
            }
            else
            {
                var acctQuery = QueryFactory.CreateResultQuery(
                    () => AccountMgr.GetAccount(client.CurrentUser),
                    QueryAccountCallback,
                    client
                    );
                client.Server.EnqueueTask(acctQuery);
            }
        }