QXmppMessage Class
The QXmppMessage class represents an XMPP message. More...
| Header: | #include <QXmppMessage.h> |
| Inherits: | QXmppStanza |
| Inherited By: |
- List of all members, including inherited members
- Deprecated members
- QXmppMessage is part of Stanzas.
Public Types
(since QXmpp 1.1) enum | Hint { NoPermanentStore, NoStore, NoCopy, Store } |
| flags | Hints |
(since QXmpp 0.8.1) enum | Marker { NoMarker, Received, Displayed, Acknowledged } |
(since QXmpp 0.2) enum | State { None, Active, Inactive, Gone, Composing, Paused } |
| enum | Type { Error, Normal, Chat, GroupChat, Headline } |
Public Functions
| QXmppMessage(const QString &from = QString(), const QString &to = QString(), const QString &body = QString(), const QString &thread = QString()) | |
| QXmppMessage(const QXmppMessage &other) | |
| QXmppMessage(QXmppMessage &&) | |
(since QXmpp 1.1) void | addHint(const QXmppMessage::Hint hint) |
(since QXmpp 1.1) QString | attachId() const |
(since QXmpp 1.2) QXmppBitsOfBinaryDataList & | bitsOfBinaryData() |
(since QXmpp 1.2) QXmppBitsOfBinaryDataList | bitsOfBinaryData() const |
| QString | body() const |
| std::optional<QXmppCallInviteElement> | callInviteElement() const |
(since QXmpp 1.5) QString | e2eeFallbackBody() const |
(since QXmpp 1.1) QXmpp::EncryptionMethod | encryptionMethod() const |
(since QXmpp 1.1) QString | encryptionMethodNs() const |
(since QXmpp 1.1) QString | encryptionName() const |
(since QXmpp 1.16) QXmpp::Xml::Extensions & | extensions() |
| const QXmpp::Xml::Extensions & | extensions() const |
(since QXmpp 1.7) const QList<QXmppFallback> & | fallbackMarkers() const |
(since QXmpp 1.7) QList<QXmppFileSourcesAttachment> | fileSourcesAttachments() const |
(since QXmpp 1.1) bool | hasHint(const QXmppMessage::Hint hint) const |
(since QXmpp 1.16) bool | hasSubject() const |
(since QXmpp 0.4) bool | isAttentionRequested() const |
(since QXmpp 1.5) bool | isCarbonForwarded() const |
(since QXmpp 0.8.1) bool | isMarkable() const |
(since QXmpp 1.0) bool | isPrivate() const |
(since QXmpp 0.4) bool | isReceiptRequested() const |
(since QXmpp 1.3) bool | isSlashMeCommand() const |
(since QXmpp 1.1) bool | isSpoiler() const |
| std::optional<QXmppJingleMessageInitiationElement> | jingleMessageInitiationElement() const |
(since QXmpp 0.8.1) QString | markedId() const |
(since QXmpp 0.8.1) QString | markedThread() const |
(since QXmpp 0.8.1) QXmppMessage::Marker | marker() const |
(since QXmpp 1.4) std::optional<QXmppMixInvitation> | mixInvitation() const |
(since QXmpp 1.7) QString | mixParticipantId() const |
(since QXmpp 1.1) QString | mixUserJid() const |
(since QXmpp 1.1) QString | mixUserNick() const |
(since QXmpp 1.16) std::optional<QXmpp::Muc::DirectInvitation> | mucDirectInvitation() const |
(since QXmpp 1.13) QString | mucOccupantId() const |
(since QXmpp 1.16) QList<uint32_t> | mucStatusCodes() const |
(since QXmpp 1.16) std::optional<QXmpp::Muc::UserQuery> | mucUserQuery() const |
(since QXmpp 1.16) std::optional<QXmppMucVoiceRequest> | mucVoiceRequest() const |
(since QXmpp 1.5) std::optional<QXmppOmemoElement> | omemoElement() const |
(since QXmpp 1.3) QString | originId() const |
(since QXmpp 1.0) QString | outOfBandUrl() const |
(since QXmpp 1.5) QList<QXmppOutOfBandUrl> | outOfBandUrls() const |
(since QXmpp 1.3) QString | parentThread() const |
(since QXmpp 1.5) virtual bool | parseExtension(const QDomElement &element, QXmpp::SceMode sceMode) |
(since QXmpp 1.5) std::optional<QXmppMessageReaction> | reaction() const |
(since QXmpp 1.9) QString | readFallbackRemovedText(QXmppFallback::Element element, const QList<QString> &supportedNamespaces) const |
(since QXmpp 1.9) QString | readFallbackText(QXmppFallback::Element element, QStringView forNamespace) const |
(since QXmpp 1.9) QString | readReplyQuoteFromBody() const |
(since QXmpp 0.4) QString | receiptId() const |
(since QXmpp 1.1) void | removeAllHints() |
(since QXmpp 1.1) void | removeHint(const QXmppMessage::Hint hint) |
(since QXmpp 1.0) QString | replaceId() const |
(since QXmpp 1.9) std::optional<QXmpp::Reply> | reply() const |
(since QXmpp 1.17) std::optional<QXmppMessageRetracted> | retracted() const |
(since QXmpp 1.17) std::optional<QXmppMessageRetraction> | retraction() const |
(since QXmpp 1.5) virtual void | serializeExtensions(QXmlStreamWriter *writer, QXmpp::SceMode sceMode, const QString &baseNamespace = {}) const |
(since QXmpp 1.1) void | setAttachId(const QString &attachId) |
(since QXmpp 0.4) void | setAttentionRequested(bool requested) |
(since QXmpp 1.2) void | setBitsOfBinaryData(const QXmppBitsOfBinaryDataList &bitsOfBinaryData) |
| void | setBody(const QString &body) |
| void | setCallInviteElement(std::optional<QXmppCallInviteElement> callInviteElement) |
(since QXmpp 1.5) void | setCarbonForwarded(bool forwarded) |
(since QXmpp 1.5) void | setE2eeFallbackBody(const QString &fallbackBody) |
(since QXmpp 1.1) void | setEncryptionMethod(QXmpp::EncryptionMethod method) |
(since QXmpp 1.1) void | setEncryptionMethodNs(const QString &encryptionMethod) |
(since QXmpp 1.1) void | setEncryptionName(const QString &encryptionName) |
(since QXmpp 1.7) void | setFallbackMarkers(const QList<QXmppFallback> &fallbackMarkers) |
(since QXmpp 1.7) void | setFileSourcesAttachments(const QList<QXmppFileSourcesAttachment> &fileSourcesAttachments) |
(since QXmpp 1.1) void | setIsSpoiler(bool isSpoiler) |
| void | setJingleMessageInitiationElement(const std::optional<QXmppJingleMessageInitiationElement> &jingleMessageInitiationElement) |
(since QXmpp 0.8.1) void | setMarkable(const bool markable) |
(since QXmpp 0.8.1) void | setMarkedThread(const QString &markedThread) |
(since QXmpp 0.8.1) void | setMarker(const QXmppMessage::Marker marker) |
(since QXmpp 0.8.1) void | setMarkerId(const QString &markerId) |
(since QXmpp 1.4) void | setMixInvitation(const std::optional<QXmppMixInvitation> &mixInvitation) |
(since QXmpp 1.1) void | setMixUserJid(const QString &mixUserJid) |
(since QXmpp 1.1) void | setMixUserNick(const QString &mixUserNick) |
(since QXmpp 1.16) void | setMucDirectInvitation(std::optional<QXmpp::Muc::DirectInvitation> invitation) |
(since QXmpp 1.13) void | setMucOccupantId(const QString &id) |
(since QXmpp 1.16) void | setMucStatusCodes(const QList<uint32_t> &codes) |
(since QXmpp 1.16) void | setMucUserQuery(std::optional<QXmpp::Muc::UserQuery> element) |
(since QXmpp 1.16) void | setMucVoiceRequest(std::optional<QXmppMucVoiceRequest> request) |
(since QXmpp 1.5) void | setOmemoElement(const std::optional<QXmppOmemoElement> &omemoElement) |
(since QXmpp 1.3) void | setOriginId(const QString &id) |
(since QXmpp 1.0) void | setOutOfBandUrl(const QString &url) |
(since QXmpp 1.5) void | setOutOfBandUrls(const QList<QXmppOutOfBandUrl> &urls) |
(since QXmpp 1.3) void | setParentThread(const QString &parent) |
(since QXmpp 1.0) void | setPrivate(const bool priv) |
(since QXmpp 1.5) void | setReaction(const std::optional<QXmppMessageReaction> &reaction) |
(since QXmpp 0.4) void | setReceiptId(const QString &id) |
(since QXmpp 0.4) void | setReceiptRequested(bool requested) |
(since QXmpp 1.0) void | setReplaceId(const QString &replaceId) |
(since QXmpp 1.9) void | setReply(const std::optional<QXmpp::Reply> &reply) |
(since QXmpp 1.17) void | setRetracted(const std::optional<QXmppMessageRetracted> &retracted) |
(since QXmpp 1.17) void | setRetraction(const std::optional<QXmppMessageRetraction> &retraction) |
(since QXmpp 1.5) void | setSharedFiles(const QList<QXmppFileShare> &sharedFiles) |
(since QXmpp 1.1) void | setSpoilerHint(const QString &spoilerHint) |
(since QXmpp 0.2) void | setStamp(const QDateTime &stamp) |
(since QXmpp 1.8) void | setStanzaIds(const QList<QXmppStanzaId> &ids) |
(since QXmpp 0.2) void | setState(QXmppMessage::State state) |
| void | setSubject(std::optional<QString> subject) |
| void | setThread(const QString &thread) |
(since QXmpp 1.5) void | setTrustMessageElement(const std::optional<QXmppTrustMessageElement> &trustMessageElement) |
| void | setType(QXmppMessage::Type type) |
(since QXmpp 0.6.2) void | setXhtml(const QString &xhtml) |
(since QXmpp 1.5) const QList<QXmppFileShare> & | sharedFiles() const |
(since QXmpp 1.3) QString | slashMeCommandText() const |
(since QXmpp 1.1) QString | spoilerHint() const |
(since QXmpp 0.2) QDateTime | stamp() const |
(since QXmpp 1.8) QList<QXmppStanzaId> | stanzaIds() const |
(since QXmpp 0.2) QXmppMessage::State | state() const |
| QString | subject() const |
| QString | thread() const |
(since QXmpp 1.5) std::optional<QXmppTrustMessageElement> | trustMessageElement() const |
| QXmppMessage::Type | type() const |
(since QXmpp 0.6.2) QString | xhtml() const |
| QXmppMessage & | operator=(QXmppMessage &&) |
| QXmppMessage & | operator=(const QXmppMessage &other) |
Reimplemented Public Functions
(since QXmpp 1.0) virtual bool | isXmppStanza() const override |
Static Public Members
(since QXmpp 1.3) bool | isSlashMeCommand(const QString &body) |
(since QXmpp 1.3) QString | slashMeCommandText(const QString &body) |
Detailed Description
Member Type Documentation
[since QXmpp 1.1] enum QXmppMessage::Hint
flags QXmppMessage::Hints
XEP-0334: Message Processing Hints| Constant | Value | Description |
|---|---|---|
QXmppMessage::NoPermanentStore | 1 << 0 | Do not allow permanent storage. |
QXmppMessage::NoStore | 1 << 1 | Do not store at all. |
QXmppMessage::NoCopy | 1 << 2 | Do not copy the message. |
QXmppMessage::Store | 1 << 3 | Do store the message. |
This enum was introduced in QXmpp 1.1.
The Hints type is a typedef for QFlags<Hint>. It stores an OR combination of Hint values.
[since QXmpp 0.8.1] enum QXmppMessage::Marker
This enum describes a chat marker as defined by XEP-0333: Chat Markers.
| Constant | Value |
|---|---|
QXmppMessage::NoMarker | 0 |
QXmppMessage::Received | 1 |
QXmppMessage::Displayed | 2 |
QXmppMessage::Acknowledged | 3 |
This enum was introduced in QXmpp 0.8.1.
[since QXmpp 0.2] enum QXmppMessage::State
This enum describes a chat state as defined by XEP-0085: Chat State Notifications.
| Constant | Value | Description |
|---|---|---|
QXmppMessage::None | 0 | The message does not contain any chat state information. |
QXmppMessage::Active | 1 | User is actively participating in the chat session. |
QXmppMessage::Inactive | 2 | User has not been actively participating in the chat session. |
QXmppMessage::Gone | 3 | User has effectively ended their participation in the chat session. |
QXmppMessage::Composing | 4 | User is composing a message. |
QXmppMessage::Paused | 5 | User had been composing but now has stopped. |
This enum was introduced in QXmpp 0.2.
enum QXmppMessage::Type
This enum describes a message type.
| Constant | Value |
|---|---|
QXmppMessage::Error | 0 |
QXmppMessage::Normal | 1 |
QXmppMessage::Chat | 2 |
QXmppMessage::GroupChat | 3 |
QXmppMessage::Headline | 4 |
Member Function Documentation
QXmppMessage::QXmppMessage(const QString &from = QString(), const QString &to = QString(), const QString &body = QString(), const QString &thread = QString())
Constructs a QXmppMessage with sender from, recipient to, message body and thread.
QXmppMessage::QXmppMessage(const QXmppMessage &other)
Constructs a copy of other.
QXmppMessage::QXmppMessage(QXmppMessage &&)
Move-constructor.
[since QXmpp 1.1] void QXmppMessage::addHint(const QXmppMessage::Hint hint)
Adds a hint to the message, as defined in XEP-0334: Message Processing Hints
This function was introduced in QXmpp 1.1.
[since QXmpp 1.1] QString QXmppMessage::attachId() const
Returns the message id this message is linked/attached to. See XEP-0367: Message Attaching for details.
This function was introduced in QXmpp 1.1.
See also setAttachId().
[since QXmpp 1.2] QXmppBitsOfBinaryDataList &QXmppMessage::bitsOfBinaryData()
Returns a list of data attached using XEP-0231: Bits of Binary.
This could be used to resolve cid: URIs found in the X-HTML body.
This function was introduced in QXmpp 1.2.
See also setBitsOfBinaryData().
[since QXmpp 1.2] QXmppBitsOfBinaryDataList QXmppMessage::bitsOfBinaryData() const
Returns a list of data packages attached using XEP-0231: Bits of Binary.
This could be used to resolve cid: URIs found in the X-HTML body.
This function was introduced in QXmpp 1.2.
QString QXmppMessage::body() const
Returns the message's body.
See also setBody().
std::optional<QXmppCallInviteElement> QXmppMessage::callInviteElement() const
Returns a Call Invite element as defined in XEP-0482: Call Invites.
See also setCallInviteElement().
[since QXmpp 1.5] QString QXmppMessage::e2eeFallbackBody() const
Returns a body that is unlike the normal body not encrypted.
It can be presented to users if the message could not be decrypted (e.g., because their clients do not support the used end-to-end encryption).
This function was introduced in QXmpp 1.5.
See also setE2eeFallbackBody().
[since QXmpp 1.1] QXmpp::EncryptionMethod QXmppMessage::encryptionMethod() const
Returns the encryption method this message is advertised to be encrypted with.
Note: QXmppMessage::NoEncryption does not necesserily mean that the message is not encrypted; it may also be that the author of the message does not support XEP-0380: Explicit Message Encryption.
Note: If this returns QXmppMessage::UnknownEncryption, you can still get the namespace of the encryption with encryptionMethodNs() and possibly also a name with encryptionName().
This function was introduced in QXmpp 1.1.
See also setEncryptionMethod().
[since QXmpp 1.1] QString QXmppMessage::encryptionMethodNs() const
Returns the namespace of the advertised encryption method via. XEP-0380: Explicit Message Encryption.
This function was introduced in QXmpp 1.1.
See also setEncryptionMethodNs().
[since QXmpp 1.1] QString QXmppMessage::encryptionName() const
Returns the associated name of the encryption method this message advertises to be encrypted with. See XEP-0380: Explicit Message Encryption for details.
This function was introduced in QXmpp 1.1.
See also setEncryptionName().
[since QXmpp 1.16] QXmpp::Xml::Extensions &QXmppMessage::extensions()
Returns the typed extension container for this message.
Extensions parsed via QXmpp::Xml::Registry and unknown elements stored as QXmpp::Xml::Element are accessible here. This method hides QXmppStanza::extensions(); application code should migrate to this API.
This function was introduced in QXmpp 1.16.
const QXmpp::Xml::Extensions &QXmppMessage::extensions() const
This is an overloaded function.
[since QXmpp 1.7] const QList<QXmppFallback> &QXmppMessage::fallbackMarkers() const
Returns the fallback elements defined in XEP-0428: Fallback Indication.
This function was introduced in QXmpp 1.7.
See also setFallbackMarkers().
[since QXmpp 1.7] QList<QXmppFileSourcesAttachment> QXmppMessage::fileSourcesAttachments() const
Returns additional sources to be attached to a file share as defined by XEP-0447: Stateless file sharing.
This function was introduced in QXmpp 1.7.
See also setFileSourcesAttachments().
[since QXmpp 1.1] bool QXmppMessage::hasHint(const QXmppMessage::Hint hint) const
Returns true if the message contains the hint passed, as defined in XEP-0334: Message Processing Hints
This function was introduced in QXmpp 1.1.
[since QXmpp 1.16] bool QXmppMessage::hasSubject() const
Returns whether the message contains a <subject/> element.
This function was introduced in QXmpp 1.16.
[since QXmpp 0.4] bool QXmppMessage::isAttentionRequested() const
Returns true if the user's attention is requested, as defined by XEP-0224: Attention.
This function was introduced in QXmpp 0.4.
[since QXmpp 1.5] bool QXmppMessage::isCarbonForwarded() const
Returns whether this message has been forwarded using carbons.
This function was introduced in QXmpp 1.5.
[since QXmpp 0.8.1] bool QXmppMessage::isMarkable() const
Returns true if a message is markable, as defined by XEP-0333: Chat Markers.
This function was introduced in QXmpp 0.8.1.
[since QXmpp 1.0] bool QXmppMessage::isPrivate() const
Returns if the message is marked with a <private/> tag, in which case it will not be forwarded to other resources according to XEP-0280: Message Carbons.
This function was introduced in QXmpp 1.0.
[since QXmpp 0.4] bool QXmppMessage::isReceiptRequested() const
Returns true if a delivery receipt is requested, as defined by XEP-0184: Message Delivery Receipts.
This function was introduced in QXmpp 0.4.
[since QXmpp 1.3] bool QXmppMessage::isSlashMeCommand() const
Returns whether the body of the message is a '/me command' as defined in XEP-0245: The /me Command.
Note: If you want to check a custom string for the /me command, you can use the static version of this method. This can be helpful when checking user input before a message was sent.
This function was introduced in QXmpp 1.3.
[static, since QXmpp 1.3] bool QXmppMessage::isSlashMeCommand(const QString &body)
Returns whether the given text is a '/me command' as defined in XEP-0245: The /me Command.
This function was introduced in QXmpp 1.3.
[since QXmpp 1.1] bool QXmppMessage::isSpoiler() const
Returns true, if this is a spoiler message according to XEP-0382: Spoiler Messages. The spoiler hint however can still be empty.
A spoiler message's content should not be visible to the user by default.
This function was introduced in QXmpp 1.1.
See also setIsSpoiler().
[override virtual, since QXmpp 1.0] bool QXmppMessage::isXmppStanza() const
Reimplements: QXmppNonza::isXmppStanza() const.
Returns whether the QXmppStanza is a stanza in the XMPP sense (i. e. a message, iq or presence)
This function was introduced in QXmpp 1.0.
std::optional<QXmppJingleMessageInitiationElement> QXmppMessage::jingleMessageInitiationElement() const
Returns a Jingle Message Initiation element as defined in XEP-0353: Jingle Message Initiation.
See also setJingleMessageInitiationElement().
[since QXmpp 0.8.1] QString QXmppMessage::markedId() const
Returns the message's marker id, as defined by XEP-0333: Chat Markers.
This function was introduced in QXmpp 0.8.1.
[since QXmpp 0.8.1] QString QXmppMessage::markedThread() const
Returns the message's marker thread, as defined by XEP-0333: Chat Markers.
This function was introduced in QXmpp 0.8.1.
See also setMarkedThread().
[since QXmpp 0.8.1] QXmppMessage::Marker QXmppMessage::marker() const
Returns the message's marker, as defined by XEP-0333: Chat Markers.
This function was introduced in QXmpp 0.8.1.
See also setMarker().
[since QXmpp 1.4] std::optional<QXmppMixInvitation> QXmppMessage::mixInvitation() const
Returns an included XEP-0369: Mediated Information eXchange (MIX) invitation as defined by XEP-0407: Mediated Information eXchange (MIX): Miscellaneous Capabilities.
This function was introduced in QXmpp 1.4.
See also setMixInvitation().
[since QXmpp 1.7] QString QXmppMessage::mixParticipantId() const
Returns the participant ID of the sender if the message is received from a MIX channel as specified in XEP-0369: Mediated Information eXchange (MIX).
This function was introduced in QXmpp 1.7.
[since QXmpp 1.1] QString QXmppMessage::mixUserJid() const
Returns the actual JID of a MIX channel participant.
This function was introduced in QXmpp 1.1.
See also setMixUserJid().
[since QXmpp 1.1] QString QXmppMessage::mixUserNick() const
Returns the MIX participant's nickname.
This function was introduced in QXmpp 1.1.
See also setMixUserNick().
[since QXmpp 1.16] std::optional<QXmpp::Muc::DirectInvitation> QXmppMessage::mucDirectInvitation() const
Returns the direct MUC invitation (XEP-0249: Direct MUC Invitations) if present.
This function was introduced in QXmpp 1.16.
See also setMucDirectInvitation().
[since QXmpp 1.13] QString QXmppMessage::mucOccupantId() const
Returns the MUC Occupant ID as defined in XEP-0421: Occupant identifiers for semi-anonymous MUCs.
This function was introduced in QXmpp 1.13.
See also setMucOccupantId().
[since QXmpp 1.16] QList<uint32_t> QXmppMessage::mucStatusCodes() const
Returns the MUC status codes from a XEP-0045: Multi-User Chat message.
Status codes are sent by the server to notify about room configuration changes, role/affiliation changes, and other events (e.g., code 104 for room config change).
This function was introduced in QXmpp 1.16.
See also setMucStatusCodes().
[since QXmpp 1.16] std::optional<QXmpp::Muc::UserQuery> QXmppMessage::mucUserQuery() const
Returns the parsed x element with namespace muc#user, if any.
This element carries mediated invitations, invitation declines, and status codes.
This function was introduced in QXmpp 1.16.
See also setMucUserQuery().
[since QXmpp 1.16] std::optional<QXmppMucVoiceRequest> QXmppMessage::mucVoiceRequest() const
Returns the XEP-0045: Multi-User Chat voice request contained in this message, if any.
Voice requests use a muc#request data form in a normal-type message. Moderators receive these when a visitor requests voice in a moderated room.
This function was introduced in QXmpp 1.16.
See also setMucVoiceRequest().
[since QXmpp 1.5] std::optional<QXmppOmemoElement> QXmppMessage::omemoElement() const
Returns an included OMEMO element as defined by XEP-0384: OMEMO Encryption.
This function was introduced in QXmpp 1.5.
See also setOmemoElement().
[since QXmpp 1.3] QString QXmppMessage::originId() const
Returns the origin ID of the message according to XEP-0359: Unique and Stable Stanza IDs.
This function was introduced in QXmpp 1.3.
See also setOriginId().
[since QXmpp 1.0] QString QXmppMessage::outOfBandUrl() const
Returns a possibly attached URL from XEP-0066: Out of Band Data
This function was introduced in QXmpp 1.0.
See also setOutOfBandUrl().
[since QXmpp 1.5] QList<QXmppOutOfBandUrl> QXmppMessage::outOfBandUrls() const
Returns possibly attached URLs from XEP-0066: Out of Band Data
This function was introduced in QXmpp 1.5.
See also setOutOfBandUrls().
[since QXmpp 1.3] QString QXmppMessage::parentThread() const
Returns the optional parent thread of this message.
The possibility to create child threads was added in RFC6121.
This function was introduced in QXmpp 1.3.
See also setParentThread().
[virtual, since QXmpp 1.5] bool QXmppMessage::parseExtension(const QDomElement &element, QXmpp::SceMode sceMode)
Parses a child element of the message stanza.
Allows inherited classes to parse additional extension elements. This function may be executed multiple times with different elements.
element is the child element of the message to be parsed. sceMode decides which elements to be parsed from the DOM (all known / only public / only sensitive).
Returns true, if the element was successfully parsed.
This function was introduced in QXmpp 1.5.
[since QXmpp 1.5] std::optional<QXmppMessageReaction> QXmppMessage::reaction() const
Returns a reaction to a message as defined by XEP-0444: Message Reactions.
This function was introduced in QXmpp 1.5.
See also setReaction().
[since QXmpp 1.9] QString QXmppMessage::readFallbackRemovedText(QXmppFallback::Element element, const QList<QString> &supportedNamespaces) const
Returns the body or subject text of the message without parts that have a fallback marker with a supported namespace.
element decides whether to use the body or the subject text. supportedNamespaces is the list of namespaces for which fallback markers should be filtered out.
This function was introduced in QXmpp 1.9.
[since QXmpp 1.9] QString QXmppMessage::readFallbackText(QXmppFallback::Element element, QStringView forNamespace) const
Returns the parts of the body or subject that are marked as fallback for forNamespace.
element decides whether to use the body or the subject text.
This function was introduced in QXmpp 1.9.
[since QXmpp 1.9] QString QXmppMessage::readReplyQuoteFromBody() const
Returns the part of the body that is marked as fallback for XEP-0461: Message Replies, without any quotation marks ('> ').
This function was introduced in QXmpp 1.9.
[since QXmpp 0.4] QString QXmppMessage::receiptId() const
If this message is a delivery receipt, returns the ID of the original message.
This function was introduced in QXmpp 0.4.
See also setReceiptId().
[since QXmpp 1.1] void QXmppMessage::removeAllHints()
Removes all hints from the message, as defined in XEP-0334: Message Processing Hints
This function was introduced in QXmpp 1.1.
[since QXmpp 1.1] void QXmppMessage::removeHint(const QXmppMessage::Hint hint)
Removes a hint from the message, as defined in XEP-0334: Message Processing Hints
hint.
This function was introduced in QXmpp 1.1.
[since QXmpp 1.0] QString QXmppMessage::replaceId() const
Returns the message id to replace with this message as used in XEP-0308: Last Message Correction. If the returned string is empty, this message is not replacing another.
This function was introduced in QXmpp 1.0.
See also setReplaceId().
[since QXmpp 1.9] std::optional<QXmpp::Reply> QXmppMessage::reply() const
Returns the message reply extension as defined in XEP-0461: Message Replies.
This function was introduced in QXmpp 1.9.
See also setReply().
[since QXmpp 1.17] std::optional<QXmppMessageRetracted> QXmppMessage::retracted() const
Returns the retracted-message tombstone as defined by XEP-0424: Message Retraction, if this message is a tombstone replacing a retracted message in an archive.
This function was introduced in QXmpp 1.17.
See also setRetracted().
[since QXmpp 1.17] std::optional<QXmppMessageRetraction> QXmppMessage::retraction() const
Returns the message retraction as defined by XEP-0424: Message Retraction, if this message retracts a previously sent message.
For moderated retractions (XEP-0425: Moderated Message Retraction), the returned object's QXmppMessageRetraction::moderation() carries information about the moderator and reason.
This function was introduced in QXmpp 1.17.
See also setRetraction().
[virtual, since QXmpp 1.5] void QXmppMessage::serializeExtensions(QXmlStreamWriter *writer, QXmpp::SceMode sceMode, const QString &baseNamespace = {}) const
Serializes all additional child elements.
writer is the XML stream writer to output the XML. sceMode is the mode which decides which elements to output (only useful for encryption). baseNamespace is a custom namespace added to basic XMPP-Core elements like <body/> (needed when encrypting elements outside of the stream).
This function was introduced in QXmpp 1.5.
[since QXmpp 1.1] void QXmppMessage::setAttachId(const QString &attachId)
Sets the id of the attached message as in XEP-0367: Message Attaching. This can be used for a "reply to" or "reaction" function.
The used message id depends on the message context, see the Business rules section of the XEP for details about when to use which id.
attachId.
This function was introduced in QXmpp 1.1.
See also attachId().
[since QXmpp 0.4] void QXmppMessage::setAttentionRequested(bool requested)
Sets whether the user's attention is requested (true) or not (false), as defined by XEP-0224: Attention.
This function was introduced in QXmpp 0.4.
See also isAttentionRequested().
[since QXmpp 1.2] void QXmppMessage::setBitsOfBinaryData(const QXmppBitsOfBinaryDataList &bitsOfBinaryData)
Sets a list of XEP-0231: Bits of Binary attachments to be included.
bitsOfBinaryData.
This function was introduced in QXmpp 1.2.
See also bitsOfBinaryData().
void QXmppMessage::setBody(const QString &body)
Sets the message's body.
See also body().
void QXmppMessage::setCallInviteElement(std::optional<QXmppCallInviteElement> callInviteElement)
Sets a Call Invite element as defined in XEP-0482: Call Invites.
callInviteElement.
See also callInviteElement().
[since QXmpp 1.5] void QXmppMessage::setCarbonForwarded(bool forwarded)
Sets whether this message has been forwarded using carbons.
Setting this to true has no effect, this is purely informational.
forwarded.
This function was introduced in QXmpp 1.5.
See also isCarbonForwarded().
[since QXmpp 1.5] void QXmppMessage::setE2eeFallbackBody(const QString &fallbackBody)
Sets the end-to-end encryption fallbackBody that is unlike the normal body not encrypted.
It can be presented to users if the message could not be decrypted (e.g., because their clients do not support the used end-to-end encryption).
This function was introduced in QXmpp 1.5.
See also e2eeFallbackBody().
[since QXmpp 1.1] void QXmppMessage::setEncryptionMethod(QXmpp::EncryptionMethod method)
Advertises that this message is encrypted with the given encryption method. See XEP-0380: Explicit Message Encryption for details.
method.
This function was introduced in QXmpp 1.1.
See also encryptionMethod().
[since QXmpp 1.1] void QXmppMessage::setEncryptionMethodNs(const QString &encryptionMethod)
Sets the namespace of the encryption method this message advertises to be encrypted with. See XEP-0380: Explicit Message Encryption for details.
encryptionMethod.
This function was introduced in QXmpp 1.1.
See also encryptionMethodNs().
[since QXmpp 1.1] void QXmppMessage::setEncryptionName(const QString &encryptionName)
Sets the name of the encryption method for XEP-0380: Explicit Message Encryption.
Note: This should only be used, if the encryption method is custom and is not one of the methods listed in the XEP.
encryptionName.
This function was introduced in QXmpp 1.1.
See also encryptionName().
[since QXmpp 1.7] void QXmppMessage::setFallbackMarkers(const QList<QXmppFallback> &fallbackMarkers)
Sets the fallback elements defined in XEP-0428: Fallback Indication.
fallbackMarkers.
This function was introduced in QXmpp 1.7.
See also fallbackMarkers().
[since QXmpp 1.7] void QXmppMessage::setFileSourcesAttachments(const QList<QXmppFileSourcesAttachment> &fileSourcesAttachments)
Sets additional sources to be attached to a file share as defined by XEP-0447: Stateless file sharing.
fileSourcesAttachments.
This function was introduced in QXmpp 1.7.
See also fileSourcesAttachments().
[since QXmpp 1.1] void QXmppMessage::setIsSpoiler(bool isSpoiler)
Sets whether this is a spoiler message as specified in XEP-0382: Spoiler Messages.
The content of spoiler messages will not be displayed by default to the user. However, clients not supporting spoiler messages will still display the content as usual.
isSpoiler.
This function was introduced in QXmpp 1.1.
See also isSpoiler().
void QXmppMessage::setJingleMessageInitiationElement(const std::optional<QXmppJingleMessageInitiationElement> &jingleMessageInitiationElement)
Sets a Jingle Message Initiation element as defined in XEP-0353: Jingle Message Initiation.
jingleMessageInitiationElement.
See also jingleMessageInitiationElement().
[since QXmpp 0.8.1] void QXmppMessage::setMarkable(const bool markable)
Sets if the message is markable, as defined by XEP-0333: Chat Markers.
markable.
This function was introduced in QXmpp 0.8.1.
See also isMarkable().
[since QXmpp 0.8.1] void QXmppMessage::setMarkedThread(const QString &markedThread)
Sets the message's marked thread, as defined by XEP-0333: Chat Markers.
markedThread.
This function was introduced in QXmpp 0.8.1.
See also markedThread().
[since QXmpp 0.8.1] void QXmppMessage::setMarker(const QXmppMessage::Marker marker)
Sets the message's marker, as defined by XEP-0333: Chat Markers
marker.
This function was introduced in QXmpp 0.8.1.
See also marker().
[since QXmpp 0.8.1] void QXmppMessage::setMarkerId(const QString &markerId)
Sets the message's marker id, as defined by XEP-0333: Chat Markers.
markerId.
This function was introduced in QXmpp 0.8.1.
[since QXmpp 1.4] void QXmppMessage::setMixInvitation(const std::optional<QXmppMixInvitation> &mixInvitation)
Sets a XEP-0369: Mediated Information eXchange (MIX) invitation as defined by XEP-0407: Mediated Information eXchange (MIX): Miscellaneous Capabilities.
mixInvitation.
This function was introduced in QXmpp 1.4.
See also mixInvitation().
[since QXmpp 1.1] void QXmppMessage::setMixUserJid(const QString &mixUserJid)
Sets the actual JID of a MIX channel participant.
mixUserJid.
This function was introduced in QXmpp 1.1.
See also mixUserJid().
[since QXmpp 1.1] void QXmppMessage::setMixUserNick(const QString &mixUserNick)
Sets the MIX participant's nickname.
mixUserNick.
This function was introduced in QXmpp 1.1.
See also mixUserNick().
[since QXmpp 1.16] void QXmppMessage::setMucDirectInvitation(std::optional<QXmpp::Muc::DirectInvitation> invitation)
Sets the direct MUC invitation (XEP-0249: Direct MUC Invitations).
This function was introduced in QXmpp 1.16.
See also mucDirectInvitation().
[since QXmpp 1.13] void QXmppMessage::setMucOccupantId(const QString &id)
Sets the MUC Occupant ID as defined in XEP-0421: Occupant identifiers for semi-anonymous MUCs.
id.
This function was introduced in QXmpp 1.13.
See also mucOccupantId().
[since QXmpp 1.16] void QXmppMessage::setMucStatusCodes(const QList<uint32_t> &codes)
Sets the MUC status codes for a XEP-0045: Multi-User Chat message.
This is primarily useful for constructing test messages or forwarded stanzas. For messages received from the server, status codes are parsed automatically.
This function was introduced in QXmpp 1.16.
See also mucStatusCodes().
[since QXmpp 1.16] void QXmppMessage::setMucUserQuery(std::optional<QXmpp::Muc::UserQuery> element)
Sets the x element with namespace muc#user on this element.
This function was introduced in QXmpp 1.16.
See also mucUserQuery().
[since QXmpp 1.16] void QXmppMessage::setMucVoiceRequest(std::optional<QXmppMucVoiceRequest> request)
Sets the XEP-0045: Multi-User Chat voice request for this message.
This is primarily useful for constructing messages in tests or for forwarding stanzas. When responding to a received voice request as a moderator, use QXmppMucRoomV2::answerVoiceRequest() instead.
This function was introduced in QXmpp 1.16.
See also mucVoiceRequest().
[since QXmpp 1.5] void QXmppMessage::setOmemoElement(const std::optional<QXmppOmemoElement> &omemoElement)
Sets an OMEMO element as defined by XEP-0384: OMEMO Encryption.
omemoElement.
This function was introduced in QXmpp 1.5.
See also omemoElement().
[since QXmpp 1.3] void QXmppMessage::setOriginId(const QString &id)
Sets the origin ID of the message according to XEP-0359: Unique and Stable Stanza IDs.
id.
This function was introduced in QXmpp 1.3.
See also originId().
[since QXmpp 1.0] void QXmppMessage::setOutOfBandUrl(const QString &url)
Sets the attached URL for XEP-0066: Out of Band Data
This overrides all other urls that may be contained in the list of out of band urls.
url.
This function was introduced in QXmpp 1.0.
See also outOfBandUrl().
[since QXmpp 1.5] void QXmppMessage::setOutOfBandUrls(const QList<QXmppOutOfBandUrl> &urls)
Sets the attached URLs for XEP-0066: Out of Band Data
urls.
This function was introduced in QXmpp 1.5.
See also outOfBandUrls().
[since QXmpp 1.3] void QXmppMessage::setParentThread(const QString &parent)
Sets the optional parent thread of this message.
The possibility to create child threads was added in RFC6121.
parent.
This function was introduced in QXmpp 1.3.
See also parentThread().
[since QXmpp 1.0] void QXmppMessage::setPrivate(const bool priv)
If true is passed, the message is marked with a <private/> tag, in which case it will not be forwarded to other resources according to XEP-0280: Message Carbons.
priv.
This function was introduced in QXmpp 1.0.
See also isPrivate().
[since QXmpp 1.5] void QXmppMessage::setReaction(const std::optional<QXmppMessageReaction> &reaction)
Sets a reaction to a message as defined by XEP-0444: Message Reactions.
The corresponding hint must be set manually:
QXmppMessage message;
message.addHint(QXmppMessage::Store);
reaction.
This function was introduced in QXmpp 1.5.
See also reaction().
[since QXmpp 0.4] void QXmppMessage::setReceiptId(const QString &id)
Make this message a delivery receipt for the message with the given id.
This function was introduced in QXmpp 0.4.
See also receiptId().
[since QXmpp 0.4] void QXmppMessage::setReceiptRequested(bool requested)
Sets whether a delivery receipt is requested, as defined by XEP-0184: Message Delivery Receipts.
requested.
This function was introduced in QXmpp 0.4.
See also isReceiptRequested().
[since QXmpp 1.0] void QXmppMessage::setReplaceId(const QString &replaceId)
Sets the message id to replace with this message as in XEP-0308: Last Message Correction.
replaceId.
This function was introduced in QXmpp 1.0.
See also replaceId().
[since QXmpp 1.9] void QXmppMessage::setReply(const std::optional<QXmpp::Reply> &reply)
Sets the message reply extension as defined in XEP-0461: Message Replies.
reply.
This function was introduced in QXmpp 1.9.
See also reply().
[since QXmpp 1.17] void QXmppMessage::setRetracted(const std::optional<QXmppMessageRetracted> &retracted)
Sets the retracted tombstone as defined by XEP-0424: Message Retraction.
This function was introduced in QXmpp 1.17.
See also retracted().
[since QXmpp 1.17] void QXmppMessage::setRetraction(const std::optional<QXmppMessageRetraction> &retraction)
Sets the message retraction as defined by XEP-0424: Message Retraction.
When sending a retraction you should also add a XEP-0428: Fallback Indication marker (see setFallbackMarkers()), a human-readable fallback body and the store hint (XEP-0334: Message Processing Hints, see QXmppMessage::Store).
This function was introduced in QXmpp 1.17.
See also retraction().
[since QXmpp 1.5] void QXmppMessage::setSharedFiles(const QList<QXmppFileShare> &sharedFiles)
Sets the via XEP-0447: Stateless file sharing shared files attached to this message.
sharedFiles.
This function was introduced in QXmpp 1.5.
See also sharedFiles().
[since QXmpp 1.1] void QXmppMessage::setSpoilerHint(const QString &spoilerHint)
Sets a spoiler hint for XEP-0382: Spoiler Messages. If the spoiler hint is not empty, isSpoiler will be set to true.
A spoiler hint is optional for spoiler messages.
Keep in mind that the spoiler hint is not displayed at all by clients not supporting spoiler messages.
spoilerHint.
This function was introduced in QXmpp 1.1.
See also spoilerHint().
[since QXmpp 0.2] void QXmppMessage::setStamp(const QDateTime &stamp)
Sets the message's timestamp without modifying the type of the stamp (XEP-0093: Legacy Delayed Delivery or XEP-0203: Delayed Delivery).
By default messages are constructed with the new delayed delivery XEP, but parsed messages keep their type.
stamp.
This function was introduced in QXmpp 0.2.
See also stamp().
[since QXmpp 1.8] void QXmppMessage::setStanzaIds(const QList<QXmppStanzaId> &ids)
Sets the stanza IDs of the message as defined in XEP-0359: Unique and Stable Stanza IDs.
ids.
This function was introduced in QXmpp 1.8.
See also stanzaIds().
[since QXmpp 0.2] void QXmppMessage::setState(QXmppMessage::State state)
Sets the the chat state notification according to XEP-0085: Chat State Notifications.
state.
This function was introduced in QXmpp 0.2.
See also state().
void QXmppMessage::setSubject(std::optional<QString> subject)
Sets or clears the message's subject. Pass std::nullopt to remove the <subject/> element.
Note: The setter previously accepted a QString. It accepts std::optional<QString> (enabling std::nullopt to remove the element) since QXmpp 1.16.
See also subject().
void QXmppMessage::setThread(const QString &thread)
Sets the message's thread.
See also thread().
[since QXmpp 1.5] void QXmppMessage::setTrustMessageElement(const std::optional<QXmppTrustMessageElement> &trustMessageElement)
Sets a trust message element as defined by XEP-0434: Trust Messages (TM).
trustMessageElement.
This function was introduced in QXmpp 1.5.
See also trustMessageElement().
void QXmppMessage::setType(QXmppMessage::Type type)
Sets the message's type.
See also type().
[since QXmpp 0.6.2] void QXmppMessage::setXhtml(const QString &xhtml)
Sets the message's XHTML body as defined by XEP-0071: XHTML-IM.
xhtml.
This function was introduced in QXmpp 0.6.2.
See also xhtml().
[since QXmpp 1.5] const QList<QXmppFileShare> &QXmppMessage::sharedFiles() const
Returns the via XEP-0447: Stateless file sharing shared files attached to this message.
This function was introduced in QXmpp 1.5.
See also setSharedFiles().
[since QXmpp 1.3] QString QXmppMessage::slashMeCommandText() const
Returns the part of the body after the /me command.
This cuts off '/me ' (with the space) from the body, in case the body starts with that. In case the body does not contain a /me command as defined in XEP-0245: The /me Command, a null string is returned.
This is useful when displaying the /me command correctly to the user.
This function was introduced in QXmpp 1.3.
[static, since QXmpp 1.3] QString QXmppMessage::slashMeCommandText(const QString &body)
Returns the part of the body after the /me command.
This cuts off '/me ' (with the space) from the body, in case the body starts with that. In case the body does not contain a /me command as defined in XEP-0245: The /me Command, a null string is returned.
This is useful when displaying the /me command correctly to the user.
This function was introduced in QXmpp 1.3.
[since QXmpp 1.1] QString QXmppMessage::spoilerHint() const
Returns the spoiler hint as specified in XEP-0382: Spoiler Messages.
The hint may be empty, even if isSpoiler is true.
This function was introduced in QXmpp 1.1.
See also setSpoilerHint().
[since QXmpp 0.2] QDateTime QXmppMessage::stamp() const
Returns the optional timestamp of the message specified using XEP-0093: Legacy Delayed Delivery or using XEP-0203: Delayed Delivery (preferred).
This function was introduced in QXmpp 0.2.
See also setStamp().
[since QXmpp 1.8] QList<QXmppStanzaId> QXmppMessage::stanzaIds() const
Returns the stanza IDs of the message as defined in XEP-0359: Unique and Stable Stanza IDs.
This function was introduced in QXmpp 1.8.
See also setStanzaIds().
[since QXmpp 0.2] QXmppMessage::State QXmppMessage::state() const
Returns the the chat state notification according to XEP-0085: Chat State Notifications.
This function was introduced in QXmpp 0.2.
See also setState().
QString QXmppMessage::subject() const
Returns the message's subject, or an empty string if not set.
Note: Use hasSubject() to distinguish between a missing and an empty <subject/> element.
See also setSubject().
QString QXmppMessage::thread() const
Returns the message's thread.
See also setThread().
[since QXmpp 1.5] std::optional<QXmppTrustMessageElement> QXmppMessage::trustMessageElement() const
Returns an included trust message element as defined by XEP-0434: Trust Messages (TM).
This function was introduced in QXmpp 1.5.
See also setTrustMessageElement().
QXmppMessage::Type QXmppMessage::type() const
Returns the message's type.
See also setType().
[since QXmpp 0.6.2] QString QXmppMessage::xhtml() const
Returns the message's XHTML body as defined by XEP-0071: XHTML-IM.
This function was introduced in QXmpp 0.6.2.
See also setXhtml().
QXmppMessage &QXmppMessage::operator=(QXmppMessage &&)
Move-assignment operator.
QXmppMessage &QXmppMessage::operator=(const QXmppMessage &other)
Assignment operator.