diff options
Diffstat (limited to 'Swift/Controllers/Roster/ItemOperations')
-rw-r--r-- | Swift/Controllers/Roster/ItemOperations/SetBlockingState.h | 15 |
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_); + } } } |