diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-11 22:20:42 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-11 22:20:42 +0800 |
commit | 95efa6ca70aa8cf1dc3283706c2254f45cad59c5 (patch) | |
tree | 003064fac6c22f387e9f21dfabe455801fbc4b77 | |
parent | 9a48fa95672a4e3287dc6564f676bed5dbb7d358 (diff) | |
parent | 734ecf362e856ea8cc61f119dc371cd90b7851af (diff) | |
download | gsoc2013-empathy-95efa6ca70aa8cf1dc3283706c2254f45cad59c5.tar gsoc2013-empathy-95efa6ca70aa8cf1dc3283706c2254f45cad59c5.tar.gz gsoc2013-empathy-95efa6ca70aa8cf1dc3283706c2254f45cad59c5.tar.bz2 gsoc2013-empathy-95efa6ca70aa8cf1dc3283706c2254f45cad59c5.tar.lz gsoc2013-empathy-95efa6ca70aa8cf1dc3283706c2254f45cad59c5.tar.xz gsoc2013-empathy-95efa6ca70aa8cf1dc3283706c2254f45cad59c5.tar.zst gsoc2013-empathy-95efa6ca70aa8cf1dc3283706c2254f45cad59c5.zip |
Merge branch 'request-chat-626630'
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 28 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-menu.c | 3 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-menu.c | 3 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-view.c | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-new-message-dialog.c | 10 | ||||
-rw-r--r-- | libempathy/empathy-call-factory.c | 1 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.c | 216 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.h | 13 | ||||
-rw-r--r-- | src/empathy-chat-manager.c | 60 | ||||
-rw-r--r-- | src/empathy-chat-window.c | 10 | ||||
-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 | ||||
-rw-r--r-- | tests/interactive/empetit.c | 22 |
15 files changed, 90 insertions, 300 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index dd140587c..71fb2e880 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,12 +241,11 @@ 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, - NULL, NULL); + account, priv->id, EMPATHY_DISPATCHER_NON_USER_ACTION); break; case TP_HANDLE_TYPE_ROOM: - empathy_dispatcher_join_muc (connection, - priv->id, EMPATHY_DISPATCHER_NON_USER_ACTION); + empathy_dispatcher_join_muc (account, priv->id, + EMPATHY_DISPATCHER_NON_USER_ACTION); break; case TP_HANDLE_TYPE_NONE: case TP_HANDLE_TYPE_LIST: @@ -263,7 +255,6 @@ reconnected_connection_ready_cb (TpConnection *connection, break; } -out: g_object_unref (chat); } @@ -290,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 @@ -719,8 +710,9 @@ chat_command_join (EmpathyChat *chat, TpConnection *connection; connection = empathy_tp_chat_get_connection (priv->tp_chat); - empathy_dispatcher_join_muc (connection, rooms[i], - gtk_get_current_event_time ()); + empathy_dispatcher_join_muc ( + empathy_get_account_for_connection (connection), rooms[i], + gtk_get_current_event_time ()); } i++; } diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index f36718c83..ce586420e 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -892,7 +892,7 @@ contact_list_view_row_activated (GtkTreeView *view, if (contact) { DEBUG ("Starting a chat"); empathy_dispatcher_chat_with_contact (contact, - gtk_get_current_event_time (), NULL, NULL); + gtk_get_current_event_time ()); g_object_unref (contact); } } diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c index a75fe8fab..651622554 100644 --- a/libempathy-gtk/empathy-contact-menu.c +++ b/libempathy-gtk/empathy-contact-menu.c @@ -216,8 +216,7 @@ static void empathy_contact_chat_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) { - empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time (), - NULL, NULL); + empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time ()); } GtkWidget * diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index c3edf06c7..092208b61 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -245,8 +245,7 @@ empathy_individual_chat_menu_item_activated (GtkMenuItem *item, g_return_if_fail (contact != NULL); - empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time (), - NULL, NULL); + empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time ()); g_object_unref (contact); } diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index 83811750b..716886dbc 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -925,7 +925,7 @@ individual_view_row_activated (GtkTreeView *view, DEBUG ("Starting a chat"); empathy_dispatcher_chat_with_contact (contact, - gtk_get_current_event_time (), NULL, NULL); + gtk_get_current_event_time ()); } g_object_unref (individual); diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c index 21480a787..a17481437 100644 --- a/libempathy-gtk/empathy-new-message-dialog.c +++ b/libempathy-gtk/empathy-new-message-dialog.c @@ -60,18 +60,18 @@ 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, - gtk_get_current_event_time (), NULL, NULL); + empathy_dispatcher_chat_with_contact_id (account, contact_id, + gtk_get_current_event_time ()); out: gtk_widget_destroy (GTK_WIDGET (dialog)); diff --git a/libempathy/empathy-call-factory.c b/libempathy/empathy-call-factory.c index 5f57f7c24..9ac4af2f7 100644 --- a/libempathy/empathy-call-factory.c +++ b/libempathy/empathy-call-factory.c @@ -255,6 +255,7 @@ empathy_call_factory_new_call_with_streams (EmpathyContact *contact, tp_account_channel_request_create_channel_async (req, NULL, NULL, create_media_channel_cb, NULL); + g_hash_table_unref (request); g_object_unref (req); } diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 1cec0e9d8..02500efcb 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -1203,204 +1203,76 @@ dispatcher_request_failed (EmpathyDispatcher *self, free_dispatcher_request_data (request_data); } -static void -dispatcher_request_channel (DispatcherRequestData *request_data) -{ - /* Extend the request_data to be a valid request */ - g_assert (request_data->request == NULL); - request_data->request = tp_asv_new ( - TP_IFACE_CHANNEL ".ChannelType", - G_TYPE_STRING, request_data->channel_type, - TP_IFACE_CHANNEL ".TargetHandleType", - G_TYPE_UINT, request_data->handle_type, - NULL); - - if (request_data->handle_type != TP_HANDLE_TYPE_NONE) - tp_asv_set_uint32 (request_data->request, TP_IFACE_CHANNEL ".TargetHandle", - request_data->handle); - - empathy_dispatcher_call_create_or_ensure_channel (request_data->dispatcher, - request_data); -} - void empathy_dispatcher_chat_with_contact (EmpathyContact *contact, - gint64 timestamp, - EmpathyDispatcherRequestCb *callback, - gpointer user_data) + gint64 timestamp) { - EmpathyDispatcher *self; - EmpathyDispatcherPriv *priv; - TpConnection *connection; - ConnectionData *connection_data; - DispatcherRequestData *request_data; - - g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - - self = empathy_dispatcher_dup_singleton (); - priv = GET_PRIV (self); - - connection = empathy_contact_get_connection (contact); - connection_data = g_hash_table_lookup (priv->connections, connection); - if (connection_data == NULL) - { - /* Connection has been invalidated */ - if (callback != NULL) - { - GError error = { TP_DBUS_ERRORS, TP_DBUS_ERROR_PROXY_UNREFERENCED, - "Connection has been invalidated" }; - callback (NULL, &error, user_data); - } - goto out; - } - - /* The contact handle might not be known yet */ - request_data = new_dispatcher_request_data (self, connection, - TP_IFACE_CHANNEL_TYPE_TEXT, TP_HANDLE_TYPE_CONTACT, - empathy_contact_get_handle (contact), NULL, timestamp, contact, - callback, user_data); - request_data->should_ensure = TRUE; - - connection_data->outstanding_requests = g_list_prepend - (connection_data->outstanding_requests, request_data); - - dispatcher_request_channel (request_data); - -out: - g_object_unref (self); + empathy_dispatcher_chat_with_contact_id ( + empathy_contact_get_account (contact), empathy_contact_get_id (contact), + timestamp); } -typedef struct -{ - EmpathyDispatcher *dispatcher; - EmpathyDispatcherRequestCb *callback; - gpointer user_data; - gint64 timestamp; -} ChatWithContactIdData; - static void -dispatcher_chat_with_contact_id_cb (TpConnection *connection, - EmpathyContact *contact, - const GError *error, - gpointer user_data, - GObject *weak_object) +ensure_text_channel_cb (GObject *source, + GAsyncResult *result, + gpointer user_data) { - ChatWithContactIdData *data = user_data; - - if (error) - { - DEBUG ("Error: %s", error->message); + GError *error = NULL; - if (data->callback != NULL) - { - data->callback (NULL, error, data->user_data); - } - } - else + if (!tp_account_channel_request_ensure_channel_finish ( + TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error)) { - empathy_dispatcher_chat_with_contact (contact, data->timestamp, - data->callback, data->user_data); + DEBUG ("Failed to ensure text channel: %s", error->message); + g_error_free (error); } - - g_object_unref (data->dispatcher); - g_slice_free (ChatWithContactIdData, data); } void -empathy_dispatcher_chat_with_contact_id (TpConnection *connection, - const gchar *contact_id, - gint64 timestamp, - EmpathyDispatcherRequestCb *callback, - gpointer user_data) -{ - EmpathyDispatcher *self; - ChatWithContactIdData *data; - - g_return_if_fail (TP_IS_CONNECTION (connection)); - g_return_if_fail (!EMP_STR_EMPTY (contact_id)); - - self = empathy_dispatcher_dup_singleton (); - data = g_slice_new0 (ChatWithContactIdData); - data->dispatcher = self; - data->callback = callback; - data->user_data = user_data; - data->timestamp = timestamp; - empathy_tp_contact_factory_get_from_id (connection, contact_id, - dispatcher_chat_with_contact_id_cb, data, NULL, NULL); -} - -static void -dispatcher_request_handles_cb (TpConnection *connection, - const GArray *handles, - const GError *error, - gpointer user_data, - GObject *object) +empathy_dispatcher_chat_with_contact_id (TpAccount *account, + const gchar *contact_id, + gint64 timestamp) { - DispatcherRequestData *request_data = (DispatcherRequestData *) user_data; - - request_data->pending_call = NULL; - - if (error != NULL) - { - EmpathyDispatcher *self = request_data->dispatcher; - EmpathyDispatcherPriv *priv = GET_PRIV (self); - ConnectionData *cd; + GHashTable *request; + TpAccountChannelRequest *req; - cd = g_hash_table_lookup (priv->connections, request_data->connection); + request = tp_asv_new ( + TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, + TP_IFACE_CHANNEL_TYPE_TEXT, + TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, + TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, contact_id, + NULL); - if (request_data->cb) - request_data->cb (NULL, error, request_data->user_data); + req = tp_account_channel_request_new (account, request, timestamp); - cd->outstanding_requests = g_list_remove (cd->outstanding_requests, - request_data); + tp_account_channel_request_ensure_channel_async (req, NULL, NULL, + ensure_text_channel_cb, NULL); - free_dispatcher_request_data (request_data); - return; - } - - request_data->handle = g_array_index (handles, guint, 0); - dispatcher_request_channel (request_data); + g_hash_table_unref (request); + g_object_unref (req); } void -empathy_dispatcher_join_muc (TpConnection *connection, - const gchar *roomname, - gint64 timestamp) +empathy_dispatcher_join_muc (TpAccount *account, + const gchar *room_name, + gint64 timestamp) { - EmpathyDispatcher *self; - EmpathyDispatcherPriv *priv; - DispatcherRequestData *request_data; - ConnectionData *connection_data; - const gchar *names[] = { roomname, NULL }; - TpProxyPendingCall *call; - - g_return_if_fail (TP_IS_CONNECTION (connection)); - g_return_if_fail (!EMP_STR_EMPTY (roomname)); - - self = empathy_dispatcher_dup_singleton (); - priv = GET_PRIV (self); - - connection_data = g_hash_table_lookup (priv->connections, connection); - g_assert (connection_data != NULL); - - /* Don't know the room handle yet */ - request_data = new_dispatcher_request_data (self, connection, - TP_IFACE_CHANNEL_TYPE_TEXT, TP_HANDLE_TYPE_ROOM, 0, NULL, timestamp, - NULL, NULL, NULL); - request_data->should_ensure = TRUE; + GHashTable *request; + TpAccountChannelRequest *req; - connection_data->outstanding_requests = g_list_prepend - (connection_data->outstanding_requests, request_data); + request = tp_asv_new ( + TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, + TP_IFACE_CHANNEL_TYPE_TEXT, + TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM, + TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, room_name, + NULL); - call = tp_cli_connection_call_request_handles ( - connection, -1, - TP_HANDLE_TYPE_ROOM, names, - dispatcher_request_handles_cb, request_data, NULL, NULL); + req = tp_account_channel_request_new (account, request, timestamp); - if (call != NULL) - request_data->pending_call = call; + tp_account_channel_request_ensure_channel_async (req, NULL, NULL, + ensure_text_channel_cb, NULL); - g_object_unref (self); + g_hash_table_unref (request); + g_object_unref (req); } static void diff --git a/libempathy/empathy-dispatcher.h b/libempathy/empathy-dispatcher.h index 1cc39cfbb..7991de085 100644 --- a/libempathy/empathy-dispatcher.h +++ b/libempathy/empathy-dispatcher.h @@ -75,18 +75,15 @@ 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, - EmpathyDispatcherRequestCb *callback, - gpointer user_data); + gint64 timestamp); + void empathy_dispatcher_chat_with_contact (EmpathyContact *contact, - gint64 timestamp, - EmpathyDispatcherRequestCb *callback, - gpointer user_data); + gint64 timestamp); /* Request a muc channel */ -void empathy_dispatcher_join_muc (TpConnection *connection, +void empathy_dispatcher_join_muc (TpAccount *account, const gchar *roomname, gint64 timestamp); diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c index 3c66e36e5..8b9a73b62 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" @@ -368,50 +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); - - 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_NON_USER_ACTION, NULL, NULL); - - 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); @@ -421,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-chat-window.c b/src/empathy-chat-window.c index e80d38298..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 (), NULL, NULL); - } + empathy_dispatcher_chat_with_contact_id ( + account, contact_id, gtk_get_current_event_time ()); g_strfreev (strv); return; 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); } diff --git a/tests/interactive/empetit.c b/tests/interactive/empetit.c index 7bcaf03ee..3ed5998ac 100644 --- a/tests/interactive/empetit.c +++ b/tests/interactive/empetit.c @@ -12,25 +12,6 @@ static GtkWidget *window = NULL; static void -chat_cb (EmpathyDispatchOperation *dispatch, - const GError *error, - gpointer user_data) -{ - GtkWidget *dialog; - - if (error != NULL) - { - dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", - error->message ? error->message : "No error message"); - - gtk_dialog_run (GTK_DIALOG (dialog)); - } - - gtk_widget_destroy (window); -} - -static void clicked_cb (GtkButton *button, gpointer data) { @@ -42,8 +23,7 @@ clicked_cb (GtkButton *button, if (!contact) return; - empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time (), - chat_cb, NULL); + empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time ()); g_object_unref (contact); } |