QXmpp: QXmppMessage Class Reference

QXmpp Version: 1.14.3

Loading...
Searching...
No Matches
QXmppMessage Class Reference
Stanzas

The QXmppMessage class represents an XMPP message. More...

`#include <QXmppMessage.h>`

Inheritance diagram for QXmppMessage:

## Public Types
enum | Type { Error = 0 , Normal , Chat , GroupChat , Headline }
| This enum describes a message type.
enum | State { None = 0 , Active , Inactive , Gone , Composing , Paused }
enum | Marker { NoMarker = 0 , Received , Displayed , Acknowledged }
enum | Hint { NoPermanentStore = 1 << 0 , NoStore = 1 << 1 , NoCopy = 1 << 2 , Store = 1 << 3 }

## Public Member Functions
| QXmppMessage (const QString &from=QString(), const QString &to=QString(), const QString &body=QString(), const QString &thread=QString())
| QXmppMessage (const QXmppMessage &other)
| Constructs a copy of other.
| QXmppMessage (QXmppMessage &&)
| Move-constructor.
QXmppMessage & | operator= (const QXmppMessage &other)
| Assignment operator.
QXmppMessage & | operator= (QXmppMessage &&)
| Move-assignment operator.
bool | isXmppStanza () const override
QString | body () const
| Returns the message's body.
void | setBody (const QString &)
| Sets the message's body.
QString | e2eeFallbackBody () const
void | setE2eeFallbackBody (const QString &fallbackBody)
QString | subject () const
| Returns the message's subject.
void | setSubject (const QString &)
| Sets the message's subject.
QString | thread () const
| Returns the message's thread.
void | setThread (const QString &)
| Sets the message's thread.
QString | parentThread () const
void | setParentThread (const QString &)
QXmppMessage::Type | type () const
| Returns the message's type.
void | setType (QXmppMessage::Type)
| Sets the message's type.
QString | outOfBandUrl () const
void | setOutOfBandUrl (const QString &)
QVector< QXmppOutOfBandUrl > | outOfBandUrls () const
void | setOutOfBandUrls (const QVector< QXmppOutOfBandUrl > &urls)
QString | xhtml () const
void | setXhtml (const QString &xhtml)
QXmppMessage::State | state () const
void | setState (QXmppMessage::State)
QDateTime | stamp () const
void | setStamp (const QDateTime &stamp)
bool | isReceiptRequested () const
void | setReceiptRequested (bool requested)
QString | receiptId () const
void | setReceiptId (const QString &id)
bool | isAttentionRequested () const
void | setAttentionRequested (bool requested)
QXmppBitsOfBinaryDataList | bitsOfBinaryData () const
QXmppBitsOfBinaryDataList & | bitsOfBinaryData ()
void | setBitsOfBinaryData (const QXmppBitsOfBinaryDataList &bitsOfBinaryData)
bool | isSlashMeCommand () const
QString | slashMeCommandText () const
QString | mucInvitationJid () const
void | setMucInvitationJid (const QString &jid)
QString | mucInvitationPassword () const
void | setMucInvitationPassword (const QString &password)
QString | mucInvitationReason () const
void | setMucInvitationReason (const QString &reason)
bool | isPrivate () const
void | setPrivate (const bool)
bool | isCarbonForwarded () const
void | setCarbonForwarded (bool)
QString | replaceId () const
void | setReplaceId (const QString &)
bool | isMarkable () const
void | setMarkable (const bool)
QString | markedId () const
void | setMarkerId (const QString &)
QString | markedThread () const
void | setMarkedThread (const QString &)
Marker | marker () const
void | setMarker (const Marker)
bool | hasHint (const Hint hint) const
void | addHint (const Hint hint)
void | removeHint (const Hint hint)
void | removeAllHints ()
std::optional< QXmppJingleMessageInitiationElement > | jingleMessageInitiationElement () const
void | setJingleMessageInitiationElement (const std::optional< QXmppJingleMessageInitiationElement > &jingleMessageInitiationElement)
QString | stanzaId () const
void | setStanzaId (const QString &id)
QString | stanzaIdBy () const
void | setStanzaIdBy (const QString &id)
QVector< QXmppStanzaId > | stanzaIds () const
void | setStanzaIds (const QVector< QXmppStanzaId > &)
QString | originId () const
void | setOriginId (const QString &id)
QString | attachId () const
void | setAttachId (const QString &)
QString | mixParticipantId () const
QString | mixUserJid () const
void | setMixUserJid (const QString &)
QString | mixUserNick () const
void | setMixUserNick (const QString &)
QXmpp::EncryptionMethod | encryptionMethod () const
void | setEncryptionMethod (QXmpp::EncryptionMethod)
QString | encryptionMethodNs () const
void | setEncryptionMethodNs (const QString &)
QString | encryptionName () const
void | setEncryptionName (const QString &)
bool | isSpoiler () const
void | setIsSpoiler (bool)
QString | spoilerHint () const
void | setSpoilerHint (const QString &)
std::optional< QXmppMixInvitation > | mixInvitation () const
void | setMixInvitation (const std::optional< QXmppMixInvitation > &mixInvitation)
QString | mucOccupantId () const
void | setMucOccupantId (const QString &occupantId)
bool | isFallback () const
void | setIsFallback (bool isFallback)
const QVector< QXmppFallback > & | fallbackMarkers () const
void | setFallbackMarkers (const QVector< QXmppFallback > &)
QString | readFallbackRemovedText (QXmppFallback::Element element, const QVector< QString > &supportedNamespaces) const
QString | readFallbackText (QXmppFallback::Element element, QStringView forNamespace) const
std::optional< QXmppTrustMessageElement > | trustMessageElement () const
void | setTrustMessageElement (const std::optional< QXmppTrustMessageElement > &trustMessageElement)
std::optional< QXmppMessageReaction > | reaction () const
void | setReaction (const std::optional< QXmppMessageReaction > &reaction)
const QVector< QXmppFileShare > & | sharedFiles () const
void | setSharedFiles (const QVector< QXmppFileShare > &sharedFiles)
QVector< QXmppFileSourcesAttachment > | fileSourcesAttachments () const
void | setFileSourcesAttachments (const QVector< QXmppFileSourcesAttachment > &)
std::optional< QXmpp::Reply > | reply () const
void | setReply (const std::optional< QXmpp::Reply > &)
QString | readReplyQuoteFromBody () const
std::optional< QXmppCallInviteElement > | callInviteElement () const
void | setCallInviteElement (std::optional< QXmppCallInviteElement > callInviteElement)
void | parseExtensions (const QDomElement &element, QXmpp::SceMode sceMode)
virtual bool | parseExtension (const QDomElement &element, QXmpp::SceMode)
virtual void | serializeExtensions (QXmlStreamWriter *writer, QXmpp::SceMode, const QString &baseNamespace={}) const
Public Member Functions inherited from QXmppStanza
| QXmppStanza (const QString &from=QString(), const QString &to=QString())
| QXmppStanza (const QXmppStanza &other)
| Constructs a copy of other.
| QXmppStanza (QXmppStanza &&)
| Move constructor.
| ~QXmppStanza () override
| Destroys a QXmppStanza.
QXmppStanza & | operator= (const QXmppStanza &other)
| Assigns other to this stanza.
QXmppStanza & | operator= (QXmppStanza &&)
| Move-assignment operator.
QString | to () const
void | setTo (const QString &)
QString | from () const
void | setFrom (const QString &)
QString | id () const
void | setId (const QString &)
QString | lang () const
void | setLang (const QString &)
QXmppStanza::Error | error () const
std::optional< Error > | errorOptional () const
void | setError (const QXmppStanza::Error &error)
void | setError (const std::optional< Error > &error)
QXmppElementList | extensions () const
void | setExtensions (const QXmppElementList &elements)
QList< QXmppExtendedAddress > | extendedAddresses () const
void | setExtendedAddresses (const QList< QXmppExtendedAddress > &extendedAddresses)
std::optional< QXmppE2eeMetadata > | e2eeMetadata () const
void | setE2eeMetadata (const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
Public Member Functions inherited from QXmppNonza
virtual void | parse (const QDomElement &)=0
virtual void | toXml (QXmlStreamWriter *writer) const =0

## Static Public Member Functions
static bool | isSlashMeCommand (const QString &body)
static QString | slashMeCommandText (const QString &body)

## Detailed Description

The QXmppMessage class represents an XMPP message.

## Member Enumeration Documentation

## ◆ Hint

enum QXmppMessage::Hint

XEP-0334: Message Processing Hints

Since
  QXmpp 1.1

Enumerator
NoPermanentStore | Do not allow permanent storage.
NoStore | Do not store at all.
NoCopy | Do not copy the message.
Store | Do store the message.

## ◆ Marker

enum QXmppMessage::Marker

This enum describes a chat marker as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ State

enum QXmppMessage::State

This enum describes a chat state as defined by XEP-0085: Chat State Notifications.

Since
  QXmpp 0.2

Enumerator
None | The message does not contain any chat state information.
Active | User is actively participating in the chat session.
Inactive | User has not been actively participating in the chat session.
Gone | User has effectively ended their participation in the chat session.
Composing | User is composing a message.
Paused | User had been composing but now has stopped.

## Constructor & Destructor Documentation

## ◆ QXmppMessage()

QXmppMessage::QXmppMessage | ( | const QString & | from = QString(),
|  | const QString & | to = QString(),
|  | const QString & | body = QString(),
|  | const QString & | thread = QString() )

Constructs a QXmppMessage.

Parameters

  from |
  to |
  body |
  thread |

## Member Function Documentation

## ◆ addHint()

void QXmppMessage::addHint | ( | const Hint | hint | ) |

Adds a hint to the message, as defined in XEP-0334: Message Processing Hints

Since
  QXmpp 1.1

## ◆ attachId()

QString QXmppMessage::attachId | ( |  | ) | const

Returns the message id this message is linked/attached to. See XEP-0367: Message Attaching for details.

Since
  QXmpp 1.1

## ◆ bitsOfBinaryData() [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.

Since
  QXmpp 1.2

## ◆ bitsOfBinaryData() [2/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.

Since
  QXmpp 1.2

## ◆ callInviteElement()

std::optional< QXmppCallInviteElement > QXmppMessage::callInviteElement | ( |  | ) | const

Returns a Call Invite element as defined in XEP-0482: Call Invites.

## ◆ e2eeFallbackBody()

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).

