static void
reply_to_stop_dtmf (DBusGProxy *proxy,
                    DBusGProxyCall *call,
                    void *_request)
{
  DEBUG ("enter");

  ModemRequest *request = _request;
  ModemCall *self = modem_request_object (request);
  ModemCallReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  char *stopped;
  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error,
          G_TYPE_STRING, &stopped,
          G_TYPE_INVALID))
    {
      g_free (stopped);
    }
  else
    {
      modem_error_fix (&error);
      DEBUG ("got " GERROR_MSG_FMT, GERROR_MSG_CODE (error));
    }

  if (callback)
    callback (self, request, error, user_data);

  g_clear_error (&error);
}
static void
reply_to_send_message (DBusGProxy *proxy,
                       DBusGProxyCall *call,
                       void *_request)
{
  ModemRequest *request = _request;
  ModemSMSService *self = modem_request_object (request);
  ModemSMSServiceSendReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  char const *message_path = NULL;

  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error,
          DBUS_TYPE_G_OBJECT_PATH, &message_path,
          G_TYPE_INVALID))
    {
      char const *destination;

      destination = modem_request_get_data (request, "destination");
    }

  callback (self, request, message_path, error, user_data);

  g_clear_error (&error);
}
Ejemplo n.º 3
0
static void
modem_call_conference_request_reply (DBusGProxy *proxy,
                                     DBusGProxyCall *call,
                                     void *_request)
{
  DEBUG ("enter");

  GPtrArray *paths;
  ModemRequest *request = _request;
  ModemCallService *self = modem_request_object (request);
  ModemCallServiceReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error,
          MODEM_TYPE_ARRAY_OF_PATHS, &paths,
          G_TYPE_INVALID))
    {

      guint i;
      char const *path;
      ModemCall *ci;

      for (i = 0; i < paths->len; i++)
        {
          path = g_ptr_array_index (paths, i);
          ci = g_hash_table_lookup (self->priv->instances, path);
          if (ci != NULL)
            {
              g_object_set (ci, "multiparty", TRUE, NULL);
            }
        }

      g_boxed_free (MODEM_TYPE_ARRAY_OF_PATHS, paths);
    }
  else {
    modem_error_fix (&error);
  }

  callback (self, request, error, user_data);
  g_clear_error (&error);
}
Ejemplo n.º 4
0
static void
reply_to_stop_tone(DBusGProxy *proxy,
  DBusGProxyCall *call,
  void *_request)
{
  ModemRequest *request = _request;
  ModemTones *self = modem_request_object(request);
  ModemTonesStoppedNotify *notify = modem_request_callback(request);
  guint source = GPOINTER_TO_UINT(
    modem_request_get_data(request, "modem-tones-stop-source"));
  gpointer data = modem_request_user_data(request);

  GError *error = NULL;

  if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID)) {
    g_error_free(error);
  }

  g_queue_remove(self->priv->stop_requests, _request);

  notify(self, source, data);
}
static void
reply_to_instance_request (DBusGProxy *proxy,
                           DBusGProxyCall *call,
                           void *_request)
{
  DEBUG ("enter");

  ModemRequest *request = _request;
  ModemCall *self = modem_request_object (request);
  ModemCallReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID))
    ;
  else
    modem_error_fix (&error);

  if (callback)
    callback (self, request, error, user_data);

  g_clear_error (&error);
}
static void
reply_to_private_chat_request (DBusGProxy *proxy,
    DBusGProxyCall *call,
    void *_request)
{
  DEBUG ("enter");

  GPtrArray *paths;
  ModemRequest *request = _request;
  ModemCall *self = modem_request_object (request);
  ModemCallReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error,
          MODEM_TYPE_ARRAY_OF_PATHS, &paths,
          G_TYPE_INVALID))
    {
      guint i;
      char const *path;

      for (i = 0; i < paths->len; i++)
        {
          path = g_ptr_array_index (paths, i);
          DEBUG("Calls in conf after split %u/%u: %s\n",
              i + 1, paths->len, path);
        }
      /* XXX: should this list be passed to the client as well? */
    }
  else {
    modem_error_fix (&error);
  }

  callback (self, request, error, user_data);
  g_clear_error (&error);
}
Ejemplo n.º 7
0
static void
modem_call_request_dial_reply (DBusGProxy *proxy,
                               DBusGProxyCall *call,
                               void *_request)
{
  DEBUG ("enter");

  ModemRequest *request = _request;
  ModemCallService *self = MODEM_CALL_SERVICE (modem_request_object (request));
  ModemCallServicePrivate *priv = self->priv;
  ModemCallRequestDialReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  char *destination = modem_request_get_data (request, "call-destination");
  GError *error = NULL;
  ModemCall *ci = NULL;
  char *object_path = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error,
          DBUS_TYPE_G_OBJECT_PATH, &object_path,
          G_TYPE_INVALID))
    {
      ci = modem_call_service_get_dialed (self, object_path, destination);
    }
  else
    {
      object_path = NULL;
      modem_error_fix (&error);
    }

  if (ci)
    {
      DEBUG ("%s: instance %s (%p)", MODEM_OFACE_CALL_MANAGER ".Dial",
          object_path, (void *)ci);

      modem_message (MODEM_LOG_CALL,
          "call create request to \"%s\" successful",
          destination);
    }
  else
    {
      char ebuffer[32];

      modem_message (MODEM_LOG_CALL,
          "call create request to \"%s\" failed: %s.%s: %s",
          destination,
          modem_error_domain_prefix (error->domain),
          modem_error_name (error, ebuffer, sizeof ebuffer),
          error->message);

      DEBUG ("%s: " GERROR_MSG_FMT, MODEM_OFACE_CALL_MANAGER ".Dial",
          GERROR_MSG_CODE (error));
    }

  if (modem_request_get_data (request, "call-canceled"))
    {
      if (ci)
        modem_call_request_release (ci, NULL, NULL);
    }
  else
    {
      g_assert (ci || error);
      callback (self, request, ci, error, user_data);
    }

  if (g_queue_find (priv->dialing.queue, request))
    g_queue_remove (priv->dialing.queue, request);

  while (g_queue_is_empty (priv->dialing.queue) &&
      !g_queue_is_empty (priv->dialing.created))
    {
      char *remote;

      ci = g_queue_pop_head (priv->dialing.created);

      g_object_get (ci, "remote", &remote, NULL);

      g_signal_emit (self, signals[SIGNAL_CREATED], 0, ci, remote);

      g_free (remote);
    }

  g_free (object_path);
  g_clear_error (&error);
}