summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-08-01 10:07:16 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-08-01 10:22:55 (GMT)
commit5a15e4df671aac30bba332801528a6283c2e4874 (patch)
tree8668089b7b9db89451b8b06ba7be29056a805f53 /Slimber/LinkLocalPresenceManager.cpp
parent336aa7d1c0a5aa223a6543d50ee17d82560c2b84 (diff)
downloadswift-5a15e4df671aac30bba332801528a6283c2e4874.zip
swift-5a15e4df671aac30bba332801528a6283c2e4874.tar.bz2
Made Slimber fully functional again.
Diffstat (limited to 'Slimber/LinkLocalPresenceManager.cpp')
-rw-r--r--Slimber/LinkLocalPresenceManager.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/Slimber/LinkLocalPresenceManager.cpp b/Slimber/LinkLocalPresenceManager.cpp
index b964786..d5834c7 100644
--- a/Slimber/LinkLocalPresenceManager.cpp
+++ b/Slimber/LinkLocalPresenceManager.cpp
@@ -18,6 +18,15 @@ LinkLocalPresenceManager::LinkLocalPresenceManager(LinkLocalServiceBrowser* brow
boost::bind(&LinkLocalPresenceManager::handleServiceRemoved, this, _1));
}
+boost::optional<LinkLocalService> LinkLocalPresenceManager::getServiceForJID(const JID& j) const {
+ foreach(const LinkLocalService& service, browser->getServices()) {
+ if (service.getJID() == j) {
+ return service;
+ }
+ }
+ return boost::optional<LinkLocalService>();
+}
+
void LinkLocalPresenceManager::handleServiceAdded(const LinkLocalService& service) {
boost::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->addItem(getRosterItem(service));
@@ -31,7 +40,7 @@ void LinkLocalPresenceManager::handleServiceChanged(const LinkLocalService& serv
void LinkLocalPresenceManager::handleServiceRemoved(const LinkLocalService& service) {
boost::shared_ptr<RosterPayload> roster(new RosterPayload());
- roster->addItem(RosterItemPayload(getJIDForService(service), "", RosterItemPayload::Remove));
+ roster->addItem(RosterItemPayload(service.getJID(), "", RosterItemPayload::Remove));
onRosterChanged(roster);
}
@@ -52,7 +61,7 @@ std::vector<boost::shared_ptr<Presence> > LinkLocalPresenceManager::getAllPresen
}
RosterItemPayload LinkLocalPresenceManager::getRosterItem(const LinkLocalService& service) const {
- return RosterItemPayload(getJIDForService(service), getRosterName(service), RosterItemPayload::Both);
+ return RosterItemPayload(service.getJID(), getRosterName(service), RosterItemPayload::Both);
}
String LinkLocalPresenceManager::getRosterName(const LinkLocalService& service) const {
@@ -73,13 +82,9 @@ String LinkLocalPresenceManager::getRosterName(const LinkLocalService& service)
return "";
}
-JID LinkLocalPresenceManager::getJIDForService(const LinkLocalService& service) const {
- return JID(service.getName());
-}
-
boost::shared_ptr<Presence> LinkLocalPresenceManager::getPresence(const LinkLocalService& service) const {
boost::shared_ptr<Presence> presence(new Presence());
- presence->setFrom(getJIDForService(service));
+ presence->setFrom(service.getJID());
switch (service.getInfo().getStatus()) {
case LinkLocalServiceInfo::Available:
presence->setShow(StatusShow::Online);