Returns
  the end-to-end encryption fallback body

Since
  QXmpp 1.5

## ◆ encryptionMethod()

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.
  If this returns QXmppMessage::UnknownEncryption, you can still get the namespace of the encryption with `encryptionMethodNs()` and possibly also a name with `encryptionName()`.

Since
  QXmpp 1.1

## ◆ encryptionMethodNs()

QString QXmppMessage::encryptionMethodNs | ( |  | ) | const

Returns the namespace of the advertised encryption method via. XEP-0380: Explicit Message Encryption.

Since
  QXmpp 1.1

## ◆ encryptionName()

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.

Since
  QXmpp 1.1

## ◆ fallbackMarkers()

const QVector< QXmppFallback > & QXmppMessage::fallbackMarkers | ( |  | ) | const

Returns the fallback elements defined in XEP-0428: Fallback Indication.

Since
  QXmpp 1.7

## ◆ fileSourcesAttachments()

QVector< QXmppFileSourcesAttachment > QXmppMessage::fileSourcesAttachments | ( |  | ) | const

Returns additional sources to be attached to a file share as defined by XEP-0447: Stateless file sharing.

Since
  QXmpp 1.7

## ◆ hasHint()

bool QXmppMessage::hasHint | ( | const Hint | hint | ) | const

Returns true if the message contains the hint passed, as defined in XEP-0334: Message Processing Hints

