diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2011-09-29 09:12:47 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2011-09-29 09:12:47 +0000 |
| commit | be06c3bcb0748ee719ca6e50dd768b5685c541ca (patch) | |
| tree | 2c232af8b2e22d578ecc03955433302fde150539 /src/QXmppArchiveIq.cpp | |
| parent | f1c671f6f6ef0ecf0b96dab21f03d423037fb636 (diff) | |
| download | qxmpp-be06c3bcb0748ee719ca6e50dd768b5685c541ca.tar.gz | |
Improve XEP-0136 support to enable archive deletion.
Diffstat (limited to 'src/QXmppArchiveIq.cpp')
| -rw-r--r-- | src/QXmppArchiveIq.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/QXmppArchiveIq.cpp b/src/QXmppArchiveIq.cpp index 706fe2e6..e8bef8fc 100644 --- a/src/QXmppArchiveIq.cpp +++ b/src/QXmppArchiveIq.cpp @@ -405,6 +405,84 @@ void QXmppArchivePrefIq::toXmlElementFromChild(QXmlStreamWriter *writer) const writer->writeEndElement(); } +/// Returns the JID which archived conversations must match. +/// + +QString QXmppArchiveRemoveIq::with() const +{ + return m_with; +} + +/// Sets the JID which archived conversations must match. +/// +/// \param with + +void QXmppArchiveRemoveIq::setWith(const QString &with) +{ + m_with = with; +} + +/// Returns the start date/time for the archived conversations. +/// + +QDateTime QXmppArchiveRemoveIq::start() const +{ + return m_start; +} + +/// Sets the start date/time for the archived conversations. +/// +/// \param start + +void QXmppArchiveRemoveIq::setStart(const QDateTime &start) +{ + m_start = start; +} + +/// Returns the end date/time for the archived conversations. +/// + +QDateTime QXmppArchiveRemoveIq::end() const +{ + return m_end; +} + +/// Sets the end date/time for the archived conversations. +/// +/// \param end + +void QXmppArchiveRemoveIq::setEnd(const QDateTime &end) +{ + m_end = end; +} + +bool QXmppArchiveRemoveIq::isArchiveRemoveIq(const QDomElement &element) +{ + QDomElement retrieveElement = element.firstChildElement("remove"); + return (retrieveElement.namespaceURI() == ns_archive); +} + +void QXmppArchiveRemoveIq::parseElementFromChild(const QDomElement &element) +{ + QDomElement listElement = element.firstChildElement("remove"); + m_with = listElement.attribute("with"); + m_start = datetimeFromString(listElement.attribute("start")); + m_end = datetimeFromString(listElement.attribute("end")); +} + +void QXmppArchiveRemoveIq::toXmlElementFromChild(QXmlStreamWriter *writer) const +{ + writer->writeStartElement("remove"); + writer->writeAttribute("xmlns", ns_archive); + if (!m_with.isEmpty()) + helperToXmlAddAttribute(writer, "with", m_with); + if (m_start.isValid()) + helperToXmlAddAttribute(writer, "start", datetimeToString(m_start)); + if (m_end.isValid()) + helperToXmlAddAttribute(writer, "end", datetimeToString(m_end)); + writer->writeEndElement(); +} + QXmppArchiveRetrieveIq::QXmppArchiveRetrieveIq() : QXmppIq(QXmppIq::Get), m_max(0) { |
