/* kf-persona.c generated by valac 0.56.0, 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 "key-file.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "folks/folks.h"
#include "folks/small-set.h"
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include "folks-internal.h"
#include "folks/small-set-internal.h"

#define FOLKS_BACKENDS_KF_PERSONA_STORE_anti_links_key_name "__anti-links"

enum  {
	FOLKS_BACKENDS_KF_PERSONA_0_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_ALIAS_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_LOCAL_IDS_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_NUM_PROPERTIES
};
static GParamSpec* folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
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;
typedef struct _FolksBackendsKfPersonaChangeLocalIdsData FolksBackendsKfPersonaChangeLocalIdsData;

struct _FolksBackendsKfPersonaPrivate {
	GeeHashMultiMap* _im_addresses;
	GeeHashMultiMap* _web_service_addresses;
	gchar* _alias;
	FolksSmallSet* _anti_links;
	GeeSet* _anti_links_ro;
	FolksSmallSet* _local_ids;
	GeeSet* _local_ids_ro;
};

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

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

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

struct _FolksBackendsKfPersonaChangeAntiLinksData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FolksBackendsKfPersona* self;
	GeeSet* anti_links;
	GeeSet* _tmp0_;
	GeeSet* _tmp1_;
	GKeyFile* key_file;
	FolksPersonaStore* _tmp2_;
	FolksPersonaStore* _tmp3_;
	GKeyFile* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	GKeyFile* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gint _tmp10_;
	gpointer* _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	FolksPersonaStore* _tmp13_;
	FolksPersonaStore* _tmp14_;
	FolksSmallSet* _tmp15_;
	FolksSmallSet* _tmp16_;
};

struct _FolksBackendsKfPersonaChangeLocalIdsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FolksBackendsKfPersona* self;
	GeeSet* local_ids;
	FolksSmallSet* _tmp0_;
	GKeyFile* key_file;
	FolksPersonaStore* _tmp1_;
	FolksPersonaStore* _tmp2_;
	GKeyFile* _tmp3_;
	GKeyFile* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gint _tmp7_;
	gpointer* _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	FolksPersonaStore* _tmp10_;
	FolksPersonaStore* _tmp11_;
	FolksSmallSet* _tmp12_;
	FolksSmallSet* _tmp13_;
};

static gint FolksBackendsKfPersona_private_offset;
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 FolksLocalIdDetailsIface * folks_backends_kf_persona_folks_local_id_details_parent_iface = NULL;
static FolksWebServiceDetailsIface * folks_backends_kf_persona_folks_web_service_details_parent_iface = NULL;

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_);
VALA_EXTERN GKeyFile* folks_backends_kf_persona_store_get_key_file (FolksBackendsKfPersonaStore* self);
VALA_EXTERN void folks_backends_kf_persona_store_save_key_file (FolksBackendsKfPersonaStore* self,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
VALA_EXTERN 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 guint _folks_abstract_field_details_hash_static_gee_hash_data_func (gconstpointer v,
                                                                    gpointer self);
static gboolean _folks_abstract_field_details_equal_static_gee_equal_data_func (gconstpointer a,
                                                                         gconstpointer b,
                                                                         gpointer self);
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_add2 (gchar** * array,
                       gint* length,
                       gint* 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_);
static void folks_backends_kf_persona_change_anti_links_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void folks_backends_kf_persona_real_change_local_ids_data_free (gpointer _data);
static void folks_backends_kf_persona_real_change_local_ids (FolksLocalIdDetails* base,
                                                      GeeSet* local_ids,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static gboolean folks_backends_kf_persona_real_change_local_ids_co (FolksBackendsKfPersonaChangeLocalIdsData* _data_);
static void folks_backends_kf_persona_change_local_ids_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
static void folks_backends_kf_persona_real_linkable_property_to_links (FolksPersona* base,
                                                                const gchar* prop_name,
                                                                FolksPersonaLinkablePropertyCallback callback,
                                                                gpointer callback_target);
static GObject * folks_backends_kf_persona_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static void folks_backends_kf_persona_finalize (GObject * obj);
static GType folks_backends_kf_persona_get_type_once (void);
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,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

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

static inline gpointer
folks_backends_kf_persona_get_instance_private (FolksBackendsKfPersona* self)
{
	return G_STRUCT_MEMBER_P (self, FolksBackendsKfPersona_private_offset);
}

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_;
	gchar* _tmp1_;
	g_return_if_fail (alias != NULL);
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeAliasData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_alias_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (alias);
	_g_free0 (_data_->alias);
	_data_->alias = _tmp1_;
	folks_backends_kf_persona_real_change_alias_co (_data_);
}

static void
folks_backends_kf_persona_change_alias_finish (FolksAliasDetails* base,
                                               GAsyncResult* _res_,
                                               GError** error)
{
	FolksBackendsKfPersonaChangeAliasData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * {@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:
	if (_data_->alias == NULL) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("");
		_g_free0 (_data_->alias);
		_data_->alias = _tmp0_;
	}
	_data_->_tmp1_ = _data_->self->priv->_alias;
	if (g_strcmp0 (_data_->_tmp1_, _data_->alias) == 0) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = folks_persona_get_uid ((FolksPersona*) _data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	g_debug ("kf-persona.vala:105: Setting alias of Kf.Persona '%s' to '%s'.", _data_->_tmp3_, _data_->alias);
	_data_->_tmp4_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_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_->key_file;
	_data_->_tmp8_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
	_data_->_tmp9_ = _data_->_tmp8_;
	g_key_file_set_string (_data_->_tmp7_, _data_->_tmp9_, "__alias", _data_->alias);
	_data_->_tmp10_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, 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_->_tmp11_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp12_ = g_strdup (_data_->alias);
	_g_free0 (_data_->self->priv->_alias);
	_data_->self->priv->_alias = _data_->_tmp12_;
	g_object_notify ((GObject*) _data_->self, "alias");
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	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_;
	g_return_if_fail (im_addresses != NULL);
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeImAddressesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_im_addresses_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (im_addresses);
	_g_object_unref0 (_data_->im_addresses);
	_data_->im_addresses = _tmp1_;
	folks_backends_kf_persona_real_change_im_addresses_co (_data_);
}

static void
folks_backends_kf_persona_change_im_addresses_finish (FolksImDetails* base,
                                                      GAsyncResult* _res_,
                                                      GError** error)
{
	FolksBackendsKfPersonaChangeImAddressesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * {@inheritDoc}
   *
   * @since 0.6.2
   */
static guint
_folks_abstract_field_details_hash_static_gee_hash_data_func (gconstpointer v,
                                                              gpointer self)
{
	guint result;
	result = folks_abstract_field_details_hash_static ((FolksAbstractFieldDetails*) v);
	return result;
}

