diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-25 22:05:30 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-25 22:07:33 (GMT) |
commit | 2833b8f09c9aef09004662a2a89eefbaee1e4247 (patch) | |
tree | a63f528cffbe811707b581b87f3cef855bc69635 /Swiften/LinkLocal | |
parent | 2b749bb5665adf893188faec1c299e23dd9c6c9f (diff) | |
download | swift-2833b8f09c9aef09004662a2a89eefbaee1e4247.zip swift-2833b8f09c9aef09004662a2a89eefbaee1e4247.tar.bz2 |
Implement LinkLocalService.
Diffstat (limited to 'Swiften/LinkLocal')
-rw-r--r-- | Swiften/LinkLocal/LinkLocalService.h | 6 | ||||
-rw-r--r-- | Swiften/LinkLocal/LinkLocalServiceBrowser.cpp | 8 | ||||
-rw-r--r-- | Swiften/LinkLocal/LinkLocalServiceBrowser.h | 5 |
3 files changed, 6 insertions, 13 deletions
diff --git a/Swiften/LinkLocal/LinkLocalService.h b/Swiften/LinkLocal/LinkLocalService.h index 2c62307..0c675a3 100644 --- a/Swiften/LinkLocal/LinkLocalService.h +++ b/Swiften/LinkLocal/LinkLocalService.h @@ -1,8 +1,8 @@ #pragma once #include "Swiften/Base/String.h" -#include "Swiften/Network/HostAddress.h" #include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h" +#include "Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h" #include "Swiften/LinkLocal/LinkLocalServiceInfo.h" namespace Swift { @@ -10,7 +10,7 @@ namespace Swift { public: LinkLocalService( const DNSSDServiceID& id, - const DNSSDService::ResolveResult& info) : + const DNSSDResolveServiceQuery::Result& info) : id(id), info(info) {} @@ -36,6 +36,6 @@ namespace Swift { private: DNSSDServiceID id; - DNSSDService::ResolveResult info; + DNSSDResolveServiceQuery::Result info; }; } diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp index 6634a0a..4e9c2de 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp @@ -20,7 +20,6 @@ LinkLocalServiceBrowser::~LinkLocalServiceBrowser() { browseQuery->stopBrowsing(); } -/* std::vector<LinkLocalService> LinkLocalServiceBrowser::getServices() const { std::vector<LinkLocalService> result; for (ServiceMap::const_iterator i = services.begin(); i != services.end(); ++i) { @@ -28,7 +27,6 @@ std::vector<LinkLocalService> LinkLocalServiceBrowser::getServices() const { } return result; } -*/ void LinkLocalServiceBrowser::handleServiceAdded(const DNSSDServiceID& service) { boost::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(service); @@ -50,11 +48,7 @@ void LinkLocalServiceBrowser::handleServiceRemoved(const DNSSDServiceID& service } void LinkLocalServiceBrowser::handleServiceResolved(const DNSSDServiceID& service, const boost::optional<DNSSDResolveServiceQuery::Result>& result) { - if (!result) { - // TODO - std::cerr << "Error resolving" << std::endl; - } - else { + if (result) { std::pair<ServiceMap::iterator, bool> r = services.insert(std::make_pair(service, *result)); if (r.second) { onServiceAdded(service); diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.h b/Swiften/LinkLocal/LinkLocalServiceBrowser.h index 5bd9bf0..7ec796a 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.h +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.h @@ -10,16 +10,15 @@ #include "Swiften/LinkLocal/DNSSD/DNSSDQuerier.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDServiceID.h" +#include "Swiften/LinkLocal/LinkLocalService.h" namespace Swift { - //class HostAddress; - class LinkLocalServiceBrowser { public: LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> querier); ~LinkLocalServiceBrowser(); - /*std::vector<LinkLocalService> getServices() const;*/ + std::vector<LinkLocalService> getServices() const; boost::signal<void (const DNSSDServiceID&)> onServiceAdded; boost::signal<void (const DNSSDServiceID&)> onServiceChanged; |