ebb_ews_migrate_data_cb (ECache *cache,
			 const gchar *uid,
			 const gchar *revision,
			 const gchar *object,
			 EOfflineState offline_state,
			 gint ncols,
			 const gchar *column_names[],
			 const gchar *column_values[],
			 gchar **out_revision,
			 gchar **out_object,
			 EOfflineState *out_offline_state,
			 ECacheColumnValues **out_other_columns,
			 gpointer user_data)
{
	MigrateData *md = user_data;

	g_return_val_if_fail (md != NULL, FALSE);
	g_return_val_if_fail (object != NULL, FALSE);
	g_return_val_if_fail (out_object != NULL, FALSE);

	if (md->data_version < 1) {
		EContact *contact;

		contact = e_contact_new_from_vcard (object);
		if (contact) {
			gchar *vcard;

			if (md->is_gal) {
				/* GAL doesn't store it, it's not writable */
				ebb_ews_remove_x_attribute (contact, X_EWS_ORIGINAL_VCARD);
			} else {
				/* This updates the X_EWS_ORIGINAL_VCARD to not contain itself */
				ebb_ews_store_original_vcard (contact);
			}

			vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
			if (vcard && *vcard)
				*out_object = vcard;
			else
				g_free (vcard);

			g_object_unref (contact);
		}
	}

	return TRUE;
}
ebb_ews_migrate_data_cb (ECache *cache,
			 const gchar *uid,
			 const gchar *revision,
			 const gchar *object,
			 EOfflineState offline_state,
			 gint ncols,
			 const gchar *column_names[],
			 const gchar *column_values[],
			 gchar **out_revision,
			 gchar **out_object,
			 EOfflineState *out_offline_state,
			 ECacheColumnValues **out_other_columns,
			 gpointer user_data)
{
	MigrateData *md = user_data;

	g_return_val_if_fail (md != NULL, FALSE);
	g_return_val_if_fail (object != NULL, FALSE);
	g_return_val_if_fail (out_object != NULL, FALSE);

	if (md->data_version < 1) {
		EContact *contact;

		contact = e_contact_new_from_vcard (object);
		if (contact) {
			gchar *vcard;

			if (md->is_gal) {
				 
				ebb_ews_remove_x_attribute (contact, X_EWS_ORIGINAL_VCARD);
			} else {
				 
				ebb_ews_store_original_vcard (contact);
			}

			vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
			if (vcard && *vcard)
				*out_object = vcard;
			else
				g_free (vcard);

			g_object_unref (contact);
		}
	}

	return TRUE;
}