summaryrefslogtreecommitdiffstats
path: root/dnssd/responder.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/responder.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/responder.cpp')
-rw-r--r--dnssd/responder.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/dnssd/responder.cpp b/dnssd/responder.cpp
index 43be68b28..ae9182a30 100644
--- a/dnssd/responder.cpp
+++ b/dnssd/responder.cpp
@@ -33,16 +33,19 @@ namespace DNSSD
static KStaticDeleter<Responder> responder_sd;
Responder* Responder::m_self = 0;
-void client_callback(AvahiClient *, AvahiClientState s, void* u)
+#ifdef HAVE_DNSSD
+void client_callback(AvahiClient *, AvahiClientState s, void* u)
{
- Responder *r = reinterpret_cast<Responder*>(u);
+ Responder *r = reinterpret_cast<Responder*>(u);
emit (r->stateChanged(s));
}
+#endif
Responder::Responder()
{
int error;
+#ifdef HAVE_DNSSD
const AvahiPoll* poll = avahi_qt_poll_get();
#ifdef AVAHI_API_0_6
m_client = avahi_client_new(poll, AVAHI_CLIENT_IGNORE_USER_CONFIG,client_callback, this, &error);
@@ -50,11 +53,14 @@ Responder::Responder()
m_client = avahi_client_new(poll, client_callback, this, &error);
#endif
if (!m_client) kdWarning() << "Failed to create avahi client" << endl;
+#endif
}
-
+
Responder::~Responder()
{
+#ifdef HAVE_DNSSD
if (m_client) avahi_client_free(m_client);
+#endif
}
Responder& Responder::self()
@@ -68,6 +74,7 @@ void Responder::process()
qApp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
}
+#ifdef HAVE_DNSSD
AvahiClientState Responder::state() const
{
#ifdef AVAHI_API_0_6
@@ -76,6 +83,7 @@ AvahiClientState Responder::state() const
return (m_client) ? (avahi_client_get_state(m_client)) : AVAHI_CLIENT_DISCONNECTED;
#endif
}
+#endif
bool domainIsLocal(const QString& domain)
{