aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <gdesmott@gnome.org>2009-02-13 18:26:03 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-02-13 18:26:03 +0800
commitb8a9bd2a39294c7e4e1b943f5ceab09171fda243 (patch)
treee90ada0777803d9119d42571395a238122bd04a0
parentd77cba7bb5063bd4af1689dbfab5dc874e03278b (diff)
downloadgsoc2013-empathy-b8a9bd2a39294c7e4e1b943f5ceab09171fda243.tar
gsoc2013-empathy-b8a9bd2a39294c7e4e1b943f5ceab09171fda243.tar.gz
gsoc2013-empathy-b8a9bd2a39294c7e4e1b943f5ceab09171fda243.tar.bz2
gsoc2013-empathy-b8a9bd2a39294c7e4e1b943f5ceab09171fda243.tar.lz
gsoc2013-empathy-b8a9bd2a39294c7e4e1b943f5ceab09171fda243.tar.xz
gsoc2013-empathy-b8a9bd2a39294c7e4e1b943f5ceab09171fda243.tar.zst
gsoc2013-empathy-b8a9bd2a39294c7e4e1b943f5ceab09171fda243.zip
event_manager_approve_channel_cb: wait that the contact is ready
From: Guillaume Desmottes <gdesmott@gnome.org> svn path=/trunk/; revision=2451
-rw-r--r--src/empathy-event-manager.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 76b9e348a..f8795b801 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -720,6 +720,36 @@ event_room_channel_process_func (EventPriv *event)
}
static void
+event_manager_muc_invite_got_contact_name_cb (EmpathyContact *contact,
+ const GError *error,
+ gpointer user_data,
+ GObject *object)
+{
+ EventManagerApproval *approval = (EventManagerApproval *) user_data;
+ TpChannel *channel;
+ const gchar *invite_msg;
+ gchar *msg;
+ TpHandle self_handle;
+
+ channel = empathy_dispatch_operation_get_channel (approval->operation);
+
+ self_handle = tp_channel_group_get_self_handle (channel);
+ tp_channel_group_get_local_pending_info (channel, self_handle, NULL, NULL,
+ &invite_msg);
+
+ msg = g_strdup_printf ("%s invited you to join %s",
+ empathy_contact_get_name (approval->contact),
+ tp_channel_get_identifier (channel));
+
+ event_manager_add (approval->manager,
+ approval->contact, EMPATHY_IMAGE_GROUP_MESSAGE, msg, invite_msg,
+ approval, event_room_channel_process_func, NULL);
+
+ empathy_sound_play (empathy_main_window_get (),
+ EMPATHY_SOUND_CONVERSATION_NEW);
+}
+
+static void
event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
EmpathyDispatchOperation *operation, EmpathyEventManager *manager)
{
@@ -760,8 +790,6 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
}
else if (handle_type == TP_HANDLE_TYPE_ROOM)
{
- gchar *msg;
- const gchar *invite_msg;
TpHandle self_handle, inviter;
EmpathyContactFactory *contact_factory;
McAccount *account;
@@ -769,7 +797,7 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
self_handle = tp_channel_group_get_self_handle (channel);
if (self_handle == 0 || !tp_channel_group_get_local_pending_info (
- channel, self_handle, &inviter, NULL, &invite_msg))
+ channel, self_handle, &inviter, NULL, NULL))
{
DEBUG ("can't handle a incoming muc to which we have not been "
"invited");
@@ -779,23 +807,17 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
return;
}
+ /* We are invited to a room */
account = empathy_tp_chat_get_account (tp_chat);
contact_factory = empathy_contact_factory_dup_singleton ();
approval->contact = empathy_contact_factory_get_from_handle (
contact_factory, account, inviter);
- /* We are invited to a room */
- msg = g_strdup_printf ("%s invited you to join %s",
- empathy_contact_get_name (approval->contact),
- tp_channel_get_identifier (channel));
-
- event_manager_add (approval->manager,
- approval->contact, EMPATHY_IMAGE_GROUP_MESSAGE, msg, invite_msg,
- approval, event_room_channel_process_func, NULL);
-
- empathy_sound_play (empathy_main_window_get (),
- EMPATHY_SOUND_CONVERSATION_NEW);
+ empathy_contact_call_when_ready (approval->contact,
+ EMPATHY_CONTACT_READY_NAME,
+ event_manager_muc_invite_got_contact_name_cb, approval, NULL,
+ G_OBJECT (manager));
g_object_unref (contact_factory);
g_object_unref (account);