[Telepathy-commits] [telepathy-qt4/master] Connection: Add setSimplePresenceStatus.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Sun Jan 25 14:22:22 PST 2009


---
 TelepathyQt4/Client/connection.cpp |   19 +++++++++++++++++++
 TelepathyQt4/Client/connection.h   |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/Client/connection.cpp b/TelepathyQt4/Client/connection.cpp
index 93882b4..c789b02 100644
--- a/TelepathyQt4/Client/connection.cpp
+++ b/TelepathyQt4/Client/connection.cpp
@@ -668,6 +668,25 @@ SimpleStatusSpecMap Connection::simplePresenceStatuses() const
 }
 
 /**
+ * Set the self presence status.
+ *
+ * \param status The desired status.
+ * \param statusMessage The desired status message.
+ * \return A PendingOperation which will emit PendingOperation::finished
+ *         when the call has finished.
+ */
+PendingOperation *Connection::setSimplePresenceStatus(const QString &status,
+        const QString &statusMessage)
+{
+    if (!mPriv->interfaces.contains(TELEPATHY_INTERFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE)) {
+        return new PendingFailure(this, TELEPATHY_ERROR_NOT_IMPLEMENTED,
+                "Connection does not support SimplePresence");
+    }
+    return new PendingVoidMethodCall(this,
+            simplePresenceInterface()->SetPresence(status, statusMessage));
+}
+
+/**
  * \fn Connection::optionalInterface(InterfaceSupportedChecking check) const
  *
  * Get a pointer to a valid instance of a given %Connection optional
diff --git a/TelepathyQt4/Client/connection.h b/TelepathyQt4/Client/connection.h
index c58cfca..29c4384 100644
--- a/TelepathyQt4/Client/connection.h
+++ b/TelepathyQt4/Client/connection.h
@@ -85,6 +85,7 @@ public:
     StatusSpecMap presenceStatuses() const;
 
     SimpleStatusSpecMap simplePresenceStatuses() const;
+    PendingOperation *setSimplePresenceStatus(const QString &status, const QString &statusMessage);
 
     template <class Interface>
     inline Interface *optionalInterface(
-- 
1.5.6.5




More information about the Telepathy-commits mailing list