Since
  QXmpp 1.1

## ◆ isAttentionRequested()

bool QXmppMessage::isAttentionRequested | ( |  | ) | const

Returns true if the user's attention is requested, as defined by XEP-0224: Attention.

Since
  QXmpp 0.4

## ◆ isCarbonForwarded()

bool QXmppMessage::isCarbonForwarded | ( |  | ) | const

Returns whether this message has been forwarded using carbons.

Since
  QXmpp 1.5

## ◆ isFallback()

bool QXmppMessage::isFallback | ( |  | ) | const

Sets whether this message is only a fallback according to XEP-0428: Fallback Indication.

This is useful for clients not supporting end-to-end encryption to indicate that the message body does not contain the intended text of the author.

Deprecated
  Use fallbackMarkers() instead, it provides full access to the fallback elements.

Since
  QXmpp 1.3

## ◆ isMarkable()

bool QXmppMessage::isMarkable | ( |  | ) | const

Returns true if a message is markable, as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ isPrivate()

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.

Since
  QXmpp 1.0

## ◆ isReceiptRequested()

bool QXmppMessage::isReceiptRequested | ( |  | ) | const

Returns true if a delivery receipt is requested, as defined by XEP-0184: Message Delivery Receipts.

Since
  QXmpp 0.4

## ◆ isSlashMeCommand() [1/2]

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.

