mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 02:24:50 +02:00
Change gloox usage to non-blocking.
This commit is contained in:
committed by
Leo Franchi
parent
64b387daf0
commit
991269e5d9
@@ -75,7 +75,7 @@ FIND_PATH(CLUCENE_LIBRARY_DIR
|
|||||||
PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
|
PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
|
||||||
IF (CLUCENE_LIBRARY_DIR)
|
IF (CLUCENE_LIBRARY_DIR)
|
||||||
MESSAGE(STATUS "Found CLucene library dir: ${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}")
|
IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
|
||||||
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
|
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
|
||||||
SET(CLUCENE_GOOD_VERSION FALSE)
|
SET(CLUCENE_GOOD_VERSION FALSE)
|
||||||
|
@@ -148,12 +148,11 @@ Jabber_p::go()
|
|||||||
// Handle proxy
|
// Handle proxy
|
||||||
|
|
||||||
qDebug() << "Connecting to the XMPP server...";
|
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 ) )
|
if( m_client->connect( false ) )
|
||||||
{
|
{
|
||||||
qDebug() << "Connected to the XMPP server";
|
int sock = static_cast<ConnectionTCPClient*>( m_client->connectionImpl() )->socket();
|
||||||
emit connected();
|
notifier_.reset( new QSocketNotifier( sock, QSocketNotifier::Read ) );
|
||||||
QTimer::singleShot( 0, this, SLOT( doJabberRecv() ) );
|
connect( notifier_.data(), SIGNAL(activated(int)), SLOT(doJabberRecv()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
qDebug() << "Could not connect to the XMPP server!";
|
qDebug() << "Could not connect to the XMPP server!";
|
||||||
@@ -171,10 +170,6 @@ Jabber_p::doJabberRecv()
|
|||||||
{
|
{
|
||||||
qDebug() << "Jabber_p::Recv failed, disconnected";
|
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
|
void
|
||||||
Jabber_p::onConnect()
|
Jabber_p::onConnect()
|
||||||
{
|
{
|
||||||
|
qDebug() << "Connected to the XMPP server";
|
||||||
// update jid resource, servers like gtalk use resource binding and may
|
// update jid resource, servers like gtalk use resource binding and may
|
||||||
// have changed our requested /resource
|
// have changed our requested /resource
|
||||||
if ( m_client->resource() != m_jid.resource() )
|
if ( m_client->resource() != m_jid.resource() )
|
||||||
@@ -270,6 +266,7 @@ Jabber_p::onConnect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Connected as:" << m_jid.full().c_str();
|
qDebug() << "Connected as:" << m_jid.full().c_str();
|
||||||
|
emit connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -7,7 +7,9 @@
|
|||||||
#define JABBER_P_H
|
#define JABBER_P_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QScopedPointer>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
#include <QSocketNotifier>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
|
||||||
@@ -137,6 +139,7 @@ private:
|
|||||||
QMap<QString, gloox::Presence::PresenceType> m_peers;
|
QMap<QString, gloox::Presence::PresenceType> m_peers;
|
||||||
QSharedPointer<gloox::VCardManager> m_vcardManager;
|
QSharedPointer<gloox::VCardManager> m_vcardManager;
|
||||||
QString m_server;
|
QString m_server;
|
||||||
|
QScopedPointer<QSocketNotifier> notifier_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // JABBER_H
|
#endif // JABBER_H
|
||||||
|
Reference in New Issue
Block a user