[Telepathy-commits] [telepathy-gabble/master] GabbleChannelManager, GabbleImFactory: make GabbleChannelManager implementations responsible for tracking which requests would be satisfied by which channels
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Nov 3 11:20:33 PST 2008
Anything else doesn't really look viable.
20080725132227-53eee-a415f248e4f71df035d307f9fd73dc0a02bc5554.gz
---
src/channel-manager.c | 8 +++++---
src/im-factory.c | 33 ++++++++++++++++++++++++++-------
2 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/src/channel-manager.c b/src/channel-manager.c
index 129f699..d95b37f 100644
--- a/src/channel-manager.c
+++ b/src/channel-manager.c
@@ -23,6 +23,8 @@
#include "config.h"
#include "channel-manager.h"
+#include "gabble-signals-marshal.h"
+
enum {
NEW_CHANNELS,
CHANNEL_CLOSED,
@@ -42,14 +44,14 @@ channel_manager_base_init (gpointer klass)
initialized = TRUE;
/* FIXME: should probably have a better GType for a GPtrArray of
- * ExportableChannel */
+ * ExportableChannel, and for a GPtrArray of request tokens */
signals[NEW_CHANNELS] = g_signal_new ("new-channels",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ gabble_marshal_VOID__POINTER_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
signals[CHANNEL_CLOSED] = g_signal_new ("channel-closed",
G_OBJECT_CLASS_TYPE (klass),
diff --git a/src/im-factory.c b/src/im-factory.c
index 71d2b79..be67118 100644
--- a/src/im-factory.c
+++ b/src/im-factory.c
@@ -183,7 +183,7 @@ gabble_im_factory_class_init (GabbleImFactoryClass *gabble_im_factory_class)
}
static GabbleIMChannel *new_im_channel (GabbleImFactory *fac,
- TpHandle handle, TpHandle initiator);
+ TpHandle handle, TpHandle initiator, gpointer request_token);
static void im_channel_closed_cb (GabbleIMChannel *chan, gpointer user_data);
@@ -249,7 +249,7 @@ im_factory_message_cb (LmMessageHandler *handler,
DEBUG ("found no IM channel, creating one");
- chan = new_im_channel (fac, handle, handle);
+ chan = new_im_channel (fac, handle, handle, NULL);
}
g_assert (chan != NULL);
@@ -334,7 +334,7 @@ im_channel_closed_cb (GabbleIMChannel *chan, gpointer user_data)
tp_channel_factory_iface_emit_new_channel (self,
(TpChannelIface *) chan, NULL);
g_ptr_array_add (array, chan);
- g_signal_emit_by_name (self, "new-channels", array);
+ g_signal_emit_by_name (self, "new-channels", array, NULL);
g_ptr_array_free (array, TRUE);
}
}
@@ -348,13 +348,14 @@ im_channel_closed_cb (GabbleIMChannel *chan, gpointer user_data)
static GabbleIMChannel *
new_im_channel (GabbleImFactory *fac,
TpHandle handle,
- TpHandle initiator)
+ TpHandle initiator,
+ gpointer request_token)
{
GabbleImFactoryPrivate *priv;
TpBaseConnection *conn;
GabbleIMChannel *chan;
char *object_path;
- GPtrArray *channels;
+ GPtrArray *channels, *requests, *request_lists;
g_return_val_if_fail (GABBLE_IS_IM_FACTORY (fac), NULL);
g_return_val_if_fail (handle != 0, NULL);
@@ -384,11 +385,29 @@ new_im_channel (GabbleImFactory *fac,
g_free (object_path);
+ if (request_token != NULL)
+ {
+ requests = g_ptr_array_sized_new (1);
+ request_lists = g_ptr_array_sized_new (1);
+ g_ptr_array_add (requests, request_token);
+ g_ptr_array_add (request_lists, requests);
+ }
+ else
+ {
+ request_lists = NULL;
+ }
+
channels = g_ptr_array_sized_new (1);
g_ptr_array_add (channels, chan);
- g_signal_emit_by_name (self, "new-channels", channels);
+ g_signal_emit_by_name (fac, "new-channels", channels, request_lists);
g_ptr_array_free (channels, TRUE);
+ if (request_token != NULL)
+ {
+ g_ptr_array_free (requests, TRUE);
+ g_ptr_array_free (request_lists, TRUE);
+ }
+
return chan;
}
@@ -510,7 +529,7 @@ gabble_im_factory_iface_request (TpChannelFactoryIface *iface,
if (!chan)
{
status = TP_CHANNEL_FACTORY_REQUEST_STATUS_CREATED;
- chan = new_im_channel (fac, handle, base_conn->self_handle);
+ chan = new_im_channel (fac, handle, base_conn->self_handle, request);
}
g_assert (chan);
--
1.5.6.5
More information about the Telepathy-commits
mailing list