示例#1
0
文件: visitor.c 项目: keis/charlatan
void
ch_visitor_visit_channel_target (ChVisitor *self,
                                 TpChannel *channel)
{
    TpConnection *connection = tp_channel_get_connection (channel);
    TpContact *contact = tp_channel_get_target_contact (channel);
    GPtrArray *contacts = g_ptr_array_new ();

    g_ptr_array_add (contacts, (gpointer) contact);
    ch_visitor_incref (self);
    tp_simple_client_factory_upgrade_contacts_async (
        tp_proxy_get_factory (connection),
        connection,
        contacts->len,
        (TpContact * const *) contacts->pdata,
        contacts_ready,
        self);

    g_ptr_array_free (contacts, TRUE);
}
示例#2
0
文件: approver.c 项目: CaoMomo/core
static void
add_dispatch_operation_cb (TpSimpleApprover *self,
    TpAccount *account,
    TpConnection *connection,
    GList *channels,
    TpChannelDispatchOperation *cdo,
    TpAddDispatchOperationContext *context,
    gpointer user_data)
{
    TpContact *target = NULL;
    GList *l;

    (void)account;      /* suppress unused-parameter warning */
    (void)connection;   /* suppress unused-parameter warning */
    (void)user_data;    /* suppress unused-parameter warning */

    g_print ("Approving this batch of channels:\n");

    for (l = channels; l != NULL; l = g_list_next (l))
    {
        TpChannel *channel = l->data;

        if (TP_IS_DBUS_TUBE_CHANNEL (channel))
        {
            target = tp_channel_get_target_contact (channel);
            break;
        }
    }

    if (target == NULL)
    {
        g_critical ("Hmm. No 1-1 D-Bus tube in cdo %s, so why did we get it?",
            tp_proxy_get_object_path (cdo));
        g_return_if_reached ();
    }

    tp_add_dispatch_operation_context_accept (context);
    show_dialog (self, cdo, target);
}
示例#3
0
static void
channel_prepared_cb (
    GObject *source,
    GAsyncResult *result,
    gpointer user_data)
{
  TpFileTransferChannel *channel = TP_FILE_TRANSFER_CHANNEL (source);
  CallbacksData *cb_data = user_data;
  EmpathyFTHandler *handler = cb_data->handler;
  EmpathyFTHandlerPriv *priv = handler->priv;
  GHashTable *properties;
  GError *error = NULL;

  if (!tp_proxy_prepare_finish (channel, result, &error))
    {
      if (!g_cancellable_is_cancelled (priv->cancellable))
        g_cancellable_cancel (priv->cancellable);

      cb_data->callback (handler, error, cb_data->user_data);
      g_clear_error (&error);
      callbacks_data_free (cb_data);
      return;
    }
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
  properties = tp_channel_borrow_immutable_properties (TP_CHANNEL (channel));
  #pragma GCC diagnostic pop

  priv->content_hash = g_strdup (
      tp_asv_get_string (properties, "ContentHash"));

  priv->content_hash_type = tp_asv_get_uint32 (
      properties, "ContentHashType", NULL);

  priv->contact = g_object_ref (tp_channel_get_target_contact (TP_CHANNEL (channel)));

  cb_data->callback (handler, NULL, cb_data->user_data);
}