[Telepathy-commits] [telepathy-gabble/master] conn-olpc: unsubscribe from Gadget presence when Publish(False) is called

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:14 PDT 2008


20080528134126-7fe3f-67e5a341b582c7a53d2965ebf2ae413f8fec4b47.gz
---
 src/conn-olpc.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 507b827..ba1102a 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -3750,14 +3750,13 @@ olpc_gadget_publish (GabbleSvcOLPCGadget *iface,
                      DBusGMethodInvocation *context)
 {
   GabbleConnection *conn = GABBLE_CONNECTION (iface);
+  GError *error = NULL;
 
   if (!check_gadget_buddy (conn, context))
     return;
 
   if (publish)
     {
-      GError *error = NULL;
-
       /* FIXME: we should check if we are already registered before */
       /* FIXME: add to roster ? */
       /* FIXME: this is ugly. We should use roster and/or
@@ -3781,8 +3780,23 @@ olpc_gadget_publish (GabbleSvcOLPCGadget *iface,
     }
   else
     {
-      /* TODO */
-      ;
+      /* FIXME: this is ugly. We should use roster and/or
+       * gabble-roster-channel if possible */
+      if (!send_presence_to_gadget (conn, LM_MESSAGE_SUB_TYPE_SUBSCRIBE,
+            &error))
+        {
+          dbus_g_method_return_error (context, error);
+          g_error_free (error);
+          return;
+        }
+
+      if (!send_presence_to_gadget (conn, LM_MESSAGE_SUB_TYPE_SUBSCRIBED,
+            &error))
+        {
+          dbus_g_method_return_error (context, error);
+          g_error_free (error);
+          return;
+        }
     }
 
   gabble_svc_olpc_gadget_return_from_publish (context);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list