aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppPubSubManager.cpp
diff options
context:
space:
mode:
authorMelvin Keskin <melvo@olomono.de>2022-04-07 17:35:08 +0200
committerLinus Jahn <lnj@kaidan.im>2022-04-09 22:27:06 +0200
commit70a64f0d897413466777ef58e4bc9c93fceda0e6 (patch)
tree94e41cbab4ca7498c33fd0f9ac5a600f6f921d40 /src/client/QXmppPubSubManager.cpp
parent0c74602895d6f55fc73aee199a1009b3226d0949 (diff)
downloadqxmpp-70a64f0d897413466777ef58e4bc9c93fceda0e6.tar.gz
PubSubManager: requestItem: Add StandardItemId enum for 'current'
Diffstat (limited to 'src/client/QXmppPubSubManager.cpp')
-rw-r--r--src/client/QXmppPubSubManager.cpp43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/client/QXmppPubSubManager.cpp b/src/client/QXmppPubSubManager.cpp
index f00f9d20..fe265061 100644
--- a/src/client/QXmppPubSubManager.cpp
+++ b/src/client/QXmppPubSubManager.cpp
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2020 Linus Jahn <lnj@kaidan.im>
// SPDX-FileCopyrightText: 2020 Germán Márquez Mejía <mancho@olomono.de>
+// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
@@ -323,6 +324,21 @@ auto QXmppPubSubManager::retractItem(const QString &jid, const QString &nodeName
}
///
+/// Deletes an item from a pubsub node.
+///
+/// The default value of itemId is used for singleton nodes (i.e., the node's
+/// single item is deleted).
+///
+/// \param jid Jabber ID of the entity hosting the pubsub service
+/// \param nodeName the name of the node to delete the item from
+/// \param itemId the ID of the item to delete
+///
+auto QXmppPubSubManager::retractItem(const QString &jid, const QString &nodeName, StandardItemId itemId) -> QFuture<Result>
+{
+ return retractItem(jid, nodeName, standardItemIdToString(itemId));
+}
+
+///
/// Purges all items from a node.
///
/// \param jid Jabber ID of the entity hosting the pubsub service
@@ -636,7 +652,7 @@ QFuture<QXmppPubSubManager::Result> QXmppPubSubManager::cancelNodeConfiguration(
///
///
-/// \fn QXmppPubSubManager::retractPepItem
+/// \fn QXmppPubSubManager::retractPepItem(const QString &nodeName, const QString &itemId)
///
/// Deletes an item from a PEP node.
///
@@ -645,7 +661,21 @@ QFuture<QXmppPubSubManager::Result> QXmppPubSubManager::cancelNodeConfiguration(
///
/// \param nodeName the name of the PEP node to delete the item from
/// \param itemId the ID of the item to delete
-/// \return
+///
+
+///
+/// \fn QXmppPubSubManager::retractPepItem(const QString &nodeName, StandardItemId itemId)
+///
+/// Deletes an item from a PEP node.
+///
+/// The default value of itemId is used for singleton nodes (i.e., the node's
+/// single item is deleted).
+///
+/// This is a convenience method equivalent to calling
+/// QXmppPubSubManager::retractItem on the current account's bare JID.
+///
+/// \param nodeName the name of the PEP node to delete the item from
+/// \param itemId the ID of the item to delete
///
///
@@ -755,6 +785,15 @@ QXmppPubSubIq<> QXmppPubSubManager::requestItemsIq(const QString &jid, const QSt
return request;
}
+QString QXmppPubSubManager::standardItemIdToString(StandardItemId itemId)
+{
+ switch (itemId) {
+ case Current:
+ return QStringLiteral("current");
+ }
+ return {};
+}
+
auto QXmppPubSubManager::publishItem(QXmppPubSubIqBase &&request) -> QFuture<PublishItemResult>
{
request.setType(QXmppIq::Set);