Since
  QXmpp 1.3

## ◆ isSlashMeCommand() [2/2]

bool QXmppMessage::isSlashMeCommand | ( | const QString & | body | ) |
| static

Returns whether the given text is a '/me command' as defined in XEP-0245: The /me Command.

Since
  QXmpp 1.3

## ◆ isSpoiler()

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.

Since
  QXmpp 1.1

## ◆ isXmppStanza()

bool QXmppMessage::isXmppStanza | ( |  | ) | const
| overridevirtual

Indicates if the QXmppStanza is a stanza in the XMPP sense (i. e. a message, iq or presence)

Since
  QXmpp 1.0

Reimplemented from QXmppNonza.

## ◆ jingleMessageInitiationElement()

std::optional< QXmppJingleMessageInitiationElement > QXmppMessage::jingleMessageInitiationElement | ( |  | ) | const

Returns a Jingle Message Initiation element as defined in XEP-0353: Jingle Message Initiation.

## ◆ markedId()

QString QXmppMessage::markedId | ( |  | ) | const

Returns the message's marker id, as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ markedThread()

QString QXmppMessage::markedThread | ( |  | ) | const

Returns the message's marker thread, as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ marker()

QXmppMessage::Marker QXmppMessage::marker | ( |  | ) | const

Returns the message's marker, as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ mixInvitation()

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.

Since
  QXmpp 1.4

## ◆ mixParticipantId()

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).

Since
  QXmpp 1.7

## ◆ mixUserJid()

QString QXmppMessage::mixUserJid | ( |  | ) | const

Returns the actual JID of a MIX channel participant.

Since
  QXmpp 1.1

## ◆ mixUserNick()

QString QXmppMessage::mixUserNick | ( |  | ) | const

Returns the MIX participant's nickname.

Since
  QXmpp 1.1

## ◆ mucInvitationJid()

QString QXmppMessage::mucInvitationJid | ( |  | ) | const

Returns the JID for a multi-user chat direct invitation as defined by XEP-0249: Direct MUC Invitations.

Since
  QXmpp 0.7.4

## ◆ mucInvitationPassword()

QString QXmppMessage::mucInvitationPassword | ( |  | ) | const

Returns the password for a multi-user chat direct invitation as defined by XEP-0249: Direct MUC Invitations.

Since
  QXmpp 0.7.4

## ◆ mucInvitationReason()

QString QXmppMessage::mucInvitationReason | ( |  | ) | const

Returns the reason for a multi-user chat direct invitation as defined by XEP-0249: Direct MUC Invitations.

Since
  QXmpp 0.7.4

## ◆ mucOccupantId()

QString QXmppMessage::mucOccupantId | ( |  | ) | const

Returns the MUC Occupant ID as defined in XEP-0421: Occupant identifiers for semi-anonymous MUCs.

