diff options
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 20 | ||||
-rw-r--r-- | libempathy-gtk/empathy-new-message-dialog.c | 8 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.c | 13 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.h | 2 | ||||
-rw-r--r-- | src/empathy-chat-manager.c | 6 | ||||
-rw-r--r-- | src/empathy-chat-window.c | 10 |
6 files changed, 27 insertions, 32 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 399f0cc9b..9c6a632bc 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -228,18 +228,11 @@ chat_set_property (GObject *object, } static void -reconnected_connection_ready_cb (TpConnection *connection, - const GError *error, - gpointer user_data) +account_reconnected (EmpathyChat *chat, + TpAccount *account) { - EmpathyChat *chat = user_data; EmpathyChatPriv *priv = GET_PRIV (chat); - if (error != NULL) { - DEBUG ("connection is not ready: %s", error->message); - goto out; - } - DEBUG ("Account reconnected, request a new Text channel"); /* FIXME: Ideally we should ask to handle ourself the channel so we can @@ -248,10 +241,10 @@ reconnected_connection_ready_cb (TpConnection *connection, switch (priv->handle_type) { case TP_HANDLE_TYPE_CONTACT: empathy_dispatcher_chat_with_contact_id ( - connection, priv->id, EMPATHY_DISPATCHER_NON_USER_ACTION); + account, priv->id, EMPATHY_DISPATCHER_NON_USER_ACTION); break; case TP_HANDLE_TYPE_ROOM: - empathy_dispatcher_join_muc (connection, + empathy_dispatcher_join_muc (tp_account_get_connection (account), priv->id, EMPATHY_DISPATCHER_NON_USER_ACTION); break; case TP_HANDLE_TYPE_NONE: @@ -262,7 +255,6 @@ reconnected_connection_ready_cb (TpConnection *connection, break; } -out: g_object_unref (chat); } @@ -289,8 +281,8 @@ chat_new_connection_cb (TpAccount *account, return; g_object_ref (chat); - tp_connection_call_when_ready (connection, reconnected_connection_ready_cb, - chat); + + account_reconnected (chat, account); } static void diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c index 6cdab4654..a17481437 100644 --- a/libempathy-gtk/empathy-new-message-dialog.c +++ b/libempathy-gtk/empathy-new-message-dialog.c @@ -60,17 +60,17 @@ G_DEFINE_TYPE(EmpathyNewMessageDialog, empathy_new_message_dialog, static void empathy_new_message_dialog_response (GtkDialog *dialog, int response_id) { - TpConnection *connection; + TpAccount *account; const gchar *contact_id; if (response_id != GTK_RESPONSE_ACCEPT) goto out; contact_id = empathy_contact_selector_dialog_get_selected ( - EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), &connection, NULL); + EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), NULL, &account); - if (EMP_STR_EMPTY (contact_id) || connection == NULL) goto out; + if (EMP_STR_EMPTY (contact_id) || account == NULL) goto out; - empathy_dispatcher_chat_with_contact_id (connection, contact_id, + empathy_dispatcher_chat_with_contact_id (account, contact_id, gtk_get_current_event_time ()); out: diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 09630e674..5e31fa71c 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -1307,16 +1307,21 @@ dispatcher_chat_with_contact_id_cb (TpConnection *connection, } void -empathy_dispatcher_chat_with_contact_id (TpConnection *connection, - const gchar *contact_id, - gint64 timestamp) +empathy_dispatcher_chat_with_contact_id (TpAccount *account, + const gchar *contact_id, + gint64 timestamp) { EmpathyDispatcher *self; ChatWithContactIdData *data; + TpConnection *connection; - g_return_if_fail (TP_IS_CONNECTION (connection)); + g_return_if_fail (TP_IS_ACCOUNT (account)); g_return_if_fail (!EMP_STR_EMPTY (contact_id)); + connection = tp_account_get_connection (account); + if (connection == NULL) + return; + self = empathy_dispatcher_dup_singleton (); data = g_slice_new0 (ChatWithContactIdData); data->dispatcher = self; diff --git a/libempathy/empathy-dispatcher.h b/libempathy/empathy-dispatcher.h index d49aa2dad..1fa6387f7 100644 --- a/libempathy/empathy-dispatcher.h +++ b/libempathy/empathy-dispatcher.h @@ -75,7 +75,7 @@ void empathy_dispatcher_create_channel (EmpathyDispatcher *dispatcher, gpointer user_data); /* Requesting 1 to 1 text channels */ -void empathy_dispatcher_chat_with_contact_id (TpConnection *connection, +void empathy_dispatcher_chat_with_contact_id (TpAccount *account, const gchar *contact_id, gint64 timestamp); diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c index 0a16be90d..a3177a3f7 100644 --- a/src/empathy-chat-manager.c +++ b/src/empathy-chat-manager.c @@ -21,6 +21,7 @@ #include <libempathy/empathy-chatroom-manager.h> #include <libempathy/empathy-dispatcher.h> +#include <libempathy/empathy-utils.h> #include "empathy-chat-window.h" @@ -385,13 +386,16 @@ connection_ready_cb (TpConnection *connection, priv = GET_PRIV (self); + /* FIXME: Once empathy_dispatcher_join_muc will take a TpAccount instead of + * a TpConnection we won't have to prepare the connection any more. */ if (error == NULL) { if (data->room) empathy_dispatcher_join_muc (connection, data->id, EMPATHY_DISPATCHER_NON_USER_ACTION); else - empathy_dispatcher_chat_with_contact_id (connection, data->id, + empathy_dispatcher_chat_with_contact_id ( + empathy_get_account_for_connection (connection), data->id, EMPATHY_DISPATCHER_NON_USER_ACTION); g_signal_emit (self, signals[CHATS_CHANGED], 0, diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 93c1ab773..27d6dd874 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -1738,14 +1738,8 @@ chat_window_drag_data_received (GtkWidget *widget, } if (!chat) { - TpConnection *connection; - - connection = tp_account_get_connection (account); - - if (connection) { - empathy_dispatcher_chat_with_contact_id ( - connection, contact_id, gtk_get_current_event_time ()); - } + empathy_dispatcher_chat_with_contact_id ( + account, contact_id, gtk_get_current_event_time ()); g_strfreev (strv); return; |