aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppVCardIq.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-09-02 17:01:52 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-09-02 17:01:52 +0200
commit9d6acca05fd618540df843d60c199a9b0e3b6e43 (patch)
tree2a57b1ad2aa452f471bc46ca245dc6fec234803a /src/base/QXmppVCardIq.cpp
parent76b2060429b4c39ac957600196a9bc1de840e59e (diff)
downloadqxmpp-9d6acca05fd618540df843d60c199a9b0e3b6e43.tar.gz
add support for vCard "DESC" element
Diffstat (limited to 'src/base/QXmppVCardIq.cpp')
-rw-r--r--src/base/QXmppVCardIq.cpp18
1 files changed, 18 insertions, 0 deletions
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())