/* kf-persona.c generated by valac 0.17.6.3-6918, the Vala compiler
 * generated from kf-persona.vala, do not modify */

/*
 * Copyright (C) 2010 Collabora Ltd.
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *       Philip Withnall <philip.withnall@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <folks/folks.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <folks-internal.h>


#define FOLKS_BACKENDS_KF_TYPE_PERSONA (folks_backends_kf_persona_get_type ())
#define FOLKS_BACKENDS_KF_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersona))
#define FOLKS_BACKENDS_KF_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersonaClass))
#define FOLKS_BACKENDS_KF_IS_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA))
#define FOLKS_BACKENDS_KF_IS_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA))
#define FOLKS_BACKENDS_KF_PERSONA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersonaClass))

typedef struct _FolksBackendsKfPersona FolksBackendsKfPersona;
typedef struct _FolksBackendsKfPersonaClass FolksBackendsKfPersonaClass;
typedef struct _FolksBackendsKfPersonaPrivate FolksBackendsKfPersonaPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE (folks_backends_kf_persona_store_get_type ())
#define FOLKS_BACKENDS_KF_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore))
#define FOLKS_BACKENDS_KF_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStoreClass))
#define FOLKS_BACKENDS_KF_IS_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE))
#define FOLKS_BACKENDS_KF_IS_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE))
#define FOLKS_BACKENDS_KF_PERSONA_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStoreClass))

typedef struct _FolksBackendsKfPersonaStore FolksBackendsKfPersonaStore;
typedef struct _FolksBackendsKfPersonaStoreClass FolksBackendsKfPersonaStoreClass;
typedef struct _FolksBackendsKfPersonaChangeAliasData FolksBackendsKfPersonaChangeAliasData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _FolksBackendsKfPersonaChangeImAddressesData FolksBackendsKfPersonaChangeImAddressesData;
typedef struct _FolksBackendsKfPersonaChangeWebServiceAddressesData FolksBackendsKfPersonaChangeWebServiceAddressesData;
typedef struct _FolksBackendsKfPersonaChangeAntiLinksData FolksBackendsKfPersonaChangeAntiLinksData;

struct _FolksBackendsKfPersona {
	FolksPersona parent_instance;
	FolksBackendsKfPersonaPrivate * priv;
};

struct _FolksBackendsKfPersonaClass {
	FolksPersonaClass parent_class;
};

struct _FolksBackendsKfPersonaPrivate {
	GeeHashMultiMap* _im_addresses;
	GeeHashMultiMap* _web_service_addresses;
	gchar* _alias;
	GeeHashSet* _anti_links;
	GeeSet* _anti_links_ro;
};

struct _FolksBackendsKfPersonaChangeAliasData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksBackendsKfPersona* self;
	gchar* alias;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	FolksPersonaStore* _tmp6_;
	FolksPersonaStore* _tmp7_;
	GKeyFile* _tmp8_;
	GKeyFile* key_file;
	GKeyFile* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	FolksPersonaStore* _tmp13_;
	FolksPersonaStore* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
};

struct _FolksBackendsKfPersonaChangeImAddressesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksBackendsKfPersona* self;
	GeeMultiMap* im_addresses;
	FolksPersonaStore* _tmp0_;
	FolksPersonaStore* _tmp1_;
	GKeyFile* _tmp2_;
	GKeyFile* key_file;
	GeeHashMultiMap* _tmp3_;
	GeeSet* _tmp4_;
	GeeSet* _tmp5_;
	GeeIterator* _tmp6_;
	GeeIterator* _tmp7_;
	GeeIterator* _protocol1_it;
	GeeIterator* _tmp8_;
	gboolean _tmp9_;
	GeeIterator* _tmp10_;
	gpointer _tmp11_;
	gchar* protocol1;
	GKeyFile* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	GError* e1;
	GeeHashMultiMap* _tmp16_;
	GeeHashMultiMap* new_im_addresses;
	GeeMultiMap* _tmp17_;
	GeeSet* _tmp18_;
	GeeSet* _tmp19_;
	GeeIterator* _tmp20_;
	GeeIterator* _tmp21_;
	GeeIterator* _protocol2_it;
	GeeIterator* _tmp22_;
	gboolean _tmp23_;
	GeeIterator* _tmp24_;
	gpointer _tmp25_;
	gchar* protocol2;
	GeeMultiMap* _tmp26_;
	const gchar* _tmp27_;
	GeeCollection* _tmp28_;
	GeeCollection* addresses;
	GeeHashSet* _tmp29_;
	GeeHashSet* normalised_addresses;
	GeeCollection* _tmp30_;
	GeeIterator* _tmp31_;
	GeeIterator* _im_fd_it;
	GeeIterator* _tmp32_;
	gboolean _tmp33_;
	GeeIterator* _tmp34_;
	gpointer _tmp35_;
	FolksImFieldDetails* im_fd;
	gchar* normalised_address;
	FolksImFieldDetails* _tmp36_;
	gconstpointer _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	GError* e2;
	const gchar* _tmp42_;
	FolksImFieldDetails* _tmp43_;
	gconstpointer _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	GError* _tmp47_;
	const gchar* _tmp48_;
	GError* _tmp49_;
	GeeHashSet* _tmp50_;
	const gchar* _tmp51_;
	const gchar* _tmp52_;
	FolksImFieldDetails* _tmp53_;
	FolksImFieldDetails* new_im_fd;
	GeeHashMultiMap* _tmp54_;
	const gchar* _tmp55_;
	FolksImFieldDetails* _tmp56_;
	GeeHashSet* _tmp57_;
	gint _tmp58_;
	gpointer* _tmp59_;
	gchar** addrs;
	gint addrs_length1;
	gint _addrs_size_;
	GeeHashSet* _tmp60_;
	gint _tmp61_;
	gint _tmp62_;
	gint _tmp63_;
	GKeyFile* _tmp64_;
	const gchar* _tmp65_;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	gchar** _tmp68_;
	gint _tmp68__length1;
	FolksPersonaStore* _tmp69_;
	FolksPersonaStore* _tmp70_;
	GeeHashMultiMap* _tmp71_;
	GeeHashMultiMap* _tmp72_;
	GError * _inner_error_;
};

struct _FolksBackendsKfPersonaChangeWebServiceAddressesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksBackendsKfPersona* self;
	GeeMultiMap* web_service_addresses;
	FolksPersonaStore* _tmp0_;
	FolksPersonaStore* _tmp1_;
	GKeyFile* _tmp2_;
	GKeyFile* key_file;
	GeeHashMultiMap* _tmp3_;
	GeeSet* _tmp4_;
	GeeSet* _tmp5_;
	GeeIterator* _tmp6_;
	GeeIterator* _tmp7_;
	GeeIterator* _web_service1_it;
	GeeIterator* _tmp8_;
	gboolean _tmp9_;
	GeeIterator* _tmp10_;
	gpointer _tmp11_;
	gchar* web_service1;
	GKeyFile* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GError* e;
	GeeHashMultiMap* _tmp18_;
	GeeHashMultiMap* new_web_service_addresses;
	GeeMultiMap* _tmp19_;
	GeeSet* _tmp20_;
	GeeSet* _tmp21_;
	GeeIterator* _tmp22_;
	GeeIterator* _tmp23_;
	GeeIterator* _web_service2_it;
	GeeIterator* _tmp24_;
	gboolean _tmp25_;
	GeeIterator* _tmp26_;
	gpointer _tmp27_;
	gchar* web_service2;
	GeeMultiMap* _tmp28_;
	const gchar* _tmp29_;
	GeeCollection* _tmp30_;
	GeeCollection* ws_fds;
	gchar** _tmp31_;
	gchar** addrs;
	gint addrs_length1;
	gint _addrs_size_;
	GeeCollection* _tmp32_;
	GeeIterator* _tmp33_;
	GeeIterator* _ws_fd1_it;
	GeeIterator* _tmp34_;
	gboolean _tmp35_;
	GeeIterator* _tmp36_;
	gpointer _tmp37_;
	FolksWebServiceFieldDetails* ws_fd1;
	gchar** _tmp38_;
	gint _tmp38__length1;
	FolksWebServiceFieldDetails* _tmp39_;
	gconstpointer _tmp40_;
	const gchar* _tmp41_;
	gchar* _tmp42_;
	GKeyFile* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gchar** _tmp49_;
	gint _tmp49__length1;
	GeeCollection* _tmp50_;
	GeeIterator* _tmp51_;
	GeeIterator* _ws_fd2_it;
	GeeIterator* _tmp52_;
	gboolean _tmp53_;
	GeeIterator* _tmp54_;
	gpointer _tmp55_;
	FolksWebServiceFieldDetails* ws_fd2;
	GeeHashMultiMap* _tmp56_;
	const gchar* _tmp57_;
	FolksWebServiceFieldDetails* _tmp58_;
	FolksPersonaStore* _tmp59_;
	FolksPersonaStore* _tmp60_;
	GeeHashMultiMap* _tmp61_;
	GeeHashMultiMap* _tmp62_;
	GError * _inner_error_;
};

struct _FolksBackendsKfPersonaChangeAntiLinksData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksBackendsKfPersona* self;
	GeeSet* anti_links;
	GeeSet* _tmp0_;
	GeeSet* _tmp1_;
	GeeSet* _tmp2_;
	gboolean _tmp3_;
	FolksPersonaStore* _tmp4_;
	FolksPersonaStore* _tmp5_;
	GKeyFile* _tmp6_;
	GKeyFile* key_file;
	GeeSet* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	GKeyFile* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	GeeSet* _tmp13_;
	gint _tmp14_;
	gpointer* _tmp15_;
	gchar** _tmp16_;
	gint _tmp16__length1;
	FolksPersonaStore* _tmp17_;
	FolksPersonaStore* _tmp18_;
	GeeHashSet* _tmp19_;
	GeeHashSet* _tmp20_;
	GeeSet* _tmp21_;
};


static gpointer folks_backends_kf_persona_parent_class = NULL;
static FolksAliasDetailsIface* folks_backends_kf_persona_folks_alias_details_parent_iface = NULL;
static FolksAntiLinkableIface* folks_backends_kf_persona_folks_anti_linkable_parent_iface = NULL;
static FolksImDetailsIface* folks_backends_kf_persona_folks_im_details_parent_iface = NULL;
static FolksWebServiceDetailsIface* folks_backends_kf_persona_folks_web_service_details_parent_iface = NULL;

GType folks_backends_kf_persona_get_type (void) G_GNUC_CONST;
#define FOLKS_BACKENDS_KF_PERSONA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersonaPrivate))
enum  {
	FOLKS_BACKENDS_KF_PERSONA_DUMMY_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES,
	FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES,
	FOLKS_BACKENDS_KF_PERSONA_ALIAS,
	FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES,
	FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES,
	FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS
};
static void folks_backends_kf_persona_real_change_alias_data_free (gpointer _data);
static void folks_backends_kf_persona_real_change_alias (FolksAliasDetails* base, const gchar* alias, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean folks_backends_kf_persona_real_change_alias_co (FolksBackendsKfPersonaChangeAliasData* _data_);
GType folks_backends_kf_persona_store_get_type (void) G_GNUC_CONST;
GKeyFile* folks_backends_kf_persona_store_get_key_file (FolksBackendsKfPersonaStore* self);
void folks_backends_kf_persona_store_save_key_file (FolksBackendsKfPersonaStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backends_kf_persona_store_save_key_file_finish (FolksBackendsKfPersonaStore* self, GAsyncResult* _res_);
static void folks_backends_kf_persona_change_alias_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_backends_kf_persona_real_change_im_addresses_data_free (gpointer _data);
static void folks_backends_kf_persona_real_change_im_addresses (FolksImDetails* base, GeeMultiMap* im_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean folks_backends_kf_persona_real_change_im_addresses_co (FolksBackendsKfPersonaChangeImAddressesData* _data_);
static void folks_backends_kf_persona_change_im_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_backends_kf_persona_real_change_web_service_addresses_data_free (gpointer _data);
static void folks_backends_kf_persona_real_change_web_service_addresses (FolksWebServiceDetails* base, GeeMultiMap* web_service_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean folks_backends_kf_persona_real_change_web_service_addresses_co (FolksBackendsKfPersonaChangeWebServiceAddressesData* _data_);
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value);
static void folks_backends_kf_persona_change_web_service_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_backends_kf_persona_real_change_anti_links_data_free (gpointer _data);
static void folks_backends_kf_persona_real_change_anti_links (FolksAntiLinkable* base, GeeSet* anti_links, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean folks_backends_kf_persona_real_change_anti_links_co (FolksBackendsKfPersonaChangeAntiLinksData* _data_);
#define FOLKS_BACKENDS_KF_PERSONA_STORE_anti_links_key_name "__anti-links"
static void folks_backends_kf_persona_change_anti_links_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
FolksBackendsKfPersona* folks_backends_kf_persona_new (const gchar* id, FolksPersonaStore* store);
FolksBackendsKfPersona* folks_backends_kf_persona_construct (GType object_type, const gchar* id, FolksPersonaStore* store);
static void folks_backends_kf_persona_real_linkable_property_to_links (FolksPersona* base, const gchar* prop_name, FolksPersonaLinkablePropertyCallback callback, void* callback_target);
static GObject * folks_backends_kf_persona_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static guint _folks_abstract_field_details_hash_ghash_func (gconstpointer key);
static void folks_backends_kf_persona_finalize (GObject* obj);
static void _vala_folks_backends_kf_persona_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_folks_backends_kf_persona_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

static const gchar* FOLKS_BACKENDS_KF_PERSONA__linkable_properties[2] = {"im-addresses", "web-service-addresses"};
static const gchar* FOLKS_BACKENDS_KF_PERSONA__writeable_properties[4] = {"alias", "im-addresses", "web-service-addresses", "anti-links"};

static void folks_backends_kf_persona_real_change_alias_data_free (gpointer _data) {
	FolksBackendsKfPersonaChangeAliasData* _data_;
	_data_ = _data;
	_g_free0 (_data_->alias);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendsKfPersonaChangeAliasData, _data_);
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void folks_backends_kf_persona_real_change_alias (FolksAliasDetails* base, const gchar* alias, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendsKfPersona * self;
	FolksBackendsKfPersonaChangeAliasData* _data_;
	FolksBackendsKfPersona* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeAliasData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_backends_kf_persona_real_change_alias);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_alias_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = alias;
	_tmp2_ = g_strdup (_tmp1_);
	_data_->alias = _tmp2_;
	folks_backends_kf_persona_real_change_alias_co (_data_);
}


static void folks_backends_kf_persona_real_change_alias_finish (FolksAliasDetails* base, GAsyncResult* _res_, GError** error) {
	FolksBackendsKfPersonaChangeAliasData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
   * {@inheritDoc}
   *
   * @since 0.6.2
   */
