From e2749a7676edaa0442d53bbfdd80c64ef08c7660 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sun, 12 Feb 2012 16:24:08 -0500 Subject: [PATCH] Fix some twitter stuff --- src/accounts/twitter/sip/twittersip.cpp | 2 ++ src/accounts/twitter/twitteraccount.cpp | 3 +++ src/libtomahawk/tomahawksettings.cpp | 16 ++++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/accounts/twitter/sip/twittersip.cpp b/src/accounts/twitter/sip/twittersip.cpp index 446cc321d..c4daa6679 100644 --- a/src/accounts/twitter/sip/twittersip.cpp +++ b/src/accounts/twitter/sip/twittersip.cpp @@ -59,6 +59,8 @@ TwitterSipPlugin::TwitterSipPlugin( Tomahawk::Accounts::Account* account ) 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(); diff --git a/src/accounts/twitter/twitteraccount.cpp b/src/accounts/twitter/twitteraccount.cpp index 390bf55e4..67bad5148 100644 --- a/src/accounts/twitter/twitteraccount.cpp +++ b/src/accounts/twitter/twitteraccount.cpp @@ -50,6 +50,8 @@ TwitterAccount::TwitterAccount( const QString &accountId ) setAccountServiceName( "Twitter" ); setTypes( AccountTypes( InfoType | SipType ) ); + qDebug() << "Got cached peers:" << configuration() << configuration()[ "cachedpeers" ]; + m_configWidget = QWeakPointer< TwitterConfigWidget >( new TwitterConfigWidget( this, 0 ) ); connect( m_configWidget.data(), SIGNAL( twitterAuthed( bool ) ), SLOT( configDialogAuthedSignalSlot( bool ) ) ); @@ -86,6 +88,7 @@ TwitterAccount::sipPlugin() { if ( m_twitterSipPlugin.isNull() ) { + qDebug() << "CHECKING:" << configuration() << configuration()[ "cachedpeers" ]; m_twitterSipPlugin = QWeakPointer< TwitterSipPlugin >( new TwitterSipPlugin( this ) ); connect( m_twitterSipPlugin.data(), SIGNAL( stateChanged( Tomahawk::Accounts::Account::ConnectionState ) ), this, SIGNAL( connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ) ); diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp index 36c8ef1ac..244a3b1b0 100644 --- a/src/libtomahawk/tomahawksettings.cpp +++ b/src/libtomahawk/tomahawksettings.cpp @@ -231,17 +231,22 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion ) continue; QVariantHash credentials; - credentials[ "cachedfriendssinceid" ] = value( sipPlugin + "/cachedfriendssinceid" ); - credentials[ "cacheddirectmessagessinceid" ] = value( sipPlugin + "/cacheddirectmessagessinceid" ); - credentials[ "cachedpeers" ] = value( sipPlugin + "/cachedpeers" ); credentials[ "oauthtoken" ] = value( sipPlugin + "/oauthtoken" ); credentials[ "oauthtokensecret" ] = value( sipPlugin + "/oauthtokensecret" ); - credentials[ "cachedmentionssinceid" ] = value( sipPlugin + "/cachedmentionssinceid" ); credentials[ "username" ] = value( sipPlugin + "/screenname" ); - credentials[ "saveddbid" ] = value( sipPlugin + "/saveddbid" ); + + QVariantHash configuration; + configuration[ "cachedfriendssinceid" ] = value( sipPlugin + "/cachedfriendssinceid" ); + configuration[ "cacheddirectmessagessinceid" ] = value( sipPlugin + "/cacheddirectmessagessinceid" ); + configuration[ "cachedpeers" ] = value( sipPlugin + "/cachedpeers" ); + qDebug() << "FOUND CACHED PEERS:" << value( sipPlugin + "/cachedpeers" ).toHash(); + configuration[ "cachedmentionssinceid" ] = value( sipPlugin + "/cachedmentionssinceid" ); + configuration[ "saveddbid" ] = value( sipPlugin + "/saveddbid" ); setValue( QString( "accounts/%1/credentials" ).arg( accountKey ), credentials ); + setValue( QString( "accounts/%1/configuration" ).arg( accountKey ), configuration ); setValue( QString( "accounts/%1/accountfriendlyname" ).arg( accountKey ), "@" + value( sipPlugin + "/screenname" ).toString() ); + sync(); } else if ( pluginName == "sipzeroconf" ) { @@ -251,7 +256,6 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion ) beginGroup( "accounts/" + accountKey ); setValue( "enabled", enabledSip.contains( sipPlugin ) == true ); setValue( "autoconnect", true ); - setValue( "configuration", QVariantHash() ); setValue( "acl", QVariantMap() ); setValue( "types", QStringList() << "SipType" ); endGroup();