コード例 #1
0
ファイル: OpenSimWorldSession.cpp プロジェクト: Chiru/naali
 void OpenSimWorldSession::HandleLoginStateChange(int state)
 {
     ProtocolUtilities::Connection::State loginState = (ProtocolUtilities::Connection::State)state;
     ProtocolModuleOpenSim::LogDebug("OpenSim login in process: " + NetworkStateToString(loginState));
     if (loginState == ProtocolUtilities::Connection::STATE_LOGIN_FAILED)
     {
         emit LoginFailed(networkOpensim_.lock()->GetLoginWorker()->GetErrorMessage().c_str());
     }
     else if (loginState == ProtocolUtilities::Connection::STATE_CONNECTED)
     {
         emit LoginSuccessful();
     }
 }
コード例 #2
0
ファイル: RealXtendWorldSession.cpp プロジェクト: A-K/naali
 void RealXtendWorldSession::HandleLoginStateChange(int state)
 {
     ProtocolUtilities::Connection::State loginState = (ProtocolUtilities::Connection::State)state;
     ProtocolModuleOpenSim::LogDebug("RexAuth login in process: " + NetworkStateToString(loginState));
     if (loginState == ProtocolUtilities::Connection::STATE_LOGIN_FAILED)
     {
         // Dont emit this if we are already connected, the state change might be false from
         // another worker thread "instance" or thread run of the constuctor. 
         // Caused crashes after teleports without the check!
         if (networkOpensim_.lock()->GetLoginWorker()->GetState() != ProtocolUtilities::Connection::STATE_CONNECTED)
             emit LoginFailed(networkOpensim_.lock()->GetLoginWorker()->GetErrorMessage().c_str());
     }
     else if (loginState == ProtocolUtilities::Connection::STATE_CONNECTED)
     {
         emit LoginSuccessful();
     }
 }
コード例 #3
0
ファイル: LoginHandler.cpp プロジェクト: Chiru/naali
    void LoginHandler::HandleLoginSuccessful()
    {
        assert(credentials_.GetType() != ProtocolUtilities::AT_Unknown);

        Foundation::ConfigurationManagerPtr mgr = owner_->GetFramework()->GetConfigManager();
        if (credentials_.GetType() ==ProtocolUtilities::AT_OpenSim)
        {
            mgr->DeclareSetting<std::string>("Login", "server", server_entry_point_url_.authority().toStdString());
            mgr->DeclareSetting<std::string>("Login", "username", credentials_.GetIdentity().toStdString());
        }
        else if (credentials_.GetType() == ProtocolUtilities::AT_RealXtend)
        {
            Foundation::ConfigurationManagerPtr mgr = owner_->GetFramework()->GetConfigManager();
            mgr->DeclareSetting<std::string>("Login", "rex_server", server_entry_point_url_.authority().toStdString());
            mgr->DeclareSetting<std::string>("Login", "auth_server", credentials_.GetAuthenticationUrl().host().toStdString());
            mgr->DeclareSetting<std::string>("Login", "auth_name", credentials_.GetIdentity().toStdString());
        }
        else if (credentials_.GetType() == ProtocolUtilities::AT_Taiga)
        {
            // do nothing for now
        }

        emit LoginSuccessful();
    }
コード例 #4
0
ファイル: LoginHandler.cpp プロジェクト: Chiru/naali
    void LoginHandler::StartWorldSession()
    {
        emit LoginStarted();

        SAFE_DELETE(world_session_);
        ProtocolUtilities::WorldStreamPtr stream = owner_->GetServerConnection();

        // Prepare the right world session.
        switch(credentials_.GetType())
        {
        case ProtocolUtilities::AT_OpenSim:
        {
            stream->UnregisterCurrentProtocolModule();
            stream->SetCurrentProtocolType(ProtocolUtilities::OpenSim);
            stream->SetConnectionType(ProtocolUtilities::DirectConnection);
            stream->StoreCredentials(credentials_.GetIdentity().toStdString(), credentials_.GetPassword().toStdString(), "");
            if (stream->PrepareCurrentProtocolModule() )
                world_session_ = new OpenSimProtocol::OpenSimWorldSession(owner_->GetFramework());
            break;
        }
        case ProtocolUtilities::AT_RealXtend:
        {
            stream->UnregisterCurrentProtocolModule();
            stream->SetCurrentProtocolType(ProtocolUtilities::OpenSim);
            stream->SetConnectionType(ProtocolUtilities::AuthenticationConnection);
            stream->StoreCredentials(credentials_.GetIdentity().toStdString(),
            credentials_.GetPassword().toStdString(), credentials_.GetAuthenticationUrl().toString().toStdString());
            if (stream->PrepareCurrentProtocolModule())
                world_session_ = new OpenSimProtocol::RealXtendWorldSession(owner_->GetFramework());
            break;
        }
        case ProtocolUtilities::AT_Taiga:
        {
            stream->UnregisterCurrentProtocolModule();
            stream->SetCurrentProtocolType(ProtocolUtilities::Taiga);
            stream->SetConnectionType(ProtocolUtilities::DirectConnection);
            stream->StoreCredentials(credentials_.GetIdentity().toStdString(), "", "");
            if (stream->PrepareCurrentProtocolModule())
                world_session_ = new TaigaProtocol::TaigaWorldSession(owner_->GetFramework());
            break;
        }
        case ProtocolUtilities::AT_Unknown:
        default:
            RexLogicModule::LogError("LoginHandler::StartWorldSession: Unknown login type.");
            return;
        }

        assert(world_session_);
        if (!world_session_)
        {
            RexLogicModule::LogError("LoginHandler::StartWorldSession: Could not instantiate world session.");
            return;
        }

        connect(world_session_, SIGNAL(LoginSuccessful()), SLOT(HandleLoginSuccessful()));
        connect(world_session_, SIGNAL(LoginFailed(const QString &)), SLOT(HandleLoginFailed(const QString &)));

        /// \todo   The return value of StartSession doesn't tell us if the login succeeded ot not for real.
        ///         because the login is done in separate thread. Refactor to void?.
        world_session_->StartSession(credentials_, server_entry_point_url_);
    }