rpms/telepathy-salut/OLPC-3 fix-activity-announce.patch, NONE, 1.1 telepathy-salut.spec, 1.25, 1.26

Guillaume Desmottes gdesmott at fedoraproject.org
Wed Sep 17 15:01:06 UTC 2008


Author: gdesmott

Update of /cvs/pkgs/rpms/telepathy-salut/OLPC-3
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv528

Modified Files:
	telepathy-salut.spec 
Added Files:
	fix-activity-announce.patch 
Log Message:
Backport patch from upstream fixing OLPC activity announcements (#8441)

fix-activity-announce.patch:

--- NEW FILE fix-activity-announce.patch ---
diff --git a/src/salut-avahi-olpc-activity.c b/src/salut-avahi-olpc-activity.c
index 702d55b..adaaeb6 100644
--- a/src/salut-avahi-olpc-activity.c
+++ b/src/salut-avahi-olpc-activity.c
@@ -125,7 +125,12 @@ update_activity_service (SalutAvahiOlpcActivity *self,
       self);
   GError *err = NULL;
 
-  g_return_val_if_fail (activity_is_announced (self), FALSE);
+  if (!activity_is_announced (self))
+    {
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+        "Trying to update an activity that's not announced");
+      return FALSE;
+    }
 
   ga_entry_group_service_freeze (priv->service);
 
@@ -217,7 +222,10 @@ salut_avahi_olpc_activity_stop_announce (SalutOlpcActivity *activity)
   SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
       self);
 
-  g_return_if_fail (activity_is_announced (self));
+  /* Announcing the activity could have failed, so check if we're actually
+   * announcing it */
+  if (!activity_is_announced (self))
+    return;
 
   g_object_unref (priv->group);
   priv->group = NULL;
diff --git a/src/salut-olpc-activity.c b/src/salut-olpc-activity.c
index 71e4aeb..d9d9cf7 100644
--- a/src/salut-olpc-activity.c
+++ b/src/salut-olpc-activity.c
@@ -374,6 +374,7 @@ resend_invite (SalutOlpcActivity *self)
 static void
 activity_changed (SalutOlpcActivity *self)
 {
+  SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
   GError *error = NULL;
 
   if (!send_properties_change_msg (self, &error))
@@ -383,7 +384,7 @@ activity_changed (SalutOlpcActivity *self)
       error = NULL;
     }
 
-  if (!self->is_private)
+  if (!self->is_private && priv->muc != NULL)
     {
       /* update announcement */
       if (!SALUT_OLPC_ACTIVITY_GET_CLASS (self)->update (self, &error))
@@ -430,6 +431,7 @@ salut_olpc_activity_update (SalutOlpcActivity *self,
                             const gchar *tags,
                             gboolean is_private)
 {
+  SalutOlpcActivityPrivate *priv = SALUT_OLPC_ACTIVITY_GET_PRIVATE (self);
   TpBaseConnection *base_conn = (TpBaseConnection *) (self->connection);
   TpHandleRepoIface *room_repo = tp_base_connection_get_handles (base_conn,
        TP_HANDLE_TYPE_ROOM);
@@ -491,19 +493,22 @@ salut_olpc_activity_update (SalutOlpcActivity *self,
       self->is_private = is_private;
       changed = TRUE;
 
-      if (is_private)
+      if (priv->muc != NULL)
         {
-          DEBUG ("activity is not public anymore. Stop to announce it");
-          salut_olpc_activity_stop_announce (self);
-        }
-      else
-        {
-          DEBUG ("activity becomes public. Announce it");
-          if (!salut_olpc_activity_announce (self, &error))
+          if (is_private)
+            {
+              DEBUG ("activity is not public anymore. Stop to announce it");
+              salut_olpc_activity_stop_announce (self);
+            }
+          else
             {
-              DEBUG ("activity announce failed: %s", error->message);
-              g_error_free (error);
-              error = NULL;
+              DEBUG ("activity becomes public. Announce it");
+             if (!salut_olpc_activity_announce (self, &error))
+               {
+                 DEBUG ("activity announce failed: %s", error->message);
+                 g_error_free (error);
+                  error = NULL;
+               }
             }
         }
     }
@@ -562,6 +567,13 @@ salut_olpc_activity_joined (SalutOlpcActivity *self,
       return FALSE;
     }
 
+  if (!self->is_private)
+    {
+      /* This might fail but that doesn't prevent us from joining the
+       * activity.. */
+      salut_olpc_activity_announce (self, NULL);
+    }
+
   g_signal_connect (priv->muc, "closed", G_CALLBACK (muc_channel_closed_cb),
       self);
 
@@ -576,6 +588,9 @@ salut_olpc_activity_left (SalutOlpcActivity *self)
   if (priv->muc == NULL)
     return;
 
+  if (!self->is_private)
+    salut_olpc_activity_stop_announce (self);
+
   g_object_unref (priv->muc);
   g_signal_handlers_disconnect_matched (priv->muc, G_SIGNAL_MATCH_DATA,
       0, 0, NULL, NULL, self);


Index: telepathy-salut.spec
===================================================================
RCS file: /cvs/pkgs/rpms/telepathy-salut/OLPC-3/telepathy-salut.spec,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- telepathy-salut.spec	25 Aug 2008 09:01:02 -0000	1.25
+++ telepathy-salut.spec	17 Sep 2008 15:00:35 -0000	1.26
@@ -1,6 +1,6 @@
 Name:           telepathy-salut
 Version:        0.3.3
-Release:        6%{?dist}
+Release:        7%{?dist}
 Summary:        Link-local XMPP telepathy connection manager
 
 Group:          Applications/Communications
@@ -10,6 +10,7 @@
 Patch0:         salut-olpc-no-dbus-uid-check.patch
 Patch1:         salut-chmod-unix-socket.patch
 Patch2:         use-tp_debug_divert_messages.patch
+Patch3:         fix-activity-announce.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  dbus-devel >= 1.1.0
@@ -38,6 +39,7 @@
 %patch0 -p1 -b .dbus-uid
 %patch1 -p1 -b .chmod-socket
 %patch2 -p1 -b .divert-messages
+%patch3 -p0 -b .fix-announce
 
 
 %build
@@ -65,6 +67,9 @@
 %{_mandir}/man8/%{name}.8.gz
 
 %changelog
+* Wed Sep 17 2008 Guillaume Desmottes <guillaume.desmottes at collabora.co.uk> - 0.3.3-7
+- Backport patch from upstream fixing OLPC activity announcements (#8441)
+
 * Mon Aug 25 2008 Guillaume Desmottes <guillaume.desmottes at collabora.co.uk> - 0.3.3-6
 - Fix use-tp_debug_divert_messages.patch
 - Bump telepathy-glib version to 0.7.1 as use-tp_debug_divert_messages.patch needs it




More information about the fedora-extras-commits mailing list