diff options
-rw-r--r-- | docs/reference/telepathy-glib/telepathy-glib-sections.txt | 6 | ||||
-rw-r--r-- | examples/client/dbus-tubes/accepter.c | 39 | ||||
-rw-r--r-- | examples/client/stream-tubes/accepter.c | 51 | ||||
-rw-r--r-- | examples/client/text-handler.c | 33 | ||||
-rw-r--r-- | telepathy-farstream/examples/call-handler.c | 15 | ||||
-rw-r--r-- | telepathy-glib/account-channel-request.c | 21 | ||||
-rw-r--r-- | telepathy-glib/base-client.c | 125 | ||||
-rw-r--r-- | telepathy-glib/base-client.h | 10 | ||||
-rw-r--r-- | telepathy-glib/handle-channel-context-internal.h | 6 | ||||
-rw-r--r-- | telepathy-glib/handle-channel-context.c | 53 | ||||
-rw-r--r-- | telepathy-glib/simple-handler.c | 41 | ||||
-rw-r--r-- | telepathy-glib/simple-handler.h | 8 | ||||
-rw-r--r-- | tests/dbus/base-client.c | 32 | ||||
-rw-r--r-- | tests/dbus/simple-handler.c | 38 | ||||
-rw-r--r-- | tests/lib/simple-client.c | 34 | ||||
-rw-r--r-- | tests/lib/simple-client.h | 2 |
16 files changed, 194 insertions, 320 deletions
diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt index d1bfe3875..42def29dc 100644 --- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt @@ -4532,8 +4532,8 @@ tp_base_client_add_handler_filter tp_base_client_add_handler_filter_vardict tp_base_client_take_handler_filter tp_base_client_be_a_handler -TpBaseClientClassHandleChannelsImpl -tp_base_client_implement_handle_channels +TpBaseClientClassHandleChannelImpl +tp_base_client_implement_handle_channel tp_base_client_dup_handled_channels tp_base_client_is_handling_channel tp_base_client_delegate_channels_async @@ -4673,7 +4673,7 @@ TP_TYPE_HANDLE_CHANNELS_CONTEXT <FILE>simple-handler</FILE> <TITLE>simple-handler</TITLE> TpSimpleHandler -TpSimpleHandlerHandleChannelsImpl +TpSimpleHandlerHandleChannelImpl tp_simple_handler_new tp_simple_handler_new_with_am <SUBSECTION Standard> diff --git a/examples/client/dbus-tubes/accepter.c b/examples/client/dbus-tubes/accepter.c index cea72a336..69e03578f 100644 --- a/examples/client/dbus-tubes/accepter.c +++ b/examples/client/dbus-tubes/accepter.c @@ -133,48 +133,27 @@ tube_invalidated_cb (TpStreamTubeChannel *tube, } static void -handle_channels (TpSimpleHandler *handler, +handle_channel (TpSimpleHandler *handler, TpAccount *account, TpConnection *conn, - GList *channels, + TpChannel *channel, GList *requests, gint64 action_time, TpHandleChannelContext *context, gpointer user_data) { TpDBusTubeChannel *tube; - GList *l; - GError error = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "No channel to be handled" }; - g_message ("Handling channels"); + g_message ("Handling channel; accepting tube"); - for (l = channels; l != NULL; l = l->next) - { - TpDBusTubeChannel *channel = l->data; - - if (!TP_IS_DBUS_TUBE_CHANNEL (channel)) - continue; - - if (tp_strdiff (tp_dbus_tube_channel_get_service_name (channel), - EXAMPLE_SERVICE_NAME)) - continue; - - g_message ("Accepting tube"); + tube = g_object_ref (channel); - tube = g_object_ref (channel); + g_signal_connect (tube, "invalidated", + G_CALLBACK (tube_invalidated_cb), NULL); - g_signal_connect (tube, "invalidated", - G_CALLBACK (tube_invalidated_cb), NULL); - - tp_dbus_tube_channel_accept_async (tube, tube_accepted, context); - - tp_handle_channel_context_accept (context); - return; - } + tp_dbus_tube_channel_accept_async (tube, tube_accepted, context); - g_message ("Rejecting channels"); - tp_handle_channel_context_fail (context, &error); + tp_handle_channel_context_accept (context); } @@ -188,7 +167,7 @@ main (int argc, manager = tp_account_manager_dup (); handler = tp_simple_handler_new_with_am (manager, FALSE, FALSE, - "ExampleServiceHandler", FALSE, handle_channels, NULL, NULL); + "ExampleServiceHandler", FALSE, handle_channel, NULL, NULL); tp_base_client_take_handler_filter (handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, diff --git a/examples/client/stream-tubes/accepter.c b/examples/client/stream-tubes/accepter.c index 432afc580..415d68824 100644 --- a/examples/client/stream-tubes/accepter.c +++ b/examples/client/stream-tubes/accepter.c @@ -75,56 +75,27 @@ tube_invalidated_cb (TpStreamTubeChannel *tube, } static void -_handle_channels (TpSimpleHandler *handler, +_handle_channel (TpSimpleHandler *handler, TpAccount *account, TpConnection *conn, - GList *channels, + TpChannel *channel, GList *requests, gint64 action_time, TpHandleChannelContext *context, gpointer user_data) { - gboolean delay = FALSE; - GList *l; + g_message ("Handling channel; accepting tube"); - g_message ("Handling channels"); + g_signal_connect (channel, "invalidated", + G_CALLBACK (tube_invalidated_cb), NULL); - for (l = channels; l != NULL; l = l->next) - { - TpStreamTubeChannel *tube = l->data; - - if (!TP_IS_STREAM_TUBE_CHANNEL (tube)) - continue; - - g_message ("Accepting tube"); - - g_signal_connect (tube, "invalidated", - G_CALLBACK (tube_invalidated_cb), NULL); - - tp_stream_tube_channel_accept_async (tube, _tube_accepted, context); - - delay = TRUE; - } - - if (delay) - { - g_message ("Delaying channel acceptance"); - - tp_handle_channel_context_delay (context); - g_object_ref (context); - } - else - { - GError *error; + tp_stream_tube_channel_accept_async (TP_STREAM_TUBE_CHANNEL (channel), + _tube_accepted, context); - g_message ("Rejecting channels"); + g_message ("Delaying channel acceptance"); - error = g_error_new (TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "No channels to be handled"); - tp_handle_channel_context_fail (context, error); - - g_error_free (error); - } + tp_handle_channel_context_delay (context); + g_object_ref (context); } @@ -138,7 +109,7 @@ main (int argc, manager = tp_account_manager_dup (); handler = tp_simple_handler_new_with_am (manager, FALSE, FALSE, - "ExampleServiceHandler", FALSE, _handle_channels, NULL, NULL); + "ExampleServiceHandler", FALSE, _handle_channel, NULL, NULL); tp_base_client_take_handler_filter (handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, diff --git a/examples/client/text-handler.c b/examples/client/text-handler.c index 9b9bf8f99..8cbe00506 100644 --- a/examples/client/text-handler.c +++ b/examples/client/text-handler.c @@ -76,36 +76,25 @@ display_pending_messages (TpTextChannel *channel) } static void -handle_channels_cb (TpSimpleHandler *self, +handle_channel_cb (TpSimpleHandler *self, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests, gint64 user_action_time, TpHandleChannelContext *context, gpointer user_data) { - GList *l; + g_print ("Handling text channel with %s\n", + tp_channel_get_identifier (channel)); - for (l = channels; l != NULL; l = g_list_next (l)) - { - TpChannel *channel = l->data; - TpTextChannel *text_chan = l->data; - - if (!TP_IS_TEXT_CHANNEL (channel)) - continue; - - g_print ("Handling text channel with %s\n", - tp_channel_get_identifier (channel)); + g_signal_connect (channel, "message-received", + G_CALLBACK (message_received_cb), NULL); - g_signal_connect (channel, "message-received", - G_CALLBACK (message_received_cb), NULL); - - /* The default TpAutomaticClientFactory used by - * tp_account_manager_dup() has already prepared - * TP_TEXT_CHANNEL_FEATURE_INCOMING_MESSAGES, if possible. */ - display_pending_messages (text_chan); - } + /* The default TpAutomaticClientFactory used by + * tp_account_manager_dup() has already prepared + * TP_TEXT_CHANNEL_FEATURE_INCOMING_MESSAGES, if possible. */ + display_pending_messages (TP_TEXT_CHANNEL (channel)); tp_handle_channel_context_accept (context); } @@ -121,7 +110,7 @@ main (int argc, tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG")); handler = tp_simple_handler_new (NULL, FALSE, FALSE, - "ExampleHandler", FALSE, handle_channels_cb, NULL, NULL); + "ExampleHandler", FALSE, handle_channel_cb, NULL, NULL); tp_base_client_take_handler_filter (handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, diff --git a/telepathy-farstream/examples/call-handler.c b/telepathy-farstream/examples/call-handler.c index 18a2fda4f..748f3eaa9 100644 --- a/telepathy-farstream/examples/call-handler.c +++ b/telepathy-farstream/examples/call-handler.c @@ -539,29 +539,26 @@ static void new_call_channel_cb (TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelContext *handler_context, gpointer user_data) { ChannelContext *context; - TpChannel *proxy; GstBus *bus; GstElement *pipeline; GstStateChangeReturn ret; g_debug ("New channel"); - proxy = channels->data; - pipeline = gst_pipeline_new (NULL); ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { - tp_channel_close_async (TP_CHANNEL (proxy), NULL, NULL); + tp_channel_close_async (channel, NULL, NULL); g_object_unref (pipeline); g_warning ("Failed to start an empty pipeline !?"); return; @@ -574,14 +571,14 @@ new_call_channel_cb (TpSimpleHandler *handler, context->buswatch = gst_bus_add_watch (bus, bus_watch_cb, context); g_object_unref (bus); - tf_channel_new_async (proxy, new_tf_channel_cb, context); + tf_channel_new_async (channel, new_tf_channel_cb, context); tp_handle_channel_context_accept (handler_context); - tp_call_channel_accept_async (TP_CALL_CHANNEL (proxy), NULL, NULL); + tp_call_channel_accept_async (TP_CALL_CHANNEL (channel), NULL, NULL); - context->proxy = g_object_ref (proxy); - g_signal_connect (proxy, "invalidated", + context->proxy = g_object_ref (channel); + g_signal_connect (channel, "invalidated", G_CALLBACK (proxy_invalidated_cb), context); } diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index 14ef6d1ca..8731a478a 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -711,28 +711,16 @@ acr_channel_invalidated_cb (TpProxy *chan, } static void -handle_channels (TpSimpleHandler *handler, +handle_channel (TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelContext *context, gpointer user_data) { TpAccountChannelRequest *self = user_data; - TpChannel *channel; - - if (G_UNLIKELY (g_list_length (channels) != 1)) - { - GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, - "We are supposed to handle only one channel" }; - - tp_handle_channel_context_fail (context, &error); - - request_fail (self, &error); - return; - } tp_handle_channel_context_accept (context); @@ -745,9 +733,6 @@ handle_channels (TpSimpleHandler *handler, return; } - /* Request succeeded */ - channel = channels->data; - if (tp_proxy_get_invalidated (channel) == NULL) { /* Keep the handler alive while the channel is valid so keep a ref on @@ -1024,7 +1009,7 @@ request_and_handle_channel_async (TpAccountChannelRequest *self, /* Create a temp handler */ self->priv->handler = tp_simple_handler_new ( tp_proxy_get_factory (self->priv->account), TRUE, FALSE, - "TpGLibRequestAndHandle", TRUE, handle_channels, self, NULL); + "TpGLibRequestAndHandle", TRUE, handle_channel, self, NULL); _tp_base_client_set_only_for_account (self->priv->handler, self->priv->account); diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index 82308142f..bf3f4788c 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -48,16 +48,16 @@ * @add_dispatch_operation: the function called to request user approval of * unrequested (incoming) channels matching this client's approver filter * (since 0.11.13) - * @handle_channels: the function called to handle channels matching this - * client's handler filter (since 0.11.13) + * @handle_channel: the function called to handle channels matching this + * client's handler filter * * The class of a #TpBaseClient. * * The virtual methods @observe_channel, @add_dispatch_operation and - * @handle_channels can be also implemented by calling + * @handle_channel can be also implemented by calling * tp_base_client_implement_observe_channel(), * tp_base_client_implement_add_dispatch_operation() and - * tp_base_client_implement_handle_channels(). This is compatible with + * tp_base_client_implement_handle_channel(). This is compatible with * telepathy-glib versions older than 0.11.13. * * Since: 0.11.5 @@ -121,7 +121,7 @@ */ /** - * TpBaseClientClassHandleChannelsImpl: + * TpBaseClientClassHandleChannelImpl: * @client: a #TpBaseClient instance * @account: a #TpAccount with %TP_ACCOUNT_FEATURE_CORE, and any other * features added via tp_client_factory_add_account_features(), prepared if @@ -129,9 +129,9 @@ * @connection: a #TpConnection with %TP_CONNECTION_FEATURE_CORE, * and any other features added via * tp_client_factory_add_connection_features(), prepared if possible - * @channels: (element-type TelepathyGLib.Channel): a #GList of #TpChannel, - * each with %TP_CHANNEL_FEATURE_CORE, and any other features added via - * tp_client_factory_add_channel_features(), prepared if possible + * @channel: a #TpChannel, with %TP_CHANNEL_FEATURE_CORE, and any other + * features added via tp_client_factory_add_channel_features(), + * prepared if possible * @requests_satisfied: (element-type TelepathyGLib.ChannelRequest): a #GList of * #TpChannelRequest having their object-path defined but are not guaranteed * to be prepared. @@ -142,7 +142,7 @@ * @context: a #TpHandleChannelContext representing the context of this * D-Bus call * - * Signature of the implementation of the HandleChannels method. + * Signature of the implementation of the HandleChannel method. * * This function must call either tp_handle_channel_context_accept(), * tp_handle_channel_context_delay() or tp_handle_channel_context_fail() @@ -613,7 +613,7 @@ tp_base_client_add_approver_filter_vardict (TpBaseClient *self, * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * Since: 0.11.6 */ @@ -624,7 +624,7 @@ tp_base_client_be_a_handler (TpBaseClient *self) g_return_if_fail (TP_IS_BASE_CLIENT (self)); g_return_if_fail (!self->priv->registered); - g_return_if_fail (cls->handle_channels != NULL); + g_return_if_fail (cls->handle_channel != NULL); self->priv->flags |= CLIENT_IS_HANDLER; } @@ -636,12 +636,12 @@ tp_base_client_be_a_handler (TpBaseClient *self) * a %TP_HASH_TYPE_CHANNEL_CLASS * * Register a new channel class as Handler.HandlerChannelFilter. - * The #TpBaseClientClass.handle_channels virtual method will be called + * The #TpBaseClientClass.handle_channel virtual method will be called * whenever a new channel's properties match the ones in @filter. * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * Since: 0.11.6 */ @@ -684,7 +684,7 @@ tp_base_client_take_handler_filter (TpBaseClient *self, g_return_if_fail (TP_IS_BASE_CLIENT (self)); g_return_if_fail (!self->priv->registered); - g_return_if_fail (cls->handle_channels != NULL); + g_return_if_fail (cls->handle_channel != NULL); self->priv->flags |= CLIENT_IS_HANDLER; g_ptr_array_add (self->priv->handler_filters, filter); @@ -696,12 +696,12 @@ tp_base_client_take_handler_filter (TpBaseClient *self, * @filter: (transfer none): a variant of type %G_VARIANT_TYPE_VARDICT * * Register a new channel class as Handler.HandlerChannelFilter. - * The #TpBaseClientClass.handle_channels virtual method will be called + * The #TpBaseClientClass.handle_channel virtual method will be called * whenever a new channel's properties match the ones in @filter. * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * If the variant is floating (see g_variant_ref_sink()), ownership * will be taken. See tp_base_client_add_observer_filter_vardict() for @@ -732,7 +732,7 @@ tp_base_client_add_handler_filter_vardict (TpBaseClient *self, * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * Since: 0.11.6 */ @@ -744,7 +744,7 @@ tp_base_client_set_handler_bypass_approval (TpBaseClient *self, g_return_if_fail (TP_IS_BASE_CLIENT (self)); g_return_if_fail (!self->priv->registered); - g_return_if_fail (cls->handle_channels != NULL); + g_return_if_fail (cls->handle_channel != NULL); if (bypass_approval) { @@ -770,7 +770,7 @@ tp_base_client_set_handler_bypass_approval (TpBaseClient *self, * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * Since: 0.11.6 */ @@ -781,7 +781,7 @@ tp_base_client_set_handler_request_notification (TpBaseClient *self) g_return_if_fail (TP_IS_BASE_CLIENT (self)); g_return_if_fail (!self->priv->registered); - g_return_if_fail (cls->handle_channels != NULL); + g_return_if_fail (cls->handle_channel != NULL); self->priv->flags |= (CLIENT_IS_HANDLER | CLIENT_HANDLER_WANTS_REQUESTS); } @@ -792,7 +792,7 @@ _tp_base_client_add_handler_capability (TpBaseClient *self, { TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); - g_return_if_fail (cls->handle_channels != NULL); + g_return_if_fail (cls->handle_channel != NULL); self->priv->flags |= CLIENT_IS_HANDLER; @@ -815,7 +815,7 @@ _tp_base_client_add_handler_capability (TpBaseClient *self, * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * Since: 0.11.6 */ @@ -827,7 +827,7 @@ tp_base_client_add_handler_capability (TpBaseClient *self, g_return_if_fail (TP_IS_BASE_CLIENT (self)); g_return_if_fail (!self->priv->registered); - g_return_if_fail (cls->handle_channels != NULL); + g_return_if_fail (cls->handle_channel != NULL); _tp_base_client_add_handler_capability (self, token); } @@ -846,7 +846,7 @@ tp_base_client_add_handler_capability (TpBaseClient *self, * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * Since: 0.11.6 */ @@ -878,7 +878,7 @@ tp_base_client_add_handler_capabilities (TpBaseClient *self, * * This method may only be called before tp_base_client_register() is * called, and may only be called on objects whose class implements - * #TpBaseClientClass.handle_channels. + * #TpBaseClientClass.handle_channel. * * Since: 0.11.6 */ @@ -2077,24 +2077,10 @@ add_handled_channel (TpBaseClient *self, } static void -add_handled_channels (TpBaseClient *self, - GPtrArray *channels) -{ - guint i; - - for (i = 0; i < channels->len; i++) - { - TpChannel *channel = g_ptr_array_index (channels, i); - - add_handled_channel (self, channel); - } -} - -static void ctx_done_cb (TpHandleChannelContext *context, TpBaseClient *self) { - add_handled_channels (self, context->channels); + add_handled_channel (self, context->channel); } static void @@ -2129,7 +2115,6 @@ delegate_channels_if_needed (TpBaseClient *self, GList *requests, *l; const gchar *handler_to_delegate = NULL; gint64 user_action_time = 0; - guint i; GList *chans = NULL; gboolean delegate = FALSE; @@ -2169,24 +2154,18 @@ delegate_channels_if_needed (TpBaseClient *self, /* We are already the one handling the channels */ goto out; - /* We are supposed to delegate the channels; check if we are handling - * them */ - for (i = 0; i < ctx->channels->len; i++) + /* We are supposed to delegate the channel; check if we are handling it */ + if (!tp_base_client_is_handling_channel (self, ctx->channel)) { - TpChannel *channel = g_ptr_array_index (ctx->channels, i); - - if (!tp_base_client_is_handling_channel (self, channel)) - { - /* Don't delegate as there is at least one channel we are not - * handling */ - DEBUG ("We have been asked to delegate channels but we are " - "not handling %s", tp_proxy_get_object_path (channel)); - goto out; - } - - chans = g_list_prepend (chans, channel); + /* Don't delegate as there is at least one channel we are not + * handling */ + DEBUG ("We have been asked to delegate channel but we are " + "not handling %s", tp_proxy_get_object_path (ctx->channel)); + goto out; } + chans = g_list_prepend (chans, ctx->channel); + DEBUG ("Delegate channels as requested"); delegate = TRUE; @@ -2203,7 +2182,7 @@ out: } static void -handle_channels_context_prepare_cb (GObject *source, +handle_channel_context_prepare_cb (GObject *source, GAsyncResult *result, gpointer user_data) { @@ -2211,7 +2190,7 @@ handle_channels_context_prepare_cb (GObject *source, TpBaseClientClass *cls = TP_BASE_CLIENT_GET_CLASS (self); TpHandleChannelContext *ctx = TP_HANDLE_CHANNEL_CONTEXT (source); GError *error = NULL; - GList *channels_list, *requests_list; + GList *requests_list; if (!_tp_handle_channel_context_prepare_finish (ctx, result, &error)) { @@ -2224,16 +2203,14 @@ handle_channels_context_prepare_cb (GObject *source, if (delegate_channels_if_needed (self, ctx)) return; - channels_list = ptr_array_to_list (ctx->channels); requests_list = ptr_array_to_list (ctx->requests_satisfied); tp_g_signal_connect_object (ctx, "done", G_CALLBACK (ctx_done_cb), self, 0); - cls->handle_channels (self, ctx->account, ctx->connection, - channels_list, requests_list, ctx->user_action_time, ctx); + cls->handle_channel (self, ctx->account, ctx->connection, + ctx->channel, requests_list, ctx->user_action_time, ctx); - g_list_free (channels_list); g_list_free (requests_list); if (_tp_handle_channel_context_get_state (ctx) == @@ -2302,9 +2279,9 @@ _tp_base_client_handle_channel (TpSvcClientHandler *iface, return; } - if (cls->handle_channels == NULL) + if (cls->handle_channel == NULL) { - DEBUG ("class %s does not implement HandleChannels", + DEBUG ("class %s does not implement HandleChannel", G_OBJECT_TYPE_NAME (self)); tp_dbus_g_method_return_not_implemented (context); @@ -2348,7 +2325,7 @@ _tp_base_client_handle_channel (TpSvcClientHandler *iface, g_ptr_array_add (requests, request); } - ctx = _tp_handle_channel_context_new (account, connection, channels, + ctx = _tp_handle_channel_context_new (account, connection, channel, requests, user_action_time, handler_info, context); account_features = dup_features_for_account (self, account); @@ -2359,7 +2336,7 @@ _tp_base_client_handle_channel (TpSvcClientHandler *iface, (GQuark *) account_features->data, (GQuark *) connection_features->data, (GQuark *) channel_features->data, - handle_channels_context_prepare_cb, self); + handle_channel_context_prepare_cb, self); g_object_unref (ctx); g_array_unref (account_features); @@ -2679,24 +2656,22 @@ tp_base_client_implement_add_dispatch_operation (TpBaseClientClass *cls, } /** - * tp_base_client_implement_handle_channels: (skip) + * tp_base_client_implement_handle_channel: (skip) * @klass: the #TpBaseClientClass of the object - * @impl: the #TpBaseClientClassHandleChannelsImpl function implementing + * @impl: the #TpBaseClientClassHandleChannelImpl function implementing * HandleCHannels() * * Called by subclasses to define the actual implementation of the - * HandleChannels() D-Bus method. + * HandleChannel() D-Bus method. * * Since 0.11.13 this is exactly equivalent to setting the - * #TpBaseClientClass.handle_channels function pointer. - * - * Since: 0.11.6 + * #TpBaseClientClass.handle_channel function pointer. */ void -tp_base_client_implement_handle_channels (TpBaseClientClass *cls, - TpBaseClientClassHandleChannelsImpl impl) +tp_base_client_implement_handle_channel (TpBaseClientClass *cls, + TpBaseClientClassHandleChannelImpl impl) { - cls->handle_channels = impl; + cls->handle_channel = impl; } /** diff --git a/telepathy-glib/base-client.h b/telepathy-glib/base-client.h index fae897119..c9339d79b 100644 --- a/telepathy-glib/base-client.h +++ b/telepathy-glib/base-client.h @@ -66,11 +66,11 @@ typedef void (*TpBaseClientClassAddDispatchOperationImpl) ( TpChannelDispatchOperation *dispatch_operation, TpAddDispatchOperationContext *context); -typedef void (*TpBaseClientClassHandleChannelsImpl) ( +typedef void (*TpBaseClientClassHandleChannelImpl) ( TpBaseClient *client, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelContext *context); @@ -80,7 +80,7 @@ struct _TpBaseClientClass { GObjectClass parent_class; TpBaseClientClassObserveChannelImpl observe_channel; TpBaseClientClassAddDispatchOperationImpl add_dispatch_operation; - TpBaseClientClassHandleChannelsImpl handle_channels; + TpBaseClientClassHandleChannelImpl handle_channel; /*<private>*/ GCallback _padding[4]; TpDBusPropertiesMixinClass dbus_properties_class; @@ -103,8 +103,8 @@ void tp_base_client_implement_observe_channel (TpBaseClientClass *klass, void tp_base_client_implement_add_dispatch_operation (TpBaseClientClass *klass, TpBaseClientClassAddDispatchOperationImpl impl); -void tp_base_client_implement_handle_channels (TpBaseClientClass *klass, - TpBaseClientClassHandleChannelsImpl impl); +void tp_base_client_implement_handle_channel (TpBaseClientClass *klass, + TpBaseClientClassHandleChannelImpl impl); /* setup functions which can only be called before register() */ diff --git a/telepathy-glib/handle-channel-context-internal.h b/telepathy-glib/handle-channel-context-internal.h index 51dcd63bf..a8024eeb4 100644 --- a/telepathy-glib/handle-channel-context-internal.h +++ b/telepathy-glib/handle-channel-context-internal.h @@ -25,6 +25,7 @@ #include <dbus/dbus-glib.h> #include <telepathy-glib/account.h> +#include <telepathy-glib/channel.h> #include <telepathy-glib/handle-channel-context.h> G_BEGIN_DECLS @@ -44,8 +45,7 @@ struct _TpHandleChannelContext { TpAccount *account; TpConnection *connection; - /* array of reffed TpChannel */ - GPtrArray *channels; + TpChannel *channel; /* array of reffed TpChannelRequest */ GPtrArray *requests_satisfied; guint64 user_action_time; @@ -55,7 +55,7 @@ struct _TpHandleChannelContext { TpHandleChannelContext * _tp_handle_channel_context_new ( TpAccount *account, TpConnection *connection, - GPtrArray *channels, + TpChannel *channel, GPtrArray *requests_satisfied, guint64 user_action_time, GHashTable *handler_info, diff --git a/telepathy-glib/handle-channel-context.c b/telepathy-glib/handle-channel-context.c index 0cae84fcb..f3084bf8e 100644 --- a/telepathy-glib/handle-channel-context.c +++ b/telepathy-glib/handle-channel-context.c @@ -72,7 +72,7 @@ G_DEFINE_TYPE(TpHandleChannelContext, enum { PROP_ACCOUNT = 1, PROP_CONNECTION, - PROP_CHANNELS, + PROP_CHANNEL, PROP_REQUESTS_SATISFIED, PROP_USER_ACTION_TIME, PROP_HANDLER_INFO, @@ -141,11 +141,7 @@ tp_handle_channel_context_dispose (GObject *object) self->connection = NULL; } - if (self->channels != NULL) - { - g_ptr_array_unref (self->channels); - self->channels = NULL; - } + g_clear_object (&self->channel); if (self->requests_satisfied != NULL) { @@ -190,8 +186,8 @@ tp_handle_channel_context_get_property (GObject *object, g_value_set_object (value, self->connection); break; - case PROP_CHANNELS: - g_value_set_boxed (value, self->channels); + case PROP_CHANNEL: + g_value_set_object (value, self->channel); break; case PROP_REQUESTS_SATISFIED: @@ -231,8 +227,8 @@ tp_handle_channel_context_set_property (GObject *object, self->connection = g_value_dup_object (value); break; - case PROP_CHANNELS: - self->channels = g_value_dup_boxed (value); + case PROP_CHANNEL: + self->channel = g_value_dup_object (value); break; case PROP_REQUESTS_SATISFIED: @@ -273,7 +269,7 @@ tp_handle_channel_context_constructed (GObject *object) g_assert (self->account != NULL); g_assert (self->connection != NULL); - g_assert (self->channels != NULL); + g_assert (self->channel != NULL); g_assert (self->requests_satisfied != NULL); g_assert (self->handler_info != NULL); g_assert (self->priv->dbus_context != NULL); @@ -330,21 +326,19 @@ tp_handle_channel_context_class_init ( param_spec); /** - * TpHandleChannelContext:channels: + * TpHandleChannelContext:channel: * - * A #GPtrArray containing #TpChannel objects representing the channels - * that have been passed to HandleChannels. + * A #TpChannel object representing the channel + * that has been passed to HandleChannel. * Read-only except during construction. * * This property can't be %NULL. - * - * Since: 0.11.6 */ - param_spec = g_param_spec_boxed ("channels", "GPtrArray of TpChannel", - "The TpChannels that have been passed to HandleChannels", - G_TYPE_PTR_ARRAY, + param_spec = g_param_spec_object ("channel", "TpChannel", + "The TpChannel that has been passed to HandleChannel", + TP_TYPE_CHANNEL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_CHANNELS, + g_object_class_install_property (object_class, PROP_CHANNEL, param_spec); /** @@ -440,7 +434,7 @@ tp_handle_channel_context_class_init ( TpHandleChannelContext * _tp_handle_channel_context_new ( TpAccount *account, TpConnection *connection, - GPtrArray *channels, + TpChannel *channel, GPtrArray *requests_satisfied, guint64 user_action_time, GHashTable *handler_info, @@ -449,7 +443,7 @@ TpHandleChannelContext * _tp_handle_channel_context_new ( return g_object_new (TP_TYPE_HANDLE_CHANNELS_CONTEXT, "account", account, "connection", connection, - "channels", channels, + "channel", channel, "requests-satisfied", requests_satisfied, "user-action-time", user_action_time, "handler-info", handler_info, @@ -636,9 +630,7 @@ context_prepare (TpHandleChannelContext *self, const GQuark *connection_features, const GQuark *channel_features) { - guint i; - - self->priv->num_pending = 2; + self->priv->num_pending = 3; tp_proxy_prepare_async (self->account, account_features, account_prepare_cb, g_object_ref (self)); @@ -646,15 +638,8 @@ context_prepare (TpHandleChannelContext *self, tp_proxy_prepare_async (self->connection, connection_features, conn_prepare_cb, g_object_ref (self)); - for (i = 0; i < self->channels->len; i++) - { - TpChannel *channel = g_ptr_array_index (self->channels, i); - - self->priv->num_pending++; - - tp_proxy_prepare_async (channel, channel_features, - hcc_channel_prepare_cb, g_object_ref (self)); - } + tp_proxy_prepare_async (self->channel, channel_features, + hcc_channel_prepare_cb, g_object_ref (self)); } void diff --git a/telepathy-glib/simple-handler.c b/telepathy-glib/simple-handler.c index 33dcb4903..426ee635f 100644 --- a/telepathy-glib/simple-handler.c +++ b/telepathy-glib/simple-handler.c @@ -30,23 +30,23 @@ * A typical simple handler would look liks this: * |[ * static void - * my_handle_channels (TpSimpleHandler *handler, + * my_handle_channel (TpSimpleHandler *handler, * TpAccount *account, * TpConnection *connection, - * GList *channels, + * TpChannel *channel, * GList *requests_satisfied, * gint64 user_action_time, * GList *requests, * TpHandleChannelContext *context, * gpointer user_data) * { - * /<!-- -->* start handling the channels here *<!-- -->/ + * /<!-- -->* start handling the channel here *<!-- -->/ * * tp_handle_channel_context_accept (context); * } * * client = tp_simple_handler_new (NULL, FALSE, FALSE, - * "MyHandler", FALSE, my_handle_channels, user_data); + * "MyHandler", FALSE, my_handle_channel, user_data); * * tp_base_client_take_handler_filter (client, tp_asv_new ( * TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT, @@ -78,13 +78,12 @@ */ /** - * TpSimpleHandlerHandleChannelsImpl: + * TpSimpleHandlerHandleChannelImpl: * @handler: a #TpSimpleHandler instance * @account: a #TpAccount having %TP_ACCOUNT_FEATURE_CORE prepared if possible * @connection: a #TpConnection having %TP_CONNECTION_FEATURE_CORE prepared * if possible - * @channels: (element-type TelepathyGLib.Channel): a #GList of #TpChannel, - * all having %TP_CHANNEL_FEATURE_CORE prepared if possible + * @channel: a #TpChannel, having %TP_CHANNEL_FEATURE_CORE prepared if possible * @requests_satisfied: (element-type TelepathyGLib.ChannelRequest): a #GList of * #TpChannelRequest having their object-path defined but are not guaranteed * to be prepared. @@ -96,7 +95,7 @@ * D-Bus call * @user_data: arbitrary user-supplied data passed to tp_simple_handler_new() * - * Signature of the implementation of the HandleChannels method. + * Signature of the implementation of the HandleChannel method. * * This function must call either tp_handle_channel_context_accept(), * tp_handle_channel_context_delay() or tp_handle_channel_context_fail() @@ -125,7 +124,7 @@ enum { struct _TpSimpleHandlerPrivate { - TpSimpleHandlerHandleChannelsImpl callback; + TpSimpleHandlerHandleChannelImpl callback; gpointer user_data; GDestroyNotify destroy; }; @@ -207,18 +206,18 @@ tp_simple_handler_dispose (GObject *object) } static void -handle_channels ( +handle_channel ( TpBaseClient *client, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelContext *context) { TpSimpleHandler *self = TP_SIMPLE_HANDLER (client); - self->priv->callback (self, account, connection, channels, + self->priv->callback (self, account, connection, channel, requests_satisfied, user_action_time, context, self->priv->user_data); } @@ -266,8 +265,8 @@ tp_simple_handler_class_init (TpSimpleHandlerClass *cls) /** * TpSimpleHandler:callback: * - * The #TpSimpleHandlerHandleChannelsImpl callback implementing the - * HandleChannels D-Bus method. + * The #TpSimpleHandlerHandleChannelImpl callback implementing the + * HandleChannel D-Bus method. * * This property can't be %NULL. * @@ -275,7 +274,7 @@ tp_simple_handler_class_init (TpSimpleHandlerClass *cls) */ param_spec = g_param_spec_pointer ("callback", "Callback", - "Function called when HandleChannels is called", + "Function called when HandleChannel is called", G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_CALLBACK, param_spec); @@ -288,7 +287,7 @@ tp_simple_handler_class_init (TpSimpleHandlerClass *cls) * Since: 0.11.6 */ param_spec = g_param_spec_pointer ("user-data", "user data", - "pointer passed as user-data when HandleChannels is called", + "pointer passed as user-data when HandleChannel is called", G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_USER_DATA, param_spec); @@ -307,7 +306,7 @@ tp_simple_handler_class_init (TpSimpleHandlerClass *cls) g_object_class_install_property (object_class, PROP_DESTROY, param_spec); - base_clt_cls->handle_channels = handle_channels; + base_clt_cls->handle_channel = handle_channel; } /** @@ -319,7 +318,7 @@ tp_simple_handler_class_init (TpSimpleHandlerClass *cls) * tp_base_client_set_handler_request_notification() for details) * @name: the name of the Handler (see #TpBaseClient:name for details) * @uniquify: the value of the #TpBaseClient:uniquify-name property - * @callback: the function called when HandleChannels is called + * @callback: the function called when HandleChannel is called * @user_data: arbitrary user-supplied data passed to @callback * @destroy: called with @user_data as its argument when the #TpSimpleHandler * is destroyed @@ -338,7 +337,7 @@ tp_simple_handler_new (TpClientFactory *factory, gboolean requests, const gchar *name, gboolean uniquify, - TpSimpleHandlerHandleChannelsImpl callback, + TpSimpleHandlerHandleChannelImpl callback, gpointer user_data, GDestroyNotify destroy) { @@ -363,7 +362,7 @@ tp_simple_handler_new (TpClientFactory *factory, * tp_base_client_set_handler_request_notification() for details) * @name: the name of the Handler (see #TpBaseClient:name for details) * @uniquify: the value of the #TpBaseClient:uniquify-name property - * @callback: the function called when HandleChannels is called + * @callback: the function called when HandleChannel is called * @user_data: arbitrary user-supplied data passed to @callback * @destroy: called with @user_data as its argument when the #TpSimpleHandler * is destroyed @@ -384,7 +383,7 @@ tp_simple_handler_new_with_am (TpAccountManager *account_manager, gboolean requests, const gchar *name, gboolean uniquify, - TpSimpleHandlerHandleChannelsImpl callback, + TpSimpleHandlerHandleChannelImpl callback, gpointer user_data, GDestroyNotify destroy) { diff --git a/telepathy-glib/simple-handler.h b/telepathy-glib/simple-handler.h index aa604e4d0..44cda4824 100644 --- a/telepathy-glib/simple-handler.h +++ b/telepathy-glib/simple-handler.h @@ -68,11 +68,11 @@ GType tp_simple_handler_get_type (void); (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_SIMPLE_HANDLER, \ TpSimpleHandlerClass)) -typedef void (*TpSimpleHandlerHandleChannelsImpl) ( +typedef void (*TpSimpleHandlerHandleChannelImpl) ( TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelContext *context, @@ -83,7 +83,7 @@ TpBaseClient *tp_simple_handler_new (TpClientFactory *factory, gboolean requests, const gchar *name, gboolean uniquify, - TpSimpleHandlerHandleChannelsImpl callback, + TpSimpleHandlerHandleChannelImpl callback, gpointer user_data, GDestroyNotify destroy); @@ -92,7 +92,7 @@ TpBaseClient *tp_simple_handler_new_with_am (TpAccountManager *account_manager, gboolean requests, const gchar *name, gboolean uniquify, - TpSimpleHandlerHandleChannelsImpl callback, + TpSimpleHandlerHandleChannelImpl callback, gpointer user_data, GDestroyNotify destroy); diff --git a/tests/dbus/base-client.c b/tests/dbus/base-client.c index ad7360db5..2efa5cc8a 100644 --- a/tests/dbus/base-client.c +++ b/tests/dbus/base-client.c @@ -761,7 +761,7 @@ channel_invalidated_cb (TpChannel *channel, } static void -call_handle_channel (Test *test, +call_handle_channels (Test *test, TpChannel *channel, GPtrArray *requests_satisified, GHashTable *info) @@ -853,11 +853,11 @@ test_handler (Test *test, g_assert (!tp_base_client_is_handling_channel (test->base_client, test->text_chan_2)); - call_handle_channel (test, test->text_chan, NULL, NULL); - call_handle_channel (test, test->text_chan_2, NULL, NULL); + call_handle_channels (test, test->text_chan, NULL, NULL); + call_handle_channels (test, test->text_chan_2, NULL, NULL); - g_assert (test->simple_client->handle_channels_ctx != NULL); - g_assert (test->simple_client->handle_channels_ctx->account == test->account); + g_assert (test->simple_client->handle_channel_ctx != NULL); + g_assert (test->simple_client->handle_channel_ctx->account == test->account); chans = tp_base_client_dup_handled_channels (test->base_client); g_assert_cmpuint (g_list_length (chans), ==, 2); @@ -1026,7 +1026,7 @@ test_handler_requests (Test *test, g_assert (requests != NULL); g_list_free_full (requests, g_object_unref); - /* Call HandleChannels */ + /* Call HandleChannel */ requests_satisified = g_ptr_array_sized_new (1); g_ptr_array_add (requests_satisified, "/Request"); @@ -1037,13 +1037,13 @@ test_handler_requests (Test *test, request_props, NULL); - call_handle_channel (test, test->text_chan, requests_satisified, info); + call_handle_channels (test, test->text_chan, requests_satisified, info); - g_assert (test->simple_client->handle_channels_ctx != NULL); + g_assert (test->simple_client->handle_channel_ctx != NULL); g_assert_cmpint ( - test->simple_client->handle_channels_ctx->requests_satisfied->len, ==, 1); + test->simple_client->handle_channel_ctx->requests_satisfied->len, ==, 1); request = g_ptr_array_index ( - test->simple_client->handle_channels_ctx->requests_satisfied, 0); + test->simple_client->handle_channel_ctx->requests_satisfied, 0); requests = tp_base_client_dup_pending_requests (test->base_client); g_assert (requests->data == request); g_list_free_full (requests, g_object_unref); @@ -1206,8 +1206,8 @@ test_delegate_channels (Test *test, tp_base_client_register (test->base_client, &test->error); g_assert_no_error (test->error); - call_handle_channel (test, test->text_chan, NULL, NULL); - call_handle_channel (test, test->text_chan_2, NULL, NULL); + call_handle_channels (test, test->text_chan, NULL, NULL); + call_handle_channels (test, test->text_chan_2, NULL, NULL); /* The client is handling the 2 channels */ chans = tp_base_client_dup_handled_channels (test->base_client); @@ -1375,8 +1375,8 @@ delegate_to_preferred_handler (Test *test, tp_base_client_register (test->base_client, &test->error); g_assert_no_error (test->error); - call_handle_channel (test, test->text_chan, NULL, NULL); - call_handle_channel (test, test->text_chan_2, NULL, NULL); + call_handle_channels (test, test->text_chan, NULL, NULL); + call_handle_channels (test, test->text_chan_2, NULL, NULL); /* The client is handling the 2 channels */ g_assert (tp_base_client_is_handling_channel (test->base_client, @@ -1415,11 +1415,11 @@ delegate_to_preferred_handler (Test *test, * delegated_channels_cb to be called */ if (supported) test->wait++; - call_handle_channel (test, test->text_chan, requests_satisfied, info); + call_handle_channels (test, test->text_chan, requests_satisfied, info); if (supported) test->wait++; - call_handle_channel (test, test->text_chan_2, requests_satisfied, info); + call_handle_channels (test, test->text_chan_2, requests_satisfied, info); g_assert_no_error (test->error); diff --git a/tests/dbus/simple-handler.c b/tests/dbus/simple-handler.c index 627ae4adf..350c94ec9 100644 --- a/tests/dbus/simple-handler.c +++ b/tests/dbus/simple-handler.c @@ -164,7 +164,7 @@ static void create_simple_handler (Test *test, gboolean bypass_approval, gboolean requests, - TpSimpleHandlerHandleChannelsImpl impl) + TpSimpleHandlerHandleChannelImpl impl) { /* Create service-side Client object */ test->simple_handler = tp_tests_object_new_static_class ( @@ -281,11 +281,11 @@ out: } static void -handle_channels_success ( +handle_channel_success ( TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisified, gint64 user_action_time, TpHandleChannelContext *context, @@ -298,7 +298,7 @@ static void test_properties (Test *test, gconstpointer data G_GNUC_UNUSED) { - create_simple_handler (test, FALSE, TRUE, handle_channels_success); + create_simple_handler (test, FALSE, TRUE, handle_channel_success); tp_base_client_add_handler_filter_vardict (test->simple_handler, g_variant_new_parsed ("{ %s: <%s> }", @@ -348,7 +348,7 @@ out: } static void -call_handle_channels (Test *test) +call_handle_channel (Test *test) { GPtrArray *requests_satisified; GHashTable *info,* chan_props; @@ -378,12 +378,12 @@ call_handle_channels (Test *test) g_hash_table_unref (chan_props); } -/* HandleChannels returns immediately */ +/* HandleChannel returns immediately */ static void test_success (Test *test, gconstpointer data G_GNUC_UNUSED) { - create_simple_handler (test, FALSE, FALSE, handle_channels_success); + create_simple_handler (test, FALSE, FALSE, handle_channel_success); tp_base_client_add_handler_filter_vardict (test->simple_handler, g_variant_new_parsed ("@a{sv} {}")); @@ -391,11 +391,11 @@ test_success (Test *test, tp_base_client_register (test->simple_handler, &test->error); g_assert_no_error (test->error); - call_handle_channels (test); + call_handle_channel (test); g_assert_no_error (test->error); } -/* HandleChannels returns in an async way */ +/* HandleChannel returns in an async way */ static gboolean accept_idle_cb (gpointer data) { @@ -407,11 +407,11 @@ accept_idle_cb (gpointer data) } static void -handle_channels_async ( +handle_channel_async ( TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisified, gint64 user_action_time, TpHandleChannelContext *context, @@ -426,7 +426,7 @@ static void test_delayed (Test *test, gconstpointer data G_GNUC_UNUSED) { - create_simple_handler (test, FALSE, FALSE, handle_channels_async); + create_simple_handler (test, FALSE, FALSE, handle_channel_async); tp_base_client_add_handler_filter_vardict (test->simple_handler, g_variant_new_parsed ("@a{sv} {}")); @@ -434,24 +434,24 @@ test_delayed (Test *test, tp_base_client_register (test->simple_handler, &test->error); g_assert_no_error (test->error); - call_handle_channels (test); + call_handle_channel (test); g_assert_no_error (test->error); } -/* HandleChannels fails */ +/* HandleChannel fails */ static void -handle_channels_fail ( +handle_channel_fail ( TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisified, gint64 user_action_time, TpHandleChannelContext *context, gpointer user_data) { GError error = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "No HandleChannels for you!" }; + "No HandleChannel for you!" }; tp_handle_channel_context_fail (context, &error); } @@ -460,7 +460,7 @@ static void test_fail (Test *test, gconstpointer data G_GNUC_UNUSED) { - create_simple_handler (test, FALSE, FALSE, handle_channels_fail); + create_simple_handler (test, FALSE, FALSE, handle_channel_fail); tp_base_client_add_handler_filter_vardict (test->simple_handler, g_variant_new_parsed ("@a{sv} {}")); @@ -468,7 +468,7 @@ test_fail (Test *test, tp_base_client_register (test->simple_handler, &test->error); g_assert_no_error (test->error); - call_handle_channels (test); + call_handle_channel (test); g_assert_error (test->error, TP_ERROR, TP_ERROR_NOT_AVAILABLE); } diff --git a/tests/lib/simple-client.c b/tests/lib/simple-client.c index fab3b7eaa..8007ef6d3 100644 --- a/tests/lib/simple-client.c +++ b/tests/lib/simple-client.c @@ -126,10 +126,10 @@ simple_add_dispatch_operation ( } static void -simple_handle_channels (TpBaseClient *client, +simple_handle_channel (TpBaseClient *client, TpAccount *account, TpConnection *connection, - GList *channels, + TpChannel *channel, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelContext *context) @@ -137,10 +137,10 @@ simple_handle_channels (TpBaseClient *client, TpTestsSimpleClient *self = TP_TESTS_SIMPLE_CLIENT (client); GList *l; - if (self->handle_channels_ctx != NULL) + if (self->handle_channel_ctx != NULL) { - g_object_unref (self->handle_channels_ctx); - self->handle_channels_ctx = NULL; + g_object_unref (self->handle_channel_ctx); + self->handle_channel_ctx = NULL; } g_assert (TP_IS_ACCOUNT (account)); @@ -149,15 +149,9 @@ simple_handle_channels (TpBaseClient *client, g_assert (TP_IS_CONNECTION (connection)); g_assert (tp_proxy_is_prepared (connection, TP_CONNECTION_FEATURE_CORE)); - g_assert_cmpuint (g_list_length (channels), >, 0); - for (l = channels; l != NULL; l = g_list_next (l)) - { - TpChannel *channel = l->data; - - g_assert (TP_IS_CHANNEL (channel)); - g_assert (tp_proxy_is_prepared (channel, TP_CHANNEL_FEATURE_CORE) || - tp_proxy_get_invalidated (channel) != NULL); - } + g_assert (TP_IS_CHANNEL (channel)); + g_assert (tp_proxy_is_prepared (channel, TP_CHANNEL_FEATURE_CORE) || + tp_proxy_get_invalidated (channel) != NULL); for (l = requests_satisfied; l != NULL; l = g_list_next (l)) { @@ -166,7 +160,7 @@ simple_handle_channels (TpBaseClient *client, g_assert (TP_IS_CHANNEL_REQUEST (request)); } - self->handle_channels_ctx = g_object_ref (context); + self->handle_channel_ctx = g_object_ref (context); tp_handle_channel_context_accept (context); } @@ -194,10 +188,10 @@ tp_tests_simple_client_dispose (GObject *object) self->add_dispatch_ctx = NULL; } - if (self->handle_channels_ctx != NULL) + if (self->handle_channel_ctx != NULL) { - g_object_unref (self->handle_channels_ctx); - self->handle_channels_ctx = NULL; + g_object_unref (self->handle_channel_ctx); + self->handle_channel_ctx = NULL; } if (dispose != NULL) @@ -218,8 +212,8 @@ tp_tests_simple_client_class_init (TpTestsSimpleClientClass *klass) tp_base_client_implement_add_dispatch_operation (base_class, simple_add_dispatch_operation); - tp_base_client_implement_handle_channels (base_class, - simple_handle_channels); + tp_base_client_implement_handle_channel (base_class, + simple_handle_channel); } TpTestsSimpleClient * diff --git a/tests/lib/simple-client.h b/tests/lib/simple-client.h index ee9ed6afa..2b64e7144 100644 --- a/tests/lib/simple-client.h +++ b/tests/lib/simple-client.h @@ -28,7 +28,7 @@ struct _TpTestsSimpleClient { TpObserveChannelContext *observe_ctx; TpAddDispatchOperationContext *add_dispatch_ctx; - TpHandleChannelContext *handle_channels_ctx; + TpHandleChannelContext *handle_channel_ctx; }; GType tp_tests_simple_client_get_type (void); |