summaryrefslogtreecommitdiffstats
path: root/dnssd/remoteservice.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/remoteservice.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/remoteservice.cpp')
-rw-r--r--dnssd/remoteservice.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/dnssd/remoteservice.cpp b/dnssd/remoteservice.cpp
index 9fa1a3fe2..8205aea00 100644
--- a/dnssd/remoteservice.cpp
+++ b/dnssd/remoteservice.cpp
@@ -38,6 +38,7 @@
namespace DNSSD
{
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol proto, AvahiResolverEvent e,
const char* name, const char* type, const char* domain, const char* hostname, const AvahiAddress* a,
@@ -47,6 +48,7 @@ void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol proto,
const char* name, const char* type, const char* domain, const char* hostname, const AvahiAddress* a,
uint16_t port, AvahiStringList* txt, void* context);
#endif
+#endif
class RemoteServicePrivate : public Responder
{
@@ -106,6 +108,7 @@ void RemoteService::resolveAsync()
if (d->m_running) return;
d->m_resolved = false;
// FIXME: first protocol should be set?
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
d->m_resolver = avahi_service_resolver_new(Responder::self().client(),AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
m_serviceName.utf8(), m_type.ascii(), domainToDNS(m_domain), AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_NO_ADDRESS,
@@ -114,6 +117,7 @@ void RemoteService::resolveAsync()
d->m_resolver = avahi_service_resolver_new(Responder::self().client(),AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
m_serviceName.utf8(), m_type.ascii(), m_domain.utf8(), AVAHI_PROTO_UNSPEC, resolve_callback, this);
#endif
+#endif
if (d->m_resolver) d->m_running=true;
else emit resolved(false);
}
@@ -160,10 +164,11 @@ QDataStream & operator>> (QDataStream & s, RemoteService & a)
Q_INT8 resolved;
operator>>(s,(static_cast<ServiceBase&>(a)));
s >> resolved;
- a.d->m_resolved = (resolved == 1);
+ a.d->m_resolved = (resolved == 1);
return s;
}
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol, AvahiResolverEvent e,
const char*, const char*, const char*, const char* hostname, const AvahiAddress*,
@@ -177,7 +182,7 @@ void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol, AvahiR
QObject *obj = reinterpret_cast<QObject*>(context);
if (e != AVAHI_RESOLVER_FOUND) {
ErrorEvent err;
- QApplication::sendEvent(obj, &err);
+ QApplication::sendEvent(obj, &err);
return;
}
QMap<QString,QString> map;
@@ -191,6 +196,7 @@ void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol, AvahiR
ResolveEvent rev(DNSToDomain(hostname),port,map);
QApplication::sendEvent(obj, &rev);
}
+#endif
}