Permalink
Browse files

Only connect XMPP plugin when credentials are loaded

  • Loading branch information...
1 parent 1210665 commit 3999a98514da2e79a3c8dbe7c54e10cf034f7074 @lfranchi lfranchi committed Jun 10, 2012
Showing with 7 additions and 1 deletion.
  1. +3 −1 src/accounts/xmpp/XmppAccount.cpp
  2. +1 −0 src/accounts/xmpp/XmppAccount.h
  3. +3 −0 src/accounts/xmpp/sip/XmppSip.cpp
@@ -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();
}
@@ -91,6 +91,7 @@ private slots:
QWeakPointer< Tomahawk::InfoSystem::XmppInfoPlugin > m_xmppInfoPlugin;
QVariantHash m_credentials;
+ bool m_credentialsLoading;
};
};
@@ -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();

0 comments on commit 3999a98

Please sign in to comment.