diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-11 21:28:09 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-11 21:28:09 +0800 |
commit | d339921eaf86de17aaae585070ae479cfbf4734f (patch) | |
tree | e1256e36416e33da304fae666718e558944a6237 /src | |
parent | fabcd2ec298f6773112c6fad57238c6f7bc2d77e (diff) | |
download | gsoc2013-empathy-d339921eaf86de17aaae585070ae479cfbf4734f.tar gsoc2013-empathy-d339921eaf86de17aaae585070ae479cfbf4734f.tar.gz gsoc2013-empathy-d339921eaf86de17aaae585070ae479cfbf4734f.tar.bz2 gsoc2013-empathy-d339921eaf86de17aaae585070ae479cfbf4734f.tar.lz gsoc2013-empathy-d339921eaf86de17aaae585070ae479cfbf4734f.tar.xz gsoc2013-empathy-d339921eaf86de17aaae585070ae479cfbf4734f.tar.zst gsoc2013-empathy-d339921eaf86de17aaae585070ae479cfbf4734f.zip |
empathy_dispatcher_join_muc: get an account instead of a connection
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-chat-manager.c | 62 | ||||
-rw-r--r-- | src/empathy-main-window.c | 5 | ||||
-rw-r--r-- | src/empathy-new-chatroom-dialog.c | 6 | ||||
-rw-r--r-- | src/empathy.c | 9 |
4 files changed, 17 insertions, 65 deletions
diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c index a3177a3f7..8b9a73b62 100644 --- a/src/empathy-chat-manager.c +++ b/src/empathy-chat-manager.c @@ -369,53 +369,11 @@ empathy_chat_manager_closed_chat (EmpathyChatManager *self, g_queue_get_length (priv->queue)); } -static void -connection_ready_cb (TpConnection *connection, - const GError *error, - gpointer user_data) -{ - ChatData *data = user_data; - EmpathyChatManager *self = chat_manager_singleton; - EmpathyChatManagerPriv *priv; - - /* Extremely unlikely to happen, but I don't really want to keep refs to the - * chat manager in the ChatData structs as it'll then prevent the manager - * from being finalized. */ - if (G_UNLIKELY (self == NULL)) - goto out; - - 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 ( - empathy_get_account_for_connection (connection), data->id, - EMPATHY_DISPATCHER_NON_USER_ACTION); - - g_signal_emit (self, signals[CHATS_CHANGED], 0, - g_queue_get_length (priv->queue)); - } - else - { - DEBUG ("Error readying connection, no chat: %s", error->message); - } - -out: - chat_data_free (data); -} - void empathy_chat_manager_undo_closed_chat (EmpathyChatManager *self) { EmpathyChatManagerPriv *priv = GET_PRIV (self); ChatData *data; - TpConnection *connection; data = g_queue_pop_tail (priv->queue); @@ -425,17 +383,17 @@ empathy_chat_manager_undo_closed_chat (EmpathyChatManager *self) DEBUG ("Removing %s from queue and starting a chat with: %s", data->room ? "room" : "contact", data->id); - connection = tp_account_get_connection (data->account); - - if (connection != NULL) - { - tp_connection_call_when_ready (connection, connection_ready_cb, data); - } + if (data->room) + empathy_dispatcher_join_muc (data->account, data->id, + EMPATHY_DISPATCHER_NON_USER_ACTION); else - { - DEBUG ("No connection, no chat."); - chat_data_free (data); - } + empathy_dispatcher_chat_with_contact_id (data->account, data->id, + EMPATHY_DISPATCHER_NON_USER_ACTION); + + g_signal_emit (self, signals[CHATS_CHANGED], 0, + g_queue_get_length (priv->queue)); + + chat_data_free (data); } guint diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index d99d2ab0b..ff8bb5e98 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -948,16 +948,13 @@ join_chatroom (EmpathyChatroom *chatroom, gint64 timestamp) { TpAccount *account; - TpConnection *connection; const gchar *room; account = empathy_chatroom_get_account (chatroom); - connection = tp_account_get_connection (account); - g_assert (connection != NULL); room = empathy_chatroom_get_room (chatroom); DEBUG ("Requesting channel for '%s'", room); - empathy_dispatcher_join_muc (connection, room, timestamp); + empathy_dispatcher_join_muc (account, room, timestamp); } typedef struct diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c index 88003e948..63e766449 100644 --- a/src/empathy-new-chatroom-dialog.c +++ b/src/empathy-new-chatroom-dialog.c @@ -714,7 +714,7 @@ static void new_chatroom_dialog_join (EmpathyNewChatroomDialog *dialog) { EmpathyAccountChooser *account_chooser; - TpConnection *connection; + TpAccount *account; const gchar *room; const gchar *server = NULL; gchar *room_name = NULL; @@ -723,7 +723,7 @@ new_chatroom_dialog_join (EmpathyNewChatroomDialog *dialog) server = gtk_entry_get_text (GTK_ENTRY (dialog->entry_server)); account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser); - connection = empathy_account_chooser_get_connection (account_chooser); + account = empathy_account_chooser_get_account (account_chooser); if (!EMP_STR_EMPTY (server)) { room_name = g_strconcat (room, "@", server, NULL); @@ -734,7 +734,7 @@ new_chatroom_dialog_join (EmpathyNewChatroomDialog *dialog) g_strstrip (room_name); DEBUG ("Requesting channel for '%s'", room_name); - empathy_dispatcher_join_muc (connection, room_name, + empathy_dispatcher_join_muc (account, room_name, gtk_get_current_event_time ()); g_free (room_name); diff --git a/src/empathy.c b/src/empathy.c index aefb934eb..c1282808a 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -298,13 +298,10 @@ account_status_changed_cb (TpAccount *account, GHashTable *details, EmpathyChatroom *room) { - TpConnection *conn; - - conn = tp_account_get_connection (account); - if (conn == NULL) + if (new_status != TP_CONNECTION_STATUS_CONNECTED) return; - empathy_dispatcher_join_muc (conn, + empathy_dispatcher_join_muc (account, empathy_chatroom_get_room (room), EMPATHY_DISPATCHER_NON_USER_ACTION); } @@ -352,7 +349,7 @@ account_manager_chatroom_ready_cb (GObject *source_object, } else { - empathy_dispatcher_join_muc (conn, + empathy_dispatcher_join_muc (account, empathy_chatroom_get_room (room), EMPATHY_DISPATCHER_NON_USER_ACTION); } |