QXmpp::Messages Namespace
namespace QXmpp::Messages| Header: | #include <QXmppClient.h> |
| Since: | QXmpp 1.18 |
Classes
(since QXmpp 1.18) class | ArchiveInfo |
(since QXmpp 1.18) class | BodyOnlyMessage |
| struct | ConfirmDelivery |
(since QXmpp 1.18) struct | Confirmation |
(since QXmpp 1.18) class | Context |
| class | EncryptionSelection |
| class | OutgoingMessage |
| struct | Prepare |
| struct | PrepareBodyOnly |
| struct | Received |
| struct | ResolveRecipients |
| struct | ResolveSender |
| struct | SelectEncryption |
(since QXmpp 1.18) class | Sent |
Types
| enum class | DecryptionState { NotEncrypted, Decrypted, NoEnvelope, SentByThisDevice, Failed, …, AlreadyDecrypted } |
(since QXmpp 1.18) enum class | DeliveryState { Written, ServerAcknowledged, Confirmed } |
| enum class | Origin { Stream, CarbonReceived, CarbonSent, Mam, Injected } |
Detailed Description
Processing of incoming and outgoing messages.
Incoming messages run through these phases:
- Unwrap: the stream, carbons and MAM create a Context with their Origin.
- ResolveSender: asynchronous, e.g. MUC sets the real sender.
- Decrypt: asynchronous, via the provider of the encryption method (QXmpp::E2ee::Provider).
- Received: synchronous, handlers consume the message.
- Deliver: QXmppClient::messageReceived() if no handler consumed the message.
Messages of archive queries skip the last two phases. QXmppMamManager::retrieve() returns their contexts to the caller of the query.
Messages of the same conversation are processed in the order in which they were received, also across the asynchronous decryption.
Messages sent via QXmppClient::sendMessage() and send() (and the deprecated QXmppClient::sendSensitive() and QXmppClient::reply()) run through these phases:
- SelectEncryption: asynchronous, usually the application selects the encryption with its policy per contact.
- Prepare: synchronous, handlers add elements or cancel sending.
- ResolveRecipients: asynchronous, only for encrypted messages, e.g. MUC sets the members of the room.
- Encrypt: asynchronous, via the provider of the selected encryption (QXmpp::E2ee::Provider). The public part of Explicit Message Encryption (XEP-0380: Explicit Message Encryption) and a fallback body are added for messages with a body. PrepareBodyOnly: synchronous, only if the provider encrypts the message for recipients of an encryption protecting only the body (e.g. OMEMO 0).
- Send.
- ConfirmDelivery: asynchronous, e.g. MUC waits for the reflection of the room. The task returned by QXmppClient::sendMessage() or send() finishes afterwards.
Outgoing messages to the same JID are sent in the order in which they were passed, also across the asynchronous phases. Waiting for the confirmation of the delivery does not block the next message.
The encryption of IQs is selected via QXmpp::Iq::SelectEncryption.
Classes
class ArchiveInfo
class BodyOnlyMessage
class ConfirmDelivery
class Confirmation
class Context
class EncryptionSelection
class OutgoingMessage
class Prepare
class PrepareBodyOnly
class Received
class ResolveRecipients
class ResolveSender
class SelectEncryption
class Sent
Type Documentation
enum class Messages::DecryptionState
| Constant | Value | Description |
|---|---|---|
QXmpp::Messages::DecryptionState::NotEncrypted | 0 | The message was not end-to-end encrypted. |
QXmpp::Messages::DecryptionState::Decrypted | 1 | The message was decrypted. |
QXmpp::Messages::DecryptionState::NoEnvelope | 2 | The message is encrypted, but not for this device. |
QXmpp::Messages::DecryptionState::SentByThisDevice | 3 | The message is encrypted and has been sent by this device, which does not encrypt for itself, e.g. an own message reflected by a MUC room or MIX channel or retrieved via MAM. The application can match it with the sent message, e.g. via its origin ID. |
QXmpp::Messages::DecryptionState::Failed | 4 | The decryption failed, see Context::decryptionError(). |
QXmpp::Messages::DecryptionState::Unsupported | 5 | There is no provider for the encryption method. |
QXmpp::Messages::DecryptionState::AlreadyDecrypted | 6 | The message has already been decrypted before, e.g. it has been received twice or retrieved again via MAM. The application should ignore it without showing an error, as required by XEP-0384: OMEMO Encryption. |
[since QXmpp 1.18] enum class Messages::DeliveryState
How far the delivery of a message sent via QXmppClient::sendMessage() has been confirmed.
| Constant | Value | Description |
|---|---|---|
QXmpp::Messages::DeliveryState::Written | 0 | The message has been written to the stream. Without Stream Management, it is unknown whether the server has received it. |
QXmpp::Messages::DeliveryState::ServerAcknowledged | 1 | The own server has acknowledged the message via XEP-0198: Stream Management. It may not have reached the recipient yet. |
QXmpp::Messages::DeliveryState::Confirmed | 2 | A handler of ConfirmDelivery has confirmed that the recipient has accepted the message, e.g. a MUC room by reflecting it. |
This enum was introduced in QXmpp 1.18.
enum class Messages::Origin
Where an incoming message came from.
| Constant | Value | Description |
|---|---|---|
QXmpp::Messages::Origin::Stream | 0 | Received directly from the server. |
QXmpp::Messages::Origin::CarbonReceived | 1 | Copy of a message received by another own device. |
QXmpp::Messages::Origin::CarbonSent | 2 | Copy of a message sent by another own device. |
QXmpp::Messages::Origin::Mam | 3 | Result of an archive query, only returned by QXmppMamManager::retrieve(). The context has a QXmpp::Messages::ArchiveInfo attachment. |
QXmpp::Messages::Origin::Injected | 4 | Injected by an extension via QXmppClientExtension::injectMessage(). |