static void folks_backends_kf_persona_change_alias_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendsKfPersonaChangeAliasData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_backends_kf_persona_real_change_alias_co (_data_);
}


static gboolean folks_backends_kf_persona_real_change_alias_co (FolksBackendsKfPersonaChangeAliasData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->alias;
	if (_data_->_tmp0_ == NULL) {
		_data_->alias = "";
	}
	_data_->_tmp1_ = _data_->self->priv->_alias;
	_data_->_tmp2_ = _data_->alias;
	if (g_strcmp0 (_data_->_tmp1_, _data_->_tmp2_) == 0) {
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = folks_persona_get_uid ((FolksPersona*) _data_->self);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = _data_->alias;
	g_debug ("kf-persona.vala:101: Setting alias of Kf.Persona '%s' to '%s'.", _data_->_tmp4_, _data_->_tmp5_);
	_data_->_tmp6_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp7_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	_data_->key_file = _data_->_tmp8_;
	_data_->_tmp9_ = _data_->key_file;
	_data_->_tmp10_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = _data_->alias;
	g_key_file_set_string (_data_->_tmp9_, _data_->_tmp11_, "__alias", _data_->_tmp12_);
	_data_->_tmp13_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp14_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), folks_backends_kf_persona_change_alias_ready, _data_);
	return FALSE;
	_state_1:
	folks_backends_kf_persona_store_save_key_file_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp14_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp15_ = _data_->alias;
	_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
	_g_free0 (_data_->self->priv->_alias);
	_data_->self->priv->_alias = _data_->_tmp16_;
	g_object_notify ((GObject*) _data_->self, "alias");
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_backends_kf_persona_real_change_im_addresses_data_free (gpointer _data) {
	FolksBackendsKfPersonaChangeImAddressesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->im_addresses);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendsKfPersonaChangeImAddressesData, _data_);
}


static void folks_backends_kf_persona_real_change_im_addresses (FolksImDetails* base, GeeMultiMap* im_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendsKfPersona * self;
	FolksBackendsKfPersonaChangeImAddressesData* _data_;
	FolksBackendsKfPersona* _tmp0_;
	GeeMultiMap* _tmp1_;
	GeeMultiMap* _tmp2_;
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeImAddressesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_backends_kf_persona_real_change_im_addresses);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_im_addresses_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = im_addresses;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data_->im_addresses = _tmp2_;
	folks_backends_kf_persona_real_change_im_addresses_co (_data_);
}


static void folks_backends_kf_persona_real_change_im_addresses_finish (FolksImDetails* base, GAsyncResult* _res_, GError** error) {
	FolksBackendsKfPersonaChangeImAddressesData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
   * {@inheritDoc}
   *
   * @since 0.6.2
   */
static void folks_backends_kf_persona_change_im_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendsKfPersonaChangeImAddressesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_backends_kf_persona_real_change_im_addresses_co (_data_);
}


