コード例 #1
0
void
_mcd_channel_undispatchable (McdChannel *channel)
{
    McdChannelPrivate *priv = MCD_CHANNEL_PRIV (channel);

    if (!_mcd_tp_channel_should_close (priv->tp_chan, "destroying"))
    {
        return;
    }

    DEBUG ("%p: %s", channel, mcd_channel_get_object_path (channel));

    /* Call Destroy() if possible, or Close() */
    if (tp_proxy_has_interface_by_id (priv->tp_chan,
        TP_IFACE_QUARK_CHANNEL_INTERFACE_DESTROYABLE))
    {
        DEBUG ("calling Destroy()");
        tp_cli_channel_interface_destroyable_call_destroy (priv->tp_chan,
                                                           -1, NULL,
                                                           NULL, NULL,
                                                           NULL);
    }
    else
    {
        DEBUG ("calling Close()");
        tp_cli_channel_call_close (priv->tp_chan, -1, NULL, NULL, NULL,
                                   NULL);
    }
}
コード例 #2
0
ファイル: empathy-tp-tube.c プロジェクト: Elleo/empathy
static void
tp_tube_finalize (GObject *object)
{
  EmpathyTpTubePriv *priv = GET_PRIV (object);

  DEBUG ("Finalizing: %p", object);

  if (priv->channel)
    {
      g_signal_handlers_disconnect_by_func (priv->channel,
          tp_tube_invalidated_cb, object);
      tp_cli_channel_call_close (priv->channel, -1, tp_tube_async_cb,
        "closing tube", NULL, NULL);
      g_object_unref (priv->channel);
    }
  if (priv->initiator_contact)
      g_object_unref (priv->initiator_contact);
  if (priv->factory)
      g_object_unref (priv->factory);

  g_free (priv->service);

  if (priv->parameters != NULL)
  g_hash_table_destroy (priv->parameters);

  G_OBJECT_CLASS (empathy_tp_tube_parent_class)->finalize (object);
}
コード例 #3
0
static void sasl_status_changed_handler(TpChannel *channel,
			guint status, const gchar *error,
			GHashTable *details, gpointer user_data,
			GObject *weak_object)
{
	HevImpathyServerSASLHandler *self =
		HEV_IMPATHY_SERVER_SASL_HANDLER(weak_object);
	HevImpathyServerSASLHandlerPrivate *priv =
		HEV_IMPATHY_SERVER_SASL_HANDLER_GET_PRIVATE(self);

	g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__);

	if(G_N_ELEMENTS(sasl_statuses) <= status)
	  return;

	if(TP_SASL_STATUS_SERVER_SUCCEEDED == status)
	{
		if(priv->save_password)
		{
			hev_impathy_keyring_set_account_password_async(priv->account,
						priv->password, hev_impathy_server_sasl_handler_set_password_handler,
						NULL);
		}

		tp_cli_channel_interface_sasl_authentication_call_accept_sasl(
					priv->channel, -1, NULL, NULL, NULL, NULL);
	}
	else if(TP_SASL_STATUS_SUCCEEDED == status)
	{
		tp_cli_channel_call_close(priv->channel, -1, NULL, NULL,
					NULL, NULL);
	}
}
static void
tp_contact_list_rename_group (EmpathyContactList *list,
			      const gchar        *old_group_name,
			      const gchar        *new_group_name)
{
	EmpathyTpContactListPriv *priv = GET_PRIV (list);
	TpChannel                *channel;
	const TpIntSet           *members;
	GArray                   *handles;

	channel = g_hash_table_lookup (priv->groups, old_group_name);
	if (channel == NULL) {
		return;
	}

	DEBUG ("rename group %s to %s", old_group_name, new_group_name);

	/* Remove all members and close the old channel */
	members = tp_channel_group_get_members (channel);
	handles = tp_intset_to_array (members);
	tp_cli_channel_interface_group_call_remove_members (channel, -1,
		handles, NULL, NULL, NULL, NULL, NULL);
	tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);

	tp_contact_list_group_add (EMPATHY_TP_CONTACT_LIST (list),
				   new_group_name, handles);
}
コード例 #5
0
static void remmina_tp_channel_handler_on_disconnect(GtkWidget *widget, RemminaTpChannelHandler *chandler)
{
	g_print("remmina_tp_channel_handler_on_disconnect: %s\n", chandler->channel_path);
	g_signal_handler_disconnect(widget, chandler->disconnect_handler);
	chandler->disconnect_handler = 0;
	tp_cli_channel_call_close(chandler->channel, -1, NULL, NULL, NULL, NULL);
}
コード例 #6
0
ファイル: empathy-tp-chat.c プロジェクト: james-w/empathy
void
empathy_tp_chat_close (EmpathyTpChat *chat) {
	EmpathyTpChatPriv *priv = GET_PRIV (chat);

	/* If there are still messages left, it'll come back..
	 * We loose the ordering of sent messages though */
	tp_cli_channel_call_close (priv->channel, -1, tp_chat_async_cb,
		"closing channel", NULL, NULL);
}
コード例 #7
0
static void
close_channel_internal (EmpathyTpFile *self,
    gboolean cancel)
{
  DEBUG ("Closing channel, should cancel %s", cancel ?
         "True" : "False");

  self->priv->is_closing = TRUE;

  tp_cli_channel_call_close (self->priv->channel, -1,
    channel_closed_cb, GINT_TO_POINTER (cancel), NULL, G_OBJECT (self));
}
コード例 #8
0
static void
file_transfer_unix_state_changed_cb (TpChannel	*channel,
                                     guint	 state,
				     guint	 reason,
				     gpointer	 user_data,
				     GObject	*weak_obj)
{
	struct ft_state *ftstate = (struct ft_state *) user_data;
	GError *error = NULL;

	g_print (" :: file_transfer_state_changed_cb (%i)\n", state);

	if (state == TP_FILE_TRANSFER_STATE_OPEN)
	{
		int sock = socket (ftstate->sa.sun_family, SOCK_STREAM, 0);
		if (sock == -1)
		{
			int e = errno;
			g_error ("UNABLE TO GET SOCKET: %s", strerror (e));
		}

		if (connect (sock, (struct sockaddr *) &ftstate->sa,
				   sizeof (struct sockaddr_un)))
		{
			int e = errno;
			g_error ("UNABLE TO CONNECT: %s", strerror (e));
		}

		/* turn the socket into an IOChannel, so that we can work
		 * with our main loop */
		ftstate->channel = g_io_channel_unix_new (sock);
		g_io_add_watch (ftstate->channel, G_IO_IN | G_IO_HUP,
				file_transfer_data_received,
				ftstate);
	}
	else if (state == TP_FILE_TRANSFER_STATE_COMPLETED ||
		 state == TP_FILE_TRANSFER_STATE_CANCELLED)
	{
		if (ftstate->channel)
		{
			/* close the socket */
			g_io_channel_shutdown (ftstate->channel, TRUE, &error);
			handle_error (error);
			/* release our resources */
			g_io_channel_unref (ftstate->channel);
		}

		g_slice_free (struct ft_state, ftstate);
		tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);
	}
}
コード例 #9
0
void
_mcd_channel_close (McdChannel *channel)
{
    McdChannelPrivate *priv = MCD_CHANNEL_PRIV (channel);

    if (!_mcd_tp_channel_should_close (priv->tp_chan, "closing"))
    {
        return;
    }

    DEBUG ("%p: calling Close() on %s", channel,
           mcd_channel_get_object_path (channel));
    tp_cli_channel_call_close (priv->tp_chan, -1, NULL, NULL, NULL, NULL);
}
static void
sasl_status_changed_cb (TpChannel *channel,
    TpSASLStatus status,
    const gchar *error,
    GHashTable *details,
    gpointer user_data,
    GObject *weak_object)
{
  EmpathyServerSASLHandler *self = EMPATHY_SERVER_SASL_HANDLER (weak_object);
  EmpathyServerSASLHandlerPriv *priv = EMPATHY_SERVER_SASL_HANDLER (weak_object)->priv;

  /* buh boh */
  if (status >= G_N_ELEMENTS (sasl_statuses))
    {
      DEBUG ("SASL status changed to unknown status");
      return;
    }

  DEBUG ("SASL status changed to '%s'", sasl_statuses[status]);

  if (status == TP_SASL_STATUS_SERVER_SUCCEEDED)
    {
      if (priv->save_password)
        {
          DEBUG ("Saving password in keyring");

          empathy_keyring_set_account_password_async (priv->account,
              priv->password, empathy_server_sasl_handler_set_password_cb,
              NULL);
        }

      DEBUG ("Calling AcceptSASL");
      tp_cli_channel_interface_sasl_authentication_call_accept_sasl (
          priv->channel, -1, NULL, NULL, NULL, NULL);
    }
  else if (status == TP_SASL_STATUS_SUCCEEDED)
    {
      DEBUG ("SASL succeeded, calling Close");
      tp_cli_channel_call_close (priv->channel, -1,
          NULL, NULL, NULL, NULL);
    }
  else if (status == TP_SASL_STATUS_SERVER_FAILED)
   {
     if (!tp_strdiff (error, TP_ERROR_STR_AUTHENTICATION_FAILED))
       {
         g_signal_emit (self, signals[AUTH_PASSWORD_FAILED], 0, priv->password);
       }
   }
}
void
empathy_tp_streamed_media_close (EmpathyTpStreamedMedia *call)
{
  EmpathyTpStreamedMediaPriv *priv = GET_PRIV (call);

  g_return_if_fail (EMPATHY_IS_TP_STREAMED_MEDIA (call));

  if (priv->status == EMPATHY_TP_STREAMED_MEDIA_STATUS_CLOSED)
      return;

  DEBUG ("Closing channel");

  tp_cli_channel_call_close (priv->channel, -1,
      NULL, NULL, NULL, NULL);

  priv->status = EMPATHY_TP_STREAMED_MEDIA_STATUS_CLOSED;
  g_object_notify (G_OBJECT (call), "status");
}
コード例 #12
0
ファイル: empathy-tube-dispatch.c プロジェクト: Elleo/empathy
void
empathy_tube_dispatch_handle (EmpathyTubeDispatch *tube_dispatch)
{
  EmpathyTubeDispatchPriv *priv = GET_PRIV (tube_dispatch);

  /* Keep ourselves alive untill the dispatching is finished */
  g_object_ref (tube_dispatch);

  /* If we can't claim it, don't do anything */
  if (!empathy_dispatch_operation_claim (priv->operation))
    goto done;

  if (priv->dispatchability != EMPATHY_TUBE_DISPATCHABILITY_POSSIBLE)
    {
      gchar *msg;
      TpChannel *channel;

      channel = empathy_dispatch_operation_get_channel (priv->operation);

      msg = g_strdup_printf (
        _("An invitation was offered for service %s, but you don't have the "
          "needed application to handle it"), priv->service);

      empathy_tube_dispatch_show_error (tube_dispatch, msg);

      g_free (msg);

      tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);

      goto done;
    }
  else
    {
      empathy_tube_do_dispatch (tube_dispatch);
    }

  return;
