diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2011-09-20 15:20:28 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2011-09-20 15:20:28 +0000 |
| commit | 44593bd7f234284a515df59cce3332f8b91d5022 (patch) | |
| tree | c826e4a4b658c9f4cf9a6c9f5792743bac3b55d4 /src/QXmppMessage.cpp | |
| parent | 037e07e751c4ebd443a5dfff99bebabdd5c9f407 (diff) | |
| download | qxmpp-44593bd7f234284a515df59cce3332f8b91d5022.tar.gz | |
add support for XEP-0224: Attention (Fixes issue #109)
Diffstat (limited to 'src/QXmppMessage.cpp')
| -rw-r--r-- | src/QXmppMessage.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/QXmppMessage.cpp b/src/QXmppMessage.cpp index 07846ec7..100b82e3 100644 --- a/src/QXmppMessage.cpp +++ b/src/QXmppMessage.cpp @@ -51,6 +51,7 @@ QXmppMessage::QXmppMessage(const QString& from, const QString& to, const m_type(Chat), m_stampType(QXmppMessage::DelayedDelivery), m_state(None), + m_attentionRequested(false), m_body(body), m_thread(thread) { @@ -78,6 +79,24 @@ void QXmppMessage::setBody(const QString& body) m_body = body; } +/// Returns true if the user's attention is requested, as defined +/// by XEP-0224: Attention. + +bool QXmppMessage::isAttentionRequested() const +{ + return m_attentionRequested; +} + +/// Sets whether the user's attention is requested, as defined +/// by XEP-0224: Attention. +/// +/// \a param requested + +void QXmppMessage::setAttentionRequested(bool requested) +{ + m_attentionRequested = requested; +} + /// Returns the message's type. /// @@ -219,6 +238,9 @@ void QXmppMessage::parse(const QDomElement &element) m_stampType = QXmppMessage::DelayedDelivery; } + // XEP-0224: Attention + m_attentionRequested = element.firstChildElement("attention").namespaceURI() == ns_attention; + QXmppElementList extensions; QDomElement xElement = element.firstChildElement("x"); while (!xElement.isNull()) @@ -284,6 +306,13 @@ void QXmppMessage::toXml(QXmlStreamWriter *xmlWriter) const } } + // XEP-0224: Attention + if (m_attentionRequested) { + xmlWriter->writeStartElement("attention"); + xmlWriter->writeAttribute("xmlns", ns_attention); + xmlWriter->writeEndElement(); + } + // other extensions foreach (const QXmppElement &extension, extensions()) extension.toXml(xmlWriter); |
