summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Soliverez <alvaro.soliverez@collabora.co.uk>2011-08-03 06:42:49 -0700
committerAlvaro Soliverez <alvaro.soliverez@collabora.co.uk>2011-08-03 06:44:15 -0700
commitfe0e36b227e597a2dd5045bf0458568544bf3211 (patch)
treeb4dddad63a5ef862ea7ea50aa5dadc2774e835b6
parent147d6f04eb1fbc845d739ab02c1b9d3c1826646b (diff)
A function to check whether a particular presence is supported
by the server (eg, jabber.org does not seem to support invisible). Patch provided by Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Reviewed-by: Alvaro Soliverez (HeiKu) <alvaro.soliverez@collabora.co.uk>
-rw-r--r--TelepathyQt4Yell/Models/accounts-model-item.cpp10
-rw-r--r--TelepathyQt4Yell/Models/accounts-model-item.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/TelepathyQt4Yell/Models/accounts-model-item.cpp b/TelepathyQt4Yell/Models/accounts-model-item.cpp
index 02dbcc6..4e423a3 100644
--- a/TelepathyQt4Yell/Models/accounts-model-item.cpp
+++ b/TelepathyQt4Yell/Models/accounts-model-item.cpp
@@ -308,6 +308,16 @@ void AccountsModelItem::setRequestedPresence(int type, const QString &status, co
mPriv->mAccount->setRequestedPresence(presence);
}
+bool AccountsModelItem::isPresenceSupported(int type) const
+{
+ Tp::PresenceSpecList list = mPriv->mAccount->allowedPresenceStatuses();
+ Q_FOREACH (const Tp::PresenceSpec &p, list) {
+ if (p.presence().type() == type && p.maySetOnSelf())
+ return true;
+ }
+ return false;
+}
+
void AccountsModelItem::onRemoved()
{
int index = parent()->indexOf(this);
diff --git a/TelepathyQt4Yell/Models/accounts-model-item.h b/TelepathyQt4Yell/Models/accounts-model-item.h
index f4cb162..29c613f 100644
--- a/TelepathyQt4Yell/Models/accounts-model-item.h
+++ b/TelepathyQt4Yell/Models/accounts-model-item.h
@@ -54,6 +54,7 @@ public:
Q_INVOKABLE void setAutomaticPresence(int type, const QString &status, const QString &statusMessage);
Q_INVOKABLE void setRequestedPresence(int type, const QString &status, const QString &statusMessage);
+ Q_INVOKABLE bool isPresenceSupported(int type) const;
void clearContacts();