aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-18 16:33:00 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-18 16:33:00 +0200
commit2b2b251d5cfd324df9ec3bfdc110568a43f03140 (patch)
treecbd9483edf8ad398f210b730b9f6184ca3a8b86c
parentc0ddf372e5ccfdda3265bdf33bfc1276d9af6885 (diff)
downloadqxmpp-2b2b251d5cfd324df9ec3bfdc110568a43f03140.tar.gz
restore support for obsolete "invisible" presence (fixes issue #111)
-rw-r--r--src/base/QXmppPresence.cpp4
-rw-r--r--src/base/QXmppPresence.h1
-rw-r--r--tests/presence.cpp12
3 files changed, 13 insertions, 4 deletions
diff --git a/src/base/QXmppPresence.cpp b/src/base/QXmppPresence.cpp
index 42143b10..e5821068 100644
--- a/src/base/QXmppPresence.cpp
+++ b/src/base/QXmppPresence.cpp
@@ -318,6 +318,8 @@ void QXmppPresence::Status::setTypeFromStr(const QString& str)
m_type = QXmppPresence::Status::DND;
else if(str == "xa")
m_type = QXmppPresence::Status::XA;
+ else if(str == "invisible")
+ m_type = QXmppPresence::Status::Invisible;
else {
qWarning("QXmppPresence::Status::setTypeFromStr() invalid input string type %s",
qPrintable(str));
@@ -341,6 +343,8 @@ QString QXmppPresence::Status::getTypeStr() const
return "dnd";
case QXmppPresence::Status::Chat:
return "chat";
+ case QXmppPresence::Status::Invisible:
+ return "invisible";
default:
qWarning("QXmppPresence::Status::getTypeStr() invalid type %d",
(int)m_type);
diff --git a/src/base/QXmppPresence.h b/src/base/QXmppPresence.h
index b4a12be9..a34526c4 100644
--- a/src/base/QXmppPresence.h
+++ b/src/base/QXmppPresence.h
@@ -77,6 +77,7 @@ public:
XA, ///< The entity or resource is away for an extended period.
DND, ///< The entity or resource is busy ("Do Not Disturb").
Chat, ///< The entity or resource is actively interested in chatting.
+ Invisible ///< obsolete XEP-0018: Invisible Presence
};
Status(QXmppPresence::Status::Type type = QXmppPresence::Status::Online,
diff --git a/tests/presence.cpp b/tests/presence.cpp
index 9c65566b..e134b30b 100644
--- a/tests/presence.cpp
+++ b/tests/presence.cpp
@@ -41,10 +41,14 @@ void tst_QXmppPresence::testPresence_data()
QTest::newRow("unavailable") << QByteArray("<presence type=\"unavailable\"/>") << int(QXmppPresence::Unavailable) << 0 << int(QXmppPresence::Status::Online) << "" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
QTest::newRow("error") << QByteArray("<presence type=\"error\"/>") << int(QXmppPresence::Error) << 0 << int(QXmppPresence::Status::Online) << "" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
- QTest::newRow("away") << QByteArray("<presence><show>away</show><status>In a meeting</status><priority>5</priority></presence>") << int(QXmppPresence::Available) << 5 << int(QXmppPresence::Status::Away) << "In a meeting" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
- QTest::newRow("dnd") << QByteArray("<presence><show>dnd</show><status>In a meeting</status><priority>5</priority></presence>") << int(QXmppPresence::Available) << 5 << int(QXmppPresence::Status::DND) << "In a meeting" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
- QTest::newRow("chat") << QByteArray("<presence><show>chat</show><status>In a meeting</status><priority>5</priority></presence>") << int(QXmppPresence::Available) << 5 << int(QXmppPresence::Status::Chat) << "In a meeting" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
- QTest::newRow("xa") << QByteArray("<presence><show>xa</show><status>In a meeting</status><priority>5</priority></presence>") << int(QXmppPresence::Available) << 5 << int(QXmppPresence::Status::XA) << "In a meeting" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
+ QTest::newRow("full") << QByteArray("<presence><show>away</show><status>In a meeting</status><priority>5</priority></presence>") << int(QXmppPresence::Available) << 5 << int(QXmppPresence::Status::Away) << "In a meeting" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
+
+ // status type
+ QTest::newRow("away") << QByteArray("<presence><show>away</show></presence>") << int(QXmppPresence::Available) << 0 << int(QXmppPresence::Status::Away) << "" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
+ QTest::newRow("dnd") << QByteArray("<presence><show>dnd</show></presence>") << int(QXmppPresence::Available) << 0 << int(QXmppPresence::Status::DND) << "" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
+ QTest::newRow("chat") << QByteArray("<presence><show>chat</show></presence>") << int(QXmppPresence::Available) << 0 << int(QXmppPresence::Status::Chat) << "" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
+ QTest::newRow("xa") << QByteArray("<presence><show>xa</show></presence>") << int(QXmppPresence::Available) << 0 << int(QXmppPresence::Status::XA) << "" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
+ QTest::newRow("invisible") << QByteArray("<presence><show>invisible</show></presence>") << int(QXmppPresence::Available) << 0 << int(QXmppPresence::Status::Invisible) << "" << int(QXmppPresence::VCardUpdateNone) << QByteArray();
QTest::newRow("vcard-photo") << QByteArray(
"<presence>"