summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2010-12-21 16:24:26 +0000
committerJonny Lamb <jonny.lamb@collabora.co.uk>2010-12-21 16:24:37 +0000
commite93acdf2a8a9d4643c433e105e8d085ef25ecb3c (patch)
treea14c9ba82464db854df9fd2bea394f9909e23f87
parent21fe8cac5062b0e87c8bb46f6db00675b09a1b1f (diff)
base-client: add set_observer_delay_approvers functiondelay-approvers
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/base-client.c45
-rw-r--r--telepathy-glib/base-client.h2
3 files changed, 48 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 288ea68aa..66e0781b8 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4621,6 +4621,7 @@ TpBaseClient
tp_base_client_add_observer_filter
tp_base_client_take_observer_filter
tp_base_client_set_observer_recover
+tp_base_client_set_observer_delay_approvers
TpBaseClientClassObserveChannelsImpl
tp_base_client_implement_observe_channels
tp_base_client_add_approver_filter
diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c
index 7c19bbffa..1af828377 100644
--- a/telepathy-glib/base-client.c
+++ b/telepathy-glib/base-client.c
@@ -224,6 +224,7 @@ typedef enum {
CLIENT_HANDLER_WANTS_REQUESTS = 1 << 3,
CLIENT_HANDLER_BYPASSES_APPROVAL = 1 << 4,
CLIENT_OBSERVER_RECOVER = 1 << 5,
+ CLIENT_OBSERVER_DELAYS_APPROVERS = 1 << 6,
} ClientFlags;
struct _TpBaseClientPrivate
@@ -413,6 +414,42 @@ tp_base_client_set_observer_recover (TpBaseClient *self,
}
/**
+ * tp_base_client_set_observer_delay_approvers:
+ * @self: a #TpBaseClient
+ * @delay_approvers: the value of the Observer.DelayApprovers property
+ *
+ * Set whether the channel dispatcher should wait for this observer to
+ * return before letting approvers know about new channels.
+ *
+ * This method may only be called before tp_base_client_register() is
+ * called, and may only be called on objects whose class implements
+ * #TpBaseClientClass.observe_channels.
+ *
+ * Since: 0.13.UNRELEASED
+ */
+void
+tp_base_client_set_observer_delay_approvers (TpBaseClient *self,
+ gboolean delay_approvers)
+{
+ TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self);
+
+ g_return_if_fail (TP_IS_BASE_CLIENT (self));
+ g_return_if_fail (!self->priv->registered);
+ g_return_if_fail (cls->observe_channels != NULL);
+
+ if (delay_approvers)
+ {
+ self->priv->flags |= (CLIENT_IS_OBSERVER |
+ CLIENT_OBSERVER_DELAYS_APPROVERS);
+ }
+ else
+ {
+ self->priv->flags |= CLIENT_IS_OBSERVER;
+ self->priv->flags &= ~CLIENT_OBSERVER_DELAYS_APPROVERS;
+ }
+}
+
+/**
* tp_base_client_add_approver_filter:
* @self: a #TpBaseClient
* @filter: (transfer none) (element-type utf8 GObject.Value):
@@ -1108,6 +1145,7 @@ typedef enum {
DP_HANDLED_CHANNELS,
DP_OBSERVER_CHANNEL_FILTER,
DP_OBSERVER_RECOVER,
+ DP_OBSERVER_DELAY_APPROVERS,
} ClientDBusProp;
static void
@@ -1186,6 +1224,11 @@ tp_base_client_get_dbus_properties (GObject *object,
(self->priv->flags & CLIENT_OBSERVER_RECOVER) != 0);
break;
+ case DP_OBSERVER_DELAY_APPROVERS:
+ g_value_set_boolean (value,
+ (self->priv->flags & CLIENT_OBSERVER_DELAYS_APPROVERS) != 0);
+ break;
+
default:
g_assert_not_reached ();
}
@@ -1220,6 +1263,8 @@ tp_base_client_class_init (TpBaseClientClass *cls)
GINT_TO_POINTER (DP_OBSERVER_CHANNEL_FILTER) },
{ "Recover",
GINT_TO_POINTER (DP_OBSERVER_RECOVER) },
+ { "DelayApprovers",
+ GINT_TO_POINTER (DP_OBSERVER_DELAY_APPROVERS) },
{ NULL }
};
static TpDBusPropertiesMixinIfaceImpl prop_ifaces[] = {
diff --git a/telepathy-glib/base-client.h b/telepathy-glib/base-client.h
index feaf4bd98..4cd708b64 100644
--- a/telepathy-glib/base-client.h
+++ b/telepathy-glib/base-client.h
@@ -110,6 +110,8 @@ void tp_base_client_take_observer_filter (TpBaseClient *self,
void tp_base_client_set_observer_recover (TpBaseClient *self,
gboolean recover);
+void tp_base_client_set_observer_delay_approvers (TpBaseClient *self,
+ gboolean delay_approvers);
void tp_base_client_add_approver_filter (TpBaseClient *self,
GHashTable *filter);