}
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
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:
break;
}
-out:
g_object_unref (chat);
}
return;
g_object_ref (chat);
- tp_connection_call_when_ready (connection, reconnected_connection_ready_cb,
- chat);
+
+ account_reconnected (chat, account);
}
static void
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:
}
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;
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);
#include <libempathy/empathy-chatroom-manager.h>
#include <libempathy/empathy-dispatcher.h>
+#include <libempathy/empathy-utils.h>
#include "empathy-chat-window.h"
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,
}
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;