aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-chat-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r--src/empathy-chat-window.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 145d45e7f..0738f6e52 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -37,11 +37,11 @@
#include <telepathy-glib/util.h>
#include <libmissioncontrol/mission-control.h>
-#include <libempathy/empathy-contact-factory.h>
#include <libempathy/empathy-contact.h>
#include <libempathy/empathy-message.h>
#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-chatroom-manager.h>
+#include <libempathy/empathy-account-manager.h>
#include <libempathy/empathy-utils.h>
#include <libempathy-gtk/empathy-images.h>
@@ -953,7 +953,7 @@ chat_window_new_message_cb (EmpathyChat *chat,
if (has_focus && priv->current_chat == chat) {
return;
}
-
+
/* If empathy_chat_is_room() returns TRUE, that means it's a named MUC.
* If empathy_chat_get_remote_contact() returns NULL, that means it's
* an unamed MUC (msn-like).
@@ -1161,17 +1161,33 @@ chat_window_drag_data_received (GtkWidget *widget,
McAccount *account;
const gchar *id;
gchar **strv;
+ const gchar *account_id;
+ const gchar *contact_id;
id = (const gchar*) selection->data;
DEBUG ("DND contact from roster with id:'%s'", id);
strv = g_strsplit (id, "/", 2);
- account = mc_account_lookup (strv[0]);
- chat = empathy_chat_window_find_chat (account, strv[1]);
+ account_id = strv[0];
+ contact_id = strv[1];
+ account = mc_account_lookup (account_id);
+ chat = empathy_chat_window_find_chat (account, contact_id);
if (!chat) {
- empathy_dispatcher_chat_with_contact_id (account, strv[2], NULL, NULL);
+ EmpathyAccountManager *account_manager;
+ TpConnection *connection;
+
+ account_manager = empathy_account_manager_dup_singleton ();
+ connection = empathy_account_manager_get_connection (
+ account_manager, account);
+
+ if (connection) {
+ empathy_dispatcher_chat_with_contact_id (
+ connection, contact_id, NULL, NULL);
+ }
+
+ g_object_unref (account_manager);
g_object_unref (account);
g_strfreev (strv);
return;
@@ -1700,17 +1716,3 @@ empathy_chat_window_present_chat (EmpathyChat *chat)
gtk_widget_grab_focus (chat->input_text_view);
}
-#if 0
-static gboolean
-chat_window_should_play_sound (EmpathyChatWindow *window)
-{
- EmpathyChatWindowPriv *priv = GET_PRIV (window);
- gboolean has_focus = FALSE;
-
- g_return_val_if_fail (EMPATHY_IS_CHAT_WINDOW (window), FALSE);
-
- g_object_get (priv->dialog, "has-toplevel-focus", &has_focus, NULL);
-
- return !has_focus;
-}
-#endif