summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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
@@ -36,4 +36,6 @@
#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>
@@ -192,14 +194,16 @@ 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));
}
@@ -283,7 +287,9 @@ void RosterController::initBlockingCommand() {
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));
+ }
}
}
@@ -357,5 +363,5 @@ void RosterController::handleOnCapsChanged(const JID& jid) {
features.insert(ContactRosterItem::WhiteboardFeature);
}
- roster_->setAvailableFeatures(jid, features);
+ roster_->applyOnItems(SetAvailableFeatures(jid, features));
}
}