diff options
author | Tobias Markmann <tm@ayena.de> | 2013-11-18 22:41:22 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-12-08 20:34:06 (GMT) |
commit | 2b6b227ef4ae0e68709d8ad327260cb8f609909c (patch) | |
tree | 654083e0381d93b99f4627de5ecbdbe496b3bba1 /Swift/Controllers/Roster/SetBlockingState.h | |
parent | acd19fa05d8a7fa2ebac9d6534ee203368f1a3e9 (diff) | |
download | swift-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/SetBlockingState.h')
-rw-r--r-- | Swift/Controllers/Roster/SetBlockingState.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Swift/Controllers/Roster/SetBlockingState.h b/Swift/Controllers/Roster/SetBlockingState.h new file mode 100644 index 0000000..72fd2e5 --- /dev/null +++ b/Swift/Controllers/Roster/SetBlockingState.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/JID/JID.h> + +#include <Swift/Controllers/Roster/RosterItemOperation.h> +#include <Swift/Controllers/Roster/ContactRosterItem.h> + +namespace Swift { + +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) { + } + + virtual void operator() (RosterItem* item) const { + ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item); + if (contact && contact->getJID().equals(jid_, compareType_)) { + contact->setBlockState(state_); + } + } + + private: + JID jid_; + ContactRosterItem::BlockState state_; + JID::CompareType compareType_; +}; + +} |