summaryrefslogtreecommitdiffstats
path: root/dnssd/query.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-22 00:17:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-22 00:17:47 +0000
commit847c48556bc8f7c17bd201ced9381e2fbb2d5d09 (patch)
tree1e5e47d7dcb6e0de81a8ce9f0464ab88e2d8babe /dnssd/query.cpp
parentcfa3abbed0a36890d0c5a41fff2ef6c0f850de25 (diff)
downloadtdelibs-847c48556bc8f7c17bd201ced9381e2fbb2d5d09.tar.gz
tdelibs-847c48556bc8f7c17bd201ced9381e2fbb2d5d09.zip
Attempt to fix compilation when Avahi is not available
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1152784 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dnssd/query.cpp')
-rw-r--r--dnssd/query.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/dnssd/query.cpp b/dnssd/query.cpp
index 27b297816..cab14b6ad 100644
--- a/dnssd/query.cpp
+++ b/dnssd/query.cpp
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include "query.h"
+#include "query.h"
#include "responder.h"
#include "remoteservice.h"
#include "sdevent.h"
@@ -35,6 +35,7 @@
namespace DNSSD
{
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
void services_callback(AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* name,
@@ -49,10 +50,11 @@ void types_callback(AvahiServiceTypeBrowser*, AvahiIfIndex, AvahiProtocol, Avahi
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
void* context);
#endif
+#endif
enum BrowserType { Types, Services };
-class QueryPrivate
+class QueryPrivate
{
public:
QueryPrivate(const QString& type, const QString& domain) : m_finished(false), m_browser(0),
@@ -81,7 +83,7 @@ Query::~Query()
case Services: avahi_service_browser_free((AvahiServiceBrowser*)d->m_browser); break;
case Types: avahi_service_type_browser_free((AvahiServiceTypeBrowser*)d->m_browser); break;
}
- }
+ }
delete d;
}
@@ -106,6 +108,7 @@ void Query::startQuery()
d->m_finished = false;
if (d->m_type=="_services._dns-sd._udp") {
d->m_browserType = Types;
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
d->m_browser = avahi_service_type_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
domainToDNS(d->m_domain), (AvahiLookupFlags)0, types_callback, this);
@@ -113,8 +116,10 @@ void Query::startQuery()
d->m_browser = avahi_service_type_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
d->m_domain.utf8(), types_callback, this);
#endif
+#endif
} else {
d->m_browserType = Services;
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
d->m_browser = avahi_service_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
d->m_type.ascii(),domainToDNS(d->m_domain), (AvahiLookupFlags)0, services_callback,this);
@@ -122,6 +127,7 @@ void Query::startQuery()
d->m_browser = avahi_service_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
d->m_type.ascii(),d->m_domain.utf8(),services_callback,this);
#endif
+#endif
}
if (d->m_browser) {
d->m_running=true;
@@ -152,17 +158,18 @@ void Query::timeout()
emit finished();
}
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
-void services_callback (AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event,
+void services_callback (AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event,
const char* serviceName, const char* regtype, const char* replyDomain, AvahiLookupResultFlags, void* context)
#else
-void services_callback (AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event,
+void services_callback (AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event,
const char* serviceName, const char* regtype, const char* replyDomain, void* context)
#endif
{
QObject *obj = reinterpret_cast<QObject*>(context);
AddRemoveEvent* arev = new AddRemoveEvent((event==AVAHI_BROWSER_NEW) ? AddRemoveEvent::Add :
- AddRemoveEvent::Remove, QString::fromUtf8(serviceName), regtype,
+ AddRemoveEvent::Remove, QString::fromUtf8(serviceName), regtype,
DNSToDomain(replyDomain));
QApplication::postEvent(obj, arev);
}
@@ -177,10 +184,11 @@ void types_callback(AvahiServiceTypeBrowser*, AvahiIfIndex, AvahiProtocol, Avahi
{
QObject *obj = reinterpret_cast<QObject*>(context);
AddRemoveEvent* arev = new AddRemoveEvent((event==AVAHI_BROWSER_NEW) ? AddRemoveEvent::Add :
- AddRemoveEvent::Remove, QString::null, regtype,
+ AddRemoveEvent::Remove, QString::null, regtype,
DNSToDomain(replyDomain));
QApplication::postEvent(obj, arev);
}
+#endif
}
#include "query.moc"