Exemple #1
0
void
TwitterSipPlugin::disconnectPlugin()
{
    tDebug() << Q_FUNC_INFO;
    m_checkTimer.stop();
    m_connectTimer.stop();
    m_dmPollTimer.stop();
    if( !m_friendsTimeline.isNull() )
        delete m_friendsTimeline.data();
    if( !m_mentions.isNull() )
        delete m_mentions.data();
    if( !m_directMessages.isNull() )
        delete m_directMessages.data();
    if( !m_directMessageNew.isNull() )
        delete m_directMessageNew.data();
    if( !m_directMessageDestroy.isNull() )
        delete m_directMessageDestroy.data();

    m_cachedTwitterAuth.clear();

    m_configuration[ "cachedpeers" ] = m_cachedPeers;
    syncConfig();
    m_cachedPeers.empty();
    m_state = Tomahawk::Accounts::Account::Disconnected;
    emit stateChanged( m_state );
}
Exemple #2
0
void
TwitterPlugin::disconnectPlugin()
{
    qDebug() << Q_FUNC_INFO;
    m_checkTimer.stop();
    m_connectTimer.stop();
    m_dmPollTimer.stop();
    if( !m_friendsTimeline.isNull() )
        delete m_friendsTimeline.data();
    if( !m_mentions.isNull() )
        delete m_mentions.data();
    if( !m_directMessages.isNull() )
        delete m_directMessages.data();
    if( !m_directMessageNew.isNull() )
        delete m_directMessageNew.data();
    if( !m_directMessageDestroy.isNull() )
        delete m_directMessageDestroy.data();
    if( !m_twitterAuth.isNull() )
        delete m_twitterAuth.data();

    syncConfig();
    m_cachedPeers.empty();
    m_state = Disconnected;
    emit stateChanged( m_state );
}
Exemple #3
0
void
TwitterSipPlugin::registerOffers( const QStringList &peerList )
{
    if ( !isValid() )
        return;

    foreach( QString screenName, peerList )
    {
        QVariantHash peerData = m_cachedPeers[screenName].toHash();

        if ( peerData.contains( "onod" ) && peerData["onod"] != Database::instance()->dbid() )
        {
            m_cachedPeers.remove( screenName );
            m_configuration[ "cachedpeers" ] = m_cachedPeers;
            syncConfig();
        }

        if ( Servent::instance()->connectedToSession( peerData["node"].toString() ) )
        {
            peerData["lastseen"] = QDateTime::currentMSecsSinceEpoch();
            m_cachedPeers[screenName] = peerData;
            m_configuration[ "cachedpeers" ] = m_cachedPeers;
            syncConfig();
            qDebug() << Q_FUNC_INFO << " already connected";
            continue;
        }
        else if ( QDateTime::currentMSecsSinceEpoch() - peerData["lastseen"].toLongLong() > 1209600000 ) // 2 weeks
        {
            qDebug() << Q_FUNC_INFO << " aging peer " << screenName << " out of cache";
            m_cachedPeers.remove( screenName );
            m_configuration[ "cachedpeers" ] = m_cachedPeers;
            syncConfig();
            m_cachedAvatars.remove( screenName );
            continue;
        }

        if ( !peerData.contains( "host" ) || !peerData.contains( "port" ) || !peerData.contains( "pkey" ) )
        {
            qDebug() << "TwitterSipPlugin does not have host, port and/or pkey values for " << screenName << " (this is usually *not* a bug or problem but a normal part of the process)";
            continue;
        }

        QMetaObject::invokeMethod( this, "registerOffer", Q_ARG( QString, screenName ), Q_ARG( QVariantHash, peerData ) );
    }
Exemple #4
0
void OgreApp::setupDemoScene()
{
    globals.initPaths();
#if defined(OGRE_IS_IOS) && defined(NETWORKING)
    syncConfig();
#endif
    
    seed = time(0);
    srand(seed);
    
    // The code snippet below is used to output text
    // create a font resource
    ResourcePtr resourceText = OgreFramework::getSingletonPtr()->m_pFontMgr->create("Arial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    resourceText->setParameter("type", "truetype");
    //resourceText->setParameter("source", "C64_User_Mono_v1.0-STYLE.ttf");
    resourceText->setParameter("source", "NEUROPOL.ttf");
    resourceText->setParameter("size", "16");
    resourceText->setParameter("resolution", "96");
    resourceText->load();
    
    Util::createSphere(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "sphereMesh", 1.0, 8, 8);
    Util::createCylinder(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "cylinderMesh", 1.0, 1.0, 8);
    Util::createDiamond(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "diamondMesh", 1.0, 1.0);
    Util::createBox(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "boxMesh", 1.0, 1.0, 1.0);
    Util::createPlane(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "planeMesh", 1.0, 1.0);
    Util::createDefaultSegments(OgreFramework::getSingletonPtr()->m_pSceneMgrMain);
    
    globals.initPaths();
    //if (!configStageType(globals.configPath, globals.configBackup, "globalConfig"))
    //    globals.setMessage("WARNING: Failed to read configuration", MESSAGE_ERROR);
    
	OgreFramework::getSingletonPtr()->m_pCameraMain->setPosition(Vector3::ZERO);
	OgreFramework::getSingletonPtr()->m_pCameraMain->lookAt(Vector3::ZERO);
	player = new Player(
                        globals.playerName,
                        OgreFramework::getSingletonPtr()->m_pCameraMain->getPosition(),
                        OgreFramework::getSingletonPtr()->m_pCameraMain->getOrientation(),
                        globals.initCamSpeed,
                        globals.vineTOffset,
                        seed,
                        "vinezors" + Util::toStringInt(seed) + ".csv");
    player->setSounds(true);
    if (!player->loadProgress(globals.savePath))
        std::cout << "WARNING: Save File could not be loaded correctly" << std::endl;
    
    globals.initLogs(player->getSkillLevel().sessionID);
    
    engineStateMgr = new EngineStateManager();
    engineStateMgr->requestPushEngine(ENGINE_MAIN_MENU, player);
    
#if defined(OGRE_IS_IOS) && (NETWORKING)
    syncLogs();
#endif
}
void PlasmaApp::cleanup()
{
    if (m_corona) {
        m_corona->saveLayout();
    }

    qDeleteAll(m_viewForPlugin);

    delete m_corona;
    m_corona = 0;

    //TODO: This manual sync() should not be necessary?
    syncConfig();
}
Exemple #6
0
void
Account::setTypes( AccountTypes types )
{
    QMutexLocker locker( &m_mutex );
    m_cfg.types = QStringList();
    if ( types & InfoType )
        m_cfg.types << "InfoType";
    if ( types & SipType )
        m_cfg.types << "SipType";
    if ( types & ResolverType )
        m_cfg.types << "ResolverType";
    if ( types & StatusPushType )
        m_cfg.types << "StatusPushType";
    syncConfig();
}
Exemple #7
0
TwitterSipPlugin::TwitterSipPlugin( Tomahawk::Accounts::Account* account )
    : SipPlugin( account )
    , m_checkTimer( this )
    , m_connectTimer( this )
    , m_dmPollTimer( this )
    , m_cachedFriendsSinceId( 0 )
    , m_cachedMentionsSinceId( 0 )
    , m_cachedDirectMessagesSinceId( 0 )
    , m_cachedPeers()
    , m_keyCache()
    , m_state( Tomahawk::Accounts::Account::Disconnected )
{
    qDebug() << Q_FUNC_INFO;

    connect( account, SIGNAL( nowAuthenticated( const QWeakPointer< TomahawkOAuthTwitter > &, const QTweetUser & ) ), SLOT( accountAuthenticated( const QWeakPointer< TomahawkOAuthTwitter > &, const QTweetUser & ) ) );

    m_configuration = account->configuration();
    qDebug() << "SIP configuration:" << m_configuration << m_configuration[ "cachedpeers" ];
    if ( Database::instance()->dbid() != m_account->configuration()[ "saveddbid" ].toString() )
    {
        m_configuration[ "cachedpeers" ] = QVariantHash();
        m_configuration[ "saveddbid" ] = Database::instance()->dbid();
        syncConfig();
    }

    m_checkTimer.setInterval( 180000 );
    m_checkTimer.setSingleShot( false );
    connect( &m_checkTimer, SIGNAL( timeout() ), SLOT( checkTimerFired() ) );

    m_dmPollTimer.setInterval( 60000 );
    m_dmPollTimer.setSingleShot( false );
    connect( &m_dmPollTimer, SIGNAL( timeout() ), SLOT( pollDirectMessages() ) );

    m_connectTimer.setInterval( 180000 );
    m_connectTimer.setSingleShot( false );
    connect( &m_connectTimer, SIGNAL( timeout() ), SLOT( connectTimerFired() ) );
}
Exemple #8
0
void OgreApp::setupDemoScene()
{
    bool isSynced = false;
    globals.initPaths();
#if defined(NETWORKING)
#if defined(OGRE_IS_IOS)
    isSynced = syncConfig();
#endif
#endif
    
    seed = time(0);
    
    srand(seed);
    sessionOver = false;
    
    Util::generateMaterials();
    
    Util::createSphere(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "sphereMesh", 1.0, 8, 8);
    Util::createCylinder(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "cylinderMesh", 1.0, 1.0, 8);
    Util::createDiamond(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "diamondMesh", 1.0, 1.0);
    Util::createBox(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "boxMesh", 1.0, 1.0, 1.0);
    Util::createPlane(OgreFramework::getSingletonPtr()->m_pSceneMgrMain, "planeMesh", 1.0, 1.0);
    Util::createDefaultSegments(OgreFramework::getSingletonPtr()->m_pSceneMgrMain);
    
	origin = Vector3(0, 0, 0);
    
	OgreFramework::getSingletonPtr()->m_pCameraMain->setPosition(Vector3(origin.x, origin.y, origin.z + globals.tunnelSegmentDepth / 2));
	OgreFramework::getSingletonPtr()->m_pCameraMain->lookAt(origin);
    
    globals.initPaths();
    if (!configStageType(globals.configPath, globals.configBackup, "globalConfig"))
        globals.setMessage("WARNING: Failed to read configuration", MESSAGE_ERROR);
    
	player = new Player(
                        globals.playerName,
                        OgreFramework::getSingletonPtr()->m_pCameraMain->getPosition(),
                        OgreFramework::getSingletonPtr()->m_pCameraMain->getOrientation(),
                        globals.initCamSpeed,
                        globals.vineTOffset,
                        SPEED_CONTROL_AUTO,
                        seed,
                        "vinezors" + Util::toStringInt(seed) + ".csv");
	player->addVine(new Vine(OgreFramework::getSingletonPtr()->m_pSceneMgrMain->getRootSceneNode(), player->getCamPos(), globals.vineRadius));
    player->setSounds(true);
    player->setRunningSpeed(globals.set1StartingSpeed, globals.set2StartingSpeed, globals.set3StartingSpeed, globals.trialStartingSpeed, globals.startingNav);
    if (!player->loadProgress(globals.savePath))
        std::cout << "WARNING: Save File could not be loaded correctly" << std::endl;
    globals.initLogs(player->getSkillLevel().sessionID);
    
    tunnel = NULL;
    hud = new Hud();
    
    // Determine length of time
    globals.sessionTime = globals.sessionTimeMin;
    if (player->getSkillLevel().sessionID >= 1)
        globals.sessionTime += ((globals.sessionTimeMax - globals.sessionTimeMin) / globals.expectedNumSessions) * (player->getSkillLevel().sessionID - 1);
    std::cout << "Session Length: " << globals.sessionTime << std::endl;
    
    levelMgr = new LevelManager(player, globals.scheduleMain, globals.scheduleRepeat, globals.scheduleRepeatRandomPool);
    
    setLevel(EVEN);
    
    Light* lightMain = OgreFramework::getSingletonPtr()->m_pSceneMgrMain->createLight("Light");
    lightMain->setDiffuseColour(1.0, 1.0, 1.0);
    lightMain->setSpecularColour(1.0, 1.0, 1.0);
    //lightMain->setAttenuation(3250, 1.0, 0.0014, 0.000007);
    lightNodeMain = OgreFramework::getSingletonPtr()->m_pSceneMgrMain->getRootSceneNode()->createChildSceneNode("lightNode");
    lightNodeMain->attachObject(lightMain);
    lightNodeMain->setPosition(OgreFramework::getSingletonPtr()->m_pCameraMain->getPosition());
    
    if (!isSynced) {
        globals.setMessage("ERROR: Could not connect for updates.\nPlease contact the RA", MESSAGE_ERROR);
    }
    
#if defined(NETWORKING)
#if defined(OGRE_IS_IOS)
    syncLogs();
#endif
#endif
}
Exemple #9
0
void ConfigBase::fsmUpEntry()
{
    syncConfig();
}