summaryrefslogtreecommitdiffstats
path: root/dnssd/servicebrowser.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/servicebrowser.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/servicebrowser.cpp')
-rw-r--r--dnssd/servicebrowser.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/dnssd/servicebrowser.cpp b/dnssd/servicebrowser.cpp
index 542580c1b..20e1b11e0 100644
--- a/dnssd/servicebrowser.cpp
+++ b/dnssd/servicebrowser.cpp
@@ -26,7 +26,9 @@
#include "responder.h"
#include "query.h"
#include "servicebrowser.h"
+#ifdef HAVE_DNSSD
#include <avahi-client/client.h>
+#endif
#include <config.h>
namespace DNSSD
@@ -34,10 +36,10 @@ namespace DNSSD
const QString ServiceBrowser::AllServices = "_services._dns-sd._udp";
-class ServiceBrowserPrivate
+class ServiceBrowserPrivate
{
-public:
- ServiceBrowserPrivate() : m_running(false)
+public:
+ ServiceBrowserPrivate() : m_running(false)
{}
QValueList<RemoteService::Ptr> m_services;
QValueList<RemoteService::Ptr> m_duringResolve;
@@ -82,12 +84,16 @@ ServiceBrowser::ServiceBrowser(const QString& type,const QString& domain,int fla
const ServiceBrowser::State ServiceBrowser::isAvailable()
{
+#ifdef HAVE_DNSSD
AvahiClientState s = Responder::self().state();
#ifdef AVAHI_API_0_6
return (s==AVAHI_CLIENT_FAILURE) ? Stopped : Working;
#else
return (s==AVAHI_CLIENT_S_INVALID || s==AVAHI_CLIENT_DISCONNECTED) ? Stopped : Working;
-#endif
+#endif
+#else
+ return Unsupported;
+#endif
}
ServiceBrowser::~ ServiceBrowser()
{
@@ -158,7 +164,7 @@ void ServiceBrowser::removeDomain(const QString& domain)
{
while (d->resolvers[domain]) d->resolvers.remove(domain);
QValueList<RemoteService::Ptr>::Iterator it = d->m_services.begin();
- while (it!=d->m_services.end())
+ while (it!=d->m_services.end())
// use section to skip possible trailing dot
if ((*it)->domain().section('.',0) == domain.section('.',0)) {
emit serviceRemoved(*it);
@@ -209,7 +215,7 @@ void ServiceBrowser::virtual_hook(int, void*)
QValueList<RemoteService::Ptr>::Iterator ServiceBrowser::findDuplicate(RemoteService::Ptr src)
{
QValueList<RemoteService::Ptr>::Iterator itEnd = d->m_services.end();
- for (QValueList<RemoteService::Ptr>::Iterator it = d->m_services.begin(); it!=itEnd; ++it)
+ for (QValueList<RemoteService::Ptr>::Iterator it = d->m_services.begin(); it!=itEnd; ++it)
if ((src->type()==(*it)->type()) && (src->serviceName()==(*it)->serviceName()) &&
(src->domain() == (*it)->domain())) return it;
return itEnd;