1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-20 04:41:36 +02:00

Add GTalk support for Telepathy accounts.

This commit is contained in:
Teo Mrnjavac
2013-06-18 18:04:06 +02:00
parent 99c3fb4431
commit bec87f692d
2 changed files with 17 additions and 9 deletions

View File

@@ -76,7 +76,7 @@ Tomahawk::Accounts::TelepathyConfigStorage::onTpAccountManagerReady( Tp::Pending
{ {
if ( acc->protocolName() == "jabber" ) if ( acc->protocolName() == "jabber" )
{ {
m_accountIds << telepathyPathToAccountId( acc->objectPath() ); m_accountIds << telepathyPathToAccountId( acc->objectPath(), acc->serviceName() );
keychainIds << acc->uniqueIdentifier(); keychainIds << acc->uniqueIdentifier();
} }
} }
@@ -106,8 +106,10 @@ Tomahawk::Accounts::TelepathyConfigStorage::onCredentialsManagerReady( const QSt
QString QString
Tomahawk::Accounts::TelepathyConfigStorage::telepathyPathToAccountId( const QString& objectPath ) Tomahawk::Accounts::TelepathyConfigStorage::telepathyPathToAccountId( const QString& objectPath, const QString& telepathyServiceName )
{ {
if ( telepathyServiceName == "google-talk" )
return QString( "googleaccount_" ) + objectPath;
return QString( "xmppaccount_" ) + objectPath; return QString( "xmppaccount_" ) + objectPath;
} }
@@ -115,10 +117,15 @@ Tomahawk::Accounts::TelepathyConfigStorage::telepathyPathToAccountId( const QStr
QString QString
Tomahawk::Accounts::TelepathyConfigStorage::accountIdToTelepathyPath( const QString& accountId ) Tomahawk::Accounts::TelepathyConfigStorage::accountIdToTelepathyPath( const QString& accountId )
{ {
QString prefix( "xmppaccount_" ); QStringList allowedPrefixes;
allowedPrefixes << "xmppaccount_"
<< "googleaccount_";
QString r = accountId; QString r = accountId;
foreach ( QString prefix, allowedPrefixes )
{
if ( r.startsWith( prefix ) ) if ( r.startsWith( prefix ) )
r.remove( 0, prefix.length() ); r.remove( 0, prefix.length() );
}
return r; return r;
} }
@@ -174,10 +181,11 @@ Tomahawk::Accounts::TelepathyConfigStorage::load( const QString& accountId, Acco
types << "SipType"; types << "SipType";
cfg.types = types; cfg.types = types;
if ( !account->parameters()[ "port" ].isNull() ) if ( account->serviceName() == "google-talk" ||
cfg.configuration[ "port" ] = account->parameters()[ "port" ].toString(); account->parameters()[ "port" ].isNull() )
else
cfg.configuration[ "port" ] = "5222"; cfg.configuration[ "port" ] = "5222";
else
cfg.configuration[ "port" ] = account->parameters()[ "port" ].toString();
if ( !account->parameters()[ "server" ].isNull() ) if ( !account->parameters()[ "server" ].isNull() )
cfg.configuration[ "server" ] = account->parameters()[ "server" ].toString(); cfg.configuration[ "server" ] = account->parameters()[ "server" ].toString();

View File

@@ -57,7 +57,7 @@ private slots:
void onCredentialsManagerReady( const QString& service ); void onCredentialsManagerReady( const QString& service );
private: private:
QString telepathyPathToAccountId( const QString& objectPath ); QString telepathyPathToAccountId( const QString& objectPath, const QString& telepathyServiceName );
QString accountIdToTelepathyPath( const QString& accountId ); QString accountIdToTelepathyPath( const QString& accountId );
const QString m_credentialsServiceName; const QString m_credentialsServiceName;