[Telepathy-commits] [telepathy-qt4/master] Connection: Remove presence (legacy) interface high-level API support.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Mon Jan 26 06:19:47 PST 2009
Connection: Remove presence (legacy) interface high-level API support (to
use it use Connection::presenceInterface() directly).
---
TelepathyQt4/Client/connection.cpp | 90 +-----------------------------------
TelepathyQt4/Client/connection.h | 6 +--
tests/pinocchio/conn-basics.cpp | 9 +---
3 files changed, 3 insertions(+), 102 deletions(-)
diff --git a/TelepathyQt4/Client/connection.cpp b/TelepathyQt4/Client/connection.cpp
index b304e26..48fbd81 100644
--- a/TelepathyQt4/Client/connection.cpp
+++ b/TelepathyQt4/Client/connection.cpp
@@ -111,7 +111,6 @@ struct Connection::Private
void startIntrospection();
void introspectMain();
- void introspectPresence();
void introspectSimplePresence();
void changeReadiness(Readiness newReadiness);
@@ -128,7 +127,6 @@ struct Connection::Private
ConnectionInterface *baseInterface;
// Optional interface proxies
- ConnectionInterfacePresenceInterface *presence;
DBus::PropertiesInterface *properties;
bool ready;
@@ -152,7 +150,6 @@ struct Connection::Private
uint status;
uint statusReason;
bool haveInitialStatus;
- StatusSpecMap presenceStatuses;
SimpleStatusSpecMap simplePresenceStatuses;
// (Bus connection name, service name) -> HandleContext
@@ -209,7 +206,6 @@ Connection::Private::Private(Connection *parent)
: parent(parent),
baseInterface(new ConnectionInterface(parent->dbusConnection(),
parent->busName(), parent->objectPath(), parent)),
- presence(0),
properties(0),
initialIntrospection(false),
readiness(ReadinessJustCreated),
@@ -307,27 +303,6 @@ void Connection::Private::introspectMain()
SLOT(gotInterfaces(QDBusPendingCallWatcher *)));
}
-void Connection::Private::introspectPresence()
-{
- // The Presence interface is not usable before the connection is established
- if (initialIntrospection) {
- parent->continueIntrospection();
- return;
- }
-
- if (!presence) {
- presence = parent->presenceInterface();
- Q_ASSERT(presence != 0);
- }
-
- debug() << "Calling GetStatuses() (legacy)";
- QDBusPendingCallWatcher *watcher =
- new QDBusPendingCallWatcher(presence->GetStatuses(), parent);
- parent->connect(watcher,
- SIGNAL(finished(QDBusPendingCallWatcher *)),
- SLOT(gotStatuses(QDBusPendingCallWatcher *)));
-}
-
void Connection::Private::introspectSimplePresence()
{
if (!properties) {
@@ -533,34 +508,6 @@ QStringList Connection::interfaces() const
}
/**
- * Return a dictionary of presence statuses valid for use with the legacy
- * Telepathy Presence interface on the remote object.
- *
- * The returned value is undefined unless the Connection has status
- * ConnectionStatusConnected and the list returned by interfaces() contains
- * %TELEPATHY_INTERFACE_CONNECTION_INTERFACE_PRESENCE.
- *
- * \return Dictionary from string identifiers to structs for each valid status.
- */
-StatusSpecMap Connection::presenceStatuses() const
-{
- if (mPriv->missingFeatures & FeaturePresence) {
- warning() << "Trying to retrieve presence from connection, but "
- "presence is not supported";
- }
- else if (!(mPriv->features & FeaturePresence)) {
- warning() << "Trying to retrieve presence from connection without "
- "calling Connection::becomeReady(FeaturePresence)";
- }
- else if (mPriv->pendingFeatures & FeaturePresence) {
- warning() << "Trying to retrieve presence from connection, but "
- "presence is still being retrieved";
- }
-
- return mPriv->presenceStatuses;
-}
-
-/**
* Return a dictionary of presence statuses valid for use with the new(er)
* Telepathy SimplePresence interface on the remote object.
*
@@ -856,10 +803,6 @@ void Connection::gotInterfaces(QDBusPendingCallWatcher *watcher)
// queue introspection of all optional features and add the feature to
// pendingFeatures so we don't queue up the introspect func for the feature
// again on becomeReady.
- if (mPriv->interfaces.contains(TELEPATHY_INTERFACE_CONNECTION_INTERFACE_PRESENCE)) {
- mPriv->introspectQueue.enqueue(&Private::introspectPresence);
- mPriv->pendingFeatures |= FeaturePresence;
- }
if (mPriv->interfaces.contains(TELEPATHY_INTERFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE)) {
mPriv->introspectQueue.enqueue(&Private::introspectSimplePresence);
mPriv->pendingFeatures |= FeatureSimplePresence;
@@ -876,33 +819,6 @@ void Connection::gotInterfaces(QDBusPendingCallWatcher *watcher)
watcher->deleteLater();
}
-void Connection::gotStatuses(QDBusPendingCallWatcher *watcher)
-{
- QDBusPendingReply<StatusSpecMap> reply = *watcher;
-
- mPriv->pendingFeatures &= ~FeaturePresence;
-
- if (!reply.isError()) {
- mPriv->features |= FeaturePresence;
- debug() << "Adding FeaturePresence to features";
-
- mPriv->presenceStatuses = reply.value();
- debug() << "Got" << mPriv->presenceStatuses.size() << "legacy presence statuses";
- }
- else {
- mPriv->missingFeatures |= FeaturePresence;
- debug() << "Adding FeaturePresence to missing features";
-
-
- warning().nospace() << "GetStatuses() failed with" <<
- reply.error().name() << ":" << reply.error().message();
- }
-
- continueIntrospection();
-
- watcher->deleteLater();
-}
-
void Connection::gotSimpleStatuses(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QDBusVariant> reply = *watcher;
@@ -1252,7 +1168,7 @@ PendingOperation *Connection::becomeReady(Features requestedFeatures)
}
}
- Feature optionalFeatures[3] = { FeaturePresence, FeatureSimplePresence };
+ Feature optionalFeatures[1] = { FeatureSimplePresence };
Feature optionalFeature;
for (uint i = 0; i < sizeof(optionalFeatures) / sizeof(Feature); ++i) {
optionalFeature = optionalFeatures[i];
@@ -1405,10 +1321,6 @@ void Connection::continueIntrospection()
// we should have all interfaces now, so if an interface is not
// present and we have a feature for it, add the feature to missing
// features.
- if (!mPriv->interfaces.contains(TELEPATHY_INTERFACE_CONNECTION_INTERFACE_PRESENCE)) {
- debug() << "adding FeaturePresence to missing features";
- mPriv->missingFeatures |= FeaturePresence;
- }
if (!mPriv->interfaces.contains(TELEPATHY_INTERFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE)) {
debug() << "adding FeatureSimplePresence to missing features";
mPriv->missingFeatures |= FeatureSimplePresence;
diff --git a/TelepathyQt4/Client/connection.h b/TelepathyQt4/Client/connection.h
index db8e32d..660fade 100644
--- a/TelepathyQt4/Client/connection.h
+++ b/TelepathyQt4/Client/connection.h
@@ -57,8 +57,7 @@ class Connection : public StatefulDBusProxy,
public:
enum Feature {
- FeaturePresence = 1,
- FeatureSimplePresence = 2,
+ FeatureSimplePresence = 1,
_Padding = 0xFFFFFFFF
};
Q_DECLARE_FLAGS(Features, Feature)
@@ -79,8 +78,6 @@ public:
QStringList interfaces() const;
- StatusSpecMap presenceStatuses() const;
-
SimpleStatusSpecMap simplePresenceStatuses() const;
PendingOperation *setSimplePresenceStatus(const QString &status, const QString &statusMessage);
@@ -168,7 +165,6 @@ private Q_SLOTS:
void onStatusChanged(uint, uint);
void gotStatus(QDBusPendingCallWatcher *watcher);
void gotInterfaces(QDBusPendingCallWatcher *watcher);
- void gotStatuses(QDBusPendingCallWatcher *watcher);
void gotSimpleStatuses(QDBusPendingCallWatcher *watcher);
void doReleaseSweep(uint type);
diff --git a/tests/pinocchio/conn-basics.cpp b/tests/pinocchio/conn-basics.cpp
index b599c27..8127632 100644
--- a/tests/pinocchio/conn-basics.cpp
+++ b/tests/pinocchio/conn-basics.cpp
@@ -161,24 +161,17 @@ void TestConnBasics::testConnect()
QVERIFY(disconnect(mConn, SIGNAL(statusChanged(uint, uint)),
this, SLOT(expectReady(uint, uint))));
- QVERIFY(connect(mConn->becomeReady(Connection::FeaturePresence),
- SIGNAL(finished(Telepathy::Client::PendingOperation*)),
- this,
- SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation*))));
- QCOMPARE(mLoop->exec(), 0);
-
QVERIFY(connect(mConn->becomeReady(Connection::FeatureSimplePresence),
SIGNAL(finished(Telepathy::Client::PendingOperation*)),
this,
SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation*))));
QCOMPARE(mLoop->exec(), 0);
- QVERIFY(connect(mConn->becomeReady(Connection::FeaturePresence | Connection::FeatureSimplePresence),
+ QVERIFY(connect(mConn->becomeReady(Connection::FeatureSimplePresence),
SIGNAL(finished(Telepathy::Client::PendingOperation*)),
this,
SLOT(expectSuccessfulCall(Telepathy::Client::PendingOperation*))));
QCOMPARE(mLoop->exec(), 0);
- QCOMPARE(mConn->isReady(Connection::FeaturePresence), true);
QCOMPARE(mConn->isReady(Connection::FeatureSimplePresence), false);
QCOMPARE(static_cast<uint>(mConn->status()),
--
1.5.6.5
More information about the Telepathy-commits
mailing list