summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-11-18 22:41:22 (GMT)
committerSwift Review <review@swift.im>2013-12-08 20:34:06 (GMT)
commit2b6b227ef4ae0e68709d8ad327260cb8f609909c (patch)
tree654083e0381d93b99f4627de5ecbdbe496b3bba1 /Swift/Controllers/Roster/SetAvailableFeatures.h
parentacd19fa05d8a7fa2ebac9d6534ee203368f1a3e9 (diff)
downloadswift-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/SetAvailableFeatures.h')
-rw-r--r--Swift/Controllers/Roster/SetAvailableFeatures.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/Swift/Controllers/Roster/SetAvailableFeatures.h b/Swift/Controllers/Roster/SetAvailableFeatures.h
new file mode 100644
index 0000000..f7e00d0
--- /dev/null
+++ b/Swift/Controllers/Roster/SetAvailableFeatures.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 SetAvailableFeatures : public RosterItemOperation {
+ public:
+ SetAvailableFeatures(const JID& jid, const std::set<ContactRosterItem::Feature>& availableFeatures, JID::CompareType compareType = JID::WithoutResource) : RosterItemOperation(true, jid), jid_(jid), availableFeatures_(availableFeatures), compareType_(compareType) {
+ }
+
+ virtual void operator() (RosterItem* item) const {
+ ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item);
+ if (contact && contact->getJID().equals(jid_, compareType_)) {
+ contact->setSupportedFeatures(availableFeatures_);
+ }
+ }
+
+ private:
+ JID jid_;
+ std::set<ContactRosterItem::Feature> availableFeatures_;
+ JID::CompareType compareType_;
+};
+
+}