summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-11-25 14:46:38 (GMT)
committerSwift Review <review@swift.im>2013-12-08 20:34:36 (GMT)
commit71dfdf25df27af0744e5d5ad2251397fa2bf48e5 (patch)
tree9bf6738621fcf42637c3bbcf46b3d04f88e658ba /Swift/Controllers/Roster/ItemOperations
parenta0aab4b82562d58b0f1d97d42d85ba7043615f55 (diff)
downloadswift-71dfdf25df27af0744e5d5ad2251397fa2bf48e5.zip
swift-71dfdf25df27af0744e5d5ad2251397fa2bf48e5.tar.bz2
Enable domain-wise (un-)blocking.
Change-Id: I88611bead558ccb58bec8d55372f847479e745ff License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/Roster/ItemOperations')
-rw-r--r--Swift/Controllers/Roster/ItemOperations/SetBlockingState.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/Swift/Controllers/Roster/ItemOperations/SetBlockingState.h b/Swift/Controllers/Roster/ItemOperations/SetBlockingState.h
index a8eea09..ddb2c7a 100644
--- a/Swift/Controllers/Roster/ItemOperations/SetBlockingState.h
+++ b/Swift/Controllers/Roster/ItemOperations/SetBlockingState.h
@@ -17,13 +17,22 @@ class RosterItem;
class SetBlockingState : public RosterItemOperation {
public:
- SetBlockingState(const JID& jid, ContactRosterItem::BlockState state, JID::CompareType compareType = JID::WithoutResource) : RosterItemOperation(true, jid), jid_(jid), state_(state), compareType_(compareType) {
+ SetBlockingState(const JID& jid, ContactRosterItem::BlockState state, JID::CompareType compareType = JID::WithoutResource) : RosterItemOperation(!jid.getNode().empty(), jid), jid_(jid), state_(state), compareType_(compareType) {
+ if (state_ == ContactRosterItem::IsBlocked && jid.getNode().empty()) {
+ state_ = ContactRosterItem::IsDomainBlocked;
+ }
}
virtual void operator() (RosterItem* item) const {
ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item);
- if (contact && contact->getJID().equals(jid_, compareType_)) {
- contact->setBlockState(state_);
+ if (jid_.getNode().empty()) {
+ if (contact && contact->getJID().getDomain() == jid_.getDomain()) {
+ contact->setBlockState(state_);
+ }
+ } else {
+ if (contact && contact->getJID().equals(jid_, compareType_)) {
+ contact->setBlockState(state_);
+ }
}
}