[Galago-commits] r2870 - in branches/libgalago/push-presence: .
libgalago
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Thu Jun 29 01:36:36 PDT 2006
Author: chipx86
Date: 2006-06-29 01:36:20 -0700 (Thu, 29 Jun 2006)
New Revision: 2870
Modified:
branches/libgalago/push-presence/ChangeLog
branches/libgalago/push-presence/libgalago/galago-service.c
branches/libgalago/push-presence/libgalago/galago-service.h
Log:
Added galago_service_get_has_status().
Modified: branches/libgalago/push-presence/ChangeLog
===================================================================
--- branches/libgalago/push-presence/ChangeLog 2006-06-18 08:33:04 UTC (rev 2869)
+++ branches/libgalago/push-presence/ChangeLog 2006-06-29 08:36:20 UTC (rev 2870)
@@ -1,3 +1,9 @@
+Thu Jun 29 01:35:51 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * libgalago/galago-service.c:
+ * libgalago/galago-service.h:
+ - Added galago_service_get_has_status().
+
Sun Jun 18 01:32:44 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* libgalago/galago-presence.c:
Modified: branches/libgalago/push-presence/libgalago/galago-service.c
===================================================================
--- branches/libgalago/push-presence/libgalago/galago-service.c 2006-06-18 08:33:04 UTC (rev 2869)
+++ branches/libgalago/push-presence/libgalago/galago-service.c 2006-06-29 08:36:20 UTC (rev 2870)
@@ -556,6 +556,10 @@
*
* Returns a list of statuses that accounts belonging to this service can
* have set.
+ *
+ * Returns: A list of statuses.
+ *
+ * Since: 0.5.1
*/
GList *
galago_service_get_registered_statuses(const GalagoService *service)
@@ -563,20 +567,58 @@
g_return_val_if_fail(service != NULL, NULL);
g_return_val_if_fail(GALAGO_IS_SERVICE(service), NULL);
- if (!galago_is_daemon() && galago_is_connected())
+ if (service->priv->registered_statuses == NULL &&
+ !galago_is_daemon() && galago_is_connected())
{
/* TODO: Should store these and free them later. */
- return galago_dbus_send_message_with_reply(
- GALAGO_OBJECT(service), "GetRegisteredStatuses",
- galago_value_new_list(GALAGO_VALUE_TYPE_OBJECT, NULL,
- (gpointer)GALAGO_TYPE_STATUS_TYPE),
- NULL);
+ service->priv->registered_statuses =
+ galago_dbus_send_message_with_reply(
+ GALAGO_OBJECT(service), "GetRegisteredStatuses",
+ galago_value_new_list(GALAGO_VALUE_TYPE_OBJECT, NULL,
+ (gpointer)GALAGO_TYPE_STATUS_TYPE),
+ NULL);
}
- return NULL; // service->priv->registered_statuses
+ return service->priv->registered_statuses;
}
/**
+ * galago_service_get_has_status:
+ * @service: The service.
+ * @status_id: The status ID to check for.
+ *
+ * Returns whether or not the specified status ID has been registered for
+ * this service.
+ *
+ * Returns: %TRUE if the status ID has been registered, or %FALSE otherwise.
+ *
+ * Since: 0.5.1
+ */
+gboolean
+galago_service_get_has_status(const GalagoService *service,
+ const char *status_id)
+{
+ GList *statuses, *l;
+
+ g_return_val_if_fail(service != NULL, FALSE);
+ g_return_val_if_fail(GALAGO_IS_SERVICE(service), FALSE);
+ g_return_val_if_fail(status_id != NULL && *status_id != '\0', FALSE);
+
+ statuses = galago_service_get_registered_statuses(service);
+
+ for (l = statuses; l != NULL; l = l->next)
+ {
+ if (!strcmp(galago_status_type_get_id(GALAGO_STATUS_TYPE(l->data)),
+ status_id))
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/**
* galago_service_get_flags
* @service: The service.
*
Modified: branches/libgalago/push-presence/libgalago/galago-service.h
===================================================================
--- branches/libgalago/push-presence/libgalago/galago-service.h 2006-06-18 08:33:04 UTC (rev 2869)
+++ branches/libgalago/push-presence/libgalago/galago-service.h 2006-06-29 08:36:20 UTC (rev 2870)
@@ -124,6 +124,8 @@
void galago_service_register_status(GalagoService *service,
GalagoStatusType *status_type);
GList *galago_service_get_registered_statuses(const GalagoService *service);
+gboolean galago_service_get_has_status(const GalagoService *service,
+ const char *status_id);
GalagoAccount *galago_service_create_account(GalagoService *service,
GalagoPerson *person,
More information about the galago-commits
mailing list