QXmpp::Messages Namespace

namespace QXmpp::Messages
Header: #include <QXmppMessages.h>
Since: QXmpp 1.18

Classes

(since QXmpp 1.18) class ArchiveInfo
struct ConfirmDelivery
(since QXmpp 1.18) class Context
class EncryptionSelection
class OutgoingMessage
struct Prepare
struct Received
struct ResolveRecipients
struct ResolveSender
struct SelectEncryption

Types

enum class DecryptionState { NotEncrypted, Decrypted, NoEnvelope, Failed, Unsupported }
enum class Origin { Stream, CarbonReceived, CarbonSent, Mam, Injected }

Detailed Description

Processing of incoming and outgoing messages.

Incoming messages run through these phases:

  1. Unwrap: the stream, carbons and MAM create a Context with their Origin.
  2. ResolveSender: asynchronous, e.g. MUC sets the real sender.
  3. Decrypt: asynchronous, via the provider of the encryption method (QXmpp::E2ee::Provider).
  4. Received: synchronous, handlers consume the message.
  5. Deliver: QXmppClient::messageReceived() if no handler consumed the message.

Messages of the same conversation are processed in the order in which they were received, also across the asynchronous decryption.

Messages sent via QXmppClient::send() (and the deprecated QXmppClient::sendSensitive() and QXmppClient::reply()) run through these phases:

  1. SelectEncryption: asynchronous, usually the application selects the encryption with its policy per contact.
  2. Prepare: synchronous, handlers add elements or cancel sending.
  3. ResolveRecipients: asynchronous, only for encrypted messages, e.g. MUC sets the members of the room.
  4. 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.
  5. Send.
  6. ConfirmDelivery: asynchronous, e.g. MUC waits for the reflection of the room. The task returned by QXmppClient::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.

Type Documentation

enum class Messages::DecryptionState

ConstantValueDescription
QXmpp::Messages::DecryptionState::NotEncrypted0The message was not end-to-end encrypted.
QXmpp::Messages::DecryptionState::Decrypted1The message was decrypted.
QXmpp::Messages::DecryptionState::NoEnvelope2The message is encrypted, but not for this device, e.g. an own message reflected by a MUC.
QXmpp::Messages::DecryptionState::Failed3The decryption failed, see Context::decryptionError().
QXmpp::Messages::DecryptionState::Unsupported4There is no provider for the encryption method.

enum class Messages::Origin

Where an incoming message came from.

ConstantValueDescription
QXmpp::Messages::Origin::Stream0Received directly from the server.
QXmpp::Messages::Origin::CarbonReceived1Copy of a message received by another own device.
QXmpp::Messages::Origin::CarbonSent2Copy of a message sent by another own device.
QXmpp::Messages::Origin::Mam3Result of an archive query, not delivered as a live message. The context has a QXmpp::Messages::ArchiveInfo attachment.
QXmpp::Messages::Origin::Injected4Injected by an extension via QXmppClientExtension::injectMessage().