diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-02-23 19:14:06 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-06-09 17:20:06 +0800 |
commit | 2d6c887b9369e2db3c3bff166ee6c2c8a595faa4 (patch) | |
tree | f3aeb521b4f43daef3bf61893a4b1ff7618d8582 /src/empathy-call-factory.c | |
parent | a6b59ff12bf5563ad4db0427c0c9e41bd8842c25 (diff) | |
download | gsoc2013-empathy-2d6c887b9369e2db3c3bff166ee6c2c8a595faa4.tar gsoc2013-empathy-2d6c887b9369e2db3c3bff166ee6c2c8a595faa4.tar.gz gsoc2013-empathy-2d6c887b9369e2db3c3bff166ee6c2c8a595faa4.tar.bz2 gsoc2013-empathy-2d6c887b9369e2db3c3bff166ee6c2c8a595faa4.tar.lz gsoc2013-empathy-2d6c887b9369e2db3c3bff166ee6c2c8a595faa4.tar.xz gsoc2013-empathy-2d6c887b9369e2db3c3bff166ee6c2c8a595faa4.tar.zst gsoc2013-empathy-2d6c887b9369e2db3c3bff166ee6c2c8a595faa4.zip |
Add TargetContact property that's guaranteed to exist on CallHandler
Conflicts:
src/empathy-call-factory.c
Diffstat (limited to 'src/empathy-call-factory.c')
-rw-r--r-- | src/empathy-call-factory.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/empathy-call-factory.c b/src/empathy-call-factory.c index 0bae03a0c..5501f499f 100644 --- a/src/empathy-call-factory.c +++ b/src/empathy-call-factory.c @@ -31,6 +31,7 @@ #include <libempathy/empathy-channel-factory.h> #include <libempathy/empathy-request-util.h> +#include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-utils.h> #include <libempathy-gtk/empathy-call-utils.h> @@ -256,21 +257,35 @@ empathy_call_factory_new_call_with_streams (EmpathyContact *contact, } static void -create_call_handler (EmpathyCallFactory *factory, - TpyCallChannel *call) +call_channel_got_contact (TpConnection *connection, + EmpathyContact *contact, + const GError *error, + gpointer user_data, + GObject *weak_object) { + EmpathyCallFactory *factory = EMPATHY_CALL_FACTORY (weak_object); EmpathyCallHandler *handler; + TpyCallChannel *call = TPY_CALL_CHANNEL (user_data); - g_return_if_fail (factory != NULL); + if (contact == NULL) + { + /* FIXME use hangup with an appropriate error */ + tp_channel_close_async (TP_CHANNEL (call), NULL, NULL); + goto out; + } - handler = empathy_call_handler_new_for_channel (call); + handler = empathy_call_handler_new_for_channel (call, contact); g_signal_emit (factory, signals[NEW_CALL_HANDLER], 0, handler, FALSE); g_object_unref (handler); + +out: + g_object_unref (call); } + static void handle_channels_cb (TpSimpleHandler *handler, TpAccount *account, @@ -288,6 +303,7 @@ handle_channels_cb (TpSimpleHandler *handler, { TpChannel *channel = l->data; TpyCallChannel *call; + const gchar *id; if (tp_proxy_get_invalidated (channel) != NULL) continue; @@ -300,8 +316,14 @@ handle_channels_cb (TpSimpleHandler *handler, continue; call = TPY_CALL_CHANNEL (channel); - create_call_handler (self, call); - g_object_unref (call); + + id = tp_channel_get_identifier (channel); + empathy_tp_contact_factory_get_from_id (connection, + id, + call_channel_got_contact, + g_object_ref (channel), + g_object_unref, + (GObject *) self); } tp_handle_channels_context_accept (context); |