summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-11-18 22:41:22 (GMT)
committerSwift Review <review@swift.im>2013-12-08 20:34:06 (GMT)
commit2b6b227ef4ae0e68709d8ad327260cb8f609909c (patch)
tree654083e0381d93b99f4627de5ecbdbe496b3bba1 /Swift/Controllers/Roster/RosterController.cpp
parentacd19fa05d8a7fa2ebac9d6534ee203368f1a3e9 (diff)
downloadswift-2b6b227ef4ae0e68709d8ad327260cb8f609909c.zip
swift-2b6b227ef4ae0e68709d8ad327260cb8f609909c.tar.bz2
Convert Roster::setAvailableFeatures() and Roster::setBlockedState() to RosterItemOperations.
Change-Id: I67943bd50ca9eb4ae53e1acefbea1c7b67684cc9 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/Roster/RosterController.cpp')
-rw-r--r--Swift/Controllers/Roster/RosterController.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp
index fd0dbb8..cb6d4d2 100644
--- a/Swift/Controllers/Roster/RosterController.cpp
+++ b/Swift/Controllers/Roster/RosterController.cpp
@@ -35,6 +35,8 @@
#include <Swift/Controllers/Roster/Roster.h>
#include <Swift/Controllers/Roster/RosterVCardProvider.h>
#include <Swift/Controllers/Roster/SetAvatar.h>
+#include <Swift/Controllers/Roster/SetAvailableFeatures.h>
+#include <Swift/Controllers/Roster/SetBlockingState.h>
#include <Swift/Controllers/Roster/SetName.h>
#include <Swift/Controllers/Roster/SetPresence.h>
#include <Swift/Controllers/Roster/SetVCard.h>
@@ -191,16 +193,18 @@ void RosterController::handleSettingChanged(const std::string& settingPath) {
void RosterController::handleBlockingStateChanged() {
if (clientBlockListManager_->getBlockList()->getState() == BlockList::Available) {
- roster_->setBlockedState(clientBlockListManager_->getBlockList()->getItems(), ContactRosterItem::IsBlocked);
+ foreach(const JID& jid, clientBlockListManager_->getBlockList()->getItems()) {
+ roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsBlocked));
+ }
}
}
void RosterController::handleBlockingItemAdded(const JID& jid) {
- roster_->setBlockedState(std::vector<JID>(1, jid), ContactRosterItem::IsBlocked);
+ roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsBlocked));
}
void RosterController::handleBlockingItemRemoved(const JID& jid) {
- roster_->setBlockedState(std::vector<JID>(1, jid), ContactRosterItem::IsUnblocked);
+ roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsUnblocked));
}
void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
@@ -282,9 +286,11 @@ void RosterController::initBlockingCommand() {
blockingOnStateChangedConnection_ = blockList->onStateChanged.connect(boost::bind(&RosterController::handleBlockingStateChanged, this));
blockingOnItemAddedConnection_ = blockList->onItemAdded.connect(boost::bind(&RosterController::handleBlockingItemAdded, this, _1));
blockingOnItemRemovedConnection_ = blockList->onItemRemoved.connect(boost::bind(&RosterController::handleBlockingItemRemoved, this, _1));
-
+ roster_->setBlockingSupported(true);
if (blockList->getState() == BlockList::Available) {
- roster_->setBlockedState(blockList->getItems(), ContactRosterItem::IsBlocked);
+ foreach(const JID& jid, blockList->getItems()) {
+ roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsBlocked));
+ }
}
}
@@ -356,7 +362,7 @@ void RosterController::handleOnCapsChanged(const JID& jid) {
if (info->hasFeature(DiscoInfo::WhiteboardFeature)) {
features.insert(ContactRosterItem::WhiteboardFeature);
}
- roster_->setAvailableFeatures(jid, features);
+ roster_->applyOnItems(SetAvailableFeatures(jid, features));
}
}