Since
  QXmpp 1.13

## ◆ originId()

QString QXmppMessage::originId | ( |  | ) | const

Returns the origin ID of the message according to XEP-0359: Unique and Stable Stanza IDs.

Since
  QXmpp 1.3

## ◆ outOfBandUrl()

QString QXmppMessage::outOfBandUrl | ( |  | ) | const

Returns a possibly attached URL from XEP-0066: Out of Band Data

Since
  QXmpp 1.0

## ◆ outOfBandUrls()

QVector< QXmppOutOfBandUrl > QXmppMessage::outOfBandUrls | ( |  | ) | const

Returns possibly attached URLs from XEP-0066: Out of Band Data

Since
  QXmpp 1.5

## ◆ parentThread()

QString QXmppMessage::parentThread | ( |  | ) | const

Returns the optional parent thread of this message.

The possibility to create child threads was added in RFC6121.

Since
  QXmpp 1.3

## ◆ parseExtension()

bool QXmppMessage::parseExtension | ( | const QDomElement & | element,
|  | QXmpp::SceMode | sceMode )
| virtual

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.

Parameters

  element | child element of the message to be parsed
  sceMode | Which elements to be parsed from the DOM (all known / only public / only sensitive)

Returns
  True, if the element was successfully parsed.

Since
  QXmpp 1.5

## ◆ parseExtensions()

void QXmppMessage::parseExtensions | ( | const QDomElement & | element,
|  | QXmpp::SceMode | sceMode )

Parses all child elements of a message stanza.

Parameters

  element | message element or SCE content element
  sceMode | mode to decide which child elements of the message to parse

## ◆ reaction()

std::optional< QXmppMessageReaction > QXmppMessage::reaction | ( |  | ) | const

Returns a reaction to a message as defined by XEP-0444: Message Reactions.

Since
  QXmpp 1.5

## ◆ readFallbackRemovedText()

QString QXmppMessage::readFallbackRemovedText | ( | QXmppFallback::Element | element,
|  | const QVector< QString > & | supportedNamespaces ) const

Returns the body or subject text of the message without parts that have a fallback marker with a supported namespace.

Parameters

  element | whether to use the body or the subject text
  supportedNamespaces |

Since
  QXmpp 1.9

## ◆ readFallbackText()

QString QXmppMessage::readFallbackText | ( | QXmppFallback::Element | element,
|  | QStringView | forNamespace ) const

Returns the parts of the body or subject that are marked as fallback for this namespace.

Parameters

  element | whether to use the body or the subject text
  forNamespace |

Since
  QXmpp 1.9

## ◆ readReplyQuoteFromBody()

QString QXmppMessage::readReplyQuoteFromBody | ( |  | ) | const

Returns the part of the body that is marked as fallback for XEP-0461: Message Replies, without any quotation marks ('> ').

Since
  QXmpp 1.9

## ◆ receiptId()

QString QXmppMessage::receiptId | ( |  | ) | const

If this message is a delivery receipt, returns the ID of the original message.

Since
  QXmpp 0.4

## ◆ removeAllHints()

void QXmppMessage::removeAllHints | ( |  | ) |

Removes all hints from the message, as defined in XEP-0334: Message Processing Hints

Since
  QXmpp 1.1

## ◆ removeHint()

void QXmppMessage::removeHint | ( | const Hint | hint | ) |

Removes a hint from the message, as defined in XEP-0334: Message Processing Hints

Since
  QXmpp 1.1

## ◆ replaceId()

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.

Since
  QXmpp 1.0

## ◆ reply()

std::optional< QXmpp::Reply > QXmppMessage::reply | ( |  | ) | const

Returns the message reply extension as defined in XEP-0461: Message Replies.

Since
  QXmpp 1.9

## ◆ serializeExtensions()

void QXmppMessage::serializeExtensions | ( | QXmlStreamWriter * | writer,
|  | QXmpp::SceMode | sceMode,
|  | const QString & | baseNamespace = {} ) const
| virtual