done:
  g_object_unref (tube_dispatch);
}
static void
sasl_status_changed_cb (TpChannel *channel,
  TpSASLStatus status,
  const gchar *error,
  GHashTable *details,
  gpointer user_data,
  GObject *weak_object)
{
  printf ("New sasl status: %d\n", status);
  switch (status) {
    case TP_SASL_STATUS_SERVER_SUCCEEDED:
      tp_cli_channel_interface_sasl_authentication_call_accept_sasl (
        channel, -1, NULL, NULL, NULL, NULL);
      break;
    case TP_SASL_STATUS_SUCCEEDED:
    case TP_SASL_STATUS_SERVER_FAILED:
      tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);
      break;
    default:
      break;
  }
}
コード例 #14
0
ファイル: empathy-tp-roomlist.c プロジェクト: Elleo/empathy
static void
tp_roomlist_finalize (GObject *object)
{
	EmpathyTpRoomlistPriv *priv = GET_PRIV (object);

	if (priv->channel) {
		DEBUG ("Closing channel...");
		g_signal_handlers_disconnect_by_func (priv->channel,
						      tp_roomlist_invalidated_cb,
						      object);
		tp_cli_channel_call_close (priv->channel, -1,
					   NULL, NULL, NULL, NULL);
		g_object_unref (priv->channel);
	}

	if (priv->account) {
		g_object_unref (priv->account);
	}
	if (priv->connection) {
		g_object_unref (priv->connection);
	}

	G_OBJECT_CLASS (empathy_tp_roomlist_parent_class)->finalize (object);
}
static void
tp_contact_list_remove_group (EmpathyContactList *list,
			      const gchar *group_name)
{
	EmpathyTpContactListPriv *priv = GET_PRIV (list);
	TpChannel                *channel;
	const TpIntSet           *members;
	GArray                   *handles;

	channel = g_hash_table_lookup (priv->groups, group_name);
	if (channel == NULL) {
		return;
	}

	DEBUG ("remove group %s", group_name);

	/* Remove all members and close the channel */
	members = tp_channel_group_get_members (channel);
	handles = tp_intset_to_array (members);
	tp_cli_channel_interface_group_call_remove_members (channel, -1,
		handles, NULL, NULL, NULL, NULL, NULL);
	tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);
	g_array_unref (handles);
}