QXmpp Version: 1.5.6
|
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 &) |
QString | e2eeFallbackBody () const |
void | setE2eeFallbackBody (const QString &fallbackBody) |
QString | subject () const |
Returns the message's subject. | |
void | setSubject (const QString &) |
QString | thread () const |
Returns the message's thread. | |
void | setThread (const QString &) |
QString | parentThread () const |
void | setParentThread (const QString &) |
QXmppMessage::Type | type () const |
Returns the message's type. | |
void | setType (QXmppMessage::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 () |
QString | stanzaId () const |
void | setStanzaId (const QString &id) |
QString | stanzaIdBy () const |
void | setStanzaIdBy (const QString &id) |
QString | originId () const |
void | setOriginId (const QString &id) |
QString | attachId () const |
void | setAttachId (const QString &) |
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) |
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) |
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. | |
virtual | ~QXmppStanza () |
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) |
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 |
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 |
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 |
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.
QString QXmppMessage::markedId | ( | ) | const |
QString QXmppMessage::markedThread | ( | ) | const |
QXmppMessage::Marker QXmppMessage::marker | ( | ) | const |
std::optional< QXmppMixInvitation > QXmppMessage::mixInvitation | ( | ) | const |
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::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 |
|
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::setBody | ( | const QString & | body | ) |
Sets the message's body.
body |
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::setIsFallback | ( | bool | isFallback | ) |
void QXmppMessage::setIsSpoiler | ( | bool | isSpoiler | ) |
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 | ) |
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::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 | ) |
void QXmppMessage::setStanzaIdBy | ( | const QString & | by | ) |
void QXmppMessage::setState | ( | QXmppMessage::State | state | ) |
void QXmppMessage::setSubject | ( | const QString & | subject | ) |
Sets the message's subject.
subject |
void QXmppMessage::setThread | ( | const QString & | thread | ) |
Sets the message's thread.
thread |
void QXmppMessage::setTrustMessageElement | ( | const std::optional< QXmppTrustMessageElement > & | trustMessageElement | ) |
Sets a trust message element as defined by XEP-0434: Trust Messages (TM).
void QXmppMessage::setType | ( | QXmppMessage::Type | type | ) |
Sets the message's type.
type |
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 |
QString QXmppMessage::stanzaIdBy | ( | ) | const |
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 |