Serializes all additional child elements.

Parameters

  writer | The XML stream writer to output the XML
  sceMode | The mode which decides which elements to output (only useful for encryption)
  baseNamespace | Custom namespace added to basic XMPP-Core elements like <body/> (needed when encrypting elements outside of the stream).

Since
  QXmpp 1.5

## ◆ setAttachId()

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.

Since
  QXmpp 1.1

## ◆ setAttentionRequested()

void QXmppMessage::setAttentionRequested | ( | bool | requested | ) |

Sets whether the user's attention is requested, as defined by XEP-0224: Attention.

Parameters

  requested | Whether to request attention (true) or not (false)

Since
  QXmpp 0.4

## ◆ setBitsOfBinaryData()

void QXmppMessage::setBitsOfBinaryData | ( | const QXmppBitsOfBinaryDataList & | bitsOfBinaryData | ) |

Sets a list of XEP-0231: Bits of Binary attachments to be included.

Since
  QXmpp 1.2

## ◆ setCallInviteElement()

void QXmppMessage::setCallInviteElement | ( | std::optional< QXmppCallInviteElement > | callInviteElement | ) |

Sets a Call Invite element as defined in XEP-0482: Call Invites.

## ◆ setCarbonForwarded()

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.

Since
  QXmpp 1.5

## ◆ setE2eeFallbackBody()

void QXmppMessage::setE2eeFallbackBody | ( | const QString & | fallbackBody | ) |

Sets 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).

Parameters

  fallbackBody | end-to-end encryption fallback body

Since
  QXmpp 1.5

## ◆ setEncryptionMethod()

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.

Since
  QXmpp 1.1

## ◆ setEncryptionMethodNs()

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.

Since
  QXmpp 1.1

## ◆ setEncryptionName()

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.

Since
  QXmpp 1.1

## ◆ setFallbackMarkers()

void QXmppMessage::setFallbackMarkers | ( | const QVector< QXmppFallback > & | fallbackMarkers | ) |

Sets the fallback elements defined in XEP-0428: Fallback Indication.

Since
  QXmpp 1.7

## ◆ setFileSourcesAttachments()

void QXmppMessage::setFileSourcesAttachments | ( | const QVector< QXmppFileSourcesAttachment > & | fileSourcesAttachments | ) |

Sets additional sources to be attached to a file share as defined by XEP-0447: Stateless file sharing.

Since
  QXmpp 1.7

## ◆ setIsFallback()

void QXmppMessage::setIsFallback | ( | bool | isFallback | ) |

Sets whether this message is only a fallback according to XEP-0428: Fallback Indication.

This is useful for clients not supporting end-to-end encryption to indicate that the message body does not contain the intended text of the author.

Deprecated
  Use setFallbackMarkers() instead, it provides full access to the fallback elements.

Since
  QXmpp 1.3

## ◆ setIsSpoiler()

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.

Since
  QXmpp 1.1

## ◆ setJingleMessageInitiationElement()

void QXmppMessage::setJingleMessageInitiationElement | ( | const std::optional< QXmppJingleMessageInitiationElement > & | jingleMessageInitiationElement | ) |

Sets a Jingle Message Initiation element as defined in XEP-0353: Jingle Message Initiation.

## ◆ setMarkable()

void QXmppMessage::setMarkable | ( | const bool | markable | ) |

Sets if the message is markable, as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ setMarkedThread()

void QXmppMessage::setMarkedThread | ( | const QString & | markedThread | ) |

Sets the message's marked thread, as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ setMarker()

void QXmppMessage::setMarker | ( | const Marker | marker | ) |

Sets the message's marker, as defined by XEP-0333: Chat Markers

Since
  QXmpp 0.8.1

## ◆ setMarkerId()

void QXmppMessage::setMarkerId | ( | const QString & | markerId | ) |

Sets the message's marker id, as defined by XEP-0333: Chat Markers.

Since
  QXmpp 0.8.1

## ◆ setMixInvitation()

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.

Since
  QXmpp 1.4