static gboolean
_folks_abstract_field_details_equal_static_gee_equal_data_func (gconstpointer a,
                                                                gconstpointer b,
                                                                gpointer self)
{
	gboolean result;
	result = folks_abstract_field_details_equal_static ((FolksAbstractFieldDetails*) a, (FolksAbstractFieldDetails*) b);
	return result;
}

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_ = 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_ = gee_multi_map_get_keys ((GeeMultiMap*) _data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_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;
			if (!gee_iterator_next (_data_->_tmp8_)) {
				break;
			}
			_data_->_tmp9_ = _data_->_protocol1_it;
			_data_->_tmp10_ = gee_iterator_get (_data_->_tmp9_);
			_data_->protocol1 = (gchar*) _data_->_tmp10_;
			{
				_data_->_tmp11_ = _data_->key_file;
				_data_->_tmp12_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
				_data_->_tmp13_ = _data_->_tmp12_;
				_data_->_tmp14_ = _data_->protocol1;
				g_key_file_remove_key (_data_->_tmp11_, _data_->_tmp13_, _data_->_tmp14_, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					if (_data_->_inner_error0_->domain == G_KEY_FILE_ERROR) {
						goto __catch0_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_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
			goto __finally0;
			__catch0_g_key_file_error:
			{
				g_clear_error (&_data_->_inner_error0_);
			}
			__finally0:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				if (_data_->_inner_error0_->domain == FOLKS_PROPERTY_ERROR) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->protocol1);
					_g_object_unref0 (_data_->_protocol1_it);
					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_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
			_g_free0 (_data_->protocol1);
		}
		_g_object_unref0 (_data_->_protocol1_it);
	}
	_data_->_tmp15_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, FOLKS_TYPE_IM_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->new_im_addresses = _data_->_tmp15_;
	{
		_data_->_tmp16_ = gee_multi_map_get_keys (_data_->im_addresses);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_g_object_unref0 (_data_->_tmp17_);
		_data_->_protocol2_it = _data_->_tmp19_;
		while (TRUE) {
			_data_->_tmp20_ = _data_->_protocol2_it;
			if (!gee_iterator_next (_data_->_tmp20_)) {
				break;
			}
			_data_->_tmp21_ = _data_->_protocol2_it;
			_data_->_tmp22_ = gee_iterator_get (_data_->_tmp21_);
			_data_->protocol2 = (gchar*) _data_->_tmp22_;
			_data_->_tmp23_ = _data_->protocol2;
			_data_->_tmp24_ = gee_multi_map_get (_data_->im_addresses, _data_->_tmp23_);
			_data_->addresses = _data_->_tmp24_;
			_data_->_tmp25_ = folks_small_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
			_data_->normalised_addresses = _data_->_tmp25_;
			{
				_data_->_tmp26_ = _data_->addresses;
				_data_->_tmp27_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp26_);
				_data_->_im_fd_it = _data_->_tmp27_;
				while (TRUE) {
					_data_->_tmp28_ = _data_->_im_fd_it;
					if (!gee_iterator_next (_data_->_tmp28_)) {
						break;
					}
					_data_->_tmp29_ = _data_->_im_fd_it;
					_data_->_tmp30_ = gee_iterator_get (_data_->_tmp29_);
					_data_->im_fd = (FolksImFieldDetails*) _data_->_tmp30_;
					{
						_data_->_tmp32_ = _data_->im_fd;
						_data_->_tmp33_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp32_);
						_data_->_tmp34_ = _data_->_tmp33_;
						_data_->_tmp35_ = _data_->protocol2;
						_data_->_tmp36_ = folks_im_details_normalise_im_address ((const gchar*) _data_->_tmp34_, _data_->_tmp35_, &_data_->_inner_error0_);
						_data_->_tmp31_ = _data_->_tmp36_;
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							if (_data_->_inner_error0_->domain == FOLKS_IM_DETAILS_ERROR) {
								goto __catch1_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_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
							g_clear_error (&_data_->_inner_error0_);
							g_object_unref (_data_->_async_result);
							return FALSE;
						}
						_data_->_tmp37_ = _data_->_tmp31_;
						_data_->_tmp31_ = NULL;
						_g_free0 (_data_->normalised_address);
						_data_->normalised_address = _data_->_tmp37_;
						_g_free0 (_data_->_tmp31_);
					}
					goto __finally1;
					__catch1_folks_im_details_error:
					{
						_data_->e2 = _data_->_inner_error0_;
						_data_->_inner_error0_ = NULL;
						_data_->_tmp38_ = _data_->im_fd;
						_data_->_tmp39_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp38_);
						_data_->_tmp40_ = _data_->_tmp39_;
						_data_->_tmp41_ = _data_->protocol2;
						_data_->_tmp42_ = _data_->e2;
						_data_->_tmp43_ = _data_->_tmp42_->message;
						_data_->_tmp44_ = g_error_new (FOLKS_PROPERTY_ERROR, FOLKS_PROPERTY_ERROR_INVALID_VALUE, _ ("Invalid IM address ‘%s’ for protocol ‘%s’: %s"), (const gchar*) _data_->_tmp40_, _data_->_tmp41_, _data_->_tmp43_);
						_data_->_inner_error0_ = _data_->_tmp44_;
						_g_error_free0 (_data_->e2);
						goto __finally1;
					}
					__finally1:
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						if (_data_->_inner_error0_->domain == FOLKS_PROPERTY_ERROR) {
							g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
							_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_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_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
							g_clear_error (&_data_->_inner_error0_);
							g_object_unref (_data_->_async_result);
							return FALSE;
						}
					}
					_data_->_tmp45_ = _data_->normalised_addresses;
					_data_->_tmp46_ = _data_->normalised_address;
					gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp45_, _data_->_tmp46_);
					_data_->_tmp47_ = _data_->normalised_address;
					_data_->_tmp48_ = folks_im_field_details_new (_data_->_tmp47_, NULL);
					_data_->new_im_fd = _data_->_tmp48_;
					_data_->_tmp49_ = _data_->new_im_addresses;
					_data_->_tmp50_ = _data_->protocol2;
					_data_->_tmp51_ = _data_->new_im_fd;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp49_, _data_->_tmp50_, _data_->_tmp51_);
					_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_->_tmp52_ = _data_->normalised_addresses;
			_data_->_tmp53_ = 0;
			_data_->_tmp54_ = gee_collection_to_array ((GeeCollection*) _data_->_tmp52_, &_data_->_tmp53_);
			_data_->addrs = (gchar**) _data_->_tmp54_;
			_data_->addrs_length1 = (_data_->_tmp53_ * sizeof (gchar*)) / sizeof (gchar*);
			_data_->_addrs_size_ = _data_->addrs_length1;
			_data_->_tmp55_ = _data_->normalised_addresses;
			_data_->_tmp56_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp55_);
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->addrs_length1 = _data_->_tmp57_;
			_data_->_tmp58_ = _data_->key_file;
			_data_->_tmp59_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
			_data_->_tmp60_ = _data_->_tmp59_;
			_data_->_tmp61_ = _data_->protocol2;
			_data_->_tmp62_ = _data_->addrs;
			_data_->_tmp62__length1 = _data_->addrs_length1;
			g_key_file_set_string_list (_data_->_tmp58_, _data_->_tmp60_, _data_->_tmp61_, (const gchar* const*) _data_->_tmp62_, (gint) _data_->_tmp62__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_->_tmp63_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp64_ = _data_->_tmp63_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp64_, 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_->_tmp64_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp65_ = _data_->new_im_addresses;
	_data_->_tmp66_ = _g_object_ref0 (_data_->_tmp65_);
	_g_object_unref0 (_data_->self->priv->_im_addresses);
	_data_->self->priv->_im_addresses = _data_->_tmp66_;
	g_object_notify ((GObject*) _data_->self, "im-addresses");
	_g_object_unref0 (_data_->new_im_addresses);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	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_;
	g_return_if_fail (web_service_addresses != NULL);
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeWebServiceAddressesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_web_service_addresses_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (web_service_addresses);
	_g_object_unref0 (_data_->web_service_addresses);
	_data_->web_service_addresses = _tmp1_;
	folks_backends_kf_persona_real_change_web_service_addresses_co (_data_);
}