static gboolean folks_backends_kf_persona_real_change_im_addresses_co (FolksBackendsKfPersonaChangeImAddressesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	_data_->key_file = _data_->_tmp2_;
	{
		_data_->_tmp3_ = _data_->self->priv->_im_addresses;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = gee_multi_map_get_keys ((GeeMultiMap*) _data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_g_object_unref0 (_data_->_tmp5_);
		_data_->_protocol1_it = _data_->_tmp7_;
		while (TRUE) {
			_data_->_tmp8_ = _data_->_protocol1_it;
			_data_->_tmp9_ = FALSE;
			_data_->_tmp9_ = gee_iterator_next (_data_->_tmp8_);
			if (!_data_->_tmp9_) {
				break;
			}
			_data_->_tmp10_ = _data_->_protocol1_it;
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = gee_iterator_get (_data_->_tmp10_);
			_data_->protocol1 = (gchar*) _data_->_tmp11_;
			{
				_data_->_tmp12_ = _data_->key_file;
				_data_->_tmp13_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
				_data_->_tmp14_ = _data_->_tmp13_;
				_data_->_tmp15_ = _data_->protocol1;
				g_key_file_remove_key (_data_->_tmp12_, _data_->_tmp14_, _data_->_tmp15_, &_data_->_inner_error_);
				if (_data_->_inner_error_ != NULL) {
					if (_data_->_inner_error_->domain == G_KEY_FILE_ERROR) {
						goto __catch2_g_key_file_error;
					}
					_g_free0 (_data_->protocol1);
					_g_object_unref0 (_data_->_protocol1_it);
					g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
					g_clear_error (&_data_->_inner_error_);
					return FALSE;
				}
			}
			goto __finally2;
			__catch2_g_key_file_error:
			{
				_data_->e1 = _data_->_inner_error_;
				_data_->_inner_error_ = NULL;
				_g_error_free0 (_data_->e1);
			}
			__finally2:
			if (_data_->_inner_error_ != NULL) {
				if (_data_->_inner_error_->domain == FOLKS_PROPERTY_ERROR) {
					g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
					g_error_free (_data_->_inner_error_);
					_g_free0 (_data_->protocol1);
					_g_object_unref0 (_data_->_protocol1_it);
					if (_data_->_state_ == 0) {
						g_simple_async_result_complete_in_idle (_data_->_async_result);
					} else {
						g_simple_async_result_complete (_data_->_async_result);
					}
					g_object_unref (_data_->_async_result);
					return FALSE;
				} else {
					_g_free0 (_data_->protocol1);
					_g_object_unref0 (_data_->_protocol1_it);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
					g_clear_error (&_data_->_inner_error_);
					return FALSE;
				}
			}
			_g_free0 (_data_->protocol1);
		}
		_g_object_unref0 (_data_->_protocol1_it);
	}
	_data_->_tmp16_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_IM_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, (GHashFunc) folks_abstract_field_details_hash, (GEqualFunc) folks_abstract_field_details_equal);
	_data_->new_im_addresses = _data_->_tmp16_;
	{
		_data_->_tmp17_ = _data_->im_addresses;
		_data_->_tmp18_ = NULL;
		_data_->_tmp18_ = gee_multi_map_get_keys (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_g_object_unref0 (_data_->_tmp19_);
		_data_->_protocol2_it = _data_->_tmp21_;
		while (TRUE) {
			_data_->_tmp22_ = _data_->_protocol2_it;
			_data_->_tmp23_ = FALSE;
			_data_->_tmp23_ = gee_iterator_next (_data_->_tmp22_);
			if (!_data_->_tmp23_) {
				break;
			}
			_data_->_tmp24_ = _data_->_protocol2_it;
			_data_->_tmp25_ = NULL;
			_data_->_tmp25_ = gee_iterator_get (_data_->_tmp24_);
			_data_->protocol2 = (gchar*) _data_->_tmp25_;
			_data_->_tmp26_ = _data_->im_addresses;
			_data_->_tmp27_ = _data_->protocol2;
			_data_->_tmp28_ = NULL;
			_data_->_tmp28_ = gee_multi_map_get (_data_->_tmp26_, _data_->_tmp27_);
			_data_->addresses = _data_->_tmp28_;
			_data_->_tmp29_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
			_data_->normalised_addresses = _data_->_tmp29_;
			{
				_data_->_tmp30_ = _data_->addresses;
				_data_->_tmp31_ = NULL;
				_data_->_tmp31_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp30_);
				_data_->_im_fd_it = _data_->_tmp31_;
				while (TRUE) {
					_data_->_tmp32_ = _data_->_im_fd_it;
					_data_->_tmp33_ = FALSE;
					_data_->_tmp33_ = gee_iterator_next (_data_->_tmp32_);
					if (!_data_->_tmp33_) {
						break;
					}
					_data_->_tmp34_ = _data_->_im_fd_it;
					_data_->_tmp35_ = NULL;
					_data_->_tmp35_ = gee_iterator_get (_data_->_tmp34_);
					_data_->im_fd = (FolksImFieldDetails*) _data_->_tmp35_;
					{
						_data_->_tmp36_ = _data_->im_fd;
						_data_->_tmp37_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp36_);
						_data_->_tmp38_ = _data_->_tmp37_;
						_data_->_tmp39_ = _data_->protocol2;
						_data_->_tmp40_ = NULL;
						_data_->_tmp40_ = folks_im_details_normalise_im_address ((const gchar*) _data_->_tmp38_, _data_->_tmp39_, &_data_->_inner_error_);
						_data_->_tmp41_ = _data_->_tmp40_;
						if (_data_->_inner_error_ != NULL) {
							if (_data_->_inner_error_->domain == FOLKS_IM_DETAILS_ERROR) {
								goto __catch3_folks_im_details_error;
							}
							_g_free0 (_data_->normalised_address);
							_g_object_unref0 (_data_->im_fd);
							_g_object_unref0 (_data_->_im_fd_it);
							_g_object_unref0 (_data_->normalised_addresses);
							_g_object_unref0 (_data_->addresses);
							_g_free0 (_data_->protocol2);
							_g_object_unref0 (_data_->_protocol2_it);
							_g_object_unref0 (_data_->new_im_addresses);
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
							g_clear_error (&_data_->_inner_error_);
							return FALSE;
						}
						_g_free0 (_data_->normalised_address);
						_data_->normalised_address = _data_->_tmp41_;
					}
					goto __finally3;
					__catch3_folks_im_details_error:
					{
						_data_->e2 = _data_->_inner_error_;
						_data_->_inner_error_ = NULL;
						_data_->_tmp42_ = NULL;
						_data_->_tmp42_ = _ ("Invalid IM address ‘%s’ for protocol ‘%s’: %s");
						_data_->_tmp43_ = _data_->im_fd;
						_data_->_tmp44_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp43_);
						_data_->_tmp45_ = _data_->_tmp44_;
						_data_->_tmp46_ = _data_->protocol2;
						_data_->_tmp47_ = _data_->e2;
						_data_->_tmp48_ = _data_->_tmp47_->message;
						_data_->_tmp49_ = g_error_new (FOLKS_PROPERTY_ERROR, FOLKS_PROPERTY_ERROR_INVALID_VALUE, _data_->_tmp42_, (const gchar*) _data_->_tmp45_, _data_->_tmp46_, _data_->_tmp48_);
						_data_->_inner_error_ = _data_->_tmp49_;
						_g_error_free0 (_data_->e2);
						goto __finally3;
					}
					__finally3:
					if (_data_->_inner_error_ != NULL) {
						if (_data_->_inner_error_->domain == FOLKS_PROPERTY_ERROR) {
							g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
							g_error_free (_data_->_inner_error_);
							_g_free0 (_data_->normalised_address);
							_g_object_unref0 (_data_->im_fd);
							_g_object_unref0 (_data_->_im_fd_it);
							_g_object_unref0 (_data_->normalised_addresses);
							_g_object_unref0 (_data_->addresses);
							_g_free0 (_data_->protocol2);
							_g_object_unref0 (_data_->_protocol2_it);
							_g_object_unref0 (_data_->new_im_addresses);
							if (_data_->_state_ == 0) {
								g_simple_async_result_complete_in_idle (_data_->_async_result);
							} else {
								g_simple_async_result_complete (_data_->_async_result);
							}
							g_object_unref (_data_->_async_result);
							return FALSE;
						} else {
							_g_free0 (_data_->normalised_address);
							_g_object_unref0 (_data_->im_fd);
							_g_object_unref0 (_data_->_im_fd_it);
							_g_object_unref0 (_data_->normalised_addresses);
							_g_object_unref0 (_data_->addresses);
							_g_free0 (_data_->protocol2);
							_g_object_unref0 (_data_->_protocol2_it);
							_g_object_unref0 (_data_->new_im_addresses);
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
							g_clear_error (&_data_->_inner_error_);
							return FALSE;
						}
					}
					_data_->_tmp50_ = _data_->normalised_addresses;
					_data_->_tmp51_ = _data_->normalised_address;
					gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp50_, _data_->_tmp51_);
					_data_->_tmp52_ = _data_->normalised_address;
					_data_->_tmp53_ = folks_im_field_details_new (_data_->_tmp52_, NULL);
					_data_->new_im_fd = _data_->_tmp53_;
					_data_->_tmp54_ = _data_->new_im_addresses;
					_data_->_tmp55_ = _data_->protocol2;
					_data_->_tmp56_ = _data_->new_im_fd;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp54_, _data_->_tmp55_, _data_->_tmp56_);
					_g_object_unref0 (_data_->new_im_fd);
					_g_free0 (_data_->normalised_address);
					_g_object_unref0 (_data_->im_fd);
				}
				_g_object_unref0 (_data_->_im_fd_it);
			}
			_data_->_tmp57_ = _data_->normalised_addresses;
			_data_->_tmp58_ = 0;
			_data_->_tmp59_ = NULL;
			_data_->_tmp59_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _data_->_tmp57_, &_data_->_tmp58_);
			_data_->addrs = (gchar**) _data_->_tmp59_;
			_data_->addrs_length1 = (_data_->_tmp58_ * sizeof (gchar*)) / sizeof (gchar*);
			_data_->_addrs_size_ = _data_->addrs_length1;
			_data_->_tmp60_ = _data_->normalised_addresses;
			_data_->_tmp61_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp60_);
			_data_->_tmp62_ = _data_->_tmp61_;
			_data_->addrs_length1 = _data_->_tmp62_;
			_data_->_tmp63_ = _data_->addrs_length1;
			_data_->_tmp64_ = _data_->key_file;
			_data_->_tmp65_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
			_data_->_tmp66_ = _data_->_tmp65_;
			_data_->_tmp67_ = _data_->protocol2;
			_data_->_tmp68_ = _data_->addrs;
			_data_->_tmp68__length1 = _data_->addrs_length1;
			g_key_file_set_string_list (_data_->_tmp64_, _data_->_tmp66_, _data_->_tmp67_, (const gchar* const*) _data_->_tmp68_, _data_->_tmp68__length1);
			_data_->addrs = (_vala_array_free (_data_->addrs, _data_->addrs_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->normalised_addresses);
			_g_object_unref0 (_data_->addresses);
			_g_free0 (_data_->protocol2);
		}
		_g_object_unref0 (_data_->_protocol2_it);
	}
	_data_->_tmp69_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp70_ = _data_->_tmp69_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp70_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), folks_backends_kf_persona_change_im_addresses_ready, _data_);
	return FALSE;
	_state_1:
	folks_backends_kf_persona_store_save_key_file_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp70_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp71_ = _data_->new_im_addresses;
	_data_->_tmp72_ = _g_object_ref0 (_data_->_tmp71_);
	_g_object_unref0 (_data_->self->priv->_im_addresses);
	_data_->self->priv->_im_addresses = _data_->_tmp72_;
	g_object_notify ((GObject*) _data_->self, "im-addresses");
	_g_object_unref0 (_data_->new_im_addresses);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_backends_kf_persona_real_change_web_service_addresses_data_free (gpointer _data) {
	FolksBackendsKfPersonaChangeWebServiceAddressesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->web_service_addresses);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendsKfPersonaChangeWebServiceAddressesData, _data_);
}


static void folks_backends_kf_persona_real_change_web_service_addresses (FolksWebServiceDetails* base, GeeMultiMap* web_service_addresses, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendsKfPersona * self;
	FolksBackendsKfPersonaChangeWebServiceAddressesData* _data_;
	FolksBackendsKfPersona* _tmp0_;
	GeeMultiMap* _tmp1_;
	GeeMultiMap* _tmp2_;
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeWebServiceAddressesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_backends_kf_persona_real_change_web_service_addresses);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_web_service_addresses_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = web_service_addresses;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data_->web_service_addresses = _tmp2_;
	folks_backends_kf_persona_real_change_web_service_addresses_co (_data_);
}


