summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Mardegan <mardy@users.sourceforge.net>2008-02-08 09:38:11 +0000
committerAlberto Mardegan <mardy@users.sourceforge.net>2008-02-08 09:38:11 +0000
commita421fb827888b3742faa6dafd7ece38de3c2a943 (patch)
tree0e4c87d049a579e5c8d5f6cc89fd43b78310720f
parent83747f15f797cb37ab4708d6cd67433f03e018d9 (diff)
Introduce a HandlerVersion parameter in the .chandler files, that
makes MC call a HandleChannel2 method on them; this provides a boolean indicating the channel direction, and the same request_id as returned by mission_control_request_channel(). git-svn-id: https://mission-control.svn.sourceforge.net/svnroot/mission-control/trunk@269 d91c8aed-3f2b-0410-a83d-924a1c20a0ba
-rw-r--r--ChangeLog6
-rw-r--r--src/mcd-chan-handler.c11
-rw-r--r--src/mcd-chan-handler.h1
-rw-r--r--src/mcd-dispatcher.c96
4 files changed, 97 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index e5a74c8e..f27f4650 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-02-06 Alberto Mardegan <alberto.mardegan@nokia.com>
+ * src/mcd-chan-handler.[hc], src/mcd-dispatcher.c:
+ Introduce a HandlerVersion parameter in the .chandler files, that
+ makes MC call a HandleChannel2 method on them; this provides a boolean
+ indicating the channel direction, and the same request_id as returned
+ by mission_control_request_channel().
+
* src/mcd-connection.c:
Don't update the avatar while we are setting it.
diff --git a/src/mcd-chan-handler.c b/src/mcd-chan-handler.c
index 67f9026e..02816669 100644
--- a/src/mcd-chan-handler.c
+++ b/src/mcd-chan-handler.c
@@ -54,7 +54,8 @@ static inline void
_mcd_channel_handler_packer(GHashTable *handlers, gchar **string_list,
gsize list_length, gchar *bus_name,
TelepathyChannelMediaCapability capabilities,
- gchar *object_path, const gchar *cm_protocol)
+ gchar *object_path, const gchar *cm_protocol,
+ gint handler_version)
{
gint i;
McdChannelHandler *handler;
@@ -66,6 +67,7 @@ _mcd_channel_handler_packer(GHashTable *handlers, gchar **string_list,
handler->bus_name = bus_name;
handler->obj_path = object_path;
handler->capabilities = capabilities;
+ handler->version = handler_version;
channel_handler = g_hash_table_lookup (handlers, string_list[i]);
@@ -102,6 +104,7 @@ scan_chandler_dir (const gchar *dirname, GHashTable *handlers,
gchar *bus_name, *object_path;
const gchar *cm_protocol;
TelepathyChannelMediaCapability capabilities;
+ gint handler_version;
if (!g_file_test (dirname, G_FILE_TEST_IS_DIR)) return;
@@ -147,6 +150,9 @@ scan_chandler_dir (const gchar *dirname, GHashTable *handlers,
cm_protocol = NULL;
}
+ handler_version = g_key_file_get_integer (file, group,
+ "HandlerVersion", NULL);
+
capabilities = g_key_file_get_integer(file, group, "TypeSpecificCapabilities",
&error);
if (error)
@@ -167,7 +173,8 @@ scan_chandler_dir (const gchar *dirname, GHashTable *handlers,
}
_mcd_channel_handler_packer(handlers, string_list, len, bus_name,
- capabilities, object_path, cm_protocol);
+ capabilities, object_path, cm_protocol,
+ handler_version);
g_strfreev(string_list);
g_key_file_free(file);
diff --git a/src/mcd-chan-handler.h b/src/mcd-chan-handler.h
index 5c7f2d60..6128c658 100644
--- a/src/mcd-chan-handler.h
+++ b/src/mcd-chan-handler.h
@@ -35,6 +35,7 @@ typedef struct
const gchar *bus_name;
const gchar *obj_path;
TelepathyChannelMediaCapability capabilities;
+ gint version;
} McdChannelHandler;
GHashTable* mcd_get_channel_handlers (void);
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 46ef2c9c..e87de917 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -134,6 +134,39 @@ static guint mcd_dispatcher_signals[LAST_SIGNAL] = { 0 };
static void mcd_dispatcher_context_free (McdDispatcherContext * ctx);
+static inline DBusGProxyCall *
+tp_ch_handle_channel_2_async (DBusGProxy *proxy,
+ const char * IN_Bus_Name,
+ const char* IN_Connection,
+ const char *IN_Channel_Type,
+ const char* IN_Channel,
+ const guint IN_Handle_Type, const guint IN_Handle,
+ gboolean incoming, guint request_id,
+ const GHashTable *options,
+ tp_ch_handle_channel_reply callback,
+ gpointer userdata)
+
+{
+ DBusGAsyncData *stuff;
+ stuff = g_new (DBusGAsyncData, 1);
+ stuff->cb = G_CALLBACK (callback);
+ stuff->userdata = userdata;
+ return dbus_g_proxy_begin_call (proxy, "HandleChannel2",
+ tp_ch_handle_channel_async_callback,
+ stuff, g_free,
+ G_TYPE_STRING, IN_Bus_Name,
+ DBUS_TYPE_G_OBJECT_PATH, IN_Connection,
+ G_TYPE_STRING, IN_Channel_Type,
+ DBUS_TYPE_G_OBJECT_PATH, IN_Channel,
+ G_TYPE_UINT, IN_Handle_Type,
+ G_TYPE_UINT, IN_Handle,
+ /* New params for version 2: */
+ G_TYPE_BOOLEAN, incoming,
+ G_TYPE_UINT, request_id,
+ dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), options,
+ G_TYPE_INVALID);
+}
+
static void
_mcd_dispatcher_load_filters (McdDispatcher * dispatcher)
{
@@ -695,22 +728,55 @@ _mcd_dispatcher_start_channel_handler (McdDispatcherContext * context)
mcd_channel_get_object_path (channel),
mcd_channel_get_handle_type (channel),
mcd_channel_get_handle (channel));
-
- call = tp_ch_handle_channel_async (handler_proxy,
- /*Connection bus */
- dbus_g_proxy_get_bus_name (DBUS_G_PROXY
+
+ if (chandler->version >= 2)
+ {
+ gboolean outgoing;
+ guint request_id;
+ GHashTable *options;
+
+ g_debug ("new chandler");
+ g_object_get (channel,
+ "outgoing", &outgoing,
+ "requestor-serial", &request_id,
+ NULL);
+ options = g_hash_table_new (g_str_hash, g_str_equal);
+ call = tp_ch_handle_channel_2_async (handler_proxy,
+ /*Connection bus */
+ dbus_g_proxy_get_bus_name (DBUS_G_PROXY
+ (tp_conn)),
+ /*Connection path */
+ dbus_g_proxy_get_path (DBUS_G_PROXY
+ (tp_conn)),
+ /*Channel type */
+ mcd_channel_get_channel_type (channel),
+ /*Object path */
+ mcd_channel_get_object_path (channel),
+ mcd_channel_get_handle_type (channel),
+ mcd_channel_get_handle (channel),
+ !outgoing,
+ request_id,
+ options,
+ _mcd_dispatcher_handle_channel_async_cb,
+ context);
+ g_hash_table_destroy (options);
+ }
+ else
+ call = tp_ch_handle_channel_async (handler_proxy,
+ /*Connection bus */
+ dbus_g_proxy_get_bus_name (DBUS_G_PROXY
+ (tp_conn)),
+ /*Connection path */
+ dbus_g_proxy_get_path (DBUS_G_PROXY
(tp_conn)),
- /*Connection path */
- dbus_g_proxy_get_path (DBUS_G_PROXY
- (tp_conn)),
- /*Channel type */
- mcd_channel_get_channel_type (channel),
- /*Object path */
- mcd_channel_get_object_path (channel),
- mcd_channel_get_handle_type (channel),
- mcd_channel_get_handle (channel),
- _mcd_dispatcher_handle_channel_async_cb,
- context);
+ /*Channel type */
+ mcd_channel_get_channel_type (channel),
+ /*Object path */
+ mcd_channel_get_object_path (channel),
+ mcd_channel_get_handle_type (channel),
+ mcd_channel_get_handle (channel),
+ _mcd_dispatcher_handle_channel_async_cb,
+ context);
call_data = g_malloc (sizeof (struct cancel_call_data));
call_data->call = call;
call_data->handler_proxy = handler_proxy;