static void
create_text_channel (TpAccount *account,
    TpHandleType target_handle_type,
    const gchar *target_id,
    gboolean sms_channel,
    gint64 timestamp,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  GHashTable *request;
  TpAccountChannelRequest *req;

  request = tp_asv_new (
      TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
        TP_IFACE_CHANNEL_TYPE_TEXT,
      TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, target_handle_type,
      TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, target_id,
      NULL);

  if (sms_channel)
    tp_asv_set_boolean (request,
        TP_PROP_CHANNEL_INTERFACE_SMS_SMS_CHANNEL, TRUE);

  req = tp_account_channel_request_new (account, request, timestamp);
  tp_account_channel_request_set_delegate_to_preferred_handler (req, TRUE);

  tp_account_channel_request_ensure_channel_async (req, EMPATHY_CHAT_BUS_NAME,
      NULL, callback ? callback : ensure_text_channel_cb, user_data);

  g_hash_table_unref (request);
  g_object_unref (req);
}
static void
import_widget_add_account (EmpathyImportWidget *self,
    EmpathyImportAccountData *data)
{
  TpAccountManager *account_manager;
  gchar *display_name;
  GHashTable *properties;
  GValue *username;

  account_manager = tp_account_manager_dup ();

  DEBUG ("connection_manager: %s\n", data->connection_manager);

  /* Set the display name of the account */
  username = g_hash_table_lookup (data->settings, "account");
  display_name = g_strdup_printf ("%s (%s)",
      data->protocol,
      g_value_get_string (username));

  DEBUG ("display name: %s\n", display_name);

  properties = tp_asv_new (NULL, NULL);
  tp_asv_set_boolean (properties, TP_IFACE_ACCOUNT ".Enabled", data->enabled);

  tp_account_manager_create_account_async (account_manager,
      (const gchar*) data->connection_manager, data->protocol, display_name,
      data->settings, properties, import_widget_create_account_cb,
      g_object_ref (self));

  g_hash_table_unref (properties);
  g_free (display_name);
  g_object_unref (account_manager);
}
Exemple #3
0
static void
tls_dialog_response_cb (GtkDialog *dialog,
    gint response_id,
    gpointer user_data)
{
  TpTLSCertificate *certificate = NULL;
  TpTLSCertificateRejectReason reason = 0;
  GHashTable *details = NULL;
  EmpathyTLSDialog *tls_dialog = EMPATHY_TLS_DIALOG (dialog);
  gboolean remember = FALSE;
  EmpathyTLSVerifier *verifier = EMPATHY_TLS_VERIFIER (user_data);

  g_object_get (tls_dialog,
      "certificate", &certificate,
      "reason", &reason,
      "remember", &remember,
      "details", &details,
      NULL);

  DEBUG ("Response %d (remember: %d)", response_id, remember);

  gtk_widget_destroy (GTK_WIDGET (dialog));

  if (response_id == GTK_RESPONSE_YES)
    {
      tp_tls_certificate_accept_async (certificate, NULL, NULL);
    }
  else
    {
      tp_asv_set_boolean (details, "user-requested", TRUE);
      tp_tls_certificate_add_rejection (certificate, reason, NULL,
          g_variant_new_parsed ("{ 'user-requested': <%b> }", TRUE));

      tp_tls_certificate_reject_async (certificate, NULL, NULL);
    }

  if (remember)
    empathy_tls_verifier_store_exception (verifier);

  g_object_unref (certificate);
  g_hash_table_unref (details);

  /* restart the timeout */
  num_windows--;

  if (num_windows > 0)
    return;

  start_timer ();
}
static gboolean
handle_snippet (WockyNode *parent_node,
    GHashTable *mail)
{
  gboolean dirty = FALSE;
  WockyNode *node;

  node = wocky_node_get_child (parent_node, "snippet");
  if (node != NULL)
    {
      if (tp_strdiff (node->content, tp_asv_get_string (mail, "content")))
        {
          dirty = TRUE;
          tp_asv_set_boolean (mail, "truncated", TRUE);
          tp_asv_set_string (mail, "content", node->content);
        }
    }

  return dirty;
}