static void folks_backends_kf_persona_real_change_web_service_addresses_finish (FolksWebServiceDetails* base, GAsyncResult* _res_, GError** error) {
	FolksBackendsKfPersonaChangeWebServiceAddressesData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
   * {@inheritDoc}
   *
   * @since 0.6.2
   */
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static void folks_backends_kf_persona_change_web_service_addresses_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendsKfPersonaChangeWebServiceAddressesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_backends_kf_persona_real_change_web_service_addresses_co (_data_);
}


static gboolean folks_backends_kf_persona_real_change_web_service_addresses_co (FolksBackendsKfPersonaChangeWebServiceAddressesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	_data_->key_file = _data_->_tmp2_;
	{
		_data_->_tmp3_ = _data_->self->priv->_web_service_addresses;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = gee_multi_map_get_keys ((GeeMultiMap*) _data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_g_object_unref0 (_data_->_tmp5_);
		_data_->_web_service1_it = _data_->_tmp7_;
		while (TRUE) {
			_data_->_tmp8_ = _data_->_web_service1_it;
			_data_->_tmp9_ = FALSE;
			_data_->_tmp9_ = gee_iterator_next (_data_->_tmp8_);
			if (!_data_->_tmp9_) {
				break;
			}
			_data_->_tmp10_ = _data_->_web_service1_it;
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = gee_iterator_get (_data_->_tmp10_);
			_data_->web_service1 = (gchar*) _data_->_tmp11_;
			{
				_data_->_tmp12_ = _data_->key_file;
				_data_->_tmp13_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
				_data_->_tmp14_ = _data_->_tmp13_;
				_data_->_tmp15_ = _data_->web_service1;
				_data_->_tmp16_ = g_strconcat ("web-service.", _data_->_tmp15_, NULL);
				_data_->_tmp17_ = _data_->_tmp16_;
				g_key_file_remove_key (_data_->_tmp12_, _data_->_tmp14_, _data_->_tmp17_, &_data_->_inner_error_);
				_g_free0 (_data_->_tmp17_);
				if (_data_->_inner_error_ != NULL) {
					if (_data_->_inner_error_->domain == G_KEY_FILE_ERROR) {
						goto __catch4_g_key_file_error;
					}
					_g_free0 (_data_->web_service1);
					_g_object_unref0 (_data_->_web_service1_it);
					g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
					g_clear_error (&_data_->_inner_error_);
					return FALSE;
				}
			}
			goto __finally4;
			__catch4_g_key_file_error:
			{
				_data_->e = _data_->_inner_error_;
				_data_->_inner_error_ = NULL;
				_g_error_free0 (_data_->e);
			}
			__finally4:
			if (_data_->_inner_error_ != NULL) {
				if (_data_->_inner_error_->domain == FOLKS_PROPERTY_ERROR) {
					g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
					g_error_free (_data_->_inner_error_);
					_g_free0 (_data_->web_service1);
					_g_object_unref0 (_data_->_web_service1_it);
					if (_data_->_state_ == 0) {
						g_simple_async_result_complete_in_idle (_data_->_async_result);
					} else {
						g_simple_async_result_complete (_data_->_async_result);
					}
					g_object_unref (_data_->_async_result);
					return FALSE;
				} else {
					_g_free0 (_data_->web_service1);
					_g_object_unref0 (_data_->_web_service1_it);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
					g_clear_error (&_data_->_inner_error_);
					return FALSE;
				}
			}
			_g_free0 (_data_->web_service1);
		}
		_g_object_unref0 (_data_->_web_service1_it);
	}
	_data_->_tmp18_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_WEB_SERVICE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, (GHashFunc) folks_abstract_field_details_hash, (GEqualFunc) folks_abstract_field_details_equal);
	_data_->new_web_service_addresses = _data_->_tmp18_;
	{
		_data_->_tmp19_ = _data_->web_service_addresses;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = gee_multi_map_get_keys (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp21_);
		_data_->_tmp23_ = _data_->_tmp22_;
		_g_object_unref0 (_data_->_tmp21_);
		_data_->_web_service2_it = _data_->_tmp23_;
		while (TRUE) {
			_data_->_tmp24_ = _data_->_web_service2_it;
			_data_->_tmp25_ = FALSE;
			_data_->_tmp25_ = gee_iterator_next (_data_->_tmp24_);
			if (!_data_->_tmp25_) {
				break;
			}
			_data_->_tmp26_ = _data_->_web_service2_it;
			_data_->_tmp27_ = NULL;
			_data_->_tmp27_ = gee_iterator_get (_data_->_tmp26_);
			_data_->web_service2 = (gchar*) _data_->_tmp27_;
			_data_->_tmp28_ = _data_->web_service_addresses;
			_data_->_tmp29_ = _data_->web_service2;
			_data_->_tmp30_ = NULL;
			_data_->_tmp30_ = gee_multi_map_get (_data_->_tmp28_, _data_->_tmp29_);
			_data_->ws_fds = _data_->_tmp30_;
			_data_->_tmp31_ = NULL;
			_data_->_tmp31_ = g_new0 (gchar*, 0 + 1);
			_data_->addrs = _data_->_tmp31_;
			_data_->addrs_length1 = 0;
			_data_->_addrs_size_ = _data_->addrs_length1;
			{
				_data_->_tmp32_ = _data_->ws_fds;
				_data_->_tmp33_ = NULL;
				_data_->_tmp33_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp32_);
				_data_->_ws_fd1_it = _data_->_tmp33_;
				while (TRUE) {
					_data_->_tmp34_ = _data_->_ws_fd1_it;
					_data_->_tmp35_ = FALSE;
					_data_->_tmp35_ = gee_iterator_next (_data_->_tmp34_);
					if (!_data_->_tmp35_) {
						break;
					}
					_data_->_tmp36_ = _data_->_ws_fd1_it;
					_data_->_tmp37_ = NULL;
					_data_->_tmp37_ = gee_iterator_get (_data_->_tmp36_);
					_data_->ws_fd1 = (FolksWebServiceFieldDetails*) _data_->_tmp37_;
					_data_->_tmp38_ = _data_->addrs;
					_data_->_tmp38__length1 = _data_->addrs_length1;
					_data_->_tmp39_ = _data_->ws_fd1;
					_data_->_tmp40_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp39_);
					_data_->_tmp41_ = _data_->_tmp40_;
					_data_->_tmp42_ = g_strdup ((const gchar*) _data_->_tmp41_);
					_vala_array_add1 (&_data_->addrs, &_data_->addrs_length1, &_data_->_addrs_size_, _data_->_tmp42_);
					_g_object_unref0 (_data_->ws_fd1);
				}
				_g_object_unref0 (_data_->_ws_fd1_it);
			}
			_data_->_tmp43_ = _data_->key_file;
			_data_->_tmp44_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
			_data_->_tmp45_ = _data_->_tmp44_;
			_data_->_tmp46_ = _data_->web_service2;
			_data_->_tmp47_ = g_strconcat ("web-service.", _data_->_tmp46_, NULL);
			_data_->_tmp48_ = _data_->_tmp47_;
			_data_->_tmp49_ = _data_->addrs;
			_data_->_tmp49__length1 = _data_->addrs_length1;
			g_key_file_set_string_list (_data_->_tmp43_, _data_->_tmp45_, _data_->_tmp48_, (const gchar* const*) _data_->_tmp49_, _data_->_tmp49__length1);
			_g_free0 (_data_->_tmp48_);
			{
				_data_->_tmp50_ = _data_->ws_fds;
				_data_->_tmp51_ = NULL;
				_data_->_tmp51_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp50_);
				_data_->_ws_fd2_it = _data_->_tmp51_;
				while (TRUE) {
					_data_->_tmp52_ = _data_->_ws_fd2_it;
					_data_->_tmp53_ = FALSE;
					_data_->_tmp53_ = gee_iterator_next (_data_->_tmp52_);
					if (!_data_->_tmp53_) {
						break;
					}
					_data_->_tmp54_ = _data_->_ws_fd2_it;
					_data_->_tmp55_ = NULL;
					_data_->_tmp55_ = gee_iterator_get (_data_->_tmp54_);
					_data_->ws_fd2 = (FolksWebServiceFieldDetails*) _data_->_tmp55_;
					_data_->_tmp56_ = _data_->new_web_service_addresses;
					_data_->_tmp57_ = _data_->web_service2;
					_data_->_tmp58_ = _data_->ws_fd2;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp56_, _data_->_tmp57_, _data_->_tmp58_);
					_g_object_unref0 (_data_->ws_fd2);
				}
				_g_object_unref0 (_data_->_ws_fd2_it);
			}
			_data_->addrs = (_vala_array_free (_data_->addrs, _data_->addrs_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->ws_fds);
			_g_free0 (_data_->web_service2);
		}
		_g_object_unref0 (_data_->_web_service2_it);
	}
	_data_->_tmp59_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp60_ = _data_->_tmp59_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp60_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), folks_backends_kf_persona_change_web_service_addresses_ready, _data_);
	return FALSE;
	_state_1:
	folks_backends_kf_persona_store_save_key_file_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp60_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp61_ = _data_->new_web_service_addresses;
	_data_->_tmp62_ = _g_object_ref0 (_data_->_tmp61_);
	_g_object_unref0 (_data_->self->priv->_web_service_addresses);
	_data_->self->priv->_web_service_addresses = _data_->_tmp62_;
	g_object_notify ((GObject*) _data_->self, "web-service-addresses");
	_g_object_unref0 (_data_->new_web_service_addresses);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_backends_kf_persona_real_change_anti_links_data_free (gpointer _data) {
	FolksBackendsKfPersonaChangeAntiLinksData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->anti_links);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendsKfPersonaChangeAntiLinksData, _data_);
}


static void folks_backends_kf_persona_real_change_anti_links (FolksAntiLinkable* base, GeeSet* anti_links, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendsKfPersona * self;
	FolksBackendsKfPersonaChangeAntiLinksData* _data_;
	FolksBackendsKfPersona* _tmp0_;
	GeeSet* _tmp1_;
	GeeSet* _tmp2_;
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeAntiLinksData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_backends_kf_persona_real_change_anti_links);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_anti_links_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = anti_links;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data_->anti_links = _tmp2_;
	folks_backends_kf_persona_real_change_anti_links_co (_data_);
}


