diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-02-21 15:26:19 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-02-21 15:26:19 +0800 |
commit | 894b1f315b62499a5d305aff6b937093a20df1a4 (patch) | |
tree | 8cecdaff46a2ee3360f9e676d11672c388a23082 /src | |
parent | 58574c8dc2e5261d8c89b9a6b6fda41687a386ea (diff) | |
parent | 1af2b9b657046268d0a44fd2aa588ea281ad1f20 (diff) | |
download | gsoc2013-empathy-894b1f315b62499a5d305aff6b937093a20df1a4.tar gsoc2013-empathy-894b1f315b62499a5d305aff6b937093a20df1a4.tar.gz gsoc2013-empathy-894b1f315b62499a5d305aff6b937093a20df1a4.tar.bz2 gsoc2013-empathy-894b1f315b62499a5d305aff6b937093a20df1a4.tar.lz gsoc2013-empathy-894b1f315b62499a5d305aff6b937093a20df1a4.tar.xz gsoc2013-empathy-894b1f315b62499a5d305aff6b937093a20df1a4.tar.zst gsoc2013-empathy-894b1f315b62499a5d305aff6b937093a20df1a4.zip |
Merge remote-tracking branch 'origin/call1' into master+call
Conflicts:
configure.ac
telepathy-yell
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/empathy-call-factory.c | 112 | ||||
-rw-r--r-- | src/empathy-call-handler.c | 206 | ||||
-rw-r--r-- | src/empathy-call-handler.h | 4 | ||||
-rw-r--r-- | src/empathy-call-observer.c | 12 | ||||
-rw-r--r-- | src/empathy-call-window.c | 134 | ||||
-rw-r--r-- | src/empathy-call-window.h | 2 | ||||
-rw-r--r-- | src/empathy-call.c | 6 | ||||
-rw-r--r-- | src/empathy-event-manager.c | 45 | ||||
-rw-r--r-- | src/empathy-notifications-approver.c | 11 | ||||
-rw-r--r-- | src/empathy.c | 3 |
11 files changed, 163 insertions, 374 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 8623ac2dd..a2aa31d5b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/tools/flymake.mk CPPFLAGS_COMMON = \ - $(YELL_CFLAGS) \ $(EMPATHY_CFLAGS) \ $(EDS_CFLAGS) \ $(ERROR_CFLAGS) \ @@ -24,7 +23,6 @@ LDADD = \ $(top_builddir)/extensions/libemp-extensions.la \ $(GCR_LIBS) \ $(EMPATHY_LIBS) \ - $(YELL_LIBS) \ $(LIBCHAMPLAIN_LIBS) \ $(NULL) diff --git a/src/empathy-call-factory.c b/src/empathy-call-factory.c index b3c85f4b0..4ff8ebe51 100644 --- a/src/empathy-call-factory.c +++ b/src/empathy-call-factory.c @@ -27,8 +27,6 @@ #include <telepathy-glib/interfaces.h> #include <telepathy-glib/util.h> -#include <telepathy-yell/telepathy-yell.h> - #include <libempathy/empathy-client-factory.h> #include <libempathy/empathy-request-util.h> #include <libempathy/empathy-tp-contact-factory.h> @@ -76,32 +74,32 @@ empathy_call_factory_init (EmpathyCallFactory *obj) tp_base_client_take_approver_filter (client, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TPY_IFACE_CHANNEL_TYPE_CALL, + TP_IFACE_CHANNEL_TYPE_CALL, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); tp_base_client_take_handler_filter (client, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TPY_IFACE_CHANNEL_TYPE_CALL, + TP_IFACE_CHANNEL_TYPE_CALL, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); tp_base_client_take_handler_filter (client, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TPY_IFACE_CHANNEL_TYPE_CALL, + TP_IFACE_CHANNEL_TYPE_CALL, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, - TPY_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, G_TYPE_BOOLEAN, TRUE, + TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, G_TYPE_BOOLEAN, TRUE, NULL)); tp_base_client_take_handler_filter (client, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TPY_IFACE_CHANNEL_TYPE_CALL, + TP_IFACE_CHANNEL_TYPE_CALL, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, - TPY_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, G_TYPE_BOOLEAN, TRUE, + TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, G_TYPE_BOOLEAN, TRUE, NULL)); tp_base_client_add_handler_capabilities_varargs (client, @@ -151,7 +149,7 @@ empathy_call_factory_class_init (EmpathyCallFactoryClass *klass) NULL, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, - 4, G_TYPE_UINT, TPY_TYPE_CALL_CHANNEL, + 4, G_TYPE_UINT, TP_TYPE_CALL_CHANNEL, TP_TYPE_CHANNEL_DISPATCH_OPERATION, TP_TYPE_ADD_DISPATCH_OPERATION_CONTEXT); } @@ -189,66 +187,6 @@ empathy_call_factory_get (void) } static void -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); - - if (contact == NULL) - { - /* FIXME use hangup with an appropriate error */ - tp_channel_close_async (TP_CHANNEL (call), NULL, NULL); - return; - } - - handler = empathy_call_handler_new_for_channel (call, contact); - - g_signal_emit (factory, signals[NEW_CALL_HANDLER], 0, - handler, FALSE); - - g_object_unref (handler); -} - -static void -call_channel_ready (EmpathyCallFactory *factory, - TpyCallChannel *call) -{ - TpChannel *channel = TP_CHANNEL (call); - const gchar *id; - - id = tp_channel_get_identifier (channel); - - /* The ready callback has a reference, so pass that on */ - empathy_tp_contact_factory_get_from_id ( - tp_channel_borrow_connection (channel), - id, - call_channel_got_contact, - channel, - g_object_unref, - (GObject *) factory); -} - -static void -call_channel_ready_cb (TpyCallChannel *call, - GParamSpec *spec, - EmpathyCallFactory *factory) -{ - gboolean ready; - - g_object_get (call, "ready", &ready, NULL); - if (!ready) - return; - - call_channel_ready (factory, call); -} - - -static void handle_channels (TpBaseClient *client, TpAccount *account, TpConnection *connection, @@ -263,36 +201,38 @@ handle_channels (TpBaseClient *client, for (l = channels; l != NULL; l = g_list_next (l)) { TpChannel *channel = l->data; - TpyCallChannel *call; - gboolean ready; + TpCallChannel *call; + TpContact *tp_contact; + EmpathyContact *contact; + EmpathyCallHandler *handler; if (tp_proxy_get_invalidated (channel) != NULL) continue; if (tp_channel_get_channel_type_id (channel) != - TPY_IFACE_QUARK_CHANNEL_TYPE_CALL) + TP_IFACE_QUARK_CHANNEL_TYPE_CALL) continue; - if (!TPY_IS_CALL_CHANNEL (channel)) + if (!TP_IS_CALL_CHANNEL (channel)) continue; - call = TPY_CALL_CHANNEL (channel); + call = TP_CALL_CHANNEL (channel); + + tp_contact = tp_channel_get_target_contact (channel); + contact = empathy_contact_dup_from_tp_contact (tp_contact); + handler = empathy_call_handler_new_for_channel (call, contact); - /* Take a ref to keep while hopping through the async callbacks */ - g_object_ref (call); - g_object_get (call, "ready", &ready, NULL); + g_signal_emit (self, signals[NEW_CALL_HANDLER], 0, + handler, FALSE); - if (!ready) - tp_g_signal_connect_object (call, "notify::ready", - G_CALLBACK (call_channel_ready_cb), self, 0); - else - call_channel_ready (self, call); + g_object_unref (handler); + g_object_unref (contact); } tp_handle_channels_context_accept (context); } -static TpyCallChannel * +static TpCallChannel * find_call_channel (GList *channels) { GList *l; @@ -307,8 +247,8 @@ find_call_channel (GList *channels) channel_type = tp_channel_get_channel_type_id (channel); - if (channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL) - return TPY_CALL_CHANNEL (channel); + if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_CALL) + return TP_CALL_CHANNEL (channel); } return NULL; @@ -323,7 +263,7 @@ approve_channels (TpBaseClient *client, TpAddDispatchOperationContext *context) { EmpathyCallFactory *self = EMPATHY_CALL_FACTORY (client); - TpyCallChannel *channel; + TpCallChannel *channel; guint handle; GError error = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, "" }; gboolean handled = FALSE; diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c index 4014ad6c6..3389c8374 100644 --- a/src/empathy-call-handler.c +++ b/src/empathy-call-handler.c @@ -26,8 +26,6 @@ #include <telepathy-glib/util.h> #include <telepathy-glib/interfaces.h> -#include <telepathy-yell/telepathy-yell.h> - #include <telepathy-farstream/telepathy-farstream.h> #include <libempathy/empathy-utils.h> @@ -63,7 +61,6 @@ enum { PROP_CALL_CHANNEL = 1, PROP_GST_BUS, PROP_CONTACT, - PROP_MEMBERS, PROP_INITIAL_AUDIO, PROP_INITIAL_VIDEO, PROP_SEND_AUDIO_CODEC, @@ -79,11 +76,9 @@ enum { /* private structure */ struct _EmpathyCallHandlerPriv { - TpyCallChannel *call; + TpCallChannel *call; EmpathyContact *contact; - /* GArray of TpContacts */ - GArray *members; TfChannel *tfchannel; gboolean initial_audio; gboolean initial_video; @@ -96,6 +91,7 @@ struct _EmpathyCallHandlerPriv { FsCandidate *video_remote_candidate; FsCandidate *audio_local_candidate; FsCandidate *video_local_candidate; + gboolean accept_when_initialised; }; #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallHandler) @@ -109,8 +105,6 @@ empathy_call_handler_dispose (GObject *object) tp_clear_object (&priv->call); tp_clear_object (&priv->contact); - tp_clear_pointer (&priv->members, g_array_unref); - G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose (object); } @@ -141,36 +135,22 @@ empathy_call_handler_init (EmpathyCallHandler *obj) } static void -on_get_contacts_cb (TpConnection *connection, - guint n_contacts, - EmpathyContact * const * contacts, - guint n_failed, - const TpHandle *failed, - const GError *error, - gpointer user_data, - GObject *weak_object) +on_call_accepted_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) { - EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (weak_object); - EmpathyCallHandlerPriv *priv = GET_PRIV (self); - guint i; - - if (n_failed > 0) - g_warning ("Failed to get %d EmpathyContacts: %s", - n_failed, error->message); - - priv->members = g_array_sized_new (FALSE, TRUE, - sizeof (EmpathyContact *), n_contacts); - - for (i = 0; i < n_contacts; i++) - g_object_ref (contacts[i]); - - g_array_append_vals (priv->members, contacts, n_contacts); + TpCallChannel *call = TP_CALL_CHANNEL (source_object); + GError *error = NULL; - g_object_notify (G_OBJECT (self), "members"); + if (!tp_call_channel_accept_finish (call, res, &error)) + { + g_warning ("could not accept Call: %s", error->message); + g_error_free (error); + } } static void -on_call_invalidated_cb (TpyCallChannel *call, +on_call_invalidated_cb (TpCallChannel *call, guint domain, gint code, gchar *message, @@ -182,91 +162,43 @@ on_call_invalidated_cb (TpyCallChannel *call, { /* Invalidated unexpectedly? Fake call ending */ g_signal_emit (self, signals[STATE_CHANGED], 0, - TPY_CALL_STATE_ENDED, NULL); + TP_CALL_STATE_ENDED, NULL); + priv->accept_when_initialised = FALSE; tp_clear_object (&priv->call); tp_clear_object (&priv->tfchannel); } } static void -on_call_state_changed_cb (TpyCallChannel *call, - TpyCallState state, - TpyCallFlags flags, - const GValueArray *call_state_reason, - GHashTable *call_state_details, +on_call_state_changed_cb (TpCallChannel *call, + TpCallState state, + TpCallFlags flags, + TpCallStateReason *reason, + GHashTable *details, EmpathyCallHandler *handler) { EmpathyCallHandlerPriv *priv = handler->priv; - gchar *dbus_reason; - guint actor, reason; - tp_value_array_unpack ((GValueArray *) call_state_reason, 3, - &actor, &reason, &dbus_reason); + g_signal_emit (handler, signals[STATE_CHANGED], 0, state, + reason->dbus_reason); - g_signal_emit (handler, signals[STATE_CHANGED], 0, state, dbus_reason); + if (state == TP_CALL_STATE_INITIALISED && + priv->accept_when_initialised) + { + tp_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); + priv->accept_when_initialised = FALSE; + } - if (state == TPY_CALL_STATE_ENDED) + if (state == TP_CALL_STATE_ENDED) { tp_channel_close_async (TP_CHANNEL (call), NULL, NULL); - + priv->accept_when_initialised = FALSE; tp_clear_object (&priv->call); tp_clear_object (&priv->tfchannel); } } static void -on_members_changed_cb (TpyCallChannel *call, - GHashTable *members, - EmpathyCallHandler *self) -{ - EmpathyCallHandlerPriv *priv = GET_PRIV (self); - GHashTableIter iter; - gpointer key, value; - TpHandle *handles; - guint n_handles; - guint i = 0; - - if (members == NULL) - return; - - n_handles = g_hash_table_size (members); - if (n_handles == 0) - return; - - handles = g_new0 (TpHandle, n_handles); - - g_hash_table_iter_init (&iter, members); - while (g_hash_table_iter_next (&iter, &key, &value)) - handles[i++] = GPOINTER_TO_UINT (key); - - empathy_tp_contact_factory_get_from_handles ( - tp_channel_borrow_connection (TP_CHANNEL (priv->call)), - n_handles, handles, - on_get_contacts_cb, - NULL, NULL, G_OBJECT (self)); - - g_free (handles); -} - -static void -empathy_call_handler_constructed (GObject *object) -{ - EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (object); - EmpathyCallHandlerPriv *priv = GET_PRIV (self); -// GHashTable *members; - - g_signal_connect (priv->call, "members-changed", - G_CALLBACK (on_members_changed_cb), object); - -/* FIXME - g_object_get (priv->call, "members", &members, NULL); - - if (members) - on_members_changed_cb (priv->call, members, self); -*/ -} - -static void empathy_call_handler_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { @@ -277,9 +209,6 @@ empathy_call_handler_set_property (GObject *object, case PROP_CONTACT: priv->contact = g_value_dup_object (value); break; - case PROP_MEMBERS: - priv->members = g_value_get_boxed (value); - break; case PROP_CALL_CHANNEL: g_return_if_fail (priv->call == NULL); @@ -312,9 +241,6 @@ empathy_call_handler_get_property (GObject *object, case PROP_CONTACT: g_value_set_object (value, priv->contact); break; - case PROP_MEMBERS: - g_value_set_boxed (value, priv->members); - break; case PROP_CALL_CHANNEL: g_value_set_object (value, priv->call); break; @@ -362,7 +288,6 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) g_type_class_add_private (klass, sizeof (EmpathyCallHandlerPriv)); - object_class->constructed = empathy_call_handler_constructed; object_class->set_property = empathy_call_handler_set_property; object_class->get_property = empathy_call_handler_get_property; object_class->dispose = empathy_call_handler_dispose; @@ -374,15 +299,9 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_CONTACT, param_spec); - param_spec = g_param_spec_boxed ("members", - "call members", "The call participants", - G_TYPE_ARRAY, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_MEMBERS, param_spec); - param_spec = g_param_spec_object ("call-channel", "call channel", "The call channel", - TPY_TYPE_CALL_CHANNEL, + TP_TYPE_CALL_CHANNEL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_CALL_CHANNEL, param_spec); @@ -529,12 +448,12 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) } EmpathyCallHandler * -empathy_call_handler_new_for_channel (TpyCallChannel *call, +empathy_call_handler_new_for_channel (TpCallChannel *call, EmpathyContact *contact) { return EMPATHY_CALL_HANDLER (g_object_new (EMPATHY_TYPE_CALL_HANDLER, "call-channel", call, - "initial-video", tpy_call_channel_has_initial_video (call), + "initial-video", tp_call_channel_has_initial_video (call, NULL), "target-contact", contact, NULL)); } @@ -748,8 +667,7 @@ src_pad_added_error_idle (gpointer data) { TfContent *content = data; - tf_content_error (content, 0 /* FIXME */, - "Could not link sink", NULL); + tf_content_error_literal (content, "Could not link sink"); g_object_unref (content); return FALSE; @@ -822,8 +740,7 @@ on_tf_channel_content_added_cb (TfChannel *tfchannel, content, &retval); if (!retval) - tf_content_error (content, 0 /* FIXME */, - "Could not link source", NULL); + tf_content_error_literal (content, "Could not link source"); /* Get sending codec */ g_object_get (content, "fs-session", &session, NULL); @@ -891,8 +808,7 @@ on_tf_channel_content_removed_cb (TfChannel *tfchannel, { g_warning ("Could not remove content!"); - tf_content_error (content, 0 /* FIXME */, - "Could not link source", NULL); + tf_content_error_literal (content, "Could not link source"); } } @@ -945,21 +861,6 @@ empathy_call_handler_start_tpfs (EmpathyCallHandler *self) } static void -on_call_accepted_cb (GObject *source_object, - GAsyncResult *res, - gpointer user_data) -{ - TpyCallChannel *call = TPY_CALL_CHANNEL (source_object); - GError *error = NULL; - - if (!tpy_call_channel_accept_finish (call, res, &error)) - { - g_warning ("could not accept Call: %s", error->message); - g_error_free (error); - } -} - -static void empathy_call_handler_request_cb (GObject *source, GAsyncResult *result, gpointer user_data) @@ -979,13 +880,13 @@ empathy_call_handler_request_cb (GObject *source, return; } - if (!TPY_IS_CALL_CHANNEL (channel)) + if (!TP_IS_CALL_CHANNEL (channel)) { DEBUG ("The channel is not a Call channel!"); return; } - priv->call = TPY_CALL_CHANNEL (channel); + priv->call = TP_CALL_CHANNEL (channel); tp_g_signal_connect_object (priv->call, "state-changed", G_CALLBACK (on_call_state_changed_cb), self, 0); tp_g_signal_connect_object (priv->call, "invalidated", @@ -994,7 +895,7 @@ empathy_call_handler_request_cb (GObject *source, g_object_notify (G_OBJECT (self), "call-channel"); empathy_call_handler_start_tpfs (self); - tpy_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); + tp_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); } void @@ -1009,11 +910,28 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler, if (priv->call != NULL) { empathy_call_handler_start_tpfs (handler); - tpy_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); + + if (tp_channel_get_requested (TP_CHANNEL (priv->call))) + { + /* accept outgoing channels immediately */ + tp_call_channel_accept_async (priv->call, + on_call_accepted_cb, NULL); + } + else + { + /* accepting incoming channels when they are INITIALISED */ + if (tp_call_channel_get_state (priv->call, NULL, NULL, NULL) == + TP_CALL_STATE_INITIALISED) + tp_call_channel_accept_async (priv->call, + on_call_accepted_cb, NULL); + else + priv->accept_when_initialised = TRUE; + } + return; } - /* No TpyCallChannel (we are redialing). Request a new call channel */ + /* No TpCallChannel (we are redialing). Request a new call channel */ g_assert (priv->contact != NULL); account = empathy_contact_get_account (priv->contact); @@ -1043,13 +961,9 @@ empathy_call_handler_stop_call (EmpathyCallHandler *handler) if (priv->call != NULL) { - tpy_call_channel_hangup_async (priv->call, - TPY_CALL_STATE_CHANGE_REASON_USER_REQUESTED, + tp_call_channel_hangup_async (priv->call, + TP_CALL_STATE_CHANGE_REASON_USER_REQUESTED, "", "", NULL, NULL); - tp_channel_close_async (TP_CHANNEL (priv->call), - NULL, NULL); - tp_clear_object (&priv->call); - tp_clear_object (&priv->tfchannel); } } diff --git a/src/empathy-call-handler.h b/src/empathy-call-handler.h index 330d368a5..3586f1584 100644 --- a/src/empathy-call-handler.h +++ b/src/empathy-call-handler.h @@ -26,7 +26,7 @@ #include <gst/gst.h> #include <gst/farsight/fs-conference-iface.h> -#include <telepathy-yell/telepathy-yell.h> +#include <telepathy-glib/telepathy-glib.h> #include <libempathy/empathy-contact.h> @@ -68,7 +68,7 @@ EmpathyCallHandler * empathy_call_handler_new_for_contact ( EmpathyContact *contact); EmpathyCallHandler * empathy_call_handler_new_for_channel ( - TpyCallChannel *call, + TpCallChannel *call, EmpathyContact *contact); void empathy_call_handler_start_call (EmpathyCallHandler *handler, diff --git a/src/empathy-call-observer.c b/src/empathy-call-observer.c index 0fecbdca6..2019cd02f 100644 --- a/src/empathy-call-observer.c +++ b/src/empathy-call-observer.c @@ -24,8 +24,6 @@ #include <telepathy-glib/telepathy-glib.h> -#include <telepathy-yell/telepathy-yell.h> - #include <libnotify/notification.h> #include <libempathy/empathy-utils.h> @@ -185,7 +183,7 @@ find_main_channel (GList *channels) channel_type = tp_channel_get_channel_type_id (channel); if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA || - channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL) + channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_CALL) return channel; } @@ -203,9 +201,9 @@ has_ongoing_calls (EmpathyCallObserver *self) GQuark type = tp_channel_get_channel_type_id (channel); /* Check that Call channels are not ended */ - if (type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL && - tpy_call_channel_get_state (TPY_CALL_CHANNEL (channel), NULL, NULL) - == TPY_CALL_STATE_ENDED) + if (type == TP_IFACE_QUARK_CHANNEL_TYPE_CALL && + tp_call_channel_get_state (TP_CALL_CHANNEL (channel), + NULL, NULL, NULL) == TP_CALL_STATE_ENDED) continue; return TRUE; @@ -372,7 +370,7 @@ empathy_call_observer_init (EmpathyCallObserver *self) tp_base_client_take_observer_filter (self->priv->observer, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TPY_IFACE_CHANNEL_TYPE_CALL, + TP_IFACE_CHANNEL_TYPE_CALL, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 451722839..51732e024 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -53,6 +53,7 @@ #include <libempathy-gtk/empathy-sound-manager.h> #include <libempathy-gtk/empathy-geometry.h> #include <libempathy-gtk/empathy-images.h> +#include <libempathy-gtk/empathy-call-utils.h> #define DEBUG_FLAG EMPATHY_DEBUG_VOIP #include <libempathy/empathy-debug.h> @@ -194,17 +195,13 @@ struct _EmpathyCallWindowPriv /* These are used to accept or reject an incoming call when the status is RINGING. */ GtkWidget *incoming_call_dialog; - TpyCallChannel *pending_channel; + TpCallChannel *pending_channel; TpChannelDispatchOperation *pending_cdo; TpAddDispatchOperationContext *pending_context; gulong video_output_motion_handler_id; guint bus_message_source_id; - /* String that contains the queued tones to send after the current ones - are sent */ - GString *tones; - gboolean sending_tones; GtkWidget *dtmf_panel; /* Details vbox */ @@ -347,60 +344,20 @@ empathy_call_window_video_call_cb (GtkToggleToolButton *button, } static void -empathy_call_window_emit_tones (EmpathyCallWindow *self) -{ - TpChannel *channel; - - if (tp_str_empty (self->priv->tones->str)) - return; - - g_object_get (self->priv->handler, "call-channel", &channel, NULL); - - DEBUG ("Emitting multiple tones: %s", self->priv->tones->str); - - tp_cli_channel_interface_dtmf_call_multiple_tones (channel, -1, - self->priv->tones->str, - NULL, NULL, NULL, NULL); - - self->priv->sending_tones = TRUE; - - g_string_set_size (self->priv->tones, 0); - - g_object_unref (channel); -} - -static void -empathy_call_window_maybe_emit_tones (EmpathyCallWindow *self) -{ - if (self->priv->sending_tones) - return; - - empathy_call_window_emit_tones (self); -} - -static void -empathy_call_window_tones_stopped_cb (TpChannel *proxy, - gboolean arg_cancelled, - gpointer user_data, - GObject *weak_object) -{ - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - - self->priv->sending_tones = FALSE; - - empathy_call_window_emit_tones (self); -} - -static void dtmf_start_tone_cb (EmpathyDialpadWidget *dialpad, TpDTMFEvent event, EmpathyCallWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + TpCallChannel *call; + gchar tones[2]; - g_string_append_c (priv->tones, tp_dtmf_event_to_char (event)); + g_object_get (self->priv->handler, "call-channel", &call, NULL); - empathy_call_window_maybe_emit_tones (self); + tones[0] = tp_dtmf_event_to_char (event); + tones[1] = '\0'; + tp_call_channel_send_tones_async (call, tones, NULL, NULL, NULL); + + g_object_unref (call); } static void @@ -1557,7 +1514,7 @@ empathy_call_window_set_state_ringing (EmpathyCallWindow *self) g_assert (self->priv->call_state != CONNECTED); - video = tpy_call_channel_has_initial_video (self->priv->pending_channel); + video = tp_call_channel_has_initial_video (self->priv->pending_channel, NULL); empathy_call_window_status_message (self, _("Incoming call")); self->priv->call_state = RINGING; @@ -1601,7 +1558,7 @@ empathy_call_window_cdo_invalidated_cb (TpProxy *channel, void empathy_call_window_start_ringing (EmpathyCallWindow *self, - TpyCallChannel *channel, + TpCallChannel *channel, TpChannelDispatchOperation *dispatch_operation, TpAddDispatchOperationContext *context) { @@ -1825,8 +1782,6 @@ empathy_call_window_init (EmpathyCallWindow *self) g_signal_connect (priv->dtmf_panel, "start-tone", G_CALLBACK (dtmf_start_tone_cb), self); - priv->tones = g_string_new (""); - gtk_box_pack_start (GTK_BOX (priv->pane), priv->dtmf_panel, FALSE, FALSE, 6); @@ -2254,14 +2209,14 @@ empathy_call_window_constructed (GObject *object) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (object); EmpathyCallWindowPriv *priv = GET_PRIV (self); - TpyCallChannel *call; - TpyCallState state; + TpCallChannel *call; + TpCallState state; g_assert (priv->handler != NULL); g_object_get (priv->handler, "call-channel", &call, NULL); - state = tpy_call_channel_get_state (call, NULL, NULL); - priv->outgoing = (state == TPY_CALL_STATE_PENDING_INITIATOR); + state = tp_call_channel_get_state (call, NULL, NULL, NULL); + priv->outgoing = (state == TP_CALL_STATE_PENDING_INITIATOR); tp_clear_object (&call); g_object_get (priv->handler, "target-contact", &priv->contact, NULL); @@ -2451,8 +2406,6 @@ empathy_call_window_finalize (GObject *object) g_timer_destroy (priv->timer); - g_string_free (priv->tones, TRUE); - G_OBJECT_CLASS (empathy_call_window_parent_class)->finalize (object); } @@ -2604,9 +2557,6 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, gtk_action_set_sensitive (priv->menu_fullscreen, FALSE); gtk_widget_set_sensitive (priv->dtmf_panel, FALSE); - priv->sending_tones = FALSE; - g_string_set_size (priv->tones, 0); - could_reset_pipeline = empathy_call_window_reset_pipeline (self); if (priv->call_state == CONNECTING) @@ -3062,7 +3012,7 @@ display_error (EmpathyCallWindow *self, #if 0 static gchar * media_stream_error_to_txt (EmpathyCallWindow *self, - TpyCallChannel *call, + TpCallChannel *call, gboolean audio, TpMediaStreamError error) { @@ -3134,7 +3084,7 @@ media_stream_error_to_txt (EmpathyCallWindow *self, static void empathy_call_window_stream_error (EmpathyCallWindow *self, - TpyCallChannel *call, + TpCallChannel *call, gboolean audio, guint code, const gchar *msg, @@ -3158,7 +3108,7 @@ empathy_call_window_stream_error (EmpathyCallWindow *self, } static void -empathy_call_window_audio_stream_error (TpyCallChannel *call, +empathy_call_window_audio_stream_error (TpCallChannel *call, guint code, const gchar *msg, EmpathyCallWindow *self) @@ -3168,7 +3118,7 @@ empathy_call_window_audio_stream_error (TpyCallChannel *call, } static void -empathy_call_window_video_stream_error (TpyCallChannel *call, +empathy_call_window_video_stream_error (TpCallChannel *call, guint code, const gchar *msg, EmpathyCallWindow *self) @@ -3227,22 +3177,22 @@ show_balance_error (EmpathyCallWindow *self) static void empathy_call_window_state_changed_cb (EmpathyCallHandler *handler, - TpyCallState state, + TpCallState state, gchar *reason, EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); - TpyCallChannel *call; + TpCallChannel *call; gboolean can_send_video; - if (state == TPY_CALL_STATE_ENDED && + if (state == TP_CALL_STATE_ENDED && !tp_strdiff (reason, TP_ERROR_STR_INSUFFICIENT_BALANCE)) { show_balance_error (self); return; } - if (state != TPY_CALL_STATE_ACCEPTED) + if (state != TP_CALL_STATE_ACCEPTED) return; if (priv->call_state == CONNECTED) @@ -3259,7 +3209,7 @@ empathy_call_window_state_changed_cb (EmpathyCallHandler *handler, g_object_get (priv->handler, "call-channel", &call, NULL); - if (tpy_call_channel_has_dtmf (call)) + if (tp_call_channel_has_dtmf (call)) gtk_widget_set_sensitive (priv->dtmf_panel, TRUE); if (priv->video_input == NULL) @@ -3604,20 +3554,20 @@ start_call (EmpathyCallWindow *self) if (empathy_call_handler_has_initial_video (priv->handler)) { - TpyCallChannel *call; - TpySendingState s; + TpCallChannel *call; + TpSendingState s; g_object_get (priv->handler, "call-channel", &call, NULL); /* If the call channel isn't set yet we're requesting it, if we're * requesting it with initial video it should be PENDING_SEND when we get * it */ if (call == NULL) - s = TPY_SENDING_STATE_PENDING_SEND; + s = TP_SENDING_STATE_PENDING_SEND; else - s = tpy_call_channel_get_video_state (call); + s = empathy_call_channel_get_video_state (call); - if (s == TPY_SENDING_STATE_PENDING_SEND || - s == TPY_SENDING_STATE_SENDING) + if (s == TP_SENDING_STATE_PENDING_SEND || + s == TP_SENDING_STATE_SENDING) { /* Enable 'send video' buttons and display the preview */ gtk_toggle_tool_button_set_active ( @@ -3733,8 +3683,10 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, } static void -empathy_call_window_members_changed_cb (TpyCallChannel *call, - GHashTable *members, +empathy_call_window_members_changed_cb (TpCallChannel *call, + GHashTable *updates, + GPtrArray *removed, + TpCallStateReason *reason, EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); @@ -3742,10 +3694,10 @@ empathy_call_window_members_changed_cb (TpyCallChannel *call, gpointer key, value; gboolean held = FALSE; - g_hash_table_iter_init (&iter, members); + g_hash_table_iter_init (&iter, updates); while (g_hash_table_iter_next (&iter, &key, &value)) { - if (GPOINTER_TO_INT (value) & TPY_CALL_MEMBER_FLAG_HELD) + if (GPOINTER_TO_INT (value) & TP_CALL_MEMBER_FLAG_HELD) { /* This assumes this is a 1-1 call, otherwise one participant * putting the call on hold wouldn't mean the call is on hold @@ -3767,7 +3719,7 @@ call_handler_notify_call_cb (EmpathyCallHandler *handler, EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); - TpyCallChannel *call; + TpCallChannel *call; g_object_get (priv->handler, "call-channel", &call, NULL); if (call == NULL) @@ -3783,10 +3735,6 @@ call_handler_notify_call_cb (EmpathyCallHandler *handler, tp_g_signal_connect_object (call, "members-changed", G_CALLBACK (empathy_call_window_members_changed_cb), self, 0); - tp_cli_channel_interface_dtmf_connect_to_stopped_tones (TP_CHANNEL (call), - empathy_call_window_tones_stopped_cb, self, NULL, - G_OBJECT (call), NULL); - g_object_unref (call); } @@ -3794,7 +3742,7 @@ static void empathy_call_window_connect_handler (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); - TpyCallChannel *call; + TpCallChannel *call; g_signal_connect (priv->handler, "state-changed", G_CALLBACK (empathy_call_window_state_changed_cb), self); @@ -4007,7 +3955,7 @@ empathy_call_window_set_send_video (EmpathyCallWindow *window, CameraState state) { EmpathyCallWindowPriv *priv = GET_PRIV (window); - TpyCallChannel *call; + TpCallChannel *call; priv->sending_video = (state == CAMERA_STATE_ON); @@ -4027,7 +3975,7 @@ empathy_call_window_set_send_video (EmpathyCallWindow *window, g_object_get (priv->handler, "call-channel", &call, NULL); DEBUG ("%s sending video", priv->sending_video ? "start": "stop"); - tpy_call_channel_send_video (call, priv->sending_video); + empathy_call_channel_send_video (call, priv->sending_video); g_object_unref (call); } diff --git a/src/empathy-call-window.h b/src/empathy-call-window.h index abaae2763..a5df2dac4 100644 --- a/src/empathy-call-window.h +++ b/src/empathy-call-window.h @@ -66,7 +66,7 @@ EmpathyCallWindow *empathy_call_window_new (EmpathyCallHandler *handler); void empathy_call_window_present (EmpathyCallWindow *window, EmpathyCallHandler *handler); void empathy_call_window_start_ringing (EmpathyCallWindow *self, - TpyCallChannel *channel, + TpCallChannel *channel, TpChannelDispatchOperation *dispatch_operation, TpAddDispatchOperationContext *context); diff --git a/src/empathy-call.c b/src/empathy-call.c index 71d9db707..5f45d1ee5 100644 --- a/src/empathy-call.c +++ b/src/empathy-call.c @@ -36,8 +36,6 @@ #include <telepathy-glib/debug-sender.h> -#include <telepathy-yell/telepathy-yell.h> - #include <libempathy/empathy-client-factory.h> #include <libempathy-gtk/empathy-ui-utils.h> @@ -91,7 +89,7 @@ find_window_for_handle (gpointer key, static gboolean incoming_call_cb (EmpathyCallFactory *factory, guint handle, - TpyCallChannel *channel, + TpCallChannel *channel, TpChannelDispatchOperation *dispatch_operation, TpAddDispatchOperationContext *context, gpointer user_data) @@ -219,8 +217,6 @@ main (int argc, g_option_context_free (optcontext); - tpy_cli_init (); - gtk_clutter_init (&argc, &argv); clutter_gst_init (&argc, &argv); diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 321cd1cca..c6b3e29ed 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -29,8 +29,6 @@ #include <telepathy-glib/interfaces.h> #include <telepathy-glib/simple-approver.h> -#include <telepathy-yell/telepathy-yell.h> - #include <libempathy/empathy-presence-manager.h> #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-connection-aggregator.h> @@ -45,6 +43,7 @@ #include <libempathy-gtk/empathy-contact-dialogs.h> #include <libempathy-gtk/empathy-sound-manager.h> #include <libempathy-gtk/empathy-ui-utils.h> +#include <libempathy-gtk/empathy-call-utils.h> #include "empathy-event-manager.h" #include "empathy-roster-window.h" @@ -413,10 +412,10 @@ reject_channel_claim_cb (GObject *source, { empathy_tp_streamed_media_close (user_data); } - else if (TPY_IS_CALL_CHANNEL (user_data)) + else if (TP_IS_CALL_CHANNEL (user_data)) { - tpy_call_channel_hangup_async (user_data, - TPY_CALL_STATE_CHANGE_REASON_USER_REQUESTED, + tp_call_channel_hangup_async (user_data, + TP_CALL_STATE_CHANGE_REASON_USER_REQUESTED, "", "", NULL, NULL); tp_channel_close_async (user_data, NULL, NULL); } @@ -474,7 +473,7 @@ event_manager_call_window_confirmation_dialog_response_cb (GtkDialog *dialog, } else if (response == ACCEPT_WITHOUT_VIDEO) { - tpy_call_channel_send_video (TPY_CALL_CHANNEL (approval->main_channel), + empathy_call_channel_send_video (TP_CALL_CHANNEL (approval->main_channel), FALSE); event_manager_approval_approve (approval); } @@ -508,9 +507,9 @@ event_channel_process_voip_func (EventPriv *event) } else if (etype == EMPATHY_EVENT_TYPE_CALL) { - TpyCallChannel *call; - call = TPY_CALL_CHANNEL (event->approval->handler_instance); - g_object_get (G_OBJECT (call), "initial-video", &video, NULL); + TpCallChannel *call; + call = TP_CALL_CHANNEL (event->approval->handler_instance); + video = tp_call_channel_has_initial_video (call, NULL); } else { @@ -638,7 +637,7 @@ event_manager_approval_done (EventManagerApproval *approval) channel_type = tp_channel_get_channel_type_id (approval->main_channel); if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA || - channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL) + channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_CALL) { priv->ringing--; if (priv->ringing == 0) @@ -676,14 +675,14 @@ cdo_invalidated_cb (TpProxy *cdo, } static void -event_manager_call_state_changed_cb (TpyCallChannel *call, - TpyCallState state, - TpyCallFlags flags, - const GValueArray *call_state_reason, - GHashTable *call_state_details, +event_manager_call_state_changed_cb (TpCallChannel *call, + TpCallState state, + TpCallFlags flags, + TpCallStateReason *reason, + GHashTable *details, EventManagerApproval *approval) { - if (state == TPY_CALL_STATE_ENDED) + if (state == TP_CALL_STATE_ENDED) { DEBUG ("Call ended, seems we missed it :/"); reject_approval (approval); @@ -700,11 +699,11 @@ event_manager_call_channel_got_contact_cb (TpConnection *connection, EventManagerApproval *approval = (EventManagerApproval *) user_data; EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager); GtkWidget *window; - TpyCallChannel *call; + TpCallChannel *call; gchar *header; gboolean video; - call = TPY_CALL_CHANNEL (approval->handler_instance); + call = TP_CALL_CHANNEL (approval->handler_instance); if (error != NULL) { @@ -713,7 +712,7 @@ event_manager_call_channel_got_contact_cb (TpConnection *connection, return; } - if (tpy_call_channel_get_state (call, NULL, NULL) == TPY_CALL_STATE_ENDED) + if (tp_call_channel_get_state (call, NULL, NULL, NULL) == TP_CALL_STATE_ENDED) { DEBUG ("Call already ended, seems we missed it :/"); reject_approval (approval); @@ -982,7 +981,7 @@ find_main_channel (GList *channels) channel_type = tp_channel_get_channel_type_id (channel); if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA || - channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL || + channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_CALL || channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER || channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_SERVER_AUTHENTICATION) return channel; @@ -1104,9 +1103,9 @@ approve_channels (TpSimpleApprover *approver, } } - else if (channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL) + else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_CALL) { - TpyCallChannel *call = TPY_CALL_CHANNEL (channel); + TpCallChannel *call = TP_CALL_CHANNEL (channel); const gchar *id; approval->handler_instance = g_object_ref (call); @@ -1510,7 +1509,7 @@ empathy_event_manager_init (EmpathyEventManager *manager) tp_base_client_take_approver_filter (priv->approver, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TPY_IFACE_CHANNEL_TYPE_CALL, + TP_IFACE_CHANNEL_TYPE_CALL, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); diff --git a/src/empathy-notifications-approver.c b/src/empathy-notifications-approver.c index ac51459fb..7a4f03731 100644 --- a/src/empathy-notifications-approver.c +++ b/src/empathy-notifications-approver.c @@ -25,11 +25,10 @@ #include <libnotify/notify.h> #include <telepathy-glib/telepathy-glib.h> -#include <telepathy-yell/telepathy-yell.h> - #include <libempathy/empathy-tp-streamed-media.h> #include <libempathy-gtk/empathy-notify-manager.h> +#include <libempathy-gtk/empathy-call-utils.h> #include "empathy-event-manager.h" @@ -127,8 +126,8 @@ notification_approve_no_video_cb (NotifyNotification *notification, { if (self->priv->event) { - tpy_call_channel_send_video ( - TPY_CALL_CHANNEL (self->priv->event->handler_instance), + empathy_call_channel_send_video ( + TP_CALL_CHANNEL (self->priv->event->handler_instance), FALSE); empathy_event_approve (self->priv->event); } @@ -197,8 +196,8 @@ add_notification_actions (EmpathyNotificationsApprover *self, video = empathy_tp_streamed_media_has_initial_video ( EMPATHY_TP_STREAMED_MEDIA (self->priv->event->handler_instance)); else - video = tpy_call_channel_has_initial_video ( - TPY_CALL_CHANNEL (self->priv->event->handler_instance)); + video = tp_call_channel_has_initial_video ( + TP_CALL_CHANNEL (self->priv->event->handler_instance), NULL); notify_notification_add_action (notification, "reject", _("Reject"), (NotifyActionCallback) notification_decline_cb, diff --git a/src/empathy.c b/src/empathy.c index f59a54f17..766ffaa2c 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -44,8 +44,6 @@ #include <telepathy-glib/connection-manager.h> #include <telepathy-glib/interfaces.h> -#include <telepathy-yell/telepathy-yell.h> - #include <telepathy-logger/log-manager.h> #include <libempathy/empathy-client-factory.h> @@ -854,7 +852,6 @@ main (int argc, char *argv[]) #endif g_type_init (); - tpy_cli_init (); empathy_init (); gtk_init (&argc, &argv); empathy_gtk_init (); |