[telepathy-mission-control/master] _mcd_client_proxy_handle_channels: infer the account path from the first channel
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Nov 2 07:18:15 PST 2009
---
src/mcd-client-priv.h | 2 +-
src/mcd-client.c | 19 +++++++++++++++++--
src/mcd-dispatch-operation.c | 7 +------
src/mcd-dispatcher.c | 11 +----------
4 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/src/mcd-client-priv.h b/src/mcd-client-priv.h
index d19f164..a52cb93 100644
--- a/src/mcd-client-priv.h
+++ b/src/mcd-client-priv.h
@@ -114,7 +114,7 @@ G_GNUC_INTERNAL guint _mcd_client_match_filters (
gboolean assume_requested);
G_GNUC_INTERNAL void _mcd_client_proxy_handle_channels (McdClientProxy *self,
- gint timeout_ms, const gchar *account_path, const GList *channels,
+ gint timeout_ms, const GList *channels,
gint64 user_action_time, GHashTable *handler_info,
tp_cli_client_handler_callback_for_handle_channels callback,
gpointer user_data, GDestroyNotify destroy, GObject *weak_object);
diff --git a/src/mcd-client.c b/src/mcd-client.c
index c8875b5..907fd92 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -1539,6 +1539,22 @@ _mcd_client_match_filters (GHashTable *channel_properties,
}
static const gchar *
+borrow_channel_account_path (McdChannel *channel)
+{
+ McdAccount *account;
+ const gchar *account_path;
+
+ account = mcd_channel_get_account (channel);
+ account_path = account == NULL ? "/"
+ : mcd_account_get_object_path (account);
+
+ if (G_UNLIKELY (account_path == NULL)) /* can't happen? */
+ account_path = "/";
+
+ return account_path;
+}
+
+static const gchar *
borrow_channel_connection_path (McdChannel *channel)
{
TpChannel *tp_channel;
@@ -1557,7 +1573,6 @@ borrow_channel_connection_path (McdChannel *channel)
void
_mcd_client_proxy_handle_channels (McdClientProxy *self,
gint timeout_ms,
- const gchar *account_path,
const GList *channels,
gint64 user_action_time,
GHashTable *handler_info,
@@ -1607,7 +1622,7 @@ _mcd_client_proxy_handle_channels (McdClientProxy *self,
}
tp_cli_client_handler_call_handle_channels ((TpClient *) self,
- timeout_ms, account_path,
+ timeout_ms, borrow_channel_account_path (channels->data),
borrow_channel_connection_path (channels->data), channel_details,
requests_satisfied, user_action_time, handler_info,
callback, user_data, destroy, weak_object);
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 4719ea7..6469e5c 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1663,15 +1663,10 @@ static void
mcd_dispatch_operation_handle_channels (McdDispatchOperation *self,
McdClientProxy *handler)
{
- const gchar *account_path;
-
- account_path = _mcd_dispatch_operation_get_account_path (self);
-
DEBUG ("calling HandleChannels on %s for op %p",
tp_proxy_get_bus_name (handler), self);
_mcd_client_proxy_handle_channels (handler,
- -1, account_path,
- self->priv->channels, self->priv->handle_with_time,
+ -1, self->priv->channels, self->priv->handle_with_time,
NULL, _mcd_dispatch_operation_handle_channels_cb,
g_object_ref (self), g_object_unref, NULL);
}
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index cc84f94..1adab79 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1759,8 +1759,6 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
GList *request_as_list;
const gchar *handler_unique;
GStrv possible_handlers;
- McdAccount *account;
- const gchar *account_path;
McdClientProxy *handler;
request_as_list = g_list_append (NULL, request);
@@ -1807,15 +1805,8 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
/* FIXME: gathering the arguments for HandleChannels is duplicated between
* this function and mcd_dispatch_operation_handle_channels */
- account = mcd_channel_get_account (request);
- account_path = account == NULL ? "/"
- : mcd_account_get_object_path (account);
-
- if (G_UNLIKELY (account_path == NULL)) /* can't happen? */
- account_path = "/";
-
_mcd_client_proxy_handle_channels (handler,
- -1, account_path, request_as_list,
+ -1, request_as_list,
0, /* the request's user action time will be used automatically */
NULL, /* no extra handler_info */
reinvoke_handle_channels_cb, NULL, NULL, (GObject *) request);
--
1.5.6.5
More information about the telepathy-commits
mailing list