+static void
+drag_data_received_individual_id (EmpathyChatWindow *self,
+ GtkWidget *widget,
+ GdkDragContext *context,
+ int x,
+ int y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time_)
+{
+ const gchar *id;
+ EmpathyIndividualManager *manager;
+ FolksIndividual *individual;
+ EmpathyChatWindowPriv *priv = GET_PRIV (self);
+ EmpathyTpChat *chat;
+ TpContact *tp_contact;
+ TpConnection *conn;
+ EmpathyContact *contact;
+
+ id = (const gchar *) gtk_selection_data_get_data (selection);
+
+ DEBUG ("DND invididual %s", id);
+
+ if (priv->current_chat == NULL)
+ goto out;
+
+ chat = empathy_chat_get_tp_chat (priv->current_chat);
+ if (chat == NULL)
+ goto out;
+
+ if (!empathy_tp_chat_can_add_contact (chat)) {
+ DEBUG ("Can't invite contact to %s",
+ tp_proxy_get_object_path (chat));
+ goto out;
+ }
+
+ manager = empathy_individual_manager_dup_singleton ();
+
+ individual = empathy_individual_manager_lookup_member (manager, id);
+ if (individual == NULL) {
+ DEBUG ("Failed to find individual %s", id);
+ goto out;
+ }
+
+ conn = tp_channel_borrow_connection ((TpChannel *) chat);
+ tp_contact = empathy_get_tp_contact_for_individual (individual, conn);
+ if (tp_contact == NULL) {
+ DEBUG ("Can't find a TpContact on connection %s for %s",
+ tp_proxy_get_object_path (conn), id);
+ goto out;
+ }
+
+ DEBUG ("Inviting %s to join %s", tp_contact_get_identifier (tp_contact),
+ tp_channel_get_identifier ((TpChannel *) chat));
+
+ contact = empathy_contact_dup_from_tp_contact (tp_contact);
+ empathy_contact_list_add (EMPATHY_CONTACT_LIST (chat), contact, NULL);
+ g_object_unref (contact);
+
+out:
+ gtk_drag_finish (context, TRUE, FALSE, time_);
+ tp_clear_object (&manager);
+}
+