From a87ddb0a7ffb76d83548eac1f4a45eac11de1335 Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Mon, 13 Dec 2010 08:33:54 +0000 Subject: use better enums for VCardUpdate types --- src/QXmppPresence.cpp | 12 ++++++------ src/QXmppPresence.h | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/QXmppPresence.cpp b/src/QXmppPresence.cpp index 64ed0d58..f1201979 100644 --- a/src/QXmppPresence.cpp +++ b/src/QXmppPresence.cpp @@ -115,14 +115,14 @@ void QXmppPresence::parse(const QDomElement &element) { m_photoHash = QByteArray::fromHex(photoElement.text().toAscii()); if(m_photoHash.isEmpty()) - m_vCardUpdateType = PhotoNotAdvertized; + m_vCardUpdateType = VCardUpdateNoPhoto; else - m_vCardUpdateType = PhotoAdvertised; + m_vCardUpdateType = VCardUpdateValidPhoto; } else { m_photoHash = QByteArray(); - m_vCardUpdateType = PhotoNotReady; + m_vCardUpdateType = VCardUpdateNotReady; } } // XEP-0115: Entity Capabilities @@ -174,13 +174,13 @@ void QXmppPresence::toXml(QXmlStreamWriter *xmlWriter) const helperToXmlAddAttribute(xmlWriter, "xmlns", ns_vcard_update); switch(m_vCardUpdateType) { - case PhotoNotAdvertized: + case VCardUpdateNoPhoto: helperToXmlAddTextElement(xmlWriter, "photo", ""); break; - case PhotoAdvertised: + case VCardUpdateValidPhoto: helperToXmlAddTextElement(xmlWriter, "photo", m_photoHash.toHex()); break; - case PhotoNotReady: + case VCardUpdateNotReady: break; default: break; diff --git a/src/QXmppPresence.h b/src/QXmppPresence.h index dddac9cb..6dfef6d8 100644 --- a/src/QXmppPresence.h +++ b/src/QXmppPresence.h @@ -49,12 +49,11 @@ public: // XEP-0153: vCard-Based Avatars enum VCardUpdateType { - // TODO fix the enum names PhotoNotAdvertized is confusing - // All of these should start with VCardUpdate VCardUpdateNone = 0, ///< Protocol is not supported - PhotoNotAdvertized, ///< User is not using any image - PhotoAdvertised, ///< User is advertising an image - PhotoNotReady ///< User is not ready to advertise an image + VCardUpdateNoPhoto, ///< User is not using any image + VCardUpdateValidPhoto, ///< User is advertising an image + VCardUpdateNotReady ///< User is not ready to advertise an image + /// \note This enables recipients to distinguish between the absence of an image /// (empty photo element) and mere support for the protocol (empty update child). }; -- cgit v1.2.3