## ◆ setMixUserJid()

void QXmppMessage::setMixUserJid | ( | const QString & | mixUserJid | ) |

Sets the actual JID of a MIX channel participant.

Since
  QXmpp 1.1

## ◆ setMixUserNick()

void QXmppMessage::setMixUserNick | ( | const QString & | mixUserNick | ) |

Sets the MIX participant's nickname.

Since
  QXmpp 1.1

## ◆ setMucInvitationJid()

void QXmppMessage::setMucInvitationJid | ( | const QString & | jid | ) |

Sets the JID for a multi-user chat direct invitation as defined by XEP-0249: Direct MUC Invitations.

Since
  QXmpp 0.7.4

## ◆ setMucInvitationPassword()

void QXmppMessage::setMucInvitationPassword | ( | const QString & | password | ) |

Sets the password for a multi-user chat direct invitation as defined by XEP-0249: Direct MUC Invitations.

Since
  QXmpp 0.7.4

## ◆ setMucInvitationReason()

void QXmppMessage::setMucInvitationReason | ( | const QString & | reason | ) |

Sets the reason for a multi-user chat direct invitation as defined by XEP-0249: Direct MUC Invitations.

Since
  QXmpp 0.7.4

## ◆ setMucOccupantId()

void QXmppMessage::setMucOccupantId | ( | const QString & | id | ) |

Sets the MUC Occupant ID as defined in XEP-0421: Occupant identifiers for semi-anonymous MUCs.

Since
  QXmpp 1.13

## ◆ setOriginId()

void QXmppMessage::setOriginId | ( | const QString & | id | ) |

Sets the origin ID of the message according to XEP-0359: Unique and Stable Stanza IDs.

Since
  QXmpp 1.3

## ◆ setOutOfBandUrl()

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.

Since
  QXmpp 1.0

## ◆ setOutOfBandUrls()

void QXmppMessage::setOutOfBandUrls | ( | const QVector< QXmppOutOfBandUrl > & | urls | ) |

Sets the attached URLs for XEP-0066: Out of Band Data

Since
  QXmpp 1.5

## ◆ setParentThread()

void QXmppMessage::setParentThread | ( | const QString & | parent | ) |

Sets the optional parent thread of this message.

The possibility to create child threads was added in RFC6121.

Since
  QXmpp 1.3

## ◆ setPrivate()

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.

Since
  QXmpp 1.0

## ◆ setReaction()

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);
QXmppMessage::addHint
void addHint(const Hint hint)
Definition QXmppMessage.cpp:875
QXmppMessage::QXmppMessage
QXmppMessage(const QString &from=QString(), const QString &to=QString(), const QString &body=QString(), const QString &thread=QString())
Definition QXmppMessage.cpp:232
QXmppMessage::Store
@ Store
Do store the message.
Definition QXmppMessage.h:124

Since
  QXmpp 1.5

## ◆ setReceiptId()

void QXmppMessage::setReceiptId | ( | const QString & | id | ) |

Make this message a delivery receipt for the message with the given id.

Since
  QXmpp 0.4

## ◆ setReceiptRequested()

void QXmppMessage::setReceiptRequested | ( | bool | requested | ) |

Sets whether a delivery receipt is requested, as defined by XEP-0184: Message Delivery Receipts.

Since
  QXmpp 0.4

## ◆ setReplaceId()

void QXmppMessage::setReplaceId | ( | const QString & | replaceId | ) |

Sets the message id to replace with this message as in XEP-0308: Last Message Correction.

Since
  QXmpp 1.0

## ◆ setReply()

void QXmppMessage::setReply | ( | const std::optional< QXmpp::Reply > & |  | ) |

Sets the message reply extension as defined in XEP-0461: Message Replies.

Since
  QXmpp 1.9

## ◆ setSharedFiles()

void QXmppMessage::setSharedFiles | ( | const QVector< QXmppFileShare > & | sharedFiles | ) |

Sets the via XEP-0447: Stateless file sharing shared files attached to this message.

Since
  QXmpp 1.5

## ◆ setSpoilerHint()

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.

Since
  QXmpp 1.1

## ◆ setStamp()

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.

Since
  QXmpp 0.2

## ◆ setStanzaId()

void QXmppMessage::setStanzaId | ( | const QString & | id | ) |

Sets the stanza ID of the message according to XEP-0359: Unique and Stable Stanza IDs.

Deprecated
  Use setStanzaIds() instead.

Since
  QXmpp 1.3

## ◆ setStanzaIdBy()

void QXmppMessage::setStanzaIdBy | ( | const QString & | by | ) |

Sets the creator of the stanza ID according to XEP-0359: Unique and Stable Stanza IDs.

Deprecated
  Use setStanzaIds() instead.

Since
  QXmpp 1.3

## ◆ setStanzaIds()

void QXmppMessage::setStanzaIds | ( | const QVector< QXmppStanzaId > & | ids | ) |

Sets the stanza IDs of the message as defined in XEP-0359: Unique and Stable Stanza IDs.

Since
  QXmpp 1.8

## ◆ setState()

void QXmppMessage::setState | ( | QXmppMessage::State | state | ) |

Sets the the chat state notification according to XEP-0085: Chat State Notifications.

Since
  QXmpp 0.2

## ◆ setTrustMessageElement()

void QXmppMessage::setTrustMessageElement | ( | const std::optional< QXmppTrustMessageElement > & | trustMessageElement | ) |

Sets a trust message element as defined by XEP-0434: Trust Messages (TM).

Since
  QXmpp 1.5

## ◆ setXhtml()

void QXmppMessage::setXhtml | ( | const QString & | xhtml | ) |

Sets the message's XHTML body as defined by XEP-0071: XHTML-IM.

Since
  QXmpp 0.6.2

## ◆ sharedFiles()

const QVector< QXmppFileShare > & QXmppMessage::sharedFiles | ( |  | ) | const

Returns the via XEP-0447: Stateless file sharing shared files attached to this message.

Since
  QXmpp 1.5

## ◆ slashMeCommandText() [1/2]

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.

Since
  QXmpp 1.3

## ◆ slashMeCommandText() [2/2]

QString QXmppMessage::slashMeCommandText | ( | const QString & | body | ) |
| static

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.

Since
  QXmpp 1.3

## ◆ spoilerHint()

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.

Since
  QXmpp 1.1

## ◆ stamp()

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).

Since
  QXmpp 0.2

## ◆ stanzaId()

QString QXmppMessage::stanzaId | ( |  | ) | const

Returns the stanza ID of the message according to XEP-0359: Unique and Stable Stanza IDs.

Deprecated
  Use stanzaIds() instead.

Since
  QXmpp 1.3

## ◆ stanzaIdBy()

QString QXmppMessage::stanzaIdBy | ( |  | ) | const

Returns the creator of the stanza ID according to XEP-0359: Unique and Stable Stanza IDs.

Deprecated
  Use stanzaIds() instead.

Since
  QXmpp 1.3

## ◆ stanzaIds()

QVector< QXmppStanzaId > QXmppMessage::stanzaIds | ( |  | ) | const

Returns the stanza IDs of the message as defined in XEP-0359: Unique and Stable Stanza IDs.

Since
  QXmpp 1.8

## ◆ state()

QXmppMessage::State QXmppMessage::state | ( |  | ) | const

Returns the the chat state notification according to XEP-0085: Chat State Notifications.

Since
  QXmpp 0.2

## ◆ trustMessageElement()

std::optional< QXmppTrustMessageElement > QXmppMessage::trustMessageElement | ( |  | ) | const

Returns an included trust message element as defined by XEP-0434: Trust Messages (TM).

Since
  QXmpp 1.5

## ◆ xhtml()

QString QXmppMessage::xhtml | ( |  | ) | const

Returns the message's XHTML body as defined by XEP-0071: XHTML-IM.

Since
  QXmpp 0.6.2

The documentation for this class was generated from the following files:

- QXmppMessage.h
- QXmppMessage.cpp