static void handle_channels (TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, GList *channels, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelsContext *context, gpointer user_data) { EmpathyChatManager *self = (EmpathyChatManager *) user_data; GList *l; for (l = channels; l != NULL; l = g_list_next (l)) { EmpathyTpChat *tp_chat = l->data; if (tp_proxy_get_invalidated (tp_chat) != NULL) continue; if (!EMPATHY_IS_TP_CHAT (tp_chat)) { DEBUG ("Channel %s doesn't implement Messages; can't handle it", tp_proxy_get_object_path (tp_chat)); continue; } DEBUG ("Now handling channel %s", tp_proxy_get_object_path (tp_chat)); process_tp_chat (self, tp_chat, account, user_action_time); } tp_handle_channels_context_accept (context); }
static void tp_yts_client_handle_channels (TpBaseClient *client, TpAccount *account, TpConnection *connection, GList *channels, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelsContext *context) { TpYtsClient *self = TP_YTS_CLIENT (client); GList *l; for (l = channels; l != NULL; l = g_list_next (l)) { TpChannel *channel = l->data; if (!TP_IS_YTS_CHANNEL (channel)) continue; g_queue_push_tail (&self->priv->incoming_channels, g_object_ref (channel)); } tp_handle_channels_context_accept (context); g_signal_emit (self, signals[RECEIVED_CHANNELS], 0); }
static void handle_dbus_channel(TpSimpleHandler* /*handler*/, TpAccount* /*account*/, TpConnection* /*connection*/, GList* channels, GList* /*requests*/, gint64 /*user_action_time*/, TpHandleChannelsContext* context, gpointer user_data) { UT_DEBUGMSG(("handle_dbus_channel()\n")); TelepathyAccountHandler* pHandler = reinterpret_cast<TelepathyAccountHandler*>(user_data); UT_return_if_fail(pHandler); for (GList* chan = channels; chan; chan = chan->next) { TpChannel* channel = TP_CHANNEL(chan->data); UT_continue_if_fail(channel); UT_DEBUGMSG((">>>>> incoming dbus channel: %s\n", tp_channel_get_identifier(channel))); if (tp_channel_get_channel_type_id(channel) != TP_IFACE_QUARK_CHANNEL_TYPE_DBUS_TUBE) continue; /* accept the channel */ tp_cli_channel_type_dbus_tube_call_accept(channel, -1, TP_SOCKET_ACCESS_CONTROL_LOCALHOST, tube_accept_cb, user_data, NULL, NULL); } tp_handle_channels_context_accept(context); }
static void handle_channels_cb (TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, GList *channels, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelsContext *context, gpointer user_data) { EmpathyStreamedMediaFactory *self = user_data; GList *l; for (l = channels; l != NULL; l = g_list_next (l)) { TpChannel *channel = l->data; EmpathyTpStreamedMedia *call; if (tp_proxy_get_invalidated (channel) != NULL) continue; if (tp_channel_get_channel_type_id (channel) != TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA) continue; call = empathy_tp_streamed_media_new (account, channel); if (empathy_tp_streamed_media_get_status (call) <= EMPATHY_TP_STREAMED_MEDIA_STATUS_READYING) { /* We have to wait that the TpStreamedMedia is ready as the * call-handler rely on it. */ tp_g_signal_connect_object (call, "notify::status", G_CALLBACK (call_status_changed_cb), self, 0); continue; } create_streamed_media_handler (self, call); g_object_unref (call); } tp_handle_channels_context_accept (context); }
static void handle_channels_cb (TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, GList *channels, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelsContext *context, gpointer user_data) { EmpathyFTFactory *self = user_data; GList *l; for (l = channels; l != NULL; l = g_list_next (l)) { TpChannel *channel = l->data; EmpathyTpFile *tp_file; if (tp_proxy_get_invalidated (channel) != NULL) continue; if (tp_channel_get_channel_type_id (channel) != TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER) continue; tp_file = empathy_tp_file_new (channel); /* We handle only incoming FT */ empathy_ft_handler_new_incoming (tp_file, ft_handler_incoming_ready_cb, self); g_object_unref (tp_file); } tp_handle_channels_context_accept (context); }
static void handle_channels_cb (TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, GList *channels, GList *requests_satisfied, gint64 user_action_time, TpHandleChannelsContext *context, gpointer user_data) { VinoTubeServersManager *self = user_data; VinoTubeServer *server; GdkDisplay *display; GdkScreen *screen; /* the server is listenning only on lo as only the tube is supposed to connect to it */ gchar * network_interface = "lo"; GList *l; TpStreamTubeChannel *channel = NULL; for (l = channels; l != NULL; l = g_list_next (l)) { TpStreamTubeChannel *chan = l->data; if (!TP_IS_STREAM_TUBE_CHANNEL (chan)) continue; if (tp_proxy_get_invalidated (chan) != NULL) continue; if (tp_strdiff (tp_stream_tube_channel_get_service (chan), "rfb")) continue; channel = chan; break; } if (channel == NULL) { /* No stream tube channel ?! */ GError error = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, "No stream tube channel" }; tp_handle_channels_context_fail (context, &error); return; } display = gdk_display_get_default (); screen = gdk_display_get_default_screen (display); server = g_object_new (VINO_TYPE_TUBE_SERVER, "display-status-icon", 0, "prompt-enabled", 0, "view-only", 0, "network-interface", network_interface, "use-alternative-port", 1, "alternative-port", self->priv->alternative_port, "auth-methods", 1, "require-encryption", 0, "vnc-password", NULL, "on-hold", 0, "screen", screen, "lock-screen", 0, "disable-background", 0, "use-upnp", 0, "tube", channel, NULL); self->priv->vino_tube_servers = g_slist_prepend (self->priv->vino_tube_servers, server); g_signal_connect (G_OBJECT (server), "disconnected", G_CALLBACK (vino_tube_servers_manager_disconnected_cb), self); self->priv->alternative_port++; vino_tube_server_share_with_tube (server, NULL); tp_handle_channels_context_accept (context); }
static void handle_channels_cb (TpSimpleHandler *handler, TpAccount *account, TpConnection *connection, GList *channels, GList *request_satisfied, gint64 user_aciton_time, TpHandleChannelsContext *handler_context, gpointer user_data) { TpChannel *channel = channels->data; gchar *path = g_build_filename ( g_get_user_config_dir (), "phoenix", "auth", NULL); GFile *file = g_file_new_for_path (path); GFileIOStream *stream; GDataInputStream *input = NULL; char *password = NULL; char *line; if (g_list_length (channels) != 1) { GError err = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Can only handle one channel at a time" }; tp_handle_channels_context_fail (handler_context, &err); goto out; } stream = g_file_open_readwrite (file, NULL, NULL); if (stream == NULL) { GError err = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "No authenication data stored" }; tp_handle_channels_context_fail (handler_context, &err); goto out; } input = g_data_input_stream_new ( g_io_stream_get_input_stream (G_IO_STREAM (stream))); while ((line = g_data_input_stream_read_line_utf8 (input, NULL, NULL, NULL)) != NULL) { gchar **r = g_strsplit (line, " ", 2); if (r[0] == NULL || r[1] == NULL) continue; if (!tp_strdiff (r[0], tp_account_get_path_suffix (account))) { password = g_strdup (r[1]); printf ("Found password: %s\n", password); g_strfreev(r); break; } g_strfreev(r); } g_object_unref (input); if (password == NULL) { GError err = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "No authenication data stored for this account" }; tp_handle_channels_context_fail (handler_context, &err); goto out; } tp_handle_channels_context_accept (handler_context); tp_cli_channel_interface_sasl_authentication_connect_to_sasl_status_changed (channel, sasl_status_changed_cb, NULL, NULL, NULL, NULL); provide_password (channel, password); out: g_free (path); g_free (password); }