1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 09:34:53 +02:00

Change gloox usage to non-blocking.

This commit is contained in:
John Maguire
2011-03-11 22:12:00 +01:00
committed by Leo Franchi
parent 64b387daf0
commit 991269e5d9
3 changed files with 9 additions and 9 deletions

View File

@@ -75,7 +75,7 @@ FIND_PATH(CLUCENE_LIBRARY_DIR
PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
IF (CLUCENE_LIBRARY_DIR)
MESSAGE(STATUS "Found CLucene library dir: ${CLUCENE_LIBRARY_DIR}")
INCLUDE(${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
#INCLUDE(${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
SET(CLUCENE_GOOD_VERSION FALSE)

View File

@@ -148,12 +148,11 @@ Jabber_p::go()
// Handle proxy
qDebug() << "Connecting to the XMPP server...";
//FIXME: This call blocks and locks up the whole GUI if the network is down
if( m_client->connect( false ) )
{
qDebug() << "Connected to the XMPP server";
emit connected();
QTimer::singleShot( 0, this, SLOT( doJabberRecv() ) );
int sock = static_cast<ConnectionTCPClient*>( m_client->connectionImpl() )->socket();
notifier_.reset( new QSocketNotifier( sock, QSocketNotifier::Read ) );
connect( notifier_.data(), SIGNAL(activated(int)), SLOT(doJabberRecv()));
}
else
qDebug() << "Could not connect to the XMPP server!";
@@ -171,10 +170,6 @@ Jabber_p::doJabberRecv()
{
qDebug() << "Jabber_p::Recv failed, disconnected";
}
else
{
QTimer::singleShot( 100, this, SLOT( doJabberRecv() ) );
}
}
@@ -260,6 +255,7 @@ Jabber_p::addContact( const QString& jid, const QString& msg )
void
Jabber_p::onConnect()
{
qDebug() << "Connected to the XMPP server";
// update jid resource, servers like gtalk use resource binding and may
// have changed our requested /resource
if ( m_client->resource() != m_jid.resource() )
@@ -270,6 +266,7 @@ Jabber_p::onConnect()
}
qDebug() << "Connected as:" << m_jid.full().c_str();
emit connected();
}

View File

@@ -7,7 +7,9 @@
#define JABBER_P_H
#include <QObject>
#include <QScopedPointer>
#include <QSharedPointer>
#include <QSocketNotifier>
#include <QMap>
#include <QNetworkProxy>
@@ -137,6 +139,7 @@ private:
QMap<QString, gloox::Presence::PresenceType> m_peers;
QSharedPointer<gloox::VCardManager> m_vcardManager;
QString m_server;
QScopedPointer<QSocketNotifier> notifier_;
};
#endif // JABBER_H