static void folks_backends_kf_persona_real_change_anti_links_finish (FolksAntiLinkable* base, GAsyncResult* _res_, GError** error) {
	FolksBackendsKfPersonaChangeAntiLinksData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
   * {@inheritDoc}
   *
   * @since 0.7.3
   */
static void folks_backends_kf_persona_change_anti_links_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendsKfPersonaChangeAntiLinksData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_backends_kf_persona_real_change_anti_links_co (_data_);
}


static gboolean folks_backends_kf_persona_real_change_anti_links_co (FolksBackendsKfPersonaChangeAntiLinksData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->anti_links;
	_data_->_tmp1_ = folks_anti_linkable_get_anti_links ((FolksAntiLinkable*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = FALSE;
	_data_->_tmp3_ = folks_internal_equal_sets (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _data_->_tmp0_, _data_->_tmp2_);
	if (_data_->_tmp3_) {
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp5_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	_data_->key_file = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->anti_links;
	_data_->_tmp8_ = folks_persona_get_uid ((FolksPersona*) _data_->self);
	_data_->_tmp9_ = _data_->_tmp8_;
	gee_collection_remove ((GeeCollection*) _data_->_tmp7_, _data_->_tmp9_);
	_data_->_tmp10_ = _data_->key_file;
	_data_->_tmp11_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = _data_->anti_links;
	_data_->_tmp14_ = 0;
	_data_->_tmp15_ = NULL;
	_data_->_tmp15_ = gee_collection_to_array ((GeeCollection*) _data_->_tmp13_, &_data_->_tmp14_);
	_data_->_tmp16_ = _data_->_tmp15_;
	_data_->_tmp16__length1 = _data_->_tmp14_;
	g_key_file_set_string_list (_data_->_tmp10_, _data_->_tmp12_, FOLKS_BACKENDS_KF_PERSONA_STORE_anti_links_key_name, (const gchar* const*) _data_->_tmp16_, _data_->_tmp14_);
	_data_->_tmp16_ = (_vala_array_free (_data_->_tmp16_, _data_->_tmp16__length1, (GDestroyNotify) g_free), NULL);
	_data_->_tmp17_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp18_ = _data_->_tmp17_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp18_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), folks_backends_kf_persona_change_anti_links_ready, _data_);
	return FALSE;
	_state_1:
	folks_backends_kf_persona_store_save_key_file_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp18_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp19_ = _data_->self->priv->_anti_links;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _data_->_tmp19_);
	_data_->_tmp20_ = _data_->self->priv->_anti_links;
	_data_->_tmp21_ = _data_->anti_links;
	gee_abstract_collection_add_all ((GeeAbstractCollection*) _data_->_tmp20_, (GeeCollection*) _data_->_tmp21_);
	g_object_notify ((GObject*) _data_->self, "anti-links");
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


/**
   * Create a new persona.
   *
   * Create a new persona for the {@link PersonaStore} ``store``, representing
   * the Persona given by the group ``uid`` in the key file ``key_file``.
   */
FolksBackendsKfPersona* folks_backends_kf_persona_construct (GType object_type, const gchar* id, FolksPersonaStore* store) {
	FolksBackendsKfPersona * self = NULL;
	FolksPersonaStore* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* iid;
	FolksPersonaStore* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_ = NULL;
	gchar* uid;
	const gchar* _tmp13_;
	FolksPersonaStore* _tmp14_;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (store != NULL, NULL);
	_tmp0_ = store;
	_tmp1_ = folks_persona_store_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat (_tmp2_, ":", NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = id;
	_tmp6_ = g_strconcat (_tmp4_, _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp4_);
	iid = _tmp7_;
	_tmp8_ = store;
	_tmp9_ = folks_persona_store_get_id (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = id;
	_tmp12_ = folks_persona_build_uid ("key-file", _tmp10_, _tmp11_);
	uid = _tmp12_;
	_tmp13_ = id;
	_tmp14_ = store;
	self = (FolksBackendsKfPersona*) g_object_new (object_type, "display-id", _tmp13_, "iid", iid, "uid", uid, "store", _tmp14_, "is-user", FALSE, NULL);
	_g_free0 (uid);
	_g_free0 (iid);
	return self;
}


FolksBackendsKfPersona* folks_backends_kf_persona_new (const gchar* id, FolksPersonaStore* store) {
	return folks_backends_kf_persona_construct (FOLKS_BACKENDS_KF_TYPE_PERSONA, id, store);
}


/**
   * {@inheritDoc}
   */
static void folks_backends_kf_persona_real_linkable_property_to_links (FolksPersona* base, const gchar* prop_name, FolksPersonaLinkablePropertyCallback callback, void* callback_target) {
	FolksBackendsKfPersona * self;
	const gchar* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	g_return_if_fail (prop_name != NULL);
	_tmp0_ = prop_name;
	if (g_strcmp0 (_tmp0_, "im-addresses") == 0) {
		{
			GeeHashMultiMap* _tmp1_;
			GeeSet* _tmp2_ = NULL;
			GeeSet* _tmp3_;
			GeeIterator* _tmp4_ = NULL;
			GeeIterator* _tmp5_;
			GeeIterator* _protocol_it;
			_tmp1_ = self->priv->_im_addresses;
			_tmp2_ = gee_multi_map_get_keys ((GeeMultiMap*) _tmp1_);
			_tmp3_ = _tmp2_;
			_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
			_tmp5_ = _tmp4_;
			_g_object_unref0 (_tmp3_);
			_protocol_it = _tmp5_;
			while (TRUE) {
				GeeIterator* _tmp6_;
				gboolean _tmp7_ = FALSE;
				GeeIterator* _tmp8_;
				gpointer _tmp9_ = NULL;
				gchar* protocol;
				GeeHashMultiMap* _tmp10_;
				const gchar* _tmp11_;
				GeeCollection* _tmp12_ = NULL;
				GeeCollection* im_addresses;
				_tmp6_ = _protocol_it;
				_tmp7_ = gee_iterator_next (_tmp6_);
				if (!_tmp7_) {
					break;
				}
				_tmp8_ = _protocol_it;
				_tmp9_ = gee_iterator_get (_tmp8_);
				protocol = (gchar*) _tmp9_;
				_tmp10_ = self->priv->_im_addresses;
				_tmp11_ = protocol;
				_tmp12_ = gee_multi_map_get ((GeeMultiMap*) _tmp10_, _tmp11_);
				im_addresses = _tmp12_;
				{
					GeeCollection* _tmp13_;
					GeeIterator* _tmp14_ = NULL;
					GeeIterator* _im_fd_it;
					_tmp13_ = im_addresses;
					_tmp14_ = gee_iterable_iterator ((GeeIterable*) _tmp13_);
					_im_fd_it = _tmp14_;
					while (TRUE) {
						GeeIterator* _tmp15_;
						gboolean _tmp16_ = FALSE;
						GeeIterator* _tmp17_;
						gpointer _tmp18_ = NULL;
						FolksImFieldDetails* im_fd;
						FolksPersonaLinkablePropertyCallback _tmp19_;
						void* _tmp19__target;
						const gchar* _tmp20_;
						gchar* _tmp21_;
						gchar* _tmp22_;
						FolksImFieldDetails* _tmp23_;
						gconstpointer _tmp24_;
						const gchar* _tmp25_;
						gchar* _tmp26_;
						gchar* _tmp27_;
						_tmp15_ = _im_fd_it;
						_tmp16_ = gee_iterator_next (_tmp15_);
						if (!_tmp16_) {
							break;
						}
						_tmp17_ = _im_fd_it;
						_tmp18_ = gee_iterator_get (_tmp17_);
						im_fd = (FolksImFieldDetails*) _tmp18_;
						_tmp19_ = callback;
						_tmp19__target = callback_target;
						_tmp20_ = protocol;
						_tmp21_ = g_strconcat (_tmp20_, ":", NULL);
						_tmp22_ = _tmp21_;
						_tmp23_ = im_fd;
						_tmp24_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp23_);
						_tmp25_ = _tmp24_;
						_tmp26_ = g_strconcat (_tmp22_, (const gchar*) _tmp25_, NULL);
						_tmp27_ = _tmp26_;
						_tmp19_ (_tmp27_, _tmp19__target);
						_g_free0 (_tmp27_);
						_g_free0 (_tmp22_);
						_g_object_unref0 (im_fd);
					}
					_g_object_unref0 (_im_fd_it);
				}
				_g_object_unref0 (im_addresses);
				_g_free0 (protocol);
			}
			_g_object_unref0 (_protocol_it);
		}
	} else {
		const gchar* _tmp28_;
		_tmp28_ = prop_name;
		if (g_strcmp0 (_tmp28_, "web-service-addresses") == 0) {
			{
				GeeMultiMap* _tmp29_;
				GeeMultiMap* _tmp30_;
				GeeSet* _tmp31_ = NULL;
				GeeSet* _tmp32_;
				GeeIterator* _tmp33_ = NULL;
				GeeIterator* _tmp34_;
				GeeIterator* _web_service_it;
				_tmp29_ = folks_web_service_details_get_web_service_addresses ((FolksWebServiceDetails*) self);
				_tmp30_ = _tmp29_;
				_tmp31_ = gee_multi_map_get_keys (_tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = gee_iterable_iterator ((GeeIterable*) _tmp32_);
				_tmp34_ = _tmp33_;
				_g_object_unref0 (_tmp32_);
				_web_service_it = _tmp34_;
				while (TRUE) {
					GeeIterator* _tmp35_;
					gboolean _tmp36_ = FALSE;
					GeeIterator* _tmp37_;
					gpointer _tmp38_ = NULL;
					gchar* web_service;
					GeeHashMultiMap* _tmp39_;
					const gchar* _tmp40_;
					GeeCollection* _tmp41_ = NULL;
					GeeCollection* web_service_addresses;
					_tmp35_ = _web_service_it;
					_tmp36_ = gee_iterator_next (_tmp35_);
					if (!_tmp36_) {
						break;
					}
					_tmp37_ = _web_service_it;
					_tmp38_ = gee_iterator_get (_tmp37_);
					web_service = (gchar*) _tmp38_;
					_tmp39_ = self->priv->_web_service_addresses;
					_tmp40_ = web_service;
					_tmp41_ = gee_multi_map_get ((GeeMultiMap*) _tmp39_, _tmp40_);
					web_service_addresses = _tmp41_;
					{
						GeeCollection* _tmp42_;
						GeeIterator* _tmp43_ = NULL;
						GeeIterator* _ws_fd_it;
						_tmp42_ = web_service_addresses;
						_tmp43_ = gee_iterable_iterator ((GeeIterable*) _tmp42_);
						_ws_fd_it = _tmp43_;
						while (TRUE) {
							GeeIterator* _tmp44_;
							gboolean _tmp45_ = FALSE;
							GeeIterator* _tmp46_;
							gpointer _tmp47_ = NULL;
							FolksWebServiceFieldDetails* ws_fd;
							FolksPersonaLinkablePropertyCallback _tmp48_;
							void* _tmp48__target;
							const gchar* _tmp49_;
							gchar* _tmp50_;
							gchar* _tmp51_;
							FolksWebServiceFieldDetails* _tmp52_;
							gconstpointer _tmp53_;
							const gchar* _tmp54_;
							gchar* _tmp55_;
							gchar* _tmp56_;
							_tmp44_ = _ws_fd_it;
							_tmp45_ = gee_iterator_next (_tmp44_);
							if (!_tmp45_) {
								break;
							}
							_tmp46_ = _ws_fd_it;
							_tmp47_ = gee_iterator_get (_tmp46_);
							ws_fd = (FolksWebServiceFieldDetails*) _tmp47_;
							_tmp48_ = callback;
							_tmp48__target = callback_target;
							_tmp49_ = web_service;
							_tmp50_ = g_strconcat (_tmp49_, ":", NULL);
							_tmp51_ = _tmp50_;
							_tmp52_ = ws_fd;
							_tmp53_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp52_);
							_tmp54_ = _tmp53_;
							_tmp55_ = g_strconcat (_tmp51_, (const gchar*) _tmp54_, NULL);
							_tmp56_ = _tmp55_;
							_tmp48_ (_tmp56_, _tmp48__target);
							_g_free0 (_tmp56_);
							_g_free0 (_tmp51_);
							_g_object_unref0 (ws_fd);
						}
						_g_object_unref0 (_ws_fd_it);
					}
					_g_object_unref0 (web_service_addresses);
					_g_free0 (web_service);
				}
				_g_object_unref0 (_web_service_it);
			}
		} else {
			const gchar* _tmp57_;
			FolksPersonaLinkablePropertyCallback _tmp58_;
			void* _tmp58__target;
			_tmp57_ = prop_name;
			_tmp58_ = callback;
			_tmp58__target = callback_target;
			FOLKS_PERSONA_CLASS (folks_backends_kf_persona_parent_class)->linkable_property_to_links (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_PERSONA, FolksPersona), _tmp57_, _tmp58_, _tmp58__target);
		}
	}
}


static gchar** folks_backends_kf_persona_real_get_linkable_properties (FolksPersona* base, int* result_length1) {
	gchar** result;
	FolksBackendsKfPersona* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = FOLKS_BACKENDS_KF_PERSONA__linkable_properties;
	_tmp0__length1 = G_N_ELEMENTS (FOLKS_BACKENDS_KF_PERSONA__linkable_properties);
	if (result_length1) {
		*result_length1 = _tmp0__length1;
	}
	result = _tmp0_;
	return result;
}


static gchar** folks_backends_kf_persona_real_get_writeable_properties (FolksPersona* base, int* result_length1) {
	gchar** result;
	FolksBackendsKfPersona* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = FOLKS_BACKENDS_KF_PERSONA__writeable_properties;
	_tmp0__length1 = G_N_ELEMENTS (FOLKS_BACKENDS_KF_PERSONA__writeable_properties);
	if (result_length1) {
		*result_length1 = _tmp0__length1;
	}
	result = _tmp0_;
	return result;
}


static const gchar* folks_backends_kf_persona_real_get_alias (FolksAliasDetails* base) {
	const gchar* result;
	FolksBackendsKfPersona* self;
	const gchar* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_alias;
	result = _tmp0_;
	return result;
}


static void folks_backends_kf_persona_real_set_alias (FolksAliasDetails* base, const gchar* value) {
	FolksBackendsKfPersona* self;
	const gchar* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = value;
	folks_alias_details_change_alias ((FolksAliasDetails*) self, _tmp0_, NULL, NULL);
}


static GeeMultiMap* folks_backends_kf_persona_real_get_im_addresses (FolksImDetails* base) {
	GeeMultiMap* result;
	FolksBackendsKfPersona* self;
	GeeHashMultiMap* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_im_addresses;
	result = (GeeMultiMap*) _tmp0_;
	return result;
}


static void folks_backends_kf_persona_real_set_im_addresses (FolksImDetails* base, GeeMultiMap* value) {
	FolksBackendsKfPersona* self;
	GeeMultiMap* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = value;
	folks_im_details_change_im_addresses ((FolksImDetails*) self, _tmp0_, NULL, NULL);
}


static GeeMultiMap* folks_backends_kf_persona_real_get_web_service_addresses (FolksWebServiceDetails* base) {
	GeeMultiMap* result;
	FolksBackendsKfPersona* self;
	GeeHashMultiMap* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_web_service_addresses;
	result = (GeeMultiMap*) _tmp0_;
	return result;
}


static void folks_backends_kf_persona_real_set_web_service_addresses (FolksWebServiceDetails* base, GeeMultiMap* value) {
	FolksBackendsKfPersona* self;
	GeeMultiMap* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = value;
	folks_web_service_details_change_web_service_addresses ((FolksWebServiceDetails*) self, _tmp0_, NULL, NULL);
}


static GeeSet* folks_backends_kf_persona_real_get_anti_links (FolksAntiLinkable* base) {
	GeeSet* result;
	FolksBackendsKfPersona* self;
	GeeSet* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_anti_links_ro;
	result = _tmp0_;
	return result;
}


static void folks_backends_kf_persona_real_set_anti_links (FolksAntiLinkable* base, GeeSet* value) {
	FolksBackendsKfPersona* self;
	GeeSet* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = value;
	folks_anti_linkable_change_anti_links ((FolksAntiLinkable*) self, _tmp0_, NULL, NULL);
}


static guint _folks_abstract_field_details_hash_ghash_func (gconstpointer key) {
	guint result;
	result = folks_abstract_field_details_hash (key);
	return result;
}


static GObject * folks_backends_kf_persona_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	FolksBackendsKfPersona * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GeeHashMultiMap* _tmp6_;
	GeeHashMultiMap* _tmp7_;
	GeeHashSet* _tmp8_;
	GeeHashSet* _tmp9_;
	GeeSet* _tmp10_;
	GeeSet* _tmp11_;
	FolksPersonaStore* _tmp12_;
	FolksPersonaStore* _tmp13_;
	GKeyFile* _tmp14_ = NULL;
	GKeyFile* key_file;
	GError * _inner_error_ = NULL;
	parent_class = G_OBJECT_CLASS (folks_backends_kf_persona_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersona);
	_tmp0_ = folks_persona_get_uid ((FolksPersona*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = folks_persona_get_iid ((FolksPersona*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = folks_persona_get_display_id ((FolksPersona*) self);
	_tmp5_ = _tmp4_;
	g_debug ("kf-persona.vala:326: Adding key-file Persona '%s' (IID '%s', group '%s" \
"')", _tmp1_, _tmp3_, _tmp5_);
	_tmp6_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_IM_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, _folks_abstract_field_details_hash_ghash_func, (GEqualFunc) folks_abstract_field_details_equal);
	_g_object_unref0 (self->priv->_im_addresses);
	self->priv->_im_addresses = _tmp6_;
	_tmp7_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_WEB_SERVICE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, (GHashFunc) folks_abstract_field_details_hash, (GEqualFunc) folks_abstract_field_details_equal);
	_g_object_unref0 (self->priv->_web_service_addresses);
	self->priv->_web_service_addresses = _tmp7_;
	_tmp8_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	_g_object_unref0 (self->priv->_anti_links);
	self->priv->_anti_links = _tmp8_;
	_tmp9_ = self->priv->_anti_links;
	_tmp10_ = gee_abstract_set_get_read_only_view ((GeeAbstractSet*) _tmp9_);
	_tmp11_ = _tmp10_;
	_g_object_unref0 (self->priv->_anti_links_ro);
	self->priv->_anti_links_ro = _tmp11_;
	_tmp12_ = folks_persona_get_store ((FolksPersona*) self);
	_tmp13_ = _tmp12_;
	_tmp14_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	key_file = _tmp14_;
	{
		GKeyFile* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gsize _tmp18_;
		gchar** _tmp19_ = NULL;
		gchar** keys;
		gint keys_length1;
		gint _keys_size_;
		gchar** _tmp20_;
		gint _tmp20__length1;
		_tmp15_ = key_file;
		_tmp16_ = folks_persona_get_display_id ((FolksPersona*) self);
		_tmp17_ = _tmp16_;
		_tmp19_ = g_key_file_get_keys (_tmp15_, _tmp17_, &_tmp18_, &_inner_error_);
		keys = _tmp19_;
		keys_length1 = _tmp18_;
		_keys_size_ = keys_length1;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch5_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
		}
		_tmp20_ = keys;
		_tmp20__length1 = keys_length1;
		{
			gchar** key_collection = NULL;
			gint key_collection_length1 = 0;
			gint _key_collection_size_ = 0;
			gint key_it = 0;
			key_collection = _tmp20_;
			key_collection_length1 = _tmp20__length1;
			for (key_it = 0; key_it < _tmp20__length1; key_it = key_it + 1) {
				const gchar* key = NULL;
				key = key_collection[key_it];
				{
					const gchar* _tmp21_;
					const gchar* _tmp31_;
					const gchar* _tmp44_;
					gchar** _tmp45_;
					gchar** _tmp46_ = NULL;
					gchar** decomposed_key;
					gint decomposed_key_length1;
					gint _decomposed_key_size_;
					gboolean _tmp47_ = FALSE;
					gchar** _tmp48_;
					gint _tmp48__length1;
					gboolean _tmp51_;
					const gchar* _tmp67_;
					const gchar* protocol;
					GKeyFile* _tmp68_;
					const gchar* _tmp69_;
					const gchar* _tmp70_;
					const gchar* _tmp71_;
					gsize _tmp72_;
					gchar** _tmp73_ = NULL;
					gchar** im_addresses;
					gint im_addresses_length1;
					gint _im_addresses_size_;
					gchar** _tmp74_;
					gint _tmp74__length1;
					_tmp21_ = key;
					if (g_strcmp0 (_tmp21_, "__alias") == 0) {
						GKeyFile* _tmp22_;
						const gchar* _tmp23_;
						const gchar* _tmp24_;
						const gchar* _tmp25_;
						gchar* _tmp26_ = NULL;
						gchar* _tmp27_;
						const gchar* _tmp28_;
						const gchar* _tmp30_;
						_tmp22_ = key_file;
						_tmp23_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp24_ = _tmp23_;
						_tmp25_ = key;
						_tmp26_ = g_key_file_get_string (_tmp22_, _tmp24_, _tmp25_, &_inner_error_);
						_tmp27_ = _tmp26_;
						if (_inner_error_ != NULL) {
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error_->domain == G_KEY_FILE_ERROR) {
								goto __catch5_g_key_file_error;
							}
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
							g_clear_error (&_inner_error_);
						}
						_g_free0 (self->priv->_alias);
						self->priv->_alias = _tmp27_;
						_tmp28_ = self->priv->_alias;
						if (_tmp28_ == NULL) {
							gchar* _tmp29_;
							_tmp29_ = g_strdup ("");
							_g_free0 (self->priv->_alias);
							self->priv->_alias = _tmp29_;
						}
						_tmp30_ = self->priv->_alias;
						g_debug ("kf-persona.vala:357:     Loaded alias '%s'.", _tmp30_);
						continue;
					}
					_tmp31_ = key;
					if (g_strcmp0 (_tmp31_, FOLKS_BACKENDS_KF_PERSONA_STORE_anti_links_key_name) == 0) {
						GKeyFile* _tmp32_;
						const gchar* _tmp33_;
						const gchar* _tmp34_;
						const gchar* _tmp35_;
						gsize _tmp36_;
						gchar** _tmp37_ = NULL;
						gchar** anti_link_array;
						gint anti_link_array_length1;
						gint _anti_link_array_size_;
						gchar** _tmp38_;
						gint _tmp38__length1;
						_tmp32_ = key_file;
						_tmp33_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp34_ = _tmp33_;
						_tmp35_ = key;
						_tmp37_ = g_key_file_get_string_list (_tmp32_, _tmp34_, _tmp35_, &_tmp36_, &_inner_error_);
						anti_link_array = _tmp37_;
						anti_link_array_length1 = _tmp36_;
						_anti_link_array_size_ = anti_link_array_length1;
						if (_inner_error_ != NULL) {
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error_->domain == G_KEY_FILE_ERROR) {
								goto __catch5_g_key_file_error;
							}
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
							g_clear_error (&_inner_error_);
						}
						_tmp38_ = anti_link_array;
						_tmp38__length1 = anti_link_array_length1;
						if (_tmp38_ != NULL) {
							gchar** _tmp39_;
							gint _tmp39__length1;
							gchar** _tmp43_;
							gint _tmp43__length1;
							_tmp39_ = anti_link_array;
							_tmp39__length1 = anti_link_array_length1;
							{
								gchar** anti_link_collection = NULL;
								gint anti_link_collection_length1 = 0;
								gint _anti_link_collection_size_ = 0;
								gint anti_link_it = 0;
								anti_link_collection = _tmp39_;
								anti_link_collection_length1 = _tmp39__length1;
								for (anti_link_it = 0; anti_link_it < _tmp39__length1; anti_link_it = anti_link_it + 1) {
									gchar* _tmp40_;
									gchar* anti_link = NULL;
									_tmp40_ = g_strdup (anti_link_collection[anti_link_it]);
									anti_link = _tmp40_;
									{
										GeeHashSet* _tmp41_;
										const gchar* _tmp42_;
										_tmp41_ = self->priv->_anti_links;
										_tmp42_ = anti_link;
										gee_abstract_collection_add ((GeeAbstractCollection*) _tmp41_, _tmp42_);
										_g_free0 (anti_link);
									}
								}
							}
							_tmp43_ = anti_link_array;
							_tmp43__length1 = anti_link_array_length1;
							g_debug ("kf-persona.vala:374:     Loaded %u anti-links.", (guint) _tmp43__length1);
							anti_link_array = (_vala_array_free (anti_link_array, anti_link_array_length1, (GDestroyNotify) g_free), NULL);
							continue;
						}
						anti_link_array = (_vala_array_free (anti_link_array, anti_link_array_length1, (GDestroyNotify) g_free), NULL);
					}
					_tmp44_ = key;
					_tmp46_ = _tmp45_ = g_strsplit (_tmp44_, ".", 2);
					decomposed_key = _tmp46_;
					decomposed_key_length1 = _vala_array_length (_tmp45_);
					_decomposed_key_size_ = decomposed_key_length1;
					_tmp48_ = decomposed_key;
					_tmp48__length1 = decomposed_key_length1;
					if (_tmp48__length1 == 2) {
						gchar** _tmp49_;
						gint _tmp49__length1;
						const gchar* _tmp50_;
						_tmp49_ = decomposed_key;
						_tmp49__length1 = decomposed_key_length1;
						_tmp50_ = _tmp49_[0];
						_tmp47_ = g_strcmp0 (_tmp50_, "web-service") == 0;
					} else {
						_tmp47_ = FALSE;
					}
					_tmp51_ = _tmp47_;
					if (_tmp51_) {
						gchar** _tmp52_;
						gint _tmp52__length1;
						const gchar* _tmp53_;
						const gchar* web_service;
						GKeyFile* _tmp54_;
						const gchar* _tmp55_;
						const gchar* _tmp56_;
						const gchar* _tmp57_;
						gsize _tmp58_;
						gchar** _tmp59_ = NULL;
						gchar** web_service_addresses;
						gint web_service_addresses_length1;
						gint _web_service_addresses_size_;
						gchar** _tmp60_;
						gint _tmp60__length1;
						_tmp52_ = decomposed_key;
						_tmp52__length1 = decomposed_key_length1;
						_tmp53_ = _tmp52_[1];
						web_service = _tmp53_;
						_tmp54_ = key_file;
						_tmp55_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp56_ = _tmp55_;
						_tmp57_ = web_service;
						_tmp59_ = g_key_file_get_string_list (_tmp54_, _tmp56_, _tmp57_, &_tmp58_, &_inner_error_);
						web_service_addresses = _tmp59_;
						web_service_addresses_length1 = _tmp58_;
						_web_service_addresses_size_ = web_service_addresses_length1;
						if (_inner_error_ != NULL) {
							decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error_->domain == G_KEY_FILE_ERROR) {
								goto __catch5_g_key_file_error;
							}
							decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
							g_clear_error (&_inner_error_);
						}
						_tmp60_ = web_service_addresses;
						_tmp60__length1 = web_service_addresses_length1;
						{
							gchar** web_service_address_collection = NULL;
							gint web_service_address_collection_length1 = 0;
							gint _web_service_address_collection_size_ = 0;
							gint web_service_address_it = 0;
							web_service_address_collection = _tmp60_;
							web_service_address_collection_length1 = _tmp60__length1;
							for (web_service_address_it = 0; web_service_address_it < _tmp60__length1; web_service_address_it = web_service_address_it + 1) {
								gchar* _tmp61_;
								gchar* web_service_address = NULL;
								_tmp61_ = g_strdup (web_service_address_collection[web_service_address_it]);
								web_service_address = _tmp61_;
								{
									GeeHashMultiMap* _tmp62_;
									const gchar* _tmp63_;
									const gchar* _tmp64_;
									FolksWebServiceFieldDetails* _tmp65_;
									FolksWebServiceFieldDetails* _tmp66_;
									_tmp62_ = self->priv->_web_service_addresses;
									_tmp63_ = web_service;
									_tmp64_ = web_service_address;
									_tmp65_ = folks_web_service_field_details_new (_tmp64_, NULL);
									_tmp66_ = _tmp65_;
									gee_multi_map_set ((GeeMultiMap*) _tmp62_, _tmp63_, _tmp66_);
									_g_object_unref0 (_tmp66_);
									_g_free0 (web_service_address);
								}
							}
						}
						web_service_addresses = (_vala_array_free (web_service_addresses, web_service_addresses_length1, (GDestroyNotify) g_free), NULL);
						decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
						continue;
					}
					_tmp67_ = key;
					protocol = _tmp67_;
					_tmp68_ = key_file;
					_tmp69_ = folks_persona_get_display_id ((FolksPersona*) self);
					_tmp70_ = _tmp69_;
					_tmp71_ = protocol;
					_tmp73_ = g_key_file_get_string_list (_tmp68_, _tmp70_, _tmp71_, &_tmp72_, &_inner_error_);
					im_addresses = _tmp73_;
					im_addresses_length1 = _tmp72_;
					_im_addresses_size_ = im_addresses_length1;
					if (_inner_error_ != NULL) {
						decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
						keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
						if (_inner_error_->domain == G_KEY_FILE_ERROR) {
							goto __catch5_g_key_file_error;
						}
						decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
						keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
						g_clear_error (&_inner_error_);
					}
					_tmp74_ = im_addresses;
					_tmp74__length1 = im_addresses_length1;
					{
						gchar** im_address_collection = NULL;
						gint im_address_collection_length1 = 0;
						gint _im_address_collection_size_ = 0;
						gint im_address_it = 0;
						im_address_collection = _tmp74_;
						im_address_collection_length1 = _tmp74__length1;
						for (im_address_it = 0; im_address_it < _tmp74__length1; im_address_it = im_address_it + 1) {
							gchar* _tmp75_;
							gchar* im_address = NULL;
							_tmp75_ = g_strdup (im_address_collection[im_address_it]);
							im_address = _tmp75_;
							{
								gchar* address = NULL;
								const gchar* _tmp82_;
								FolksImFieldDetails* _tmp83_;
								FolksImFieldDetails* im_fd;
								GeeHashMultiMap* _tmp84_;
								const gchar* _tmp85_;
								FolksImFieldDetails* _tmp86_;
								{
									const gchar* _tmp76_;
									const gchar* _tmp77_;
									gchar* _tmp78_ = NULL;
									gchar* _tmp79_;
									_tmp76_ = im_address;
									_tmp77_ = protocol;
									_tmp78_ = folks_im_details_normalise_im_address (_tmp76_, _tmp77_, &_inner_error_);
									_tmp79_ = _tmp78_;
									if (_inner_error_ != NULL) {
										if (_inner_error_->domain == FOLKS_IM_DETAILS_ERROR) {
											goto __catch6_folks_im_details_error;
										}
										_g_free0 (address);
										_g_free0 (im_address);
										im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
										decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
										keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
										g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
										g_clear_error (&_inner_error_);
									}
									_g_free0 (address);
									address = _tmp79_;
								}
								goto __finally6;
								__catch6_folks_im_details_error:
								{
									GError* e = NULL;
									GError* _tmp80_;
									const gchar* _tmp81_;
									e = _inner_error_;
									_inner_error_ = NULL;
									_tmp80_ = e;
									_tmp81_ = _tmp80_->message;
									g_warning ("kf-persona.vala:414: %s", _tmp81_);
									_g_error_free0 (e);
									_g_free0 (address);
									_g_free0 (im_address);
									continue;
								}
								__finally6:
								if (_inner_error_ != NULL) {
									_g_free0 (address);
									_g_free0 (im_address);
									im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
									decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
									keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
									if (_inner_error_->domain == G_KEY_FILE_ERROR) {
										goto __catch5_g_key_file_error;
									}
									_g_free0 (address);
									_g_free0 (im_address);
									im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
									decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
									keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
									g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
									g_clear_error (&_inner_error_);
								}
								_tmp82_ = address;
								_tmp83_ = folks_im_field_details_new (_tmp82_, NULL);
								im_fd = _tmp83_;
								_tmp84_ = self->priv->_im_addresses;
								_tmp85_ = protocol;
								_tmp86_ = im_fd;
								gee_multi_map_set ((GeeMultiMap*) _tmp84_, _tmp85_, _tmp86_);
								_g_object_unref0 (im_fd);
								_g_free0 (address);
								_g_free0 (im_address);
							}
						}
					}
					im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
					decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
				}
			}
		}
		keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally5;
	__catch5_g_key_file_error:
	{
		GError* e = NULL;
		GError* _tmp87_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp87_ = e;
		if (!g_error_matches (_tmp87_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
			const gchar* _tmp88_ = NULL;
			GError* _tmp89_;
			const gchar* _tmp90_;
			_tmp88_ = _ ("Couldn't load data from key file: %s");
			_tmp89_ = e;
			_tmp90_ = _tmp89_->message;
			g_warning (_tmp88_, _tmp90_);
		}
		_g_error_free0 (e);
	}
	__finally5:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
	}
	return obj;
}


