[Telepathy-commits] [telepathy-gabble/master] Implement SimplePresence

Sjoerd Simons sjoerd at luon.net
Tue Aug 19 10:54:11 PDT 2008


20080616135632-93b9a-41c4521c70e43987b338f7f0c396b41a684a7bbf.gz
---
 src/conn-presence.c |    6 ++++++
 src/connection.c    |   10 ++++++++++
 src/connection.h    |    2 ++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/conn-presence.c b/src/conn-presence.c
index 24f530b..ac6501a 100644
--- a/src/conn-presence.c
+++ b/src/conn-presence.c
@@ -281,6 +281,10 @@ static gboolean
 status_available_cb (GObject *obj, guint status)
 {
   GabbleConnection *conn = GABBLE_CONNECTION (obj);
+  TpBaseConnection *base = (TpBaseConnection *) conn;
+
+  if (base->status =!= TP_CONNECTION_STATUS_CONNECTED)
+    return FALSE;
 
   if (gabble_statuses[status].presence_type == TP_CONNECTION_PRESENCE_TYPE_HIDDEN &&
       (conn->features & GABBLE_CONNECTION_FEATURES_PRESENCE_INVISIBLE) == 0)
@@ -297,6 +301,8 @@ conn_presence_class_init (GabbleConnectionClass *klass)
       G_STRUCT_OFFSET (GabbleConnectionClass, presence_class),
       status_available_cb, construct_contact_statuses_cb,
       set_own_status_cb, gabble_statuses);
+
+  tp_presence_mixin_simple_init_dbus_properties ((GObjectClass *) klass);
 }
 
 
diff --git a/src/connection.c b/src/connection.c
index b32266e..9b0a039 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -39,6 +39,7 @@
 #include <telepathy-glib/handle-repo-static.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/svc-connection.h>
+#include <telepathy-glib/svc-generic.h>
 
 #define DEBUG_FLAG GABBLE_DEBUG_CONNECTION
 
@@ -83,6 +84,10 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection,
       conn_avatars_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CAPABILITIES,
       capabilities_service_iface_init);
+    G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_DBUS_PROPERTIES,
+       tp_dbus_properties_mixin_iface_init);
+    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
+      tp_presence_mixin_simple_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE,
       conn_presence_iface_init);
     G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_OLPC_BUDDY_INFO,
@@ -472,6 +477,7 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class)
   static const gchar *interfaces_always_present[] = {
       TP_IFACE_CONNECTION_INTERFACE_ALIASING,
       TP_IFACE_CONNECTION_INTERFACE_CAPABILITIES,
+      TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
       TP_IFACE_CONNECTION_INTERFACE_PRESENCE,
       TP_IFACE_CONNECTION_INTERFACE_AVATARS,
       NULL };
@@ -634,7 +640,11 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class)
           NULL,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  tp_dbus_properties_mixin_class_init (object_class,
+      G_STRUCT_OFFSET (GabbleConnectionClass, properties_class));
+
   conn_presence_class_init (gabble_connection_class);
+
 }
 
 static gboolean
diff --git a/src/connection.h b/src/connection.h
index c22ba31..887191b 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -26,6 +26,7 @@
 #include <loudmouth/loudmouth.h>
 #include <telepathy-glib/base-connection.h>
 #include <telepathy-glib/presence-mixin.h>
+#include <telepathy-glib/dbus-properties-mixin.h>
 
 #include "types.h"
 #include "error.h"
@@ -96,6 +97,7 @@ typedef enum {
 
 struct _GabbleConnectionClass {
     TpBaseConnectionClass parent_class;
+    TpDBusPropertiesMixinClass properties_class;
     TpPresenceMixinClass presence_class;
 };
 
-- 
1.5.6.3




More information about the Telepathy-commits mailing list