1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 09:04:33 +02:00

Only connect XMPP plugin when credentials are loaded

This commit is contained in:
Leo Franchi
2012-06-10 11:28:28 +02:00
parent 1210665e56
commit 3999a98514
3 changed files with 7 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ XmppAccountFactory::createAccount( const QString& accountId )
XmppAccount::XmppAccount( const QString &accountId )
: Account( accountId )
, m_credentialsLoading( true )
{
connect( this, SIGNAL( credentialsLoaded( QVariantHash ) ), this, SLOT( onCredentialsLoaded( QVariantHash ) ) );
@@ -59,7 +60,7 @@ XmppAccount::~XmppAccount()
void
XmppAccount::authenticate()
{
if ( connectionState() != Account::Connected )
if ( connectionState() != Account::Connected && !m_credentialsLoading )
sipPlugin()->connectPlugin();
}
@@ -96,6 +97,7 @@ void
XmppAccount::onCredentialsLoaded( const QVariantHash& credentials )
{
m_credentials = credentials;
m_credentialsLoading = false;
if ( !m_xmppSipPlugin.isNull() )
m_xmppSipPlugin.data()->configurationChanged();
}

View File

@@ -91,6 +91,7 @@ protected:
QWeakPointer< Tomahawk::InfoSystem::XmppInfoPlugin > m_xmppInfoPlugin;
QVariantHash m_credentials;
bool m_credentialsLoading;
};
};

View File

@@ -581,6 +581,7 @@ XmppSipPlugin::configurationChanged()
server = readServer();
port = readPort();
qDebug() << Q_FUNC_INFO << "Configuration changed in SIP plugin:" << username << password << server << port << m_account->accountFriendlyName();
if ( m_currentUsername != username )
{
m_currentUsername = username;
@@ -610,6 +611,8 @@ XmppSipPlugin::configurationChanged()
m_xmppAccount->saveCredentials( credentials );
}
qDebug() << Q_FUNC_INFO << "reconnecting?" << reconnect << "enabled?" << m_account->enabled() << m_account->accountFriendlyName();
if ( reconnect )
setupClientHelper();