1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-19 04:11:46 +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" )
{
m_accountIds << telepathyPathToAccountId( acc->objectPath() );
m_accountIds << telepathyPathToAccountId( acc->objectPath(), acc->serviceName() );
keychainIds << acc->uniqueIdentifier();
}
}
@@ -106,8 +106,10 @@ Tomahawk::Accounts::TelepathyConfigStorage::onCredentialsManagerReady( const QSt
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;
}
@@ -115,10 +117,15 @@ Tomahawk::Accounts::TelepathyConfigStorage::telepathyPathToAccountId( const QStr
QString
Tomahawk::Accounts::TelepathyConfigStorage::accountIdToTelepathyPath( const QString& accountId )
{
QString prefix( "xmppaccount_" );
QStringList allowedPrefixes;
allowedPrefixes << "xmppaccount_"
<< "googleaccount_";
QString r = accountId;
if ( r.startsWith( prefix ) )
r.remove( 0, prefix.length() );
foreach ( QString prefix, allowedPrefixes )
{
if ( r.startsWith( prefix ) )
r.remove( 0, prefix.length() );
}
return r;
}
@@ -174,10 +181,11 @@ Tomahawk::Accounts::TelepathyConfigStorage::load( const QString& accountId, Acco
types << "SipType";
cfg.types = types;
if ( !account->parameters()[ "port" ].isNull() )
cfg.configuration[ "port" ] = account->parameters()[ "port" ].toString();
else
if ( account->serviceName() == "google-talk" ||
account->parameters()[ "port" ].isNull() )
cfg.configuration[ "port" ] = "5222";
else
cfg.configuration[ "port" ] = account->parameters()[ "port" ].toString();
if ( !account->parameters()[ "server" ].isNull() )
cfg.configuration[ "server" ] = account->parameters()[ "server" ].toString();

View File

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