static void channel_prepared (GObject *proxy, GAsyncResult *prepare_res, gpointer user_data) { GSimpleAsyncResult *res = user_data; TfCallChannel *self = TF_CALL_CHANNEL (g_async_result_get_source_object (G_ASYNC_RESULT (res))); GError *error = NULL; GPtrArray *contents; guint i; if (!tp_proxy_prepare_finish (proxy, prepare_res, &error)) { g_warning ("Preparing the channel: %s", error->message); g_simple_async_result_take_error (res, error); goto out; } if (tp_call_channel_has_hardware_streaming (TP_CALL_CHANNEL (proxy))) { g_warning ("Hardware streaming property is TRUE, ignoring"); g_simple_async_result_set_error (res, TP_ERROR, TP_ERROR_NOT_CAPABLE, "This channel does hardware streaming, not handled here"); goto out; } contents = tp_call_channel_get_contents (TP_CALL_CHANNEL (proxy)); self->contents = g_ptr_array_new_with_free_func (free_content); for (i = 0; i < contents->len; i++) if (!add_content (self, g_ptr_array_index (contents, i))) break; g_simple_async_result_set_op_res_gboolean (res, TRUE); out: g_simple_async_result_complete (res); g_object_unref (res); g_object_unref (self); }
static void on_call_accepted_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { TpCallChannel *call = TP_CALL_CHANNEL (source_object); GError *error = NULL; if (!tp_call_channel_accept_finish (call, res, &error)) { g_warning ("could not accept Call: %s", error->message); g_error_free (error); } }
static gboolean has_ongoing_calls (EmpathyCallObserver *self) { GList *l; for (l = self->priv->channels; l != NULL; l = l->next) { TpChannel *channel = TP_CHANNEL (l->data); GQuark type = tp_channel_get_channel_type_id (channel); /* Check that Call channels are not 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; } return FALSE; }
static void empathy_call_handler_request_cb (GObject *source, GAsyncResult *result, gpointer user_data) { EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (user_data); EmpathyCallHandlerPriv *priv = GET_PRIV (self); TpChannel *channel; GError *error = NULL; TpAccountChannelRequest *req = TP_ACCOUNT_CHANNEL_REQUEST (source); channel = tp_account_channel_request_create_and_handle_channel_finish (req, result, NULL, &error); if (channel == NULL) { DEBUG ("Failed to create the channel: %s", error->message); g_error_free (error); return; } if (!TP_IS_CALL_CHANNEL (channel)) { DEBUG ("The channel is not a Call channel!"); return; } 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", G_CALLBACK (on_call_invalidated_cb), self, 0); g_object_notify (G_OBJECT (self), "call-channel"); empathy_call_handler_start_tpfs (self); tp_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); }
void tf_call_channel_error (TfCallChannel *channel) { tp_call_channel_hangup_async (TP_CALL_CHANNEL (channel->proxy), TP_CALL_STATE_CHANGE_REASON_UNKNOWN, "", "", NULL, NULL); }