diff options
Diffstat (limited to 'Swiften/Roster')
-rw-r--r-- | Swiften/Roster/XMPPRosterController.cpp | 7 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRosterImpl.cpp | 8 |
2 files changed, 6 insertions, 9 deletions
diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp index 57b0645..8ee9755 100644 --- a/Swiften/Roster/XMPPRosterController.cpp +++ b/Swiften/Roster/XMPPRosterController.cpp @@ -9,7 +9,6 @@ #include <boost/bind.hpp> #include <Swiften/Base/Log.h> -#include <Swiften/Base/foreach.h> #include <Swiften/Elements/RosterItemPayload.h> #include <Swiften/Queries/IQRouter.h> #include <Swiften/Roster/GetRosterRequest.h> @@ -51,7 +50,7 @@ void XMPPRosterController::requestRoster() { void XMPPRosterController::handleRosterReceived(std::shared_ptr<RosterPayload> rosterPayload, bool initial, std::shared_ptr<RosterPayload> previousRoster) { if (rosterPayload) { - foreach(const RosterItemPayload& item, rosterPayload->getItems()) { + for (const auto& item : rosterPayload->getItems()) { //Don't worry about the updated case, the XMPPRoster sorts that out. if (item.getSubscription() == RosterItemPayload::Remove) { xmppRoster_->removeContact(item.getJID()); @@ -62,7 +61,7 @@ void XMPPRosterController::handleRosterReceived(std::shared_ptr<RosterPayload> r } else if (previousRoster) { // The cached version hasn't changed; emit all items - foreach(const RosterItemPayload& item, previousRoster->getItems()) { + for (const auto& item : previousRoster->getItems()) { if (item.getSubscription() != RosterItemPayload::Remove) { xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups(), item.getSubscription()); } @@ -83,7 +82,7 @@ void XMPPRosterController::saveRoster(const std::string& version) { std::vector<XMPPRosterItem> items = xmppRoster_->getItems(); std::shared_ptr<RosterPayload> roster(new RosterPayload()); roster->setVersion(version); - foreach(const XMPPRosterItem& item, items) { + for (const auto& item : items) { roster->addItem(RosterItemPayload(item.getJID(), item.getName(), item.getSubscription(), item.getGroups())); } rosterStorage_->setRoster(roster); diff --git a/Swiften/Roster/XMPPRosterImpl.cpp b/Swiften/Roster/XMPPRosterImpl.cpp index 9a2ea7a..74f634f 100644 --- a/Swiften/Roster/XMPPRosterImpl.cpp +++ b/Swiften/Roster/XMPPRosterImpl.cpp @@ -1,13 +1,11 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Roster/XMPPRosterImpl.h> -#include <Swiften/Base/foreach.h> - namespace Swift { XMPPRosterImpl::XMPPRosterImpl() { @@ -78,7 +76,7 @@ RosterItemPayload::Subscription XMPPRosterImpl::getSubscriptionStateForJID(const std::vector<XMPPRosterItem> XMPPRosterImpl::getItems() const { std::vector<XMPPRosterItem> result; - foreach(const RosterMap::value_type& entry, entries_) { + for (const auto& entry : entries_) { result.push_back(entry.second); } return result; @@ -96,7 +94,7 @@ boost::optional<XMPPRosterItem> XMPPRosterImpl::getItem(const JID& jid) const { std::set<std::string> XMPPRosterImpl::getGroups() const { std::set<std::string> result; - foreach(const RosterMap::value_type& entry, entries_) { + for (const auto& entry : entries_) { std::vector<std::string> groups = entry.second.getGroups(); result.insert(groups.begin(), groups.end()); } |