static void dispatch_cb (EmpathyDispatcher *dispatcher, EmpathyDispatchOperation *operation, gpointer user_data) { GQuark channel_type; channel_type = empathy_dispatch_operation_get_channel_type_id (operation); if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_TEXT) { EmpathyTpChat *tp_chat; EmpathyChat *chat = NULL; const gchar *id; tp_chat = EMPATHY_TP_CHAT ( empathy_dispatch_operation_get_channel_wrapper (operation)); id = empathy_tp_chat_get_id (tp_chat); if (!id) { EmpathyContact *contact; contact = empathy_tp_chat_get_remote_contact (tp_chat); if (contact) { id = empathy_contact_get_id (contact); } } if (id) { McAccount *account; account = empathy_tp_chat_get_account (tp_chat); chat = empathy_chat_window_find_chat (account, id); } if (chat) { empathy_chat_set_tp_chat (chat, tp_chat); } else { chat = empathy_chat_new (tp_chat); } empathy_chat_window_present_chat (chat); empathy_dispatch_operation_claim (operation); } else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA) { EmpathyCallFactory *factory; factory = empathy_call_factory_get (); empathy_call_factory_claim_channel (factory, operation); } else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER) { EmpathyFTManager *ft_manager; EmpathyTpFile *tp_file; ft_manager = empathy_ft_manager_dup_singleton (); tp_file = EMPATHY_TP_FILE ( empathy_dispatch_operation_get_channel_wrapper (operation)); empathy_ft_manager_add_tp_file (ft_manager, tp_file); empathy_dispatch_operation_claim (operation); } }
static void dispatch_channel_cb (EmpathyDispatcher *dispatcher, TpChannel *channel, gpointer user_data) { gchar *channel_type; g_object_get (channel, "channel-type", &channel_type, NULL); if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT)) { EmpathyTpChat *tp_chat; EmpathyChat *chat = NULL; const gchar *id; tp_chat = empathy_tp_chat_new (channel); empathy_run_until_ready (tp_chat); id = empathy_tp_chat_get_id (tp_chat); if (!id) { EmpathyContact *contact; contact = empathy_tp_chat_get_remote_contact (tp_chat); if (contact) { id = empathy_contact_get_id (contact); } } if (id) { McAccount *account; account = empathy_tp_chat_get_account (tp_chat); chat = empathy_chat_window_find_chat (account, id); } if (chat) { empathy_chat_set_tp_chat (chat, tp_chat); } else { chat = empathy_chat_new (tp_chat); } empathy_chat_window_present_chat (chat); g_object_unref (tp_chat); } else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA)) { empathy_call_window_new (channel); } }