Exemplo n.º 1
0
static void
constructed (GObject *object)
{
  ExampleCallStream *self = EXAMPLE_CALL_STREAM (object);
  void (*chain_up) (GObject *) =
      ((GObjectClass *) example_call_stream_parent_class)->constructed;

  if (chain_up != NULL)
    chain_up (object);

  tp_dbus_daemon_register_object (
      tp_base_connection_get_dbus_daemon (self->priv->conn),
      self->priv->object_path, self);

  if (self->priv->locally_requested)
    {
      example_call_stream_change_direction (self, TRUE, TRUE);
    }
  else
    {
      example_call_stream_receive_direction_request (self, TRUE, TRUE);
    }

  if (self->priv->handle != 0)
    {
      TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
          self->priv->conn, TP_HANDLE_TYPE_CONTACT);

      tp_handle_ref (contact_repo, self->priv->handle);
    }
}
Exemplo n.º 2
0
static gboolean
stream_set_sending (TpBaseCallStream *base,
    gboolean sending,
    GError **error)
{
  ExampleCallStream *self = EXAMPLE_CALL_STREAM (base);
  TpSendingState remote_sending_state =
      tp_base_call_stream_get_remote_sending_state (base, self->priv->handle);

  example_call_stream_change_direction (self, sending,
      (remote_sending_state == TP_SENDING_STATE_SENDING));

  return TRUE;
}
Exemplo n.º 3
0
static gboolean
stream_request_receiving (TpBaseCallStream *base,
    TpHandle contact,
    gboolean receive,
    GError **error)
{
  ExampleCallStream *self = EXAMPLE_CALL_STREAM (base);
  TpSendingState local_sending_state =
      tp_base_call_stream_get_local_sending_state (base);

  /* This is the only member */
  g_assert (contact == self->priv->handle);

  example_call_stream_change_direction (self,
      (local_sending_state == TP_SENDING_STATE_SENDING),
      receive);

  return TRUE;
}
Exemplo n.º 4
0
static void
constructed (GObject *object)
{
  ExampleCallStream *self = EXAMPLE_CALL_STREAM (object);
  void (*chain_up) (GObject *) =
      ((GObjectClass *) example_call_stream_parent_class)->constructed;
  static guint count = 0;
  TpBaseConnection *conn;
  TpDBusDaemon *dbus;
  gchar *object_path;
  TpCallStreamEndpoint *endpoint;

  if (chain_up != NULL)
    chain_up (object);

  conn = tp_base_call_stream_get_connection ((TpBaseCallStream *) self);
  dbus = tp_base_connection_get_dbus_daemon (conn);
  object_path = g_strdup_printf ("%s/Endpoint%d",
      tp_base_call_stream_get_object_path ((TpBaseCallStream *) self),
      count++);
  endpoint = tp_call_stream_endpoint_new (dbus, object_path,
      TP_STREAM_TRANSPORT_TYPE_RAW_UDP, FALSE);

  tp_base_media_call_stream_add_endpoint ((TpBaseMediaCallStream *) self,
      endpoint);

  if (self->priv->locally_requested)
    {
      example_call_stream_change_direction (self, TRUE, TRUE);
    }
  else
    {
      example_call_stream_receive_direction_request (self, TRUE, TRUE);
    }

  g_object_unref (endpoint);
  g_free (object_path);
}