static void
folks_backends_kf_persona_change_web_service_addresses_finish (FolksWebServiceDetails* base,
                                                               GAsyncResult* _res_,
                                                               GError** error)
{
	FolksBackendsKfPersonaChangeWebServiceAddressesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * {@inheritDoc}
   *
   * @since 0.6.2
   */
static void
_vala_array_add2 (gchar** * array,
                  gint* length,
                  gint* 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_ = 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_ = gee_multi_map_get_keys ((GeeMultiMap*) _data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_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;
			if (!gee_iterator_next (_data_->_tmp8_)) {
				break;
			}
			_data_->_tmp9_ = _data_->_web_service1_it;
			_data_->_tmp10_ = gee_iterator_get (_data_->_tmp9_);
			_data_->web_service1 = (gchar*) _data_->_tmp10_;
			{
				_data_->_tmp11_ = _data_->key_file;
				_data_->_tmp12_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
				_data_->_tmp13_ = _data_->_tmp12_;
				_data_->_tmp14_ = _data_->web_service1;
				_data_->_tmp15_ = g_strconcat ("web-service.", _data_->_tmp14_, NULL);
				_data_->_tmp16_ = _data_->_tmp15_;
				g_key_file_remove_key (_data_->_tmp11_, _data_->_tmp13_, _data_->_tmp16_, &_data_->_inner_error0_);
				_g_free0 (_data_->_tmp16_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					if (_data_->_inner_error0_->domain == G_KEY_FILE_ERROR) {
						goto __catch0_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_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
			goto __finally0;
			__catch0_g_key_file_error:
			{
				g_clear_error (&_data_->_inner_error0_);
			}
			__finally0:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				if (_data_->_inner_error0_->domain == FOLKS_PROPERTY_ERROR) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->web_service1);
					_g_object_unref0 (_data_->_web_service1_it);
					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_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
			_g_free0 (_data_->web_service1);
		}
		_g_object_unref0 (_data_->_web_service1_it);
	}
	_data_->_tmp17_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, FOLKS_TYPE_WEB_SERVICE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->new_web_service_addresses = _data_->_tmp17_;
	{
		_data_->_tmp18_ = gee_multi_map_get_keys (_data_->web_service_addresses);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_g_object_unref0 (_data_->_tmp19_);
		_data_->_web_service2_it = _data_->_tmp21_;
		while (TRUE) {
			_data_->_tmp22_ = _data_->_web_service2_it;
			if (!gee_iterator_next (_data_->_tmp22_)) {
				break;
			}
			_data_->_tmp23_ = _data_->_web_service2_it;
			_data_->_tmp24_ = gee_iterator_get (_data_->_tmp23_);
			_data_->web_service2 = (gchar*) _data_->_tmp24_;
			_data_->_tmp25_ = _data_->web_service2;
			_data_->_tmp26_ = gee_multi_map_get (_data_->web_service_addresses, _data_->_tmp25_);
			_data_->ws_fds = _data_->_tmp26_;
			_data_->_tmp27_ = g_new0 (gchar*, 0 + 1);
			_data_->addrs = _data_->_tmp27_;
			_data_->addrs_length1 = 0;
			_data_->_addrs_size_ = _data_->addrs_length1;
			{
				_data_->_tmp28_ = _data_->ws_fds;
				_data_->_tmp29_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp28_);
				_data_->_ws_fd1_it = _data_->_tmp29_;
				while (TRUE) {
					_data_->_tmp30_ = _data_->_ws_fd1_it;
					if (!gee_iterator_next (_data_->_tmp30_)) {
						break;
					}
					_data_->_tmp31_ = _data_->_ws_fd1_it;
					_data_->_tmp32_ = gee_iterator_get (_data_->_tmp31_);
					_data_->ws_fd1 = (FolksWebServiceFieldDetails*) _data_->_tmp32_;
					_data_->_tmp33_ = _data_->ws_fd1;
					_data_->_tmp34_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp33_);
					_data_->_tmp35_ = _data_->_tmp34_;
					_data_->_tmp36_ = g_strdup ((const gchar*) _data_->_tmp35_);
					_vala_array_add2 (&_data_->addrs, &_data_->addrs_length1, &_data_->_addrs_size_, _data_->_tmp36_);
					_g_object_unref0 (_data_->ws_fd1);
				}
				_g_object_unref0 (_data_->_ws_fd1_it);
			}
			_data_->_tmp37_ = _data_->key_file;
			_data_->_tmp38_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
			_data_->_tmp39_ = _data_->_tmp38_;
			_data_->_tmp40_ = _data_->web_service2;
			_data_->_tmp41_ = g_strconcat ("web-service.", _data_->_tmp40_, NULL);
			_data_->_tmp42_ = _data_->_tmp41_;
			_data_->_tmp43_ = _data_->addrs;
			_data_->_tmp43__length1 = _data_->addrs_length1;
			g_key_file_set_string_list (_data_->_tmp37_, _data_->_tmp39_, _data_->_tmp42_, (const gchar* const*) _data_->_tmp43_, (gint) _data_->_tmp43__length1);
			_g_free0 (_data_->_tmp42_);
			{
				_data_->_tmp44_ = _data_->ws_fds;
				_data_->_tmp45_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp44_);
				_data_->_ws_fd2_it = _data_->_tmp45_;
				while (TRUE) {
					_data_->_tmp46_ = _data_->_ws_fd2_it;
					if (!gee_iterator_next (_data_->_tmp46_)) {
						break;
					}
					_data_->_tmp47_ = _data_->_ws_fd2_it;
					_data_->_tmp48_ = gee_iterator_get (_data_->_tmp47_);
					_data_->ws_fd2 = (FolksWebServiceFieldDetails*) _data_->_tmp48_;
					_data_->_tmp49_ = _data_->new_web_service_addresses;
					_data_->_tmp50_ = _data_->web_service2;
					_data_->_tmp51_ = _data_->ws_fd2;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp49_, _data_->_tmp50_, _data_->_tmp51_);
					_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_->_tmp52_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp53_ = _data_->_tmp52_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp53_, 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_->_tmp53_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp54_ = _data_->new_web_service_addresses;
	_data_->_tmp55_ = _g_object_ref0 (_data_->_tmp54_);
	_g_object_unref0 (_data_->self->priv->_web_service_addresses);
	_data_->self->priv->_web_service_addresses = _data_->_tmp55_;
	g_object_notify ((GObject*) _data_->self, "web-service-addresses");
	_g_object_unref0 (_data_->new_web_service_addresses);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	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_;
	g_return_if_fail (anti_links != NULL);
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeAntiLinksData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_anti_links_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (anti_links);
	_g_object_unref0 (_data_->anti_links);
	_data_->anti_links = _tmp1_;
	folks_backends_kf_persona_real_change_anti_links_co (_data_);
}

static void
folks_backends_kf_persona_change_anti_links_finish (FolksAntiLinkable* base,
                                                    GAsyncResult* _res_,
                                                    GError** error)
{
	FolksBackendsKfPersonaChangeAntiLinksData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * {@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_ = folks_anti_linkable_get_anti_links ((FolksAntiLinkable*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (folks_internal_equal_sets (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _data_->anti_links, _data_->_tmp1_)) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	_data_->key_file = _data_->_tmp4_;
	_data_->_tmp5_ = folks_persona_get_uid ((FolksPersona*) _data_->self);
	_data_->_tmp6_ = _data_->_tmp5_;
	gee_collection_remove ((GeeCollection*) _data_->anti_links, _data_->_tmp6_);
	_data_->_tmp7_ = _data_->key_file;
	_data_->_tmp8_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = 0;
	_data_->_tmp11_ = gee_collection_to_array ((GeeCollection*) _data_->anti_links, &_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp12__length1 = _data_->_tmp10_;
	g_key_file_set_string_list (_data_->_tmp7_, _data_->_tmp9_, FOLKS_BACKENDS_KF_PERSONA_STORE_anti_links_key_name, (const gchar* const*) _data_->_tmp12_, (gint) _data_->_tmp10_);
	_data_->_tmp12_ = (_vala_array_free (_data_->_tmp12_, _data_->_tmp12__length1, (GDestroyNotify) g_free), NULL);
	_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_anti_links_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_->self->priv->_anti_links;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _data_->_tmp15_);
	_data_->_tmp16_ = _data_->self->priv->_anti_links;
	gee_collection_add_all ((GeeCollection*) _data_->_tmp16_, (GeeCollection*) _data_->anti_links);
	g_object_notify ((GObject*) _data_->self, "anti-links");
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
folks_backends_kf_persona_real_change_local_ids_data_free (gpointer _data)
{
	FolksBackendsKfPersonaChangeLocalIdsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->local_ids);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendsKfPersonaChangeLocalIdsData, _data_);
}

static void
folks_backends_kf_persona_real_change_local_ids (FolksLocalIdDetails* base,
                                                 GeeSet* local_ids,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	FolksBackendsKfPersona * self;
	FolksBackendsKfPersonaChangeLocalIdsData* _data_;
	FolksBackendsKfPersona* _tmp0_;
	GeeSet* _tmp1_;
	g_return_if_fail (local_ids != NULL);
	self = (FolksBackendsKfPersona*) base;
	_data_ = g_slice_new0 (FolksBackendsKfPersonaChangeLocalIdsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, folks_backends_kf_persona_real_change_local_ids_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (local_ids);
	_g_object_unref0 (_data_->local_ids);
	_data_->local_ids = _tmp1_;
	folks_backends_kf_persona_real_change_local_ids_co (_data_);
}

static void
folks_backends_kf_persona_change_local_ids_finish (FolksLocalIdDetails* base,
                                                   GAsyncResult* _res_,
                                                   GError** error)
{
	FolksBackendsKfPersonaChangeLocalIdsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * {@inheritDoc}
   *
   * @since 0.14.0
   */
static void
folks_backends_kf_persona_change_local_ids_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	FolksBackendsKfPersonaChangeLocalIdsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_backends_kf_persona_real_change_local_ids_co (_data_);
}

static gboolean
folks_backends_kf_persona_real_change_local_ids_co (FolksBackendsKfPersonaChangeLocalIdsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_local_ids;
	if (folks_internal_equal_sets (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _data_->local_ids, (GeeSet*) _data_->_tmp0_)) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	_data_->key_file = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->key_file;
	_data_->_tmp5_ = folks_persona_get_display_id ((FolksPersona*) _data_->self);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = 0;
	_data_->_tmp8_ = gee_collection_to_array ((GeeCollection*) _data_->local_ids, &_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp9__length1 = _data_->_tmp7_;
	g_key_file_set_string_list (_data_->_tmp4_, _data_->_tmp6_, "__local-ids", (const gchar* const*) _data_->_tmp9_, (gint) _data_->_tmp7_);
	_data_->_tmp9_ = (_vala_array_free (_data_->_tmp9_, _data_->_tmp9__length1, (GDestroyNotify) g_free), NULL);
	_data_->_tmp10_ = folks_persona_get_store ((FolksPersona*) _data_->self);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_state_ = 1;
	folks_backends_kf_persona_store_save_key_file (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), folks_backends_kf_persona_change_local_ids_ready, _data_);
	return FALSE;
	_state_1:
	folks_backends_kf_persona_store_save_key_file_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore), _data_->_res_);
	_data_->_tmp12_ = _data_->self->priv->_local_ids;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _data_->_tmp12_);
	_data_->_tmp13_ = _data_->self->priv->_local_ids;
	gee_collection_add_all ((GeeCollection*) _data_->_tmp13_, (GeeCollection*) _data_->local_ids);
	g_object_notify ((GObject*) _data_->self, "local-ids");
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	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;
	gchar* iid = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* uid = NULL;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (store != NULL, NULL);
	_tmp0_ = folks_persona_store_get_id (store);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat (_tmp1_, ":", NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat (_tmp3_, id, NULL);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	iid = _tmp5_;
	_tmp6_ = folks_persona_store_get_id (store);
	_tmp7_ = _tmp6_;
	_tmp8_ = folks_persona_build_uid ("key-file", _tmp7_, id);
	uid = _tmp8_;
	self = (FolksBackendsKfPersona*) g_object_new (object_type, "display-id", id, "iid", iid, "uid", uid, "store", store, "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,
                                                           gpointer callback_target)
{
	FolksBackendsKfPersona * self;
	self = (FolksBackendsKfPersona*) base;
	g_return_if_fail (prop_name != NULL);
	if (g_strcmp0 (prop_name, "im-addresses") == 0) {
		GeeMapIterator* iter = NULL;
		GeeHashMultiMap* _tmp0_;
		GeeMapIterator* _tmp1_;
		_tmp0_ = self->priv->_im_addresses;
		_tmp1_ = gee_multi_map_map_iterator ((GeeMultiMap*) _tmp0_);
		iter = _tmp1_;
		while (TRUE) {
			GeeMapIterator* _tmp2_;
			GeeMapIterator* _tmp3_;
			gpointer _tmp4_;
			gchar* _tmp5_;
			gchar* _tmp6_;
			gchar* _tmp7_;
			GeeMapIterator* _tmp8_;
			gpointer _tmp9_;
			FolksImFieldDetails* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp2_ = iter;
			if (!gee_map_iterator_next (_tmp2_)) {
				break;
			}
			_tmp3_ = iter;
			_tmp4_ = gee_map_iterator_get_key (_tmp3_);
			_tmp5_ = (gchar*) _tmp4_;
			_tmp6_ = g_strconcat (_tmp5_, ":", NULL);
			_tmp7_ = _tmp6_;
			_tmp8_ = iter;
			_tmp9_ = gee_map_iterator_get_value (_tmp8_);
			_tmp10_ = (FolksImFieldDetails*) _tmp9_;
			_tmp11_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = g_strconcat (_tmp7_, (const gchar*) _tmp12_, NULL);
			_tmp14_ = _tmp13_;
			callback (_tmp14_, callback_target);
			_g_free0 (_tmp14_);
			_g_object_unref0 (_tmp10_);
			_g_free0 (_tmp7_);
			_g_free0 (_tmp5_);
		}
		_g_object_unref0 (iter);
	} else {
		if (g_strcmp0 (prop_name, "local-ids") == 0) {
			FolksSmallSet* _tmp15_;
			_tmp15_ = self->priv->_local_ids;
			if (_tmp15_ != NULL) {
				{
					FolksSmallSet* _id_list = NULL;
					FolksSmallSet* _tmp16_;
					gint _id_size = 0;
					FolksSmallSet* _tmp17_;
					gint _tmp18_;
					gint _tmp19_;
					gint _id_index = 0;
					_tmp16_ = self->priv->_local_ids;
					_id_list = _tmp16_;
					_tmp17_ = _id_list;
					_tmp18_ = gee_collection_get_size ((GeeCollection*) _tmp17_);
					_tmp19_ = _tmp18_;
					_id_size = _tmp19_;
					_id_index = -1;
					while (TRUE) {
						gint _tmp20_;
						gint _tmp21_;
						gchar* id = NULL;
						FolksSmallSet* _tmp22_;
						gconstpointer _tmp23_;
						gchar* _tmp24_;
						const gchar* _tmp25_;
						_id_index = _id_index + 1;
						_tmp20_ = _id_index;
						_tmp21_ = _id_size;
						if (!(_tmp20_ < _tmp21_)) {
							break;
						}
						_tmp22_ = _id_list;
						_tmp23_ = folks_small_set_get (_tmp22_, _id_index);
						_tmp24_ = g_strdup ((const gchar*) _tmp23_);
						id = _tmp24_;
						_tmp25_ = id;
						callback (_tmp25_, callback_target);
						_g_free0 (id);
					}
				}
			}
		} else {
			if (g_strcmp0 (prop_name, "web-service-addresses") == 0) {
				GeeMapIterator* iter = NULL;
				GeeMultiMap* _tmp26_;
				GeeMultiMap* _tmp27_;
				GeeMapIterator* _tmp28_;
				_tmp26_ = folks_web_service_details_get_web_service_addresses ((FolksWebServiceDetails*) self);
				_tmp27_ = _tmp26_;
				_tmp28_ = gee_multi_map_map_iterator (_tmp27_);
				iter = _tmp28_;
				while (TRUE) {
					GeeMapIterator* _tmp29_;
					GeeMapIterator* _tmp30_;
					gpointer _tmp31_;
					gchar* _tmp32_;
					gchar* _tmp33_;
					gchar* _tmp34_;
					GeeMapIterator* _tmp35_;
					gpointer _tmp36_;
					FolksWebServiceFieldDetails* _tmp37_;
					gconstpointer _tmp38_;
					gconstpointer _tmp39_;
					gchar* _tmp40_;
					gchar* _tmp41_;
					_tmp29_ = iter;
					if (!gee_map_iterator_next (_tmp29_)) {
						break;
					}
					_tmp30_ = iter;
					_tmp31_ = gee_map_iterator_get_key (_tmp30_);
					_tmp32_ = (gchar*) _tmp31_;
					_tmp33_ = g_strconcat (_tmp32_, ":", NULL);
					_tmp34_ = _tmp33_;
					_tmp35_ = iter;
					_tmp36_ = gee_map_iterator_get_value (_tmp35_);
					_tmp37_ = (FolksWebServiceFieldDetails*) _tmp36_;
					_tmp38_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp37_);
					_tmp39_ = _tmp38_;
					_tmp40_ = g_strconcat (_tmp34_, (const gchar*) _tmp39_, NULL);
					_tmp41_ = _tmp40_;
					callback (_tmp41_, callback_target);
					_g_free0 (_tmp41_);
					_g_object_unref0 (_tmp37_);
					_g_free0 (_tmp34_);
					_g_free0 (_tmp32_);
				}
				_g_object_unref0 (iter);
			} else {
				FOLKS_PERSONA_CLASS (folks_backends_kf_persona_parent_class)->linkable_property_to_links (G_TYPE_CHECK_INSTANCE_CAST (self, FOLKS_TYPE_PERSONA, FolksPersona), prop_name, callback, callback_target);
			}
		}
	}
}

static gchar**
folks_backends_kf_persona_real_get_linkable_properties (FolksPersona* base,
                                                        gint* 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,
                                                         gint* 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;
	self = (FolksBackendsKfPersona*) base;
	folks_alias_details_change_alias ((FolksAliasDetails*) self, value, 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;
	self = (FolksBackendsKfPersona*) base;
	folks_im_details_change_im_addresses ((FolksImDetails*) self, value, 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;
	self = (FolksBackendsKfPersona*) base;
	folks_web_service_details_change_web_service_addresses ((FolksWebServiceDetails*) self, value, 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;
	self = (FolksBackendsKfPersona*) base;
	folks_anti_linkable_change_anti_links ((FolksAntiLinkable*) self, value, NULL, NULL);
}

static GeeSet*
folks_backends_kf_persona_real_get_local_ids (FolksLocalIdDetails* base)
{
	GeeSet* result;
	FolksBackendsKfPersona* self;
	FolksSmallSet* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GeeSet* _tmp6_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_local_ids;
	_tmp1_ = folks_persona_get_iid ((FolksPersona*) self);
	_tmp2_ = _tmp1_;
	if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp0_, _tmp2_) == FALSE) {
		FolksSmallSet* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = self->priv->_local_ids;
		_tmp4_ = folks_persona_get_iid ((FolksPersona*) self);
		_tmp5_ = _tmp4_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp5_);
	}
	_tmp6_ = self->priv->_local_ids_ro;
	result = _tmp6_;
	return result;
}

static void
folks_backends_kf_persona_real_set_local_ids (FolksLocalIdDetails* base,
                                              GeeSet* value)
{
	FolksBackendsKfPersona* self;
	self = (FolksBackendsKfPersona*) base;
	folks_local_id_details_change_local_ids ((FolksLocalIdDetails*) self, value, NULL, NULL);
}

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_;
	FolksSmallSet* _tmp8_;
	FolksSmallSet* _tmp9_;
	GeeSet* _tmp10_;
	GeeSet* _tmp11_;
	FolksSmallSet* _tmp12_;
	FolksSmallSet* _tmp13_;
	GeeSet* _tmp14_;
	GeeSet* _tmp15_;
	GKeyFile* key_file = NULL;
	FolksPersonaStore* _tmp16_;
	FolksPersonaStore* _tmp17_;
	GKeyFile* _tmp18_;
	GError* _inner_error0_ = 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:381: Adding key-file Persona '%s' (IID '%s', group '%s" \
"')", _tmp1_, _tmp3_, _tmp5_);
	_tmp6_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, FOLKS_TYPE_IM_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_g_object_unref0 (self->priv->_im_addresses);
	self->priv->_im_addresses = _tmp6_;
	_tmp7_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, FOLKS_TYPE_WEB_SERVICE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_g_object_unref0 (self->priv->_web_service_addresses);
	self->priv->_web_service_addresses = _tmp7_;
	_tmp8_ = folks_small_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, 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_small_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_local_ids);
	self->priv->_local_ids = _tmp12_;
	_tmp13_ = self->priv->_local_ids;
	_tmp14_ = gee_abstract_set_get_read_only_view ((GeeAbstractSet*) _tmp13_);
	_tmp15_ = _tmp14_;
	_g_object_unref0 (self->priv->_local_ids_ro);
	self->priv->_local_ids_ro = _tmp15_;
	_tmp16_ = folks_persona_get_store ((FolksPersona*) self);
	_tmp17_ = _tmp16_;
	_tmp18_ = folks_backends_kf_persona_store_get_key_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore));
	key_file = _tmp18_;
	{
		gchar** keys = NULL;
		GKeyFile* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		gsize _tmp22_ = 0;
		gchar** _tmp23_;
		gint keys_length1;
		gint _keys_size_;
		gchar** _tmp24_;
		gint _tmp24__length1;
		_tmp19_ = key_file;
		_tmp20_ = folks_persona_get_display_id ((FolksPersona*) self);
		_tmp21_ = _tmp20_;
		_tmp23_ = g_key_file_get_keys (_tmp19_, _tmp21_, &_tmp22_, &_inner_error0_);
		keys = _tmp23_;
		keys_length1 = _tmp22_;
		_keys_size_ = keys_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
				goto __catch0_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
		}
		_tmp24_ = keys;
		_tmp24__length1 = keys_length1;
		{
			gchar** key_collection = NULL;
			gint key_collection_length1 = 0;
			gint _key_collection_size_ = 0;
			gint key_it = 0;
			key_collection = _tmp24_;
			key_collection_length1 = _tmp24__length1;
			for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) {
				const gchar* key = NULL;
				key = key_collection[key_it];
				{
					const gchar* _tmp25_;
					const gchar* _tmp36_;
					const gchar* _tmp49_;
					gchar** decomposed_key = NULL;
					const gchar* _tmp63_;
					gchar** _tmp64_;
					gchar** _tmp65_;
					gint decomposed_key_length1;
					gint _decomposed_key_size_;
					gboolean _tmp66_ = FALSE;
					gchar** _tmp67_;
					gint _tmp67__length1;
					const gchar* protocol = NULL;
					const gchar* _tmp85_;
					gchar** im_addresses = NULL;
					GKeyFile* _tmp86_;
					const gchar* _tmp87_;
					const gchar* _tmp88_;
					const gchar* _tmp89_;
					gsize _tmp90_ = 0;
					gchar** _tmp91_;
					gint im_addresses_length1;
					gint _im_addresses_size_;
					gchar** _tmp92_;
					gint _tmp92__length1;
					_tmp25_ = key;
					if (g_strcmp0 (_tmp25_, "__alias") == 0) {
						gchar* _tmp26_ = NULL;
						GKeyFile* _tmp27_;
						const gchar* _tmp28_;
						const gchar* _tmp29_;
						const gchar* _tmp30_;
						gchar* _tmp31_;
						gchar* _tmp32_;
						const gchar* _tmp33_;
						const gchar* _tmp35_;
						_tmp27_ = key_file;
						_tmp28_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp29_ = _tmp28_;
						_tmp30_ = key;
						_tmp31_ = g_key_file_get_string (_tmp27_, _tmp29_, _tmp30_, &_inner_error0_);
						_tmp26_ = _tmp31_;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
								goto __catch0_g_key_file_error;
							}
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
						}
						_tmp32_ = _tmp26_;
						_tmp26_ = NULL;
						_g_free0 (self->priv->_alias);
						self->priv->_alias = _tmp32_;
						_tmp33_ = self->priv->_alias;
						if (_tmp33_ == NULL) {
							gchar* _tmp34_;
							_tmp34_ = g_strdup ("");
							_g_free0 (self->priv->_alias);
							self->priv->_alias = _tmp34_;
						}
						_tmp35_ = self->priv->_alias;
						g_debug ("kf-persona.vala:414:     Loaded alias '%s'.", _tmp35_);
						_g_free0 (_tmp26_);
						continue;
					}
					_tmp36_ = key;
					if (g_strcmp0 (_tmp36_, FOLKS_BACKENDS_KF_PERSONA_STORE_anti_links_key_name) == 0) {
						gchar** anti_link_array = NULL;
						GKeyFile* _tmp37_;
						const gchar* _tmp38_;
						const gchar* _tmp39_;
						const gchar* _tmp40_;
						gsize _tmp41_ = 0;
						gchar** _tmp42_;
						gint anti_link_array_length1;
						gint _anti_link_array_size_;
						gchar** _tmp43_;
						gint _tmp43__length1;
						_tmp37_ = key_file;
						_tmp38_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp39_ = _tmp38_;
						_tmp40_ = key;
						_tmp42_ = g_key_file_get_string_list (_tmp37_, _tmp39_, _tmp40_, &_tmp41_, &_inner_error0_);
						anti_link_array = _tmp42_;
						anti_link_array_length1 = _tmp41_;
						_anti_link_array_size_ = anti_link_array_length1;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
								goto __catch0_g_key_file_error;
							}
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
						}
						_tmp43_ = anti_link_array;
						_tmp43__length1 = anti_link_array_length1;
						if (_tmp43_ != NULL) {
							gchar** _tmp44_;
							gint _tmp44__length1;
							gchar** _tmp48_;
							gint _tmp48__length1;
							_tmp44_ = anti_link_array;
							_tmp44__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 = _tmp44_;
								anti_link_collection_length1 = _tmp44__length1;
								for (anti_link_it = 0; anti_link_it < anti_link_collection_length1; anti_link_it = anti_link_it + 1) {
									gchar* _tmp45_;
									gchar* anti_link = NULL;
									_tmp45_ = g_strdup (anti_link_collection[anti_link_it]);
									anti_link = _tmp45_;
									{
										FolksSmallSet* _tmp46_;
										const gchar* _tmp47_;
										_tmp46_ = self->priv->_anti_links;
										_tmp47_ = anti_link;
										gee_abstract_collection_add ((GeeAbstractCollection*) _tmp46_, _tmp47_);
										_g_free0 (anti_link);
									}
								}
							}
							_tmp48_ = anti_link_array;
							_tmp48__length1 = anti_link_array_length1;
							g_debug ("kf-persona.vala:431:     Loaded %u anti-links.", (guint) _tmp48__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);
					}
					_tmp49_ = key;
					if (g_strcmp0 (_tmp49_, "__local_ids") == 0) {
						gchar** local_ids_array = NULL;
						GKeyFile* _tmp50_;
						const gchar* _tmp51_;
						const gchar* _tmp52_;
						const gchar* _tmp53_;
						gsize _tmp54_ = 0;
						gchar** _tmp55_;
						gint local_ids_array_length1;
						gint _local_ids_array_size_;
						gchar** _tmp56_;
						gint _tmp56__length1;
						_tmp50_ = key_file;
						_tmp51_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp52_ = _tmp51_;
						_tmp53_ = key;
						_tmp55_ = g_key_file_get_string_list (_tmp50_, _tmp52_, _tmp53_, &_tmp54_, &_inner_error0_);
						local_ids_array = _tmp55_;
						local_ids_array_length1 = _tmp54_;
						_local_ids_array_size_ = local_ids_array_length1;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
								goto __catch0_g_key_file_error;
							}
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
						}
						_tmp56_ = local_ids_array;
						_tmp56__length1 = local_ids_array_length1;
						if (_tmp56_ != NULL) {
							gchar** _tmp57_;
							gint _tmp57__length1;
							gchar** _tmp62_;
							gint _tmp62__length1;
							_tmp57_ = local_ids_array;
							_tmp57__length1 = local_ids_array_length1;
							{
								gchar** local_id_collection = NULL;
								gint local_id_collection_length1 = 0;
								gint _local_id_collection_size_ = 0;
								gint local_id_it = 0;
								local_id_collection = _tmp57_;
								local_id_collection_length1 = _tmp57__length1;
								for (local_id_it = 0; local_id_it < local_id_collection_length1; local_id_it = local_id_it + 1) {
									gchar* _tmp58_;
									gchar* local_id = NULL;
									_tmp58_ = g_strdup (local_id_collection[local_id_it]);
									local_id = _tmp58_;
									{
										GeeSet* _tmp59_;
										GeeSet* _tmp60_;
										const gchar* _tmp61_;
										_tmp59_ = folks_local_id_details_get_local_ids ((FolksLocalIdDetails*) self);
										_tmp60_ = _tmp59_;
										_tmp61_ = local_id;
										gee_collection_add ((GeeCollection*) _tmp60_, _tmp61_);
										_g_free0 (local_id);
									}
								}
							}
							_tmp62_ = local_ids_array;
							_tmp62__length1 = local_ids_array_length1;
							g_debug ("kf-persona.vala:449:     Loaded %u local_ids.", (guint) _tmp62__length1);
							local_ids_array = (_vala_array_free (local_ids_array, local_ids_array_length1, (GDestroyNotify) g_free), NULL);
							continue;
						}
						local_ids_array = (_vala_array_free (local_ids_array, local_ids_array_length1, (GDestroyNotify) g_free), NULL);
					}
					_tmp63_ = key;
					_tmp65_ = _tmp64_ = g_strsplit (_tmp63_, ".", 2);
					decomposed_key = _tmp65_;
					decomposed_key_length1 = _vala_array_length (_tmp64_);
					_decomposed_key_size_ = decomposed_key_length1;
					_tmp67_ = decomposed_key;
					_tmp67__length1 = decomposed_key_length1;
					if (_tmp67__length1 == 2) {
						gchar** _tmp68_;
						gint _tmp68__length1;
						const gchar* _tmp69_;
						_tmp68_ = decomposed_key;
						_tmp68__length1 = decomposed_key_length1;
						_tmp69_ = _tmp68_[0];
						_tmp66_ = g_strcmp0 (_tmp69_, "web-service") == 0;
					} else {
						_tmp66_ = FALSE;
					}
					if (_tmp66_) {
						const gchar* web_service = NULL;
						gchar** _tmp70_;
						gint _tmp70__length1;
						const gchar* _tmp71_;
						gchar** web_service_addresses = NULL;
						GKeyFile* _tmp72_;
						const gchar* _tmp73_;
						const gchar* _tmp74_;
						const gchar* _tmp75_;
						gsize _tmp76_ = 0;
						gchar** _tmp77_;
						gint web_service_addresses_length1;
						gint _web_service_addresses_size_;
						gchar** _tmp78_;
						gint _tmp78__length1;
						_tmp70_ = decomposed_key;
						_tmp70__length1 = decomposed_key_length1;
						_tmp71_ = _tmp70_[1];
						web_service = _tmp71_;
						_tmp72_ = key_file;
						_tmp73_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp74_ = _tmp73_;
						_tmp75_ = web_service;
						_tmp77_ = g_key_file_get_string_list (_tmp72_, _tmp74_, _tmp75_, &_tmp76_, &_inner_error0_);
						web_service_addresses = _tmp77_;
						web_service_addresses_length1 = _tmp76_;
						_web_service_addresses_size_ = web_service_addresses_length1;
						if (G_UNLIKELY (_inner_error0_ != 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_error0_->domain == G_KEY_FILE_ERROR) {
								goto __catch0_g_key_file_error;
							}
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
						}
						_tmp78_ = web_service_addresses;
						_tmp78__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 = _tmp78_;
							web_service_address_collection_length1 = _tmp78__length1;
							for (web_service_address_it = 0; web_service_address_it < web_service_address_collection_length1; web_service_address_it = web_service_address_it + 1) {
								gchar* _tmp79_;
								gchar* web_service_address = NULL;
								_tmp79_ = g_strdup (web_service_address_collection[web_service_address_it]);
								web_service_address = _tmp79_;
								{
									GeeHashMultiMap* _tmp80_;
									const gchar* _tmp81_;
									const gchar* _tmp82_;
									FolksWebServiceFieldDetails* _tmp83_;
									FolksWebServiceFieldDetails* _tmp84_;
									_tmp80_ = self->priv->_web_service_addresses;
									_tmp81_ = web_service;
									_tmp82_ = web_service_address;
									_tmp83_ = folks_web_service_field_details_new (_tmp82_, NULL);
									_tmp84_ = _tmp83_;
									gee_multi_map_set ((GeeMultiMap*) _tmp80_, _tmp81_, _tmp84_);
									_g_object_unref0 (_tmp84_);
									_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;
					}
					_tmp85_ = key;
					protocol = _tmp85_;
					_tmp86_ = key_file;
					_tmp87_ = folks_persona_get_display_id ((FolksPersona*) self);
					_tmp88_ = _tmp87_;
					_tmp89_ = protocol;
					_tmp91_ = g_key_file_get_string_list (_tmp86_, _tmp88_, _tmp89_, &_tmp90_, &_inner_error0_);
					im_addresses = _tmp91_;
					im_addresses_length1 = _tmp90_;
					_im_addresses_size_ = im_addresses_length1;
					if (G_UNLIKELY (_inner_error0_ != 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_error0_->domain == G_KEY_FILE_ERROR) {
							goto __catch0_g_key_file_error;
						}
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
					}
					_tmp92_ = im_addresses;
					_tmp92__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 = _tmp92_;
						im_address_collection_length1 = _tmp92__length1;
						for (im_address_it = 0; im_address_it < im_address_collection_length1; im_address_it = im_address_it + 1) {
							gchar* _tmp93_;
							gchar* im_address = NULL;
							_tmp93_ = g_strdup (im_address_collection[im_address_it]);
							im_address = _tmp93_;
							{
								gchar* address = NULL;
								FolksImFieldDetails* im_fd = NULL;
								const gchar* _tmp101_;
								FolksImFieldDetails* _tmp102_;
								GeeHashMultiMap* _tmp103_;
								const gchar* _tmp104_;
								FolksImFieldDetails* _tmp105_;
								{
									gchar* _tmp94_ = NULL;
									const gchar* _tmp95_;
									const gchar* _tmp96_;
									gchar* _tmp97_;
									gchar* _tmp98_;
									_tmp95_ = im_address;
									_tmp96_ = protocol;
									_tmp97_ = folks_im_details_normalise_im_address (_tmp95_, _tmp96_, &_inner_error0_);
									_tmp94_ = _tmp97_;
									if (G_UNLIKELY (_inner_error0_ != NULL)) {
										if (_inner_error0_->domain == FOLKS_IM_DETAILS_ERROR) {
											goto __catch1_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_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
										g_clear_error (&_inner_error0_);
									}
									_tmp98_ = _tmp94_;
									_tmp94_ = NULL;
									_g_free0 (address);
									address = _tmp98_;
									_g_free0 (_tmp94_);
								}
								goto __finally1;
								__catch1_folks_im_details_error:
								{
									GError* e = NULL;
									GError* _tmp99_;
									const gchar* _tmp100_;
									e = _inner_error0_;
									_inner_error0_ = NULL;
									_tmp99_ = e;
									_tmp100_ = _tmp99_->message;
									g_warning ("kf-persona.vala:490: %s", _tmp100_);
									_g_error_free0 (e);
									_g_free0 (address);
									_g_free0 (im_address);
									continue;
								}
								__finally1:
								if (G_UNLIKELY (_inner_error0_ != 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_error0_->domain == G_KEY_FILE_ERROR) {
										goto __catch0_g_key_file_error;
									}
									g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
									g_clear_error (&_inner_error0_);
								}
								_tmp101_ = address;
								_tmp102_ = folks_im_field_details_new (_tmp101_, NULL);
								im_fd = _tmp102_;
								_tmp103_ = self->priv->_im_addresses;
								_tmp104_ = protocol;
								_tmp105_ = im_fd;
								gee_multi_map_set ((GeeMultiMap*) _tmp103_, _tmp104_, _tmp105_);
								_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 __finally0;
	__catch0_g_key_file_error:
	{
		GError* e = NULL;
		GError* _tmp106_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp106_ = e;
		if (!g_error_matches (_tmp106_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
			GError* _tmp107_;
			const gchar* _tmp108_;
			_tmp107_ = e;
			_tmp108_ = _tmp107_->message;
			g_warning (_ ("Couldn’t load data from key file: %s"), _tmp108_);
		}
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
	}
	return obj;
}

static void
folks_backends_kf_persona_class_init (FolksBackendsKfPersonaClass * klass,
                                      gpointer klass_data)
{
	folks_backends_kf_persona_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FolksBackendsKfPersona_private_offset);
	((FolksPersonaClass *) klass)->linkable_property_to_links = (void (*) (FolksPersona*, const gchar*, FolksPersonaLinkablePropertyCallback, gpointer)) 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_PROPERTY, folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES_PROPERTY] = g_param_spec_boxed ("linkable-properties", "linkable-properties", "linkable-properties", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.6.0
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES_PROPERTY, folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES_PROPERTY] = g_param_spec_boxed ("writeable-properties", "writeable-properties", "writeable-properties", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.1.15
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_ALIAS_PROPERTY, folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_ALIAS_PROPERTY] = g_param_spec_string ("alias", "alias", "alias", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES_PROPERTY, folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES_PROPERTY] = g_param_spec_object ("im-addresses", "im-addresses", "im-addresses", GEE_TYPE_MULTI_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES_PROPERTY, folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES_PROPERTY] = g_param_spec_object ("web-service-addresses", "web-service-addresses", "web-service-addresses", GEE_TYPE_MULTI_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.7.3
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS_PROPERTY, folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS_PROPERTY] = g_param_spec_object ("anti-links", "anti-links", "anti-links", GEE_TYPE_SET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.14.0
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_LOCAL_IDS_PROPERTY, folks_backends_kf_persona_properties[FOLKS_BACKENDS_KF_PERSONA_LOCAL_IDS_PROPERTY] = g_param_spec_object ("local-ids", "local-ids", "local-ids", GEE_TYPE_SET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
}

static void
folks_backends_kf_persona_folks_alias_details_interface_init (FolksAliasDetailsIface * iface,
                                                              gpointer iface_data)
{
	folks_backends_kf_persona_folks_alias_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_alias = (void (*) (FolksAliasDetails*, const gchar*, GAsyncReadyCallback, gpointer)) folks_backends_kf_persona_real_change_alias;
	iface->change_alias_finish = (void (*) (FolksAliasDetails*, GAsyncResult*, GError**)) folks_backends_kf_persona_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,
                                                              gpointer iface_data)
{
	folks_backends_kf_persona_folks_anti_linkable_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_anti_links = (void (*) (FolksAntiLinkable*, GeeSet*, GAsyncReadyCallback, gpointer)) folks_backends_kf_persona_real_change_anti_links;
	iface->change_anti_links_finish = (void (*) (FolksAntiLinkable*, GAsyncResult*, GError**)) folks_backends_kf_persona_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,
                                                           gpointer iface_data)
{
	folks_backends_kf_persona_folks_im_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_im_addresses = (void (*) (FolksImDetails*, GeeMultiMap*, GAsyncReadyCallback, gpointer)) folks_backends_kf_persona_real_change_im_addresses;
	iface->change_im_addresses_finish = (void (*) (FolksImDetails*, GAsyncResult*, GError**)) folks_backends_kf_persona_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_local_id_details_interface_init (FolksLocalIdDetailsIface * iface,
                                                                 gpointer iface_data)
{
	folks_backends_kf_persona_folks_local_id_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_local_ids = (void (*) (FolksLocalIdDetails*, GeeSet*, GAsyncReadyCallback, gpointer)) folks_backends_kf_persona_real_change_local_ids;
	iface->change_local_ids_finish = (void (*) (FolksLocalIdDetails*, GAsyncResult*, GError**)) folks_backends_kf_persona_change_local_ids_finish;
	iface->get_local_ids = folks_backends_kf_persona_real_get_local_ids;
	iface->set_local_ids = folks_backends_kf_persona_real_set_local_ids;
}

static void
folks_backends_kf_persona_folks_web_service_details_interface_init (FolksWebServiceDetailsIface * iface,
                                                                    gpointer iface_data)
{
	folks_backends_kf_persona_folks_web_service_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_web_service_addresses = (void (*) (FolksWebServiceDetails*, GeeMultiMap*, GAsyncReadyCallback, gpointer)) folks_backends_kf_persona_real_change_web_service_addresses;
	iface->change_web_service_addresses_finish = (void (*) (FolksWebServiceDetails*, GAsyncResult*, GError**)) folks_backends_kf_persona_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,
                                         gpointer klass)
{
	gchar* _tmp0_;
	self->priv = folks_backends_kf_persona_get_instance_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_unref0 (self->priv->_local_ids);
	_g_object_unref0 (self->priv->_local_ids_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
 */
static GType
folks_backends_kf_persona_get_type_once (void)
{
	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_local_id_details_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_local_id_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_LOCAL_ID_DETAILS, &folks_local_id_details_info);
	g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_WEB_SERVICE_DETAILS, &folks_web_service_details_info);
	FolksBackendsKfPersona_private_offset = g_type_add_instance_private (folks_backends_kf_persona_type_id, sizeof (FolksBackendsKfPersonaPrivate));
	return folks_backends_kf_persona_type_id;
}

GType
folks_backends_kf_persona_get_type (void)
{
	static volatile gsize folks_backends_kf_persona_type_id__once = 0;
	if (g_once_init_enter (&folks_backends_kf_persona_type_id__once)) {
		GType folks_backends_kf_persona_type_id;
		folks_backends_kf_persona_type_id = folks_backends_kf_persona_get_type_once ();
		g_once_init_leave (&folks_backends_kf_persona_type_id__once, folks_backends_kf_persona_type_id);
	}
	return folks_backends_kf_persona_type_id__once;
}

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_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, folks_persona_get_linkable_properties ((FolksPersona*) self, &length));
		}
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, folks_persona_get_writeable_properties ((FolksPersona*) self, &length));
		}
		break;
		case FOLKS_BACKENDS_KF_PERSONA_ALIAS_PROPERTY:
		g_value_set_string (value, folks_alias_details_get_alias ((FolksAliasDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES_PROPERTY:
		g_value_set_object (value, folks_im_details_get_im_addresses ((FolksImDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES_PROPERTY:
		g_value_set_object (value, folks_web_service_details_get_web_service_addresses ((FolksWebServiceDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS_PROPERTY:
		g_value_set_object (value, folks_anti_linkable_get_anti_links ((FolksAntiLinkable*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_LOCAL_IDS_PROPERTY:
		g_value_set_object (value, folks_local_id_details_get_local_ids ((FolksLocalIdDetails*) 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_PROPERTY:
		folks_alias_details_set_alias ((FolksAliasDetails*) self, g_value_get_string (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES_PROPERTY:
		folks_im_details_set_im_addresses ((FolksImDetails*) self, g_value_get_object (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES_PROPERTY:
		folks_web_service_details_set_web_service_addresses ((FolksWebServiceDetails*) self, g_value_get_object (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_ANTI_LINKS_PROPERTY:
		folks_anti_linkable_set_anti_links ((FolksAntiLinkable*) self, g_value_get_object (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_LOCAL_IDS_PROPERTY:
		folks_local_id_details_set_local_ids ((FolksLocalIdDetails*) 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,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