static void folks_backends_kf_persona_class_init (FolksBackendsKfPersonaClass * klass) {
	folks_backends_kf_persona_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FolksBackendsKfPersonaPrivate));
	FOLKS_PERSONA_CLASS (klass)->linkable_property_to_links = folks_backends_kf_persona_real_linkable_property_to_links;
	FOLKS_PERSONA_CLASS (klass)->get_linkable_properties = folks_backends_kf_persona_real_get_linkable_properties;
	FOLKS_PERSONA_CLASS (klass)->get_writeable_properties = folks_backends_kf_persona_real_get_writeable_properties;
	G_OBJECT_CLASS (klass)->get_property = _vala_folks_backends_kf_persona_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folks_backends_kf_persona_set_property;
	G_OBJECT_CLASS (klass)->constructor = folks_backends_kf_persona_constructor;
	G_OBJECT_CLASS (klass)->finalize = folks_backends_kf_persona_finalize;
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES, g_param_spec_boxed ("linkable-properties", "linkable-properties", "linkable-properties", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.6.0
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES, g_param_spec_boxed ("writeable-properties", "writeable-properties", "writeable-properties", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.1.15
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_ALIAS, g_param_spec_string ("alias", "alias", "alias", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES, g_param_spec_object ("im-addresses", "im-addresses", "im-addresses", GEE_TYPE_MULTI_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES, g_param_spec_object ("web-service-addresses", "web-service-addresses", "web-service-addresses", GEE_TYPE_MULTI_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.7.3
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS, g_param_spec_object ("anti-links", "anti-links", "anti-links", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void folks_backends_kf_persona_folks_alias_details_interface_init (FolksAliasDetailsIface * iface) {
	folks_backends_kf_persona_folks_alias_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_alias = (void (*)(FolksAliasDetails*, const gchar*, GError**)) folks_backends_kf_persona_real_change_alias;
	iface->change_alias_finish = folks_backends_kf_persona_real_change_alias_finish;
	iface->get_alias = folks_backends_kf_persona_real_get_alias;
	iface->set_alias = folks_backends_kf_persona_real_set_alias;
}


static void folks_backends_kf_persona_folks_anti_linkable_interface_init (FolksAntiLinkableIface * iface) {
	folks_backends_kf_persona_folks_anti_linkable_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_anti_links = (void (*)(FolksAntiLinkable*, GeeSet*, GError**)) folks_backends_kf_persona_real_change_anti_links;
	iface->change_anti_links_finish = folks_backends_kf_persona_real_change_anti_links_finish;
	iface->get_anti_links = folks_backends_kf_persona_real_get_anti_links;
	iface->set_anti_links = folks_backends_kf_persona_real_set_anti_links;
}


static void folks_backends_kf_persona_folks_im_details_interface_init (FolksImDetailsIface * iface) {
	folks_backends_kf_persona_folks_im_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_im_addresses = (void (*)(FolksImDetails*, GeeMultiMap*, GError**)) folks_backends_kf_persona_real_change_im_addresses;
	iface->change_im_addresses_finish = folks_backends_kf_persona_real_change_im_addresses_finish;
	iface->get_im_addresses = folks_backends_kf_persona_real_get_im_addresses;
	iface->set_im_addresses = folks_backends_kf_persona_real_set_im_addresses;
}


static void folks_backends_kf_persona_folks_web_service_details_interface_init (FolksWebServiceDetailsIface * iface) {
	folks_backends_kf_persona_folks_web_service_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_web_service_addresses = (void (*)(FolksWebServiceDetails*, GeeMultiMap*, GError**)) folks_backends_kf_persona_real_change_web_service_addresses;
	iface->change_web_service_addresses_finish = folks_backends_kf_persona_real_change_web_service_addresses_finish;
	iface->get_web_service_addresses = folks_backends_kf_persona_real_get_web_service_addresses;
	iface->set_web_service_addresses = folks_backends_kf_persona_real_set_web_service_addresses;
}


static void folks_backends_kf_persona_instance_init (FolksBackendsKfPersona * self) {
	gchar* _tmp0_;
	self->priv = FOLKS_BACKENDS_KF_PERSONA_GET_PRIVATE (self);
	_tmp0_ = g_strdup ("");
	self->priv->_alias = _tmp0_;
}


static void folks_backends_kf_persona_finalize (GObject* obj) {
	FolksBackendsKfPersona * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersona);
	_g_object_unref0 (self->priv->_im_addresses);
	_g_object_unref0 (self->priv->_web_service_addresses);
	_g_free0 (self->priv->_alias);
	_g_object_unref0 (self->priv->_anti_links);
	_g_object_unref0 (self->priv->_anti_links_ro);
	G_OBJECT_CLASS (folks_backends_kf_persona_parent_class)->finalize (obj);
}


/**
 * A persona subclass which represents a single persona from a simple key file.
 *
 * @since 0.1.13
 */
GType folks_backends_kf_persona_get_type (void) {
	static volatile gsize folks_backends_kf_persona_type_id__volatile = 0;
	if (g_once_init_enter (&folks_backends_kf_persona_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksBackendsKfPersonaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_backends_kf_persona_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksBackendsKfPersona), 0, (GInstanceInitFunc) folks_backends_kf_persona_instance_init, NULL };
		static const GInterfaceInfo folks_alias_details_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_alias_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_anti_linkable_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_anti_linkable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_im_details_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_im_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_web_service_details_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_web_service_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType folks_backends_kf_persona_type_id;
		folks_backends_kf_persona_type_id = g_type_register_static (FOLKS_TYPE_PERSONA, "FolksBackendsKfPersona", &g_define_type_info, 0);
		g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_ALIAS_DETAILS, &folks_alias_details_info);
		g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_ANTI_LINKABLE, &folks_anti_linkable_info);
		g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_IM_DETAILS, &folks_im_details_info);
		g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_WEB_SERVICE_DETAILS, &folks_web_service_details_info);
		g_once_init_leave (&folks_backends_kf_persona_type_id__volatile, folks_backends_kf_persona_type_id);
	}
	return folks_backends_kf_persona_type_id__volatile;
}


