event_room_channel_process_func (EventPriv *event)
{
GtkWidget *dialog, *button, *image;
- TpHandle room_handle;
- GArray *handles;
- gchar **names;
TpChannel *channel = empathy_dispatch_operation_get_channel (
event->approval->operation);
return;
}
- /* get room name */
- room_handle = tp_channel_get_handle (channel, NULL);
-
- handles = g_array_new (FALSE, FALSE, sizeof (guint));
- g_array_append_val (handles, room_handle);
-
- tp_cli_connection_run_inspect_handles (
- tp_channel_borrow_connection (channel), -1,
- TP_HANDLE_TYPE_ROOM, handles, &names, NULL, NULL);
-
/* create dialog */
dialog = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Room invitation"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("%s is inviting you to join %s"),
empathy_contact_get_name (event->approval->contact),
- *names);
+ tp_channel_get_identifier (channel));
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_OK);
gtk_widget_show (dialog);
- g_array_free (handles, TRUE);
- g_free (names);
-
event->approval->dialog = dialog;
}
}
else if (handle_type == TP_HANDLE_TYPE_ROOM)
{
- EmpathyTpGroup *group;
- EmpathyPendingInfo *info;
gchar *msg;
- GArray *handles;
- gchar **names;
+ const gchar *invite_msg;
+ TpHandle self_handle, inviter;
+ EmpathyContactFactory *contact_factory;
+ McAccount *account;
- group = empathy_tp_group_new (channel);
- empathy_run_until_ready (group);
- info = empathy_tp_group_get_invitation (group, NULL);
+ self_handle = tp_channel_group_get_self_handle (channel);
- if (info == NULL)
+ if (self_handle == 0 || !tp_channel_group_get_local_pending_info (
+ channel, self_handle, &inviter, NULL, &invite_msg))
{
DEBUG ("can't handle a incoming muc to which we have not been "
"invited");
if (empathy_dispatch_operation_claim (approval->operation))
empathy_tp_chat_close (tp_chat);
-
- g_object_unref (group);
return;
}
- /* We are invited to a room */
- handles = g_array_new (FALSE, FALSE, sizeof (guint));
- g_array_append_val (handles, handle);
- tp_cli_connection_run_inspect_handles (
- tp_channel_borrow_connection (channel), -1,
- TP_HANDLE_TYPE_ROOM, handles, &names, NULL, NULL);
+ account = empathy_tp_chat_get_account (tp_chat);
+ contact_factory = empathy_contact_factory_dup_singleton ();
- msg = g_strdup_printf ("%s invited you to join %s",
- empathy_contact_get_name (info->actor), *names);
+ approval->contact = empathy_contact_factory_get_from_handle (
+ contact_factory, account, inviter);
- approval->contact = g_object_ref (info->actor);
+ /* 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,
- info->actor, EMPATHY_IMAGE_GROUP_MESSAGE, msg, NULL,
+ 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);
- g_array_free (handles, TRUE);
- g_free (names);
- g_object_unref (group);
+ g_object_unref (contact_factory);
}
}
else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA))