QXmpp Version: 1.10.0
|
The QXmppMessage class represents an XMPP message. More...
#include <QXmppMessage.h>
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) |
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 bool | isXmppStanza () const |
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) |
The QXmppMessage class represents an XMPP message.
enum QXmppMessage::Hint |
enum QXmppMessage::Marker |
enum QXmppMessage::State |
This enum describes a chat state as defined by XEP-0085: Chat State Notifications.
QXmppMessage::QXmppMessage | ( | const QString & | from = QString() , |
const QString & | to = QString() , |
||
const QString & | body = QString() , |
||
const QString & | thread = QString() |
||
) |
Constructs a QXmppMessage.
from | |
to | |
body | |
thread |
void QXmppMessage::addHint | ( | const Hint | hint | ) |
QString QXmppMessage::attachId | ( | ) | const |
QXmppBitsOfBinaryDataList & QXmppMessage::bitsOfBinaryData | ( | ) |
QXmppBitsOfBinaryDataList QXmppMessage::bitsOfBinaryData | ( | ) | const |
std::optional< QXmppCallInviteElement > QXmppMessage::callInviteElement | ( | ) | const |
Returns a Call Invite element as defined in XEP-0482: Call Invites.
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).
QXmpp::EncryptionMethod QXmppMessage::encryptionMethod | ( | ) | const |
Returns the encryption method this message is advertised to be encrypted with.
encryptionMethodNs()
and possibly also a name with encryptionName()
.QString QXmppMessage::encryptionMethodNs | ( | ) | const |
QString QXmppMessage::encryptionName | ( | ) | const |
const QVector< QXmppFallback > & QXmppMessage::fallbackMarkers | ( | ) | const |
Returns the fallback elements defined in XEP-0428: Fallback Indication.
QVector< QXmppFileSourcesAttachment > QXmppMessage::fileSourcesAttachments | ( | ) | const |
Returns additional sources to be attached to a file share as defined by XEP-0447: Stateless file sharing.
bool QXmppMessage::hasHint | ( | const Hint | hint | ) | const |
bool QXmppMessage::isAttentionRequested | ( | ) | const |
bool QXmppMessage::isCarbonForwarded | ( | ) | const |
Returns whether this message has been forwarded using carbons.
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.
bool QXmppMessage::isMarkable | ( | ) | const |
bool QXmppMessage::isPrivate | ( | ) | const |
bool QXmppMessage::isReceiptRequested | ( | ) | const |
bool QXmppMessage::isSlashMeCommand | ( | ) | const |
|
static |
bool QXmppMessage::isSpoiler | ( | ) | const |
|
overridevirtual |
Indicates if the QXmppStanza is a stanza in the XMPP sense (i. e. a message, iq or presence)
Reimplemented from QXmppNonza.
std::optional< QXmppJingleMessageInitiationElement > QXmppMessage::jingleMessageInitiationElement | ( | ) | const |
Returns a Jingle Message Initiation element as defined in XEP-0353: Jingle Message Initiation.
QString QXmppMessage::markedId | ( | ) | const |
QString QXmppMessage::markedThread | ( | ) | const |
QXmppMessage::Marker QXmppMessage::marker | ( | ) | const |
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.
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).
QString QXmppMessage::mixUserJid | ( | ) | const |
Returns the actual JID of a MIX channel participant.
QString QXmppMessage::mixUserNick | ( | ) | const |
Returns the MIX participant's nickname.
QString QXmppMessage::mucInvitationJid | ( | ) | const |
QString QXmppMessage::mucInvitationPassword | ( | ) | const |
QString QXmppMessage::mucInvitationReason | ( | ) | const |
QString QXmppMessage::originId | ( | ) | const |
QString QXmppMessage::outOfBandUrl | ( | ) | const |
QVector< QXmppOutOfBandUrl > QXmppMessage::outOfBandUrls | ( | ) | const |
QString QXmppMessage::parentThread | ( | ) | const |
Returns the optional parent thread of this message.
The possibility to create child threads was added in RFC6121.
|
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.
element | child element of the message to be parsed |
sceMode | Which elements to be parsed from the DOM (all known / only public / only sensitive) |
void QXmppMessage::parseExtensions | ( | const QDomElement & | element, |
QXmpp::SceMode | sceMode | ||
) |
Parses all child elements of a message stanza.
element | message element or SCE content element |
sceMode | mode to decide which child elements of the message to parse |
std::optional< QXmppMessageReaction > QXmppMessage::reaction | ( | ) | const |
Returns a reaction to a message as defined by XEP-0444: Message Reactions.
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.
element | whether to use the body or the subject text |
supportedNamespaces |
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.
element | whether to use the body or the subject text |
forNamespace |
QString QXmppMessage::readReplyQuoteFromBody | ( | ) | const |
Returns the part of the body that is marked as fallback for XEP-0461: Message Replies, without any quotation marks ('> ').
QString QXmppMessage::receiptId | ( | ) | const |
If this message is a delivery receipt, returns the ID of the original message.
void QXmppMessage::removeAllHints | ( | ) |
void QXmppMessage::removeHint | ( | const Hint | hint | ) |
QString QXmppMessage::replaceId | ( | ) | const |
std::optional< QXmpp::Reply > QXmppMessage::reply | ( | ) | const |
Returns the message reply extension as defined in XEP-0461: Message Replies.
|
virtual |
Serializes all additional child elements.
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). |
void QXmppMessage::setAttachId | ( | const QString & | attachId | ) |
void QXmppMessage::setAttentionRequested | ( | bool | requested | ) |
void QXmppMessage::setBitsOfBinaryData | ( | const QXmppBitsOfBinaryDataList & | bitsOfBinaryData | ) |
void QXmppMessage::setCallInviteElement | ( | std::optional< QXmppCallInviteElement > | callInviteElement | ) |
Sets a Call Invite element as defined in XEP-0482: Call Invites.
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.
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).
fallbackBody | end-to-end encryption fallback body |
void QXmppMessage::setEncryptionMethod | ( | QXmpp::EncryptionMethod | method | ) |
void QXmppMessage::setEncryptionMethodNs | ( | const QString & | encryptionMethod | ) |
void QXmppMessage::setEncryptionName | ( | const QString & | encryptionName | ) |
void QXmppMessage::setFallbackMarkers | ( | const QVector< QXmppFallback > & | fallbackMarkers | ) |
Sets the fallback elements defined in XEP-0428: Fallback Indication.
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.
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.
void QXmppMessage::setIsSpoiler | ( | bool | isSpoiler | ) |
void QXmppMessage::setJingleMessageInitiationElement | ( | const std::optional< QXmppJingleMessageInitiationElement > & | jingleMessageInitiationElement | ) |
Sets a Jingle Message Initiation element as defined in XEP-0353: Jingle Message Initiation.
void QXmppMessage::setMarkable | ( | const bool | markable | ) |
void QXmppMessage::setMarkedThread | ( | const QString & | markedThread | ) |
void QXmppMessage::setMarker | ( | const Marker | marker | ) |
void QXmppMessage::setMarkerId | ( | const QString & | markerId | ) |
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.
void QXmppMessage::setMixUserJid | ( | const QString & | mixUserJid | ) |
Sets the actual JID of a MIX channel participant.
void QXmppMessage::setMixUserNick | ( | const QString & | mixUserNick | ) |
Sets the MIX participant's nickname.
void QXmppMessage::setMucInvitationJid | ( | const QString & | jid | ) |
void QXmppMessage::setMucInvitationPassword | ( | const QString & | password | ) |
void QXmppMessage::setMucInvitationReason | ( | const QString & | reason | ) |
void QXmppMessage::setOriginId | ( | const QString & | id | ) |
void QXmppMessage::setOutOfBandUrl | ( | const QString & | url | ) |
void QXmppMessage::setOutOfBandUrls | ( | const QVector< QXmppOutOfBandUrl > & | urls | ) |
void QXmppMessage::setParentThread | ( | const QString & | parent | ) |
Sets the optional parent thread of this message.
The possibility to create child threads was added in RFC6121.
void QXmppMessage::setPrivate | ( | const bool | priv | ) |
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:
void QXmppMessage::setReceiptId | ( | const QString & | id | ) |
Make this message a delivery receipt for the message with the given id.
void QXmppMessage::setReceiptRequested | ( | bool | requested | ) |
void QXmppMessage::setReplaceId | ( | const QString & | replaceId | ) |
void QXmppMessage::setReply | ( | const std::optional< QXmpp::Reply > & | ) |
Sets the message reply extension as defined in XEP-0461: Message Replies.
void QXmppMessage::setSharedFiles | ( | const QVector< QXmppFileShare > & | sharedFiles | ) |
Sets the via XEP-0447: Stateless file sharing shared files attached to this message.
void QXmppMessage::setSpoilerHint | ( | const QString & | spoilerHint | ) |
void QXmppMessage::setStamp | ( | const QDateTime & | stamp | ) |
void QXmppMessage::setStanzaId | ( | const QString & | id | ) |
Sets the stanza ID of the message according to XEP-0359: Unique and Stable Stanza IDs.
void QXmppMessage::setStanzaIdBy | ( | const QString & | by | ) |
Sets the creator of the stanza ID according to XEP-0359: Unique and Stable Stanza IDs.
void QXmppMessage::setStanzaIds | ( | const QVector< QXmppStanzaId > & | ids | ) |
Sets the stanza IDs of the message as defined in XEP-0359: Unique and Stable Stanza IDs.
void QXmppMessage::setState | ( | QXmppMessage::State | state | ) |
void QXmppMessage::setTrustMessageElement | ( | const std::optional< QXmppTrustMessageElement > & | trustMessageElement | ) |
Sets a trust message element as defined by XEP-0434: Trust Messages (TM).
void QXmppMessage::setXhtml | ( | const QString & | xhtml | ) |
const QVector< QXmppFileShare > & QXmppMessage::sharedFiles | ( | ) | const |
Returns the via XEP-0447: Stateless file sharing shared files attached to this message.
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.
|
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.
QString QXmppMessage::spoilerHint | ( | ) | const |
QDateTime QXmppMessage::stamp | ( | ) | const |
QString QXmppMessage::stanzaId | ( | ) | const |
Returns the stanza ID of the message according to XEP-0359: Unique and Stable Stanza IDs.
QString QXmppMessage::stanzaIdBy | ( | ) | const |
Returns the creator of the stanza ID according to XEP-0359: Unique and Stable Stanza IDs.
QVector< QXmppStanzaId > QXmppMessage::stanzaIds | ( | ) | const |
Returns the stanza IDs of the message as defined in XEP-0359: Unique and Stable Stanza IDs.
QXmppMessage::State QXmppMessage::state | ( | ) | const |
std::optional< QXmppTrustMessageElement > QXmppMessage::trustMessageElement | ( | ) | const |
Returns an included trust message element as defined by XEP-0434: Trust Messages (TM).
QString QXmppMessage::xhtml | ( | ) | const |