1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Get finally rid of our own copy of jdns.

This commit is contained in:
Dominik Schmidt
2011-05-24 13:01:47 +02:00
parent 39b9086d17
commit 7b9c3b8bb9
4 changed files with 0 additions and 104 deletions

View File

@@ -274,7 +274,6 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${INSTALL_PATH}\bin\tomahawk.exe" File "${INSTALL_PATH}\bin\tomahawk.exe"
File "${INSTALL_PATH}\lib\libqxtweb-standalone.dll" File "${INSTALL_PATH}\lib\libqxtweb-standalone.dll"
File "${INSTALL_PATH}\lib\libtomahawk_jdns.dll"
File "${INSTALL_PATH}\lib\libtomahawk_lastfm2.dll" File "${INSTALL_PATH}\lib\libtomahawk_lastfm2.dll"
File "${INSTALL_PATH}\lib\libtomahawklib.dll" File "${INSTALL_PATH}\lib\libtomahawklib.dll"
File "${INSTALL_PATH}\lib\libtomahawk_sipjabber.dll" File "${INSTALL_PATH}\lib\libtomahawk_sipjabber.dll"
@@ -287,7 +286,6 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${BUILD_PATH}\libtomahawklib.dll" File "${BUILD_PATH}\libtomahawklib.dll"
File "${BUILD_PATH}\libqxtweb-standalone.dll" File "${BUILD_PATH}\libqxtweb-standalone.dll"
File "${BUILD_PATH}\libtomahawk_jdns.dll"
File "${BUILD_PATH}\libtomahawk_portfwd.dll" File "${BUILD_PATH}\libtomahawk_portfwd.dll"
File "${BUILD_PATH}\libtomahawk_lastfm2.dll" File "${BUILD_PATH}\libtomahawk_lastfm2.dll"
File "${BUILD_PATH}\libtomahawk_sipjabber.dll" File "${BUILD_PATH}\libtomahawk_sipjabber.dll"

View File

@@ -361,9 +361,6 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
${LIBPORTFWD_INCLUDE_DIR} ${LIBPORTFWD_INCLUDE_DIR}
${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb ${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb
${THIRDPARTY_DIR}/jdns
${THIRDPARTY_DIR}/jdns/jdns
${THIRDPARTY_DIR}/jdns/jdnsshared
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src ${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
) )
@@ -418,9 +415,6 @@ SET( libSources ${libSources} ${libUI_H} ${libHeaders_NoMOC} )
add_library( tomahawklib SHARED ${libSources} ${libMoc} ) add_library( tomahawklib SHARED ${libSources} ${libMoc} )
target_link_libraries( tomahawklib target_link_libraries( tomahawklib
# Internal
tomahawk_jdns
# Thirdparty shipped with tomahawk # Thirdparty shipped with tomahawk
${LIBPORTFWD_LIBRARIES} ${LIBPORTFWD_LIBRARIES}

View File

@@ -38,9 +38,6 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
#include <qjdns.h>
#include <jdnsshared.h>
namespace TomahawkUtils namespace TomahawkUtils
{ {
@@ -378,68 +375,4 @@ setProxy( QNetworkProxy* proxy )
s_proxy->setCapabilities( QNetworkProxy::TunnelingCapability | QNetworkProxy::ListeningCapability | QNetworkProxy::UdpTunnelingCapability ); s_proxy->setCapabilities( QNetworkProxy::TunnelingCapability | QNetworkProxy::ListeningCapability | QNetworkProxy::UdpTunnelingCapability );
} }
///////////////// DNSResolver /////////////////
static DNSResolver* s_dnsResolver = 0;
DNSResolver*
dnsResolver()
{
if( !s_dnsResolver )
s_dnsResolver = new DNSResolver();
return s_dnsResolver;
}
DNSResolver::DNSResolver()
{
m_dnsShared = new JDnsShared(JDnsShared::UnicastInternet);
m_dnsShared->addInterface(QHostAddress::Any);
m_dnsShared->addInterface(QHostAddress::AnyIPv6);
m_dnsSharedRequest = new JDnsSharedRequest(m_dnsShared);
connect(m_dnsSharedRequest, SIGNAL(resultsReady()), SLOT(resultsReady()));
}
void
DNSResolver::resolve( QString &host, QString type )
{
if( type == "SRV" )
{
// For the moment, assume we are looking for XMPP...
QString fullHost( "_xmpp-client._tcp." + host );
qDebug() << "Looking up SRV record for" << fullHost.toUtf8();
m_dnsSharedRequest->query( fullHost.toUtf8(), QJDns::Srv );
}
else
{
QString badResult( "NONE" );
emit result( badResult );
}
}
void
DNSResolver::resultsReady()
{
if( m_dnsSharedRequest->success() )
{
QList<QJDns::Record> results = m_dnsSharedRequest->results();
foreach( QJDns::Record r, results )
{
qDebug() << "Found result (of some type):" << QString( r.name );
if( r.type == QJDns::Srv )
{
QString foundResult( r.name );
emit result( foundResult );
return;
}
}
}
qDebug() << "DNS resolve request was NOT successful! Error:" << (int)(m_dnsSharedRequest->error());
QString badResult( "NONE" );
emit result( badResult );
}
} // ns } // ns

View File

@@ -33,37 +33,8 @@ class QPixmap;
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkProxy; class QNetworkProxy;
class JDnsShared;
class JDnsSharedRequest;
namespace TomahawkUtils namespace TomahawkUtils
{ {
//NOTE: The JDnsShared system is supposed to allow you to make multiple requests
//at once, but either I'm a dumbass, or it's a broken paradigm, or both,
//because there's no way that I can see to tell what result is for what query.
//Be aware of this if ever we want to do parallel connections/lookups; turn it into
//a non-static non-singleton normal utility class then.
class DLLEXPORT DNSResolver : public QObject
{
Q_OBJECT
public:
explicit DNSResolver();
~DNSResolver() {}
void resolve( QString& host, QString type );
signals:
void result( QString& result );
public slots:
void resultsReady();
private:
JDnsShared* m_dnsShared;
JDnsSharedRequest* m_dnsSharedRequest;
};
class DLLEXPORT Sleep : public QThread class DLLEXPORT Sleep : public QThread
{ {
public: public: