From 9d6acca05fd618540df843d60c199a9b0e3b6e43 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Sun, 2 Sep 2012 17:01:52 +0200 Subject: add support for vCard "DESC" element --- src/base/QXmppVCardIq.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/base/QXmppVCardIq.cpp') diff --git a/src/base/QXmppVCardIq.cpp b/src/base/QXmppVCardIq.cpp index 27bcbc34..68f573e5 100644 --- a/src/base/QXmppVCardIq.cpp +++ b/src/base/QXmppVCardIq.cpp @@ -438,6 +438,7 @@ class QXmppVCardIqPrivate : public QSharedData { public: QDate birthday; + QString description; QString firstName; QString fullName; QString lastName; @@ -504,6 +505,20 @@ void QXmppVCardIq::setBirthday(const QDate &birthday) d->birthday = birthday; } +/// Returns the free-form descriptive text. + +QString QXmppVCardIq::description() const +{ + return d->description; +} + +/// Sets the free-form descriptive text. + +void QXmppVCardIq::setDescription(const QString &description) +{ + d->description = description; +} + /// Returns the email address. /// @@ -722,6 +737,7 @@ void QXmppVCardIq::parseElementFromChild(const QDomElement& nodeRecv) // vCard QDomElement cardElement = nodeRecv.firstChildElement("vCard"); d->birthday = QDate::fromString(cardElement.firstChildElement("BDAY").text(), "yyyy-MM-dd"); + d->description = cardElement.firstChildElement("DESC").text(); d->fullName = cardElement.firstChildElement("FN").text(); d->nickName = cardElement.firstChildElement("NICKNAME").text(); QDomElement nameElement = cardElement.firstChildElement("N"); @@ -762,6 +778,8 @@ void QXmppVCardIq::toXmlElementFromChild(QXmlStreamWriter *writer) const address.toXml(writer); if (d->birthday.isValid()) helperToXmlAddTextElement(writer, "BDAY", d->birthday.toString("yyyy-MM-dd")); + if (!d->description.isEmpty()) + helperToXmlAddTextElement(writer, "DESC", d->description); foreach (const QXmppVCardEmail &email, d->emails) email.toXml(writer); if (!d->fullName.isEmpty()) -- cgit v1.2.3