chat = empathy_chat_window_find_chat (account, id);
if (!chat) {
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ empathy_chat_with_contact_id (account, id);
return;
}
gpointer user_data);
static void contact_list_view_action_cb (GtkAction *action,
EmpathyContactListView *view);
-static void contact_list_view_action_activated (EmpathyContactListView *view,
- EmpathyContact *contact);
static void contact_list_view_voip_activated (EmpathyContactListView *view,
EmpathyContact *contact);
-1);
if (contact) {
- contact_list_view_action_activated (view, contact);
+ empathy_chat_with_contact (contact);
g_object_unref (contact);
}
}
parent = empathy_get_toplevel_window (GTK_WIDGET (view));
if (contact && strcmp (name, "Chat") == 0) {
- contact_list_view_action_activated (view, contact);
+ empathy_chat_with_contact (contact);
}
else if (contact && strcmp (name, "Call") == 0) {
contact_list_view_voip_activated (view, contact);
}
}
-static void
-contact_list_view_action_activated (EmpathyContactListView *view,
- EmpathyContact *contact)
-{
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
-}
-
static void
contact_list_view_voip_activated (EmpathyContactListView *view,
EmpathyContact *contact)
gint response,
EmpathyNewMessageDialog *dialog)
{
- McAccount *account;
- const gchar *id;
+ McAccount *account;
+ const gchar *id;
account = empathy_account_chooser_get_account (EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser));
id = gtk_entry_get_text (GTK_ENTRY (dialog->entry_id));
}
if (response == GTK_RESPONSE_OK) {
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel_with_string_handle (mc,
- account,
- TP_IFACE_CHANNEL_TYPE_TEXT,
- id,
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ empathy_chat_with_contact_id (account, id);
}
else if (response == 3) {
EmpathyContactFactory *factory;
/* If offline message is not supported by CM we need to
* request a new Text Channel. */
if (!empathy_chat_is_connected (EMPATHY_CHAT (chat))) {
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ empathy_chat_with_contact (contact);
}
}
#endif
}
+void
+empathy_chat_with_contact (EmpathyContact *contact)
+{
+ MissionControl *mc;
+
+ mc = empathy_mission_control_new ();
+ mission_control_request_channel (mc,
+ empathy_contact_get_account (contact),
+ TP_IFACE_CHANNEL_TYPE_TEXT,
+ empathy_contact_get_handle (contact),
+ TP_HANDLE_TYPE_CONTACT,
+ NULL, NULL);
+ g_object_unref (mc);
+}
+
+void
+empathy_chat_with_contact_id (McAccount *account, const gchar *contact_id)
+{
+ MissionControl *mc;
+
+ mc = empathy_mission_control_new ();
+ mission_control_request_channel_with_string_handle (mc,
+ account,
+ TP_IFACE_CHANNEL_TYPE_TEXT,
+ contact_id,
+ TP_HANDLE_TYPE_CONTACT,
+ NULL, NULL);
+ g_object_unref (mc);
+}
+
gchar * empathy_inspect_channel (McAccount *account,
TpChan *tp_chan);
void empathy_call_contact (EmpathyContact *contact);
+void empathy_chat_with_contact (EmpathyContact *contact);
+void empathy_chat_with_contact_id (McAccount *account,
+ const gchar *contact_id);
+
G_END_DECLS
#endif /* __EMPATHY_UTILS_H__ */