aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppClient.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2021-09-03 18:17:40 +0200
committerLinus Jahn <lnj@kaidan.im>2021-09-03 20:42:34 +0200
commit040b7d9a8c7625f93e93690e47dbabb71ff87fd7 (patch)
tree15a2ad8b8b13c6beeb38c6438953b896992f699e /src/client/QXmppClient.cpp
parent0623aa38f2ead734dddea4cbad899a868f01cb1e (diff)
Refactor packet sending: Add SendSuccess/SendError
Diffstat (limited to 'src/client/QXmppClient.cpp')
-rw-r--r--src/client/QXmppClient.cpp28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/client/QXmppClient.cpp b/src/client/QXmppClient.cpp
index 4d1efe7d..e6655bd0 100644
--- a/src/client/QXmppClient.cpp
+++ b/src/client/QXmppClient.cpp
@@ -326,32 +326,12 @@ bool QXmppClient::sendPacket(const QXmppNonza &packet)
///
/// Sends a packet and reports the result via QFuture.
///
-/// The QFuture might have multiple results. The first result of the future is
-/// reported immediately (it's safe to access resultAt(0)). If writing the data
-/// to the socket succeeds (that does not mean the server received it),
-/// QXmpp::Sent is reported. Otherwise QXmpp::NotSent is reported.
-///
/// If stream management is enabled the future continues to be active until the
-/// server acknowledges the packet. On success QXmpp::Acknowledged is reported
-/// and the future finishes.
+/// server acknowledges the packet. On success QXmpp::SendSuccess with
+/// acknowledged == true is reported and the future finishes.
///
/// If connection errors occur the packet is resent if possible. If reconnecting
-/// is not possible, QXmpp::NotSent is reported.
-///
-/// For you the most important result is the last one. QXmpp::Sent means the
-/// packet has been sent without stream management (no acknowledgment).
-/// QXmpp::Acknowledged means the packet has been sent and has been received by
-/// the server, QXmpp::NotSent means no success.
-///
-/// \note <b>TL;DR</b>: The future might have multiple results, so don't do:
-/// \code
-/// send().result();
-/// \endcode
-/// Instead do the following to handle the final result:
-/// \code
-/// send().results().last();
-/// \endcode
-/// QXmpp::Sent or QXmpp::Acknowledged mean success.
+/// is not possible, an error is reported.
///
/// \warning THIS API IS NOT FINALIZED YET!
///
@@ -359,7 +339,7 @@ bool QXmppClient::sendPacket(const QXmppNonza &packet)
/// You can use QFutureWatcher in Qt 5 and QFuture::then() in Qt 6 to handle the
/// results.
///
-QFuture<QXmpp::PacketState> QXmppClient::send(const QXmppStanza &stanza)
+QFuture<QXmpp::SendResult> QXmppClient::send(const QXmppStanza &stanza)
{
return d->stream->send(stanza);
}