diff options
| author | Linus Jahn <lnj@kaidan.im> | 2021-07-05 15:17:12 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2021-07-05 18:07:28 +0200 |
| commit | 28aad17d6d928ee0a983d7032ae0f11fbc71bb06 (patch) | |
| tree | 84ddbf79ec563dca6698eb711cdaa7d6eb08cc5c /src/client/QXmppClient.cpp | |
| parent | a35d7e7b8eac25d0cb088d60cb2f00ec05a41800 (diff) | |
| download | qxmpp-28aad17d6d928ee0a983d7032ae0f11fbc71bb06.tar.gz | |
Add QXmppClient::sendGenericIq() just returning Success/StanzaError
Diffstat (limited to 'src/client/QXmppClient.cpp')
| -rw-r--r-- | src/client/QXmppClient.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/client/QXmppClient.cpp b/src/client/QXmppClient.cpp index 4f8bfc26..74875275 100644 --- a/src/client/QXmppClient.cpp +++ b/src/client/QXmppClient.cpp @@ -29,6 +29,7 @@ #include "QXmppDiscoveryIq.h" #include "QXmppDiscoveryManager.h" #include "QXmppEntityTimeManager.h" +#include "QXmppFutureUtils_p.h" #include "QXmppLogger.h" #include "QXmppMessage.h" #include "QXmppOutgoingClient.h" @@ -117,6 +118,18 @@ QStringList QXmppClientPrivate::discoveryFeatures() /// (with type 'error' or 'result') or it contains the packet error, if the /// request couldn't be sent. /// +/// \since QXmpp 1.5 +/// + +/// +/// \typedef QXmppClient::EmptyResult +/// +/// Result of a generic request without a return value. Contains Success in case +/// everything went well. If the returned IQ contained an error a +/// QXmppStanza::Error is reported. +/// +/// \since QXmpp 1.5 +/// /// Creates a QXmppClient object. /// \param parent is passed to the QObject's constructor. @@ -345,6 +358,10 @@ QFuture<QXmpp::PacketState> QXmppClient::send(const QXmppStanza &stanza) /// /// Sends an IQ packet and returns the response asynchronously. /// +/// This is useful for further processing and parsing of the returned +/// QDomElement. If you don't expect a special response, you may want use +/// sendGenericIq(). +/// /// \warning THIS API IS NOT FINALIZED YET! /// /// \since QXmpp 1.5 @@ -354,6 +371,27 @@ QFuture<QXmppClient::IqResult> QXmppClient::sendIq(const QXmppIq &iq) return d->stream->sendIq(iq); } +/// +/// Sends an IQ and returns possible stanza errors. +/// +/// If you want to parse a special IQ response in the result case, you can use +/// sendIq() and parse the returned QDomElement. +/// +/// \returns Returns QXmpp::Success (on response type 'result') or the contained +/// QXmppStanza::Error (on response type 'error') +/// +/// \warning THIS API IS NOT FINALIZED YET! +/// +/// \since QXmpp 1.5 +/// +QFuture<QXmppClient::EmptyResult> QXmppClient::sendGenericIq(const QXmppIq &iq) +{ + using namespace QXmpp::Private; + return chainIq<EmptyResult, QXmppIq>(sendIq(iq), this, [](const QXmppIq &) { + return QXmpp::Success(); + }); +} + /// Disconnects the client and the current presence of client changes to /// QXmppPresence::Unavailable and status text changes to "Logged out". /// |
