[Galago-commits] r2872 - in branches/libgalago/push-presence: .
libgalago
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Mon Jul 3 02:07:51 PDT 2006
Author: chipx86
Date: 2006-07-03 02:07:19 -0700 (Mon, 03 Jul 2006)
New Revision: 2872
Modified:
branches/libgalago/push-presence/ChangeLog
branches/libgalago/push-presence/libgalago/galago-presence.c
Log:
Flesh out galago_presence_enable_status() and galago_presence_set_status_attrs() a bit.
Modified: branches/libgalago/push-presence/ChangeLog
===================================================================
--- branches/libgalago/push-presence/ChangeLog 2006-06-29 08:38:16 UTC (rev 2871)
+++ branches/libgalago/push-presence/ChangeLog 2006-07-03 09:07:19 UTC (rev 2872)
@@ -1,3 +1,9 @@
+Mon Jul 03 02:07:00 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * libgalago/galago-presence.c:
+ - Flesh out galago_presence_enable_status() and
+ galago_presence_set_status_attrs() a bit.
+
Thu Jun 29 01:37:48 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* libgalago/galago-account.c:
Modified: branches/libgalago/push-presence/libgalago/galago-presence.c
===================================================================
--- branches/libgalago/push-presence/libgalago/galago-presence.c 2006-06-29 08:38:16 UTC (rev 2871)
+++ branches/libgalago/push-presence/libgalago/galago-presence.c 2006-07-03 09:07:19 UTC (rev 2872)
@@ -54,6 +54,11 @@
LAST_SIGNAL
};
+static void _galago_presence_set_status_attrs_vargs(GalagoPresence *presence,
+ const char *status_id,
+ const char *attr_id,
+ GValue *attr_value,
+ va_list extra_attrs);
static void _galago_dbus_account_destroy_presence(GalagoAccount *account,
GalagoPresence *presence);
@@ -514,16 +519,69 @@
return available && !galago_presence_is_idle(presence);
}
+static void
+append_attributes(DBusMessageIter *iter,
+ const char *attr_id,
+ GValue *attr_value,
+ va_list args)
+{
+ do
+ {
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &attr_id);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &attr_value);
+
+ attr_id = (const char *)va_arg(args, char *);
+
+ if (attr_value != NULL)
+ attr_value = (GValue *)va_arg(args, GValue *);
+ }
+ while ((attr_id = (const char *)va_arg(args, char *)) != NULL);
+}
+
void
galago_presence_enable_status(GalagoPresence *presence,
const char *status_id,
const char *attr_id,
GValue *attr_value, ...)
{
+ va_list args;
+
g_return_if_fail(presence != NULL);
g_return_if_fail(GALAGO_IS_PRESENCE(presence));
g_return_if_fail(status_id != NULL && *status_id != '\0');
g_return_if_fail(attr_id == NULL || attr_value != NULL);
+
+ if (galago_presence_get_status_enabled(presence, status_id))
+ {
+ if (attr_id != NULL)
+ {
+ va_start(args, attr_value);
+ _galago_presence_set_status_attrs_vargs(presence, status_id,
+ attr_id, attr_value,
+ args);
+ va_end(args);
+ }
+
+ return;
+ }
+
+ if (GALAGO_OBJECT_IS_LOCAL(presence) && galago_is_connected())
+ {
+ DBusMessage *message;
+ DBusMessageIter iter;
+
+ /* TODO: Handle a reply of sorts? */
+ message = galago_dbus_message_new_method_call(GALAGO_OBJECT(presence),
+ "EnableStatus",
+ FALSE, &iter);
+
+ va_start(args, attr_value);
+ append_attributes(&iter, attr_id, attr_value, args);
+ va_end(args);
+
+ dbus_connection_send(galago_get_dbus_conn(), message, NULL);
+ dbus_message_unref(message);
+ }
}
void
@@ -533,6 +591,14 @@
g_return_if_fail(presence != NULL);
g_return_if_fail(GALAGO_IS_PRESENCE(presence));
g_return_if_fail(status_id != NULL && *status_id != '\0');
+
+ if (!galago_presence_get_status_enabled(presence, status_id))
+ return;
+
+ if (GALAGO_OBJECT_IS_LOCAL(presence) && galago_is_connected() &&
+ galago_is_feed())
+ {
+ }
}
GList *
@@ -555,17 +621,47 @@
return FALSE;
}
+static void
+_galago_presence_set_status_attrs_vargs(GalagoPresence *presence,
+ const char *status_id,
+ const char *attr_id,
+ GValue *attr_value,
+ va_list extra_attrs)
+{
+ if (GALAGO_OBJECT_IS_LOCAL(presence) && galago_is_connected())
+ {
+ DBusMessage *message;
+ DBusMessageIter iter;
+ DBusError error;
+
+ /* TODO: Handle a reply of sorts? */
+ message = galago_dbus_message_new_method_call(GALAGO_OBJECT(presence),
+ "SetStatusAttributes",
+ FALSE, &iter);
+ append_attributes(&iter, attr_id, attr_value, extra_attrs);
+ dbus_connection_send(galago_get_dbus_conn(), message, NULL);
+ dbus_message_unref(message);
+ }
+}
+
void
galago_presence_set_status_attrs(GalagoPresence *presence,
const char *status_id,
const char *attr_id,
GValue *attr_value, ...)
{
+ va_list args;
+
g_return_if_fail(presence != NULL);
g_return_if_fail(GALAGO_IS_PRESENCE(presence));
g_return_if_fail(status_id != NULL && *status_id != '\0');
g_return_if_fail(attr_id != NULL && *attr_id != '\0');
g_return_if_fail(attr_value != NULL);
+
+ va_start(args, attr_value);
+ _galago_presence_set_status_attrs_vargs(presence, status_id, attr_id,
+ attr_value, args);
+ va_end(args);
}
const GValue *
More information about the galago-commits
mailing list