Ejemplo n.º 1
0
static void
jingle_info_reply_cb (
    GObject *source,
    GAsyncResult *result,
    gpointer user_data)
{
  WockyPorter *porter = WOCKY_PORTER (source);
  GabbleJingleInfo *self = GABBLE_JINGLE_INFO (user_data);
  WockyStanza *reply = NULL;
  GError *error = NULL;

  reply = wocky_porter_send_iq_finish (porter, result, &error);
  if (reply != NULL &&
      !wocky_stanza_extract_errors (reply, NULL, &error, NULL, NULL))
    {
      got_jingle_info_stanza (self, reply);
    }
  else
    {
      DEBUG ("jingle info request failed: %s", error->message);
      g_clear_error (&error);
    }

  g_clear_object (&reply);
  g_object_unref (self);
}
Ejemplo n.º 2
0
static void
set_location_sent_cb (GabbleConnection *conn,
    WockyStanza *sent_msg,
    WockyStanza *reply_msg,
    GObject *object,
    gpointer user_data)
{
  DBusGMethodInvocation *context = user_data;
  GError *error = NULL;

  if (!wocky_stanza_extract_errors (reply_msg, NULL, &error, NULL, NULL))
    {
      dbus_g_method_return (context);
    }
  else
    {
      GError *tp_error = NULL;

      DEBUG ("SetLocation failed: %s", error->message);

      gabble_set_tp_error_from_wocky (error, &tp_error);
      dbus_g_method_return_error (context, tp_error);
      g_error_free (tp_error);
      g_error_free (error);
    }
}
Ejemplo n.º 3
0
static void
query_unread_mails_cb (GObject *source_object,
    GAsyncResult *res,
    gpointer user_data)
{
  GError *error = NULL;
  WockyPorter *porter = WOCKY_PORTER (source_object);
  WockyStanza *reply = wocky_porter_send_iq_finish (porter, res, &error);
  GabbleConnection *conn = GABBLE_CONNECTION (user_data);

  if (reply == NULL ||
      wocky_stanza_extract_errors (reply, NULL, &error, NULL, NULL))
    {
      DEBUG ("Failed retreive unread emails information: %s", error->message);
      g_error_free (error);
    }
  else if (conn->mail_priv->interested)
    {
      WockyNode *node = wocky_node_get_child (
          wocky_stanza_get_top_node (reply), "mailbox");

      DEBUG ("Got unread mail details");

      if (node != NULL)
        store_unread_mails (conn, node);
    }
  /* else we no longer care about unread mail, so ignore it */

  tp_clear_object (&reply);

  return_from_request_inbox_url (conn);
}
Ejemplo n.º 4
0
gboolean
conn_util_send_iq_finish (GabbleConnection *self,
    GAsyncResult *result,
    WockyStanza **response,
    GError **error)
{
  GSimpleAsyncResult *res;
  WockyStanza *resp;
  GError *err = NULL;

  g_return_val_if_fail (g_simple_async_result_is_valid (result,
          G_OBJECT (self), conn_util_send_iq_async), FALSE);

  res = (GSimpleAsyncResult *) result;

  resp = g_simple_async_result_get_op_res_gpointer (res);

  if (g_simple_async_result_propagate_error (res, &err) ||
      wocky_stanza_extract_errors (resp, NULL, &err, NULL, NULL))
    {
      gabble_set_tp_error_from_wocky (err, error);
      g_error_free (err);

      return FALSE;
    }

  if (response != NULL)
    *response = g_object_ref (resp);

  return TRUE;
}
Ejemplo n.º 5
0
static void
request_location_reply_cb (GObject *source,
    GAsyncResult *res,
    gpointer user_data)
{
  YetAnotherContextStruct *ctx = user_data;
  WockyStanza *reply;
  WockyNode *item_node;
  GError *wocky_error = NULL, *tp_error = NULL;

  reply = wocky_pep_service_get_finish (WOCKY_PEP_SERVICE (source), res,
      &item_node, &wocky_error);

  if (reply == NULL ||
      wocky_stanza_extract_errors (reply, NULL, &wocky_error, NULL, NULL))
    {
      DEBUG ("fetching location failed: %s", wocky_error->message);
      gabble_set_tp_error_from_wocky (wocky_error, &tp_error);
      dbus_g_method_return_error (ctx->context, tp_error);
      g_error_free (tp_error);
    }
  else
    {
      GHashTable *location;

      if (update_location_from_item (ctx->self, ctx->handle, item_node))
        {
          location = get_cached_location (ctx->self, ctx->handle);
          /* We just cached a location for this contact, so it should be
           * non-NULL.
           */
          g_return_if_fail (location != NULL);
        }
      else
        {
          /* If the location's unparseable, we'll hit this path. That seems
           * okay.
           */
          location = g_hash_table_new (NULL, NULL);
        }

      tp_svc_connection_interface_location_return_from_request_location (
          ctx->context, location);
      g_hash_table_unref (location);
    }

  tp_clear_object (&reply);
  g_object_unref (ctx->self);
  g_slice_free (YetAnotherContextStruct, ctx);
}
Ejemplo n.º 6
0
static void
set_settings_cb (GObject *source_object,
    GAsyncResult *res,
    gpointer user_data)
{
  GError *error = NULL;
  WockyPorter *porter = WOCKY_PORTER (source_object);
  WockyStanza *reply = wocky_porter_send_iq_finish (porter, res, &error);

  if (reply == NULL ||
      wocky_stanza_extract_errors (reply, NULL, &error, NULL, NULL))
    {
      DEBUG ("Failed to set google user settings: %s", error->message);
      g_error_free (error);
    }

  tp_clear_object (&reply);
}