diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-09-12 13:54:12 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-09-12 13:54:12 +0200 |
| commit | 80f977677d9cc579ad957a91e8f4931176526d80 (patch) | |
| tree | 2873ddeb3e8c3b9439fac5a1a4fe4945b7f13608 /src/base/QXmppMessage.cpp | |
| parent | 8c743b33c7baccd4910b68acdee6d2b8dccd6642 (diff) | |
| download | qxmpp-80f977677d9cc579ad957a91e8f4931176526d80.tar.gz | |
explicitly parse XEP-0249: Direct MUC Invitations message attributes
Diffstat (limited to 'src/base/QXmppMessage.cpp')
| -rw-r--r-- | src/base/QXmppMessage.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/base/QXmppMessage.cpp b/src/base/QXmppMessage.cpp index 8c692605..4952fb54 100644 --- a/src/base/QXmppMessage.cpp +++ b/src/base/QXmppMessage.cpp @@ -74,6 +74,11 @@ public: // Request message receipt as per XEP-0184. QString receiptId; bool receiptRequested; + + // XEP-0249: Direct MUC Invitations + QString mucInvitationJid; + QString mucInvitationPassword; + QString mucInvitationReason; }; /// Constructs a QXmppMessage. @@ -190,6 +195,54 @@ void QXmppMessage::setReceiptId(const QString &id) d->receiptId = id; } +/// Returns the JID for a multi-user chat direct invitation as defined +/// by XEP-0249: Direct MUC Invitations. + +QString QXmppMessage::mucInvitationJid() const +{ + return d->mucInvitationJid; +} + +/// Sets the JID for a multi-user chat direct invitation as defined +/// by XEP-0249: Direct MUC Invitations. + +void QXmppMessage::setMucInvitationJid(const QString &jid) +{ + d->mucInvitationJid = jid; +} + +/// Returns the password for a multi-user chat direct invitation as defined +/// by XEP-0249: Direct MUC Invitations. + +QString QXmppMessage::mucInvitationPassword() const +{ + return d->mucInvitationPassword; +} + +/// Sets the \a password for a multi-user chat direct invitation as defined +/// by XEP-0249: Direct MUC Invitations. + +void QXmppMessage::setMucInvitationPassword(const QString &password) +{ + d->mucInvitationPassword = password; +} + +/// Returns the reason for a multi-user chat direct invitation as defined +/// by XEP-0249: Direct MUC Invitations. + +QString QXmppMessage::mucInvitationReason() const +{ + return d->mucInvitationReason; +} + +/// Sets the \a reason for a multi-user chat direct invitation as defined +/// by XEP-0249: Direct MUC Invitations. + +void QXmppMessage::setMucInvitationReason(const QString &reason) +{ + d->mucInvitationReason = reason; +} + /// Returns the message's type. /// @@ -370,6 +423,11 @@ void QXmppMessage::parse(const QDomElement &element) d->stamp = QDateTime::fromString(str, "yyyyMMddThh:mm:ss"); d->stamp.setTimeSpec(Qt::UTC); d->stampType = LegacyDelayedDelivery; + } else if (xElement.namespaceURI() == ns_conference) { + // XEP-0249: Direct MUC Invitations + d->mucInvitationJid = xElement.attribute("jid"); + d->mucInvitationPassword = xElement.attribute("password"); + d->mucInvitationReason = xElement.attribute("reason"); } else { // other extensions extensions << QXmppElement(xElement); @@ -455,6 +513,18 @@ void QXmppMessage::toXml(QXmlStreamWriter *xmlWriter) const xmlWriter->writeEndElement(); } + // XEP-0249: Direct MUC Invitations + if (!d->mucInvitationJid.isEmpty()) { + xmlWriter->writeStartElement("x"); + xmlWriter->writeAttribute("xmlns", ns_conference); + xmlWriter->writeAttribute("jid", d->mucInvitationJid); + if (!d->mucInvitationPassword.isEmpty()) + xmlWriter->writeAttribute("password", d->mucInvitationPassword); + if (!d->mucInvitationReason.isEmpty()) + xmlWriter->writeAttribute("reason", d->mucInvitationReason); + xmlWriter->writeEndElement(); + } + // other extensions QXmppStanza::extensionsToXml(xmlWriter); |
