#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libmissioncontrol/mission-control.h>
#include <telepathy-glib/util.h>
+#include <libempathy/empathy-account-manager.h>
#include <libempathy/empathy-log-manager.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-utils.h>
EmpathyContact *remote_contact;
EmpathyLogManager *log_manager;
- MissionControl *mc;
+ EmpathyAccountManager *account_manager;
GSList *sent_messages;
gint sent_messages_index;
GList *compositors;
guint composing_stop_timeout_id;
guint block_events_timeout_id;
TpHandleType handle_type;
- gpointer token;
gint contacts_width;
gboolean has_input_vscroll;
}
static void
-chat_status_changed_cb (MissionControl *mc,
- TpConnectionStatus status,
- McPresence presence,
- TpConnectionStatusReason reason,
- const gchar *unique_name,
- EmpathyChat *chat)
+chat_connection_changed_cb (EmpathyAccountManager *manager,
+ McAccount *account,
+ TpConnectionStatusReason reason,
+ TpConnectionStatus current,
+ TpConnectionStatus previous,
+ EmpathyChat *chat)
{
EmpathyChatPriv *priv = GET_PRIV (chat);
- McAccount *account;
- account = mc_account_lookup (unique_name);
-
- if (status == TP_CONNECTION_STATUS_CONNECTED && !priv->tp_chat &&
+ if (current == TP_CONNECTION_STATUS_CONNECTED && !priv->tp_chat &&
empathy_account_equal (account, priv->account) &&
priv->handle_type != TP_HANDLE_TYPE_NONE) {
TpConnection *connection;
+ MissionControl *mc;
DEBUG ("Account reconnected, request a new Text channel");
+
+ mc = empathy_mission_control_new ();
connection = mission_control_get_tpconnection (mc, account, NULL);
tp_connection_run_until_ready (connection, FALSE, NULL, NULL);
empathy_connection_request_channel (connection, -1,
NULL, NULL, NULL, NULL);
g_object_unref (connection);
}
-
- g_object_unref (account);
}
static void
chat_composing_remove_timeout (chat);
- empathy_disconnect_account_status_changed (priv->token);
- g_object_unref (priv->mc);
+ g_object_unref (priv->account_manager);
g_object_unref (priv->log_manager);
if (priv->tp_chat) {
priv->contacts_width = -1;
priv->sent_messages = NULL;
priv->sent_messages_index = -1;
- priv->mc = empathy_mission_control_new ();
+ priv->account_manager = empathy_account_manager_new ();
- priv->token = empathy_connect_to_account_status_changed (priv->mc,
- G_CALLBACK (chat_status_changed_cb),
- chat, NULL);
+ g_signal_connect (priv->account_manager,
+ "account-connection-changed",
+ G_CALLBACK (chat_connection_changed_cb),
+ chat);
/* Block events for some time to avoid having "has come online" or
* "joined" messages. */