summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-18 19:04:32 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-18 20:40:56 (GMT)
commit4457bc810a326de8d7895b3f2ff36ade5f1ae1a0 (patch)
tree1556c4b0190453897d4799d23b05e651b0bb8a32 /Swiften/LinkLocal/LinkLocalRoster.cpp
parent4052a822acd9da9dab6a8e2343c6170fb08dd8d6 (diff)
downloadswift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.zip
swift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.tar.bz2
Implement incoming linklocal connections.
Diffstat (limited to 'Swiften/LinkLocal/LinkLocalRoster.cpp')
-rw-r--r--Swiften/LinkLocal/LinkLocalRoster.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/Swiften/LinkLocal/LinkLocalRoster.cpp b/Swiften/LinkLocal/LinkLocalRoster.cpp
index 89bfa55..6809377 100644
--- a/Swiften/LinkLocal/LinkLocalRoster.cpp
+++ b/Swiften/LinkLocal/LinkLocalRoster.cpp
@@ -77,6 +77,7 @@ void LinkLocalRoster::handleServiceAdded(const DNSSDService::Service& service) {
if (selfService && *selfService == service) {
return;
}
+ std::cout << "Service added: " << service.name << std::endl;
dnsSDService->startResolvingService(service);
}
@@ -93,7 +94,7 @@ void LinkLocalRoster::handleServiceRemoved(const DNSSDService::Service& service)
void LinkLocalRoster::handleServiceResolved(const DNSSDService::Service& service, const DNSSDService::ResolveResult& result) {
services.insert(std::make_pair(service, result));
- dnsSDService->resolveHostname(result.host);
+ std::cout << "Service resolved: " << service.name << std::endl;
boost::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->addItem(getRosterItem(service, result));
@@ -109,4 +110,22 @@ void LinkLocalRoster::handleStopped(bool error) {
std::cout << "DNSSDService stopped: " << error << std::endl;
}
+bool LinkLocalRoster::hasItem(const JID& j) const {
+ for(ServiceMap::const_iterator i = services.begin(); i != services.end(); ++i) {
+ if (getJIDForService(i->first) == j) {
+ return true;
+ }
+ }
+ return false;
+}
+
+String LinkLocalRoster::getHostname(const JID& j) const {
+ for(ServiceMap::const_iterator i = services.begin(); i != services.end(); ++i) {
+ if (getJIDForService(i->first) == j) {
+ return i->second.host;
+ }
+ }
+ return "";
+}
+
}