summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-07-14 14:53:35 (GMT)
committerSwift Review <review@swift.im>2014-07-29 06:26:04 (GMT)
commit170e408e18579ceac6520a404ad945fcda404248 (patch)
tree0c9864919b85cea99207dcbb9706508618d9f671
parent9403679b404852edfc0509026da7d5c131d21c38 (diff)
downloadswift-contrib-170e408e18579ceac6520a404ad945fcda404248.zip
swift-contrib-170e408e18579ceac6520a404ad945fcda404248.tar.bz2
Fix renaming contact group makes blocked user appear to be unblocked.
Test-Information: Block a user and rename the group then verify that the user still appears as blocked in the roster. Try renaming a group with several users in various states of blocked and unblocked and verify that the states are preserved after renaming. Change-Id: I93ff721b053f299d5f1c3f62dd8687f021701fe1
-rw-r--r--Swift/Controllers/Roster/RosterController.cpp16
-rw-r--r--Swift/Controllers/Roster/RosterController.h1
2 files changed, 16 insertions, 1 deletions
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp
index ecca9fe..e823a1c 100644
--- a/Swift/Controllers/Roster/RosterController.cpp
+++ b/Swift/Controllers/Roster/RosterController.cpp
@@ -282,7 +282,7 @@ void RosterController::updateItem(const XMPPRosterItem& item) {
roster->addItem(itemPayload);
SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
- request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
+ request->onResponse.connect(boost::bind(&RosterController::handleRosterItemUpdated, this, _1, roster));
request->send();
}
@@ -300,6 +300,20 @@ void RosterController::initBlockingCommand() {
}
}
+void RosterController::handleRosterItemUpdated(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload) {
+ if (!!error) {
+ handleRosterSetError(error, rosterPayload);
+ }
+ boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList();
+ std::vector<RosterItemPayload> items = rosterPayload->getItems();
+ if (blockList->getState() == BlockList::Available && items.size() > 0) {
+ std::vector<JID> jids = blockList->getItems();
+ if (std::find(jids.begin(), jids.end(), items[0].getJID()) != jids.end()) {
+ roster_->applyOnItems(SetBlockingState(items[0].getJID(), ContactRosterItem::IsBlocked));
+ }
+ }
+}
+
void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload) {
if (!error) {
return;
diff --git a/Swift/Controllers/Roster/RosterController.h b/Swift/Controllers/Roster/RosterController.h
index d0c7024..3338d7f 100644
--- a/Swift/Controllers/Roster/RosterController.h
+++ b/Swift/Controllers/Roster/RosterController.h
@@ -80,6 +80,7 @@ namespace Swift {
void handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event);
void handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event);
void handleUIEvent(boost::shared_ptr<UIEvent> event);
+ void handleRosterItemUpdated(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload);
void handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload);
void applyAllPresenceTo(const JID& jid);
void handleEditProfileRequest();