[Galago-commits] r2869 - in branches/libgalago/push-presence: . libgalago

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sun Jun 18 01:33:08 PDT 2006


Author: chipx86
Date: 2006-06-18 01:33:04 -0700 (Sun, 18 Jun 2006)
New Revision: 2869

Modified:
   branches/libgalago/push-presence/ChangeLog
   branches/libgalago/push-presence/libgalago/galago-presence.c
Log:
Re-implement galago_presence_is_available() and galago_presence_is_discarded().


Modified: branches/libgalago/push-presence/ChangeLog
===================================================================
--- branches/libgalago/push-presence/ChangeLog	2006-06-18 08:27:39 UTC (rev 2868)
+++ branches/libgalago/push-presence/ChangeLog	2006-06-18 08:33:04 UTC (rev 2869)
@@ -1,3 +1,9 @@
+Sun Jun 18 01:32:44 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* libgalago/galago-presence.c:
+	  - Re-implement galago_presence_is_available() and
+	    galago_presence_is_discarded().
+
 Sun Jun 18 01:27:24 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* libgalago/galago-presence.c:

Modified: branches/libgalago/push-presence/libgalago/galago-presence.c
===================================================================
--- branches/libgalago/push-presence/libgalago/galago-presence.c	2006-06-18 08:27:39 UTC (rev 2868)
+++ branches/libgalago/push-presence/libgalago/galago-presence.c	2006-06-18 08:33:04 UTC (rev 2869)
@@ -472,12 +472,7 @@
 	g_return_val_if_fail(presence != NULL,             TRUE);
 	g_return_val_if_fail(GALAGO_IS_PRESENCE(presence), TRUE);
 
-	g_assert_not_reached();
-
-	return FALSE;
-#if 0
-	return (galago_presence_get_statuses(presence) == NULL);
-#endif
+	return galago_presence_get_enabled_statuses(presence) == NULL;
 }
 
 /**
@@ -491,19 +486,32 @@
 gboolean
 galago_presence_is_available(const GalagoPresence *presence)
 {
-	g_assert_not_reached();
-	return FALSE;
-#if 0
-	GalagoStatus *status;
+	gboolean available = FALSE;
+	GList *l;
 
 	g_return_val_if_fail(presence != NULL,             FALSE);
 	g_return_val_if_fail(GALAGO_IS_PRESENCE(presence), FALSE);
 
-	status = galago_presence_get_active_status(presence);
+	/*
+	 * NOTE: This doesn't seem perfect, and would return wrong results
+	 *       if there's an available status and unavailable status set
+	 *       at the same time, but that's really a bug as they should be
+	 *       exclusive.
+	 */
+	for (l = galago_presence_get_enabled_statuses(presence);
+		 l != NULL; l = l->next)
+	{
+		GalagoStatusType *status_type = GALAGO_STATUS_TYPE(l->data);
 
-	return ((status != NULL && galago_status_is_available(status)) &&
-			!galago_presence_is_idle(presence));
-#endif
+		if (galago_status_type_is_exclusive(status_type) &&
+			galago_status_type_is_available(status_type))
+		{
+			available = TRUE;
+			break;
+		}
+	}
+
+	return available && !galago_presence_is_idle(presence);
 }
 
 void



More information about the galago-commits mailing list