static void _vala_folks_backends_kf_persona_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	FolksBackendsKfPersona * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersona);
	switch (property_id) {
		case FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES:
		{
			int length;
			g_value_set_boxed (value, folks_persona_get_linkable_properties ((FolksPersona*) self, &length));
		}
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES:
		{
			int length;
			g_value_set_boxed (value, folks_persona_get_writeable_properties ((FolksPersona*) self, &length));
		}
		break;
		case FOLKS_BACKENDS_KF_PERSONA_ALIAS:
		g_value_set_string (value, folks_alias_details_get_alias ((FolksAliasDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES:
		g_value_set_object (value, folks_im_details_get_im_addresses ((FolksImDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES:
		g_value_set_object (value, folks_web_service_details_get_web_service_addresses ((FolksWebServiceDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS:
		g_value_set_object (value, folks_anti_linkable_get_anti_links ((FolksAntiLinkable*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_folks_backends_kf_persona_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	FolksBackendsKfPersona * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersona);
	switch (property_id) {
		case FOLKS_BACKENDS_KF_PERSONA_ALIAS:
		folks_alias_details_set_alias ((FolksAliasDetails*) self, g_value_get_string (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES:
		folks_im_details_set_im_addresses ((FolksImDetails*) self, g_value_get_object (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES:
		folks_web_service_details_set_web_service_addresses ((FolksWebServiceDetails*) self, g_value_get_object (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS:
		folks_anti_linkable_set_anti_links ((FolksAntiLinkable*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



