/* import-pidgin.c generated by valac 0.29.3.10-b87a, the Vala compiler
 * generated from import-pidgin.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <folks/folks.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <stdio.h>
#include <gee.h>


#define FOLKS_TYPE_IMPORTER (folks_importer_get_type ())
#define FOLKS_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_IMPORTER, FolksImporter))
#define FOLKS_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_IMPORTER, FolksImporterClass))
#define FOLKS_IS_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_IMPORTER))
#define FOLKS_IS_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_IMPORTER))
#define FOLKS_IMPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_IMPORTER, FolksImporterClass))

typedef struct _FolksImporter FolksImporter;
typedef struct _FolksImporterClass FolksImporterClass;
typedef struct _FolksImporterPrivate FolksImporterPrivate;

#define FOLKS_IMPORTERS_TYPE_PIDGIN (folks_importers_pidgin_get_type ())
#define FOLKS_IMPORTERS_PIDGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_IMPORTERS_TYPE_PIDGIN, FolksImportersPidgin))
#define FOLKS_IMPORTERS_PIDGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_IMPORTERS_TYPE_PIDGIN, FolksImportersPidginClass))
#define FOLKS_IMPORTERS_IS_PIDGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_IMPORTERS_TYPE_PIDGIN))
#define FOLKS_IMPORTERS_IS_PIDGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_IMPORTERS_TYPE_PIDGIN))
#define FOLKS_IMPORTERS_PIDGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_IMPORTERS_TYPE_PIDGIN, FolksImportersPidginClass))

typedef struct _FolksImportersPidgin FolksImportersPidgin;
typedef struct _FolksImportersPidginClass FolksImportersPidginClass;
typedef struct _FolksImportersPidginPrivate FolksImportersPidginPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _FolksImportersPidginImportData FolksImportersPidginImportData;
typedef struct _FolksImportersPidginParseBlistData FolksImportersPidginParseBlistData;
typedef struct _FolksImportersPidginParseGroupData FolksImportersPidginParseGroupData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _FolksImportersPidginParseContactData FolksImportersPidginParseContactData;

typedef enum  {
	FOLKS_IMPORT_ERROR_MALFORMED_INPUT
} FolksImportError;
#define FOLKS_IMPORT_ERROR folks_import_error_quark ()
struct _FolksImporter {
	GObject parent_instance;
	FolksImporterPrivate * priv;
};

struct _FolksImporterClass {
	GObjectClass parent_class;
	void (*import) (FolksImporter* self, FolksPersonaStore* destination_store, const gchar* source_filename, GAsyncReadyCallback _callback_, gpointer _user_data_);
	guint (*import_finish) (FolksImporter* self, GAsyncResult* _res_, GError** error);
};

struct _FolksImportersPidgin {
	FolksImporter parent_instance;
	FolksImportersPidginPrivate * priv;
};

struct _FolksImportersPidginClass {
	FolksImporterClass parent_class;
};

struct _FolksImportersPidginPrivate {
	FolksPersonaStore* destination_store;
	guint persona_count;
};

struct _FolksImportersPidginImportData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksImportersPidgin* self;
	FolksPersonaStore* destination_store;
	gchar* source_filename;
	guint result;
	FolksPersonaStore* _tmp0_;
	FolksPersonaStore* _tmp1_;
	gchar* filename;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	GFile* file;
	const gchar* _tmp11_;
	GFile* _tmp12_;
	GFile* _tmp13_;
	gboolean _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	GError* _tmp17_;
	GFileInfo* file_info;
	GFileInfo* _tmp18_;
	GFile* _tmp19_;
	GFileInfo* _tmp20_;
	GFileInfo* _tmp21_;
	GError* e;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	GError* _tmp24_;
	const gchar* _tmp25_;
	GError* _tmp26_;
	GFileInfo* _tmp27_;
	gboolean _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GError* _tmp31_;
	xmlDoc* xml_doc;
	const gchar* _tmp32_;
	xmlDoc* _tmp33_;
	xmlDoc* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	GError* _tmp37_;
	xmlNode* root_node;
	xmlDoc* _tmp38_;
	xmlNode* _tmp39_;
	gboolean _tmp40_;
	gboolean _tmp41_;
	xmlNode* _tmp42_;
	xmlNode* _tmp43_;
	const gchar* _tmp44_;
	xmlNode* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	xmlDoc* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	GError* _tmp51_;
	xmlNode* iter;
	xmlNode* _tmp52_;
	xmlNode* _tmp53_;
	gboolean _tmp54_;
	xmlNode* _tmp55_;
	xmlNode* _tmp56_;
	xmlNode* _tmp57_;
	gboolean _tmp58_;
	xmlNode* _tmp59_;
	xmlElementType _tmp60_;
	xmlNode* _tmp61_;
	const gchar* _tmp62_;
	xmlNode* _tmp63_;
	xmlDoc* _tmp64_;
	FILE* _tmp65_;
	guint _tmp66_;
	const gchar* _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	guint _tmp70_;
	const gchar* _tmp71_;
	guint _tmp72_;
	GError * _inner_error_;
};

struct _FolksImportersPidginParseBlistData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksImportersPidgin* self;
	xmlNode* blist_node;
	xmlNode* iter;
	xmlNode* _tmp0_;
	xmlNode* _tmp1_;
	gboolean _tmp2_;
	xmlNode* _tmp3_;
	xmlNode* _tmp4_;
	xmlNode* _tmp5_;
	gboolean _tmp6_;
	xmlNode* _tmp7_;
	xmlElementType _tmp8_;
	xmlNode* _tmp9_;
	const gchar* _tmp10_;
	xmlNode* _tmp11_;
};

struct _FolksImportersPidginParseGroupData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksImportersPidgin* self;
	xmlNode* group_node;
	gchar* group_name;
	xmlNode* _tmp0_;
	gchar* _tmp1_;
	xmlNode* iter;
	xmlNode* _tmp2_;
	xmlNode* _tmp3_;
	gboolean _tmp4_;
	xmlNode* _tmp5_;
	xmlNode* _tmp6_;
	xmlNode* _tmp7_;
	gboolean _tmp8_;
	xmlNode* _tmp9_;
	xmlElementType _tmp10_;
	xmlNode* _tmp11_;
	const gchar* _tmp12_;
	FolksPersona* persona;
	xmlNode* _tmp13_;
	FolksPersona* _tmp14_;
	gboolean _tmp15_;
	FolksPersona* _tmp16_;
	FolksPersona* _tmp17_;
	FolksGroupDetails* group_details;
	FolksPersona* _tmp18_;
	FolksGroupDetails* _tmp19_;
	FolksGroupDetails* _tmp20_;
	const gchar* _tmp21_;
	GError* e;
	FILE* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	FolksPersona* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GError* _tmp29_;
	const gchar* _tmp30_;
	GError * _inner_error_;
};

struct _FolksImportersPidginParseContactData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksImportersPidgin* self;
	xmlNode* contact_node;
	FolksPersona* result;
	gchar* alias;
	GeeHashMultiMap* im_addresses;
	GeeHashMultiMap* _tmp0_;
	gchar* im_address_string;
	gchar* _tmp1_;
	xmlNode* iter;
	xmlNode* _tmp2_;
	xmlNode* _tmp3_;
	gboolean _tmp4_;
	xmlNode* _tmp5_;
	xmlNode* _tmp6_;
	xmlNode* _tmp7_;
	gboolean _tmp8_;
	xmlNode* _tmp9_;
	xmlElementType _tmp10_;
	xmlNode* _tmp11_;
	const gchar* _tmp12_;
	gchar* blist_protocol;
	xmlNode* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* tp_protocol;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	const gchar* _tmp18_;
	xmlNode* subiter;
	xmlNode* _tmp19_;
	xmlNode* _tmp20_;
	gboolean _tmp21_;
	xmlNode* _tmp22_;
	xmlNode* _tmp23_;
	xmlNode* _tmp24_;
	xmlNode* _tmp25_;
	xmlElementType _tmp26_;
	xmlNode* _tmp27_;
	const gchar* _tmp28_;
	xmlNode* _tmp29_;
	gchar* _tmp30_;
	xmlNode* _tmp31_;
	const gchar* _tmp32_;
	gchar* im_address;
	xmlNode* _tmp33_;
	gchar* _tmp34_;
	GeeHashMultiMap* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	FolksImFieldDetails* _tmp38_;
	FolksImFieldDetails* _tmp39_;
	const gchar* _tmp40_;
	const gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gboolean _tmp45_;
	GeeHashMultiMap* _tmp46_;
	gint _tmp47_;
	gint _tmp48_;
	gboolean _tmp49_;
	gboolean _tmp50_;
	const gchar* _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	const gchar* _tmp58_;
	gchar* _tmp59_;
	gchar* _tmp60_;
	FILE* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	GHashTable* details;
	GHashFunc _tmp64_;
	GEqualFunc _tmp65_;
	GHashTable* _tmp66_;
	GValue im_addresses_value;
	GValue _tmp67_;
	GeeHashMultiMap* _tmp68_;
	GHashTable* _tmp69_;
	gchar* _tmp70_;
	GValue _tmp71_;
	GValue _tmp72_;
	GValue* _tmp73_;
	FolksPersona* persona;
	FolksPersona* _tmp74_;
	FolksPersonaStore* _tmp75_;
	GHashTable* _tmp76_;
	FolksPersona* _tmp77_;
	FolksPersona* _tmp78_;
	GError* e;
	FILE* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	const gchar* _tmp82_;
	GError* _tmp83_;
	const gchar* _tmp84_;
	gboolean _tmp85_;
	const gchar* _tmp86_;
	FolksPersona* _tmp87_;
	FolksPersona* _tmp88_;
	const gchar* _tmp89_;
	FILE* _tmp90_;
	const gchar* _tmp91_;
	FolksPersona* _tmp92_;
	const gchar* _tmp93_;
	const gchar* _tmp94_;
	const gchar* _tmp95_;
	const gchar* _tmp96_;
	guint _tmp97_;
	GError * _inner_error_;
};


static gpointer folks_importers_pidgin_parent_class = NULL;

GType folks_importer_get_type (void) G_GNUC_CONST;
GQuark folks_import_error_quark (void);
GType folks_importers_pidgin_get_type (void) G_GNUC_CONST;
#define FOLKS_IMPORTERS_PIDGIN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_IMPORTERS_TYPE_PIDGIN, FolksImportersPidginPrivate))
enum  {
	FOLKS_IMPORTERS_PIDGIN_DUMMY_PROPERTY
};
static void folks_importers_pidgin_real_import_data_free (gpointer _data);
static void folks_importers_pidgin_real_import (FolksImporter* base, FolksPersonaStore* destination_store, const gchar* source_filename, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean folks_importers_pidgin_real_import_co (FolksImportersPidginImportData* _data_);
static void folks_importers_pidgin_import_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_importers_pidgin_parse_blist (FolksImportersPidgin* self, xmlNode* blist_node, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void folks_importers_pidgin_parse_blist_finish (FolksImportersPidgin* self, GAsyncResult* _res_);
static void folks_importers_pidgin_parse_blist_data_free (gpointer _data);
static gboolean folks_importers_pidgin_parse_blist_co (FolksImportersPidginParseBlistData* _data_);
static void folks_importers_pidgin_parse_group (FolksImportersPidgin* self, xmlNode* group_node, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void folks_importers_pidgin_parse_group_finish (FolksImportersPidgin* self, GAsyncResult* _res_);
static void folks_importers_pidgin_parse_blist_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_importers_pidgin_parse_group_data_free (gpointer _data);
static gboolean folks_importers_pidgin_parse_group_co (FolksImportersPidginParseGroupData* _data_);
static void folks_importers_pidgin_parse_contact (FolksImportersPidgin* self, xmlNode* contact_node, GAsyncReadyCallback _callback_, gpointer _user_data_);
static FolksPersona* folks_importers_pidgin_parse_contact_finish (FolksImportersPidgin* self, GAsyncResult* _res_);
static void folks_importers_pidgin_parse_group_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_importers_pidgin_parse_contact_data_free (gpointer _data);
static gboolean folks_importers_pidgin_parse_contact_co (FolksImportersPidginParseContactData* _data_);
static gchar* folks_importers_pidgin_blist_protocol_to_tp_protocol (FolksImportersPidgin* self, const gchar* blist_protocol);
static void _g_free0_ (gpointer var);
static void _vala_GValue_free (GValue* self);
static void __vala_GValue_free0_ (gpointer var);
static GValue* _g_value_dup (GValue* self);
static void folks_importers_pidgin_parse_contact_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
FolksImportersPidgin* folks_importers_pidgin_new (void);
FolksImportersPidgin* folks_importers_pidgin_construct (GType object_type);
FolksImporter* folks_importer_construct (GType object_type);
static void folks_importers_pidgin_finalize (GObject* obj);


static void folks_importers_pidgin_real_import_data_free (gpointer _data) {
	FolksImportersPidginImportData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->destination_store);
	_g_free0 (_data_->source_filename);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksImportersPidginImportData, _data_);
}


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


static void folks_importers_pidgin_real_import (FolksImporter* base, FolksPersonaStore* destination_store, const gchar* source_filename, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksImportersPidgin * self;
	FolksImportersPidginImportData* _data_;
	FolksImportersPidgin* _tmp0_ = NULL;
	FolksPersonaStore* _tmp1_ = NULL;
	FolksPersonaStore* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	self = (FolksImportersPidgin*) base;
	_data_ = g_slice_new0 (FolksImportersPidginImportData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_importers_pidgin_real_import);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_importers_pidgin_real_import_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = destination_store;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->destination_store);
	_data_->destination_store = _tmp2_;
	_tmp3_ = source_filename;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (_data_->source_filename);
	_data_->source_filename = _tmp4_;
	folks_importers_pidgin_real_import_co (_data_);
}


static guint folks_importers_pidgin_real_import_finish (FolksImporter* base, GAsyncResult* _res_, GError** error) {
	guint result;
	FolksImportersPidginImportData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return 0U;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static gchar* string_strip (const gchar* self) {
	gchar* result = NULL;
	gchar* _result_ = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	g_strstrip (_tmp1_);
	result = _result_;
	return result;
}


static void folks_importers_pidgin_import_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksImportersPidginImportData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_importers_pidgin_real_import_co (_data_);
}


static gboolean folks_importers_pidgin_real_import_co (FolksImportersPidginImportData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->destination_store;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_g_object_unref0 (_data_->self->priv->destination_store);
	_data_->self->priv->destination_store = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->source_filename;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = g_strdup (_data_->_tmp2_);
	_data_->filename = _data_->_tmp3_;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->filename;
	if (_data_->_tmp5_ == NULL) {
		_data_->_tmp4_ = TRUE;
	} else {
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->filename;
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = string_strip (_data_->_tmp6_);
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp4_ = g_strcmp0 (_data_->_tmp8_, "") == 0;
		_g_free0 (_data_->_tmp8_);
	}
	if (_data_->_tmp4_) {
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = g_get_home_dir ();
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = g_build_filename (_data_->_tmp9_, ".purple", "blist.xml", NULL, NULL);
		_g_free0 (_data_->filename);
		_data_->filename = _data_->_tmp10_;
	}
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = _data_->filename;
	_data_->_tmp12_ = NULL;
	_data_->_tmp12_ = g_file_new_for_path (_data_->_tmp11_);
	_data_->file = _data_->_tmp12_;
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = _data_->file;
	_data_->_tmp14_ = FALSE;
	_data_->_tmp14_ = g_file_query_exists (_data_->_tmp13_, NULL);
	if (!_data_->_tmp14_) {
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _ ("File %s does not exist.");
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _data_->filename;
		_data_->_tmp17_ = NULL;
		_data_->_tmp17_ = g_error_new (FOLKS_IMPORT_ERROR, FOLKS_IMPORT_ERROR_MALFORMED_INPUT, _data_->_tmp15_, _data_->_tmp16_);
		_data_->_inner_error_ = _data_->_tmp17_;
		if (_data_->_inner_error_->domain == FOLKS_IMPORT_ERROR) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	{
		_data_->_tmp19_ = NULL;
		_data_->_tmp19_ = _data_->file;
		_data_->_state_ = 1;
		g_file_query_info_async (_data_->_tmp19_, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, folks_importers_pidgin_import_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = g_file_query_info_finish (_data_->_tmp19_, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp18_ = _data_->_tmp20_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch5_g_error;
		}
		_data_->_tmp21_ = NULL;
		_data_->_tmp21_ = _data_->_tmp18_;
		_data_->_tmp18_ = NULL;
		_g_object_unref0 (_data_->file_info);
		_data_->file_info = _data_->_tmp21_;
		_g_object_unref0 (_data_->_tmp18_);
	}
	goto __finally5;
	__catch5_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = _ ("Failed to get information about file %s: %s");
		_data_->_tmp23_ = NULL;
		_data_->_tmp23_ = _data_->filename;
		_data_->_tmp24_ = NULL;
		_data_->_tmp24_ = _data_->e;
		_data_->_tmp25_ = NULL;
		_data_->_tmp25_ = _data_->_tmp24_->message;
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = g_error_new (FOLKS_IMPORT_ERROR, FOLKS_IMPORT_ERROR_MALFORMED_INPUT, _data_->_tmp22_, _data_->_tmp23_, _data_->_tmp25_);
		_data_->_inner_error_ = _data_->_tmp26_;
		_g_error_free0 (_data_->e);
		goto __finally5;
	}
	__finally5:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		if (_data_->_inner_error_->domain == FOLKS_IMPORT_ERROR) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_data_->_tmp27_ = NULL;
	_data_->_tmp27_ = _data_->file_info;
	_data_->_tmp28_ = FALSE;
	_data_->_tmp28_ = g_file_info_get_attribute_boolean (_data_->_tmp27_, G_FILE_ATTRIBUTE_ACCESS_CAN_READ);
	if (!_data_->_tmp28_) {
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = _ ("File %s is not readable.");
		_data_->_tmp30_ = NULL;
		_data_->_tmp30_ = _data_->filename;
		_data_->_tmp31_ = NULL;
		_data_->_tmp31_ = g_error_new (FOLKS_IMPORT_ERROR, FOLKS_IMPORT_ERROR_MALFORMED_INPUT, _data_->_tmp29_, _data_->_tmp30_);
		_data_->_inner_error_ = _data_->_tmp31_;
		if (_data_->_inner_error_->domain == FOLKS_IMPORT_ERROR) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_data_->_tmp32_ = NULL;
	_data_->_tmp32_ = _data_->filename;
	_data_->_tmp33_ = NULL;
	_data_->_tmp33_ = xmlParseFile (_data_->_tmp32_);
	_data_->xml_doc = _data_->_tmp33_;
	_data_->_tmp34_ = NULL;
	_data_->_tmp34_ = _data_->xml_doc;
	if (_data_->_tmp34_ == NULL) {
		_data_->_tmp35_ = NULL;
		_data_->_tmp35_ = _ ("The Pidgin buddy list file '%s' could not be loaded.");
		_data_->_tmp36_ = NULL;
		_data_->_tmp36_ = _data_->filename;
		_data_->_tmp37_ = NULL;
		_data_->_tmp37_ = g_error_new (FOLKS_IMPORT_ERROR, FOLKS_IMPORT_ERROR_MALFORMED_INPUT, _data_->_tmp35_, _data_->_tmp36_);
		_data_->_inner_error_ = _data_->_tmp37_;
		if (_data_->_inner_error_->domain == FOLKS_IMPORT_ERROR) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_data_->_tmp38_ = NULL;
	_data_->_tmp38_ = _data_->xml_doc;
	_data_->_tmp39_ = NULL;
	_data_->_tmp39_ = xmlDocGetRootElement (_data_->_tmp38_);
	_data_->root_node = _data_->_tmp39_;
	_data_->_tmp42_ = NULL;
	_data_->_tmp42_ = _data_->root_node;
	if (_data_->_tmp42_ == NULL) {
		_data_->_tmp41_ = TRUE;
	} else {
		_data_->_tmp43_ = NULL;
		_data_->_tmp43_ = _data_->root_node;
		_data_->_tmp44_ = NULL;
		_data_->_tmp44_ = _data_->_tmp43_->name;
		_data_->_tmp41_ = g_strcmp0 (_data_->_tmp44_, "purple") != 0;
	}
	if (_data_->_tmp41_) {
		_data_->_tmp40_ = TRUE;
	} else {
		_data_->_tmp45_ = NULL;
		_data_->_tmp45_ = _data_->root_node;
		_data_->_tmp46_ = NULL;
		_data_->_tmp46_ = (gchar*) xmlGetProp (_data_->_tmp45_, (xmlChar*) "version");
		_data_->_tmp47_ = NULL;
		_data_->_tmp47_ = _data_->_tmp46_;
		_data_->_tmp40_ = g_strcmp0 (_data_->_tmp47_, "1.0") != 0;
		_g_free0 (_data_->_tmp47_);
	}
	if (_data_->_tmp40_) {
		_data_->_tmp48_ = NULL;
		_data_->_tmp48_ = _data_->xml_doc;
		xmlFreeDoc (_data_->_tmp48_);
		_data_->_tmp49_ = NULL;
		_data_->_tmp49_ = _ ("The Pidgin buddy list file ‘%s’ could not be loaded: the root element " \
"could not be found or was not recognized.");
		_data_->_tmp50_ = NULL;
		_data_->_tmp50_ = _data_->filename;
		_data_->_tmp51_ = NULL;
		_data_->_tmp51_ = g_error_new (FOLKS_IMPORT_ERROR, FOLKS_IMPORT_ERROR_MALFORMED_INPUT, _data_->_tmp49_, _data_->_tmp50_);
		_data_->_inner_error_ = _data_->_tmp51_;
		if (_data_->_inner_error_->domain == FOLKS_IMPORT_ERROR) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->file_info);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->filename);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	{
		_data_->_tmp52_ = NULL;
		_data_->_tmp52_ = _data_->root_node;
		_data_->_tmp53_ = NULL;
		_data_->_tmp53_ = _data_->_tmp52_->children;
		_data_->iter = _data_->_tmp53_;
		{
			_data_->_tmp54_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp54_) {
					_data_->_tmp55_ = NULL;
					_data_->_tmp55_ = _data_->iter;
					_data_->_tmp56_ = NULL;
					_data_->_tmp56_ = _data_->_tmp55_->next;
					_data_->iter = _data_->_tmp56_;
				}
				_data_->_tmp54_ = FALSE;
				_data_->_tmp57_ = NULL;
				_data_->_tmp57_ = _data_->iter;
				if (!(_data_->_tmp57_ != NULL)) {
					break;
				}
				_data_->_tmp59_ = NULL;
				_data_->_tmp59_ = _data_->iter;
				_data_->_tmp60_ = 0;
				_data_->_tmp60_ = _data_->_tmp59_->type;
				if (_data_->_tmp60_ != XML_ELEMENT_NODE) {
					_data_->_tmp58_ = TRUE;
				} else {
					_data_->_tmp61_ = NULL;
					_data_->_tmp61_ = _data_->iter;
					_data_->_tmp62_ = NULL;
					_data_->_tmp62_ = _data_->_tmp61_->name;
					_data_->_tmp58_ = g_strcmp0 (_data_->_tmp62_, "blist") != 0;
				}
				if (_data_->_tmp58_) {
					continue;
				}
				_data_->_tmp63_ = NULL;
				_data_->_tmp63_ = _data_->iter;
				_data_->_state_ = 2;
				folks_importers_pidgin_parse_blist (_data_->self, _data_->_tmp63_, folks_importers_pidgin_import_ready, _data_);
				return FALSE;
				_state_2:
				folks_importers_pidgin_parse_blist_finish (_data_->self, _data_->_res_);
			}
		}
	}
	_data_->_tmp64_ = NULL;
	_data_->_tmp64_ = _data_->xml_doc;
	xmlFreeDoc (_data_->_tmp64_);
	_data_->_tmp65_ = NULL;
	_data_->_tmp65_ = stdout;
	_data_->_tmp66_ = 0U;
	_data_->_tmp66_ = _data_->self->priv->persona_count;
	_data_->_tmp67_ = NULL;
	_data_->_tmp67_ = ngettext ("Imported %u buddy from '%s'.", "Imported %u buddies from '%s'.", (gulong) _data_->_tmp66_);
	_data_->_tmp68_ = NULL;
	_data_->_tmp68_ = g_strconcat (_data_->_tmp67_, "\n", NULL);
	_data_->_tmp69_ = NULL;
	_data_->_tmp69_ = _data_->_tmp68_;
	_data_->_tmp70_ = 0U;
	_data_->_tmp70_ = _data_->self->priv->persona_count;
	_data_->_tmp71_ = NULL;
	_data_->_tmp71_ = _data_->filename;
	fprintf (_data_->_tmp65_, _data_->_tmp69_, _data_->_tmp70_, _data_->_tmp71_);
	_g_free0 (_data_->_tmp69_);
	_data_->_tmp72_ = 0U;
	_data_->_tmp72_ = _data_->self->priv->persona_count;
	_data_->result = _data_->_tmp72_;
	_g_object_unref0 (_data_->file_info);
	_g_object_unref0 (_data_->file);
	_g_free0 (_data_->filename);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_g_object_unref0 (_data_->file_info);
	_g_object_unref0 (_data_->file);
	_g_free0 (_data_->filename);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_importers_pidgin_parse_blist_data_free (gpointer _data) {
	FolksImportersPidginParseBlistData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksImportersPidginParseBlistData, _data_);
}


static void folks_importers_pidgin_parse_blist (FolksImportersPidgin* self, xmlNode* blist_node, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksImportersPidginParseBlistData* _data_;
	FolksImportersPidgin* _tmp0_ = NULL;
	xmlNode* _tmp1_ = NULL;
	_data_ = g_slice_new0 (FolksImportersPidginParseBlistData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_importers_pidgin_parse_blist);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_importers_pidgin_parse_blist_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = blist_node;
	_data_->blist_node = _tmp1_;
	folks_importers_pidgin_parse_blist_co (_data_);
}


static void folks_importers_pidgin_parse_blist_finish (FolksImportersPidgin* self, GAsyncResult* _res_) {
	FolksImportersPidginParseBlistData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void folks_importers_pidgin_parse_blist_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksImportersPidginParseBlistData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_importers_pidgin_parse_blist_co (_data_);
}


static gboolean folks_importers_pidgin_parse_blist_co (FolksImportersPidginParseBlistData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = NULL;
		_data_->_tmp0_ = _data_->blist_node;
		_data_->_tmp1_ = NULL;
		_data_->_tmp1_ = _data_->_tmp0_->children;
		_data_->iter = _data_->_tmp1_;
		{
			_data_->_tmp2_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp2_) {
					_data_->_tmp3_ = NULL;
					_data_->_tmp3_ = _data_->iter;
					_data_->_tmp4_ = NULL;
					_data_->_tmp4_ = _data_->_tmp3_->next;
					_data_->iter = _data_->_tmp4_;
				}
				_data_->_tmp2_ = FALSE;
				_data_->_tmp5_ = NULL;
				_data_->_tmp5_ = _data_->iter;
				if (!(_data_->_tmp5_ != NULL)) {
					break;
				}
				_data_->_tmp7_ = NULL;
				_data_->_tmp7_ = _data_->iter;
				_data_->_tmp8_ = 0;
				_data_->_tmp8_ = _data_->_tmp7_->type;
				if (_data_->_tmp8_ != XML_ELEMENT_NODE) {
					_data_->_tmp6_ = TRUE;
				} else {
					_data_->_tmp9_ = NULL;
					_data_->_tmp9_ = _data_->iter;
					_data_->_tmp10_ = NULL;
					_data_->_tmp10_ = _data_->_tmp9_->name;
					_data_->_tmp6_ = g_strcmp0 (_data_->_tmp10_, "group") != 0;
				}
				if (_data_->_tmp6_) {
					continue;
				}
				_data_->_tmp11_ = NULL;
				_data_->_tmp11_ = _data_->iter;
				_data_->_state_ = 1;
				folks_importers_pidgin_parse_group (_data_->self, _data_->_tmp11_, folks_importers_pidgin_parse_blist_ready, _data_);
				return FALSE;
				_state_1:
				folks_importers_pidgin_parse_group_finish (_data_->self, _data_->_res_);
			}
		}
	}
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_importers_pidgin_parse_group_data_free (gpointer _data) {
	FolksImportersPidginParseGroupData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksImportersPidginParseGroupData, _data_);
}


static void folks_importers_pidgin_parse_group (FolksImportersPidgin* self, xmlNode* group_node, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksImportersPidginParseGroupData* _data_;
	FolksImportersPidgin* _tmp0_ = NULL;
	xmlNode* _tmp1_ = NULL;
	_data_ = g_slice_new0 (FolksImportersPidginParseGroupData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_importers_pidgin_parse_group);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_importers_pidgin_parse_group_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = group_node;
	_data_->group_node = _tmp1_;
	folks_importers_pidgin_parse_group_co (_data_);
}


static void folks_importers_pidgin_parse_group_finish (FolksImportersPidgin* self, GAsyncResult* _res_) {
	FolksImportersPidginParseGroupData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void folks_importers_pidgin_parse_group_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksImportersPidginParseGroupData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_importers_pidgin_parse_group_co (_data_);
}


static gboolean folks_importers_pidgin_parse_group_co (FolksImportersPidginParseGroupData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->group_node;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = (gchar*) xmlGetProp (_data_->_tmp0_, (xmlChar*) "name");
	_data_->group_name = _data_->_tmp1_;
	{
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = _data_->group_node;
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->_tmp2_->children;
		_data_->iter = _data_->_tmp3_;
		{
			_data_->_tmp4_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp4_) {
					_data_->_tmp5_ = NULL;
					_data_->_tmp5_ = _data_->iter;
					_data_->_tmp6_ = NULL;
					_data_->_tmp6_ = _data_->_tmp5_->next;
					_data_->iter = _data_->_tmp6_;
				}
				_data_->_tmp4_ = FALSE;
				_data_->_tmp7_ = NULL;
				_data_->_tmp7_ = _data_->iter;
				if (!(_data_->_tmp7_ != NULL)) {
					break;
				}
				_data_->_tmp9_ = NULL;
				_data_->_tmp9_ = _data_->iter;
				_data_->_tmp10_ = 0;
				_data_->_tmp10_ = _data_->_tmp9_->type;
				if (_data_->_tmp10_ != XML_ELEMENT_NODE) {
					_data_->_tmp8_ = TRUE;
				} else {
					_data_->_tmp11_ = NULL;
					_data_->_tmp11_ = _data_->iter;
					_data_->_tmp12_ = NULL;
					_data_->_tmp12_ = _data_->_tmp11_->name;
					_data_->_tmp8_ = g_strcmp0 (_data_->_tmp12_, "contact") != 0;
				}
				if (_data_->_tmp8_) {
					continue;
				}
				_data_->_tmp13_ = NULL;
				_data_->_tmp13_ = _data_->iter;
				_data_->_state_ = 1;
				folks_importers_pidgin_parse_contact (_data_->self, _data_->_tmp13_, folks_importers_pidgin_parse_group_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp14_ = NULL;
				_data_->_tmp14_ = folks_importers_pidgin_parse_contact_finish (_data_->self, _data_->_res_);
				_data_->persona = _data_->_tmp14_;
				_data_->_tmp16_ = NULL;
				_data_->_tmp16_ = _data_->persona;
				if (_data_->_tmp16_ == NULL) {
					_data_->_tmp15_ = TRUE;
				} else {
					_data_->_tmp17_ = NULL;
					_data_->_tmp17_ = _data_->persona;
					_data_->_tmp15_ = !G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp17_, FOLKS_TYPE_GROUP_DETAILS);
				}
				if (_data_->_tmp15_) {
					_g_object_unref0 (_data_->persona);
					continue;
				}
				{
					_data_->_tmp18_ = NULL;
					_data_->_tmp18_ = _data_->persona;
					_data_->_tmp19_ = NULL;
					_data_->_tmp19_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp18_, FOLKS_TYPE_GROUP_DETAILS, FolksGroupDetails));
					_data_->group_details = _data_->_tmp19_;
					_data_->_tmp20_ = NULL;
					_data_->_tmp20_ = _data_->group_details;
					_data_->_tmp21_ = NULL;
					_data_->_tmp21_ = _data_->group_name;
					_data_->_state_ = 2;
					folks_group_details_change_group (_data_->_tmp20_, _data_->_tmp21_, TRUE, folks_importers_pidgin_parse_group_ready, _data_);
					return FALSE;
					_state_2:
					folks_group_details_change_group_finish (_data_->_tmp20_, _data_->_res_, &_data_->_inner_error_);
					if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
						_g_object_unref0 (_data_->group_details);
						goto __catch6_g_error;
					}
					_g_object_unref0 (_data_->group_details);
				}
				goto __finally6;
				__catch6_g_error:
				{
					_data_->e = _data_->_inner_error_;
					_data_->_inner_error_ = NULL;
					_data_->_tmp22_ = NULL;
					_data_->_tmp22_ = stderr;
					_data_->_tmp23_ = NULL;
					_data_->_tmp23_ = _ ("Error changing group of contact ‘%s’: %s");
					_data_->_tmp24_ = NULL;
					_data_->_tmp24_ = g_strconcat (_data_->_tmp23_, "\n", NULL);
					_data_->_tmp25_ = NULL;
					_data_->_tmp25_ = _data_->_tmp24_;
					_data_->_tmp26_ = NULL;
					_data_->_tmp26_ = _data_->persona;
					_data_->_tmp27_ = NULL;
					_data_->_tmp27_ = folks_persona_get_iid (_data_->_tmp26_);
					_data_->_tmp28_ = NULL;
					_data_->_tmp28_ = _data_->_tmp27_;
					_data_->_tmp29_ = NULL;
					_data_->_tmp29_ = _data_->e;
					_data_->_tmp30_ = NULL;
					_data_->_tmp30_ = _data_->_tmp29_->message;
					fprintf (_data_->_tmp22_, _data_->_tmp25_, _data_->_tmp28_, _data_->_tmp30_);
					_g_free0 (_data_->_tmp25_);
					_g_error_free0 (_data_->e);
				}
				__finally6:
				if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
					_g_object_unref0 (_data_->persona);
					_g_free0 (_data_->group_name);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
					g_clear_error (&_data_->_inner_error_);
					return FALSE;
				}
				_g_object_unref0 (_data_->persona);
			}
		}
	}
	_g_free0 (_data_->group_name);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_importers_pidgin_parse_contact_data_free (gpointer _data) {
	FolksImportersPidginParseContactData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksImportersPidginParseContactData, _data_);
}


static void folks_importers_pidgin_parse_contact (FolksImportersPidgin* self, xmlNode* contact_node, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksImportersPidginParseContactData* _data_;
	FolksImportersPidgin* _tmp0_ = NULL;
	xmlNode* _tmp1_ = NULL;
	_data_ = g_slice_new0 (FolksImportersPidginParseContactData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, folks_importers_pidgin_parse_contact);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_importers_pidgin_parse_contact_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = contact_node;
	_data_->contact_node = _tmp1_;
	folks_importers_pidgin_parse_contact_co (_data_);
}


static FolksPersona* folks_importers_pidgin_parse_contact_finish (FolksImportersPidgin* self, GAsyncResult* _res_) {
	FolksPersona* result;
	FolksImportersPidginParseContactData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _vala_GValue_free (GValue* self) {
	g_value_unset (self);
	g_free (self);
}


static void __vala_GValue_free0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL));
}


static GValue* _g_value_dup (GValue* self) {
	return g_boxed_copy (G_TYPE_VALUE, self);
}


static gpointer __g_value_dup0 (gpointer self) {
	return self ? _g_value_dup (self) : NULL;
}


static void folks_importers_pidgin_parse_contact_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksImportersPidginParseContactData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_importers_pidgin_parse_contact_co (_data_);
}


static gboolean folks_importers_pidgin_parse_contact_co (FolksImportersPidginParseContactData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->alias = NULL;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_IM_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->im_addresses = _data_->_tmp0_;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = g_strdup ("");
	_data_->im_address_string = _data_->_tmp1_;
	{
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = _data_->contact_node;
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->_tmp2_->children;
		_data_->iter = _data_->_tmp3_;
		{
			_data_->_tmp4_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp4_) {
					_data_->_tmp5_ = NULL;
					_data_->_tmp5_ = _data_->iter;
					_data_->_tmp6_ = NULL;
					_data_->_tmp6_ = _data_->_tmp5_->next;
					_data_->iter = _data_->_tmp6_;
				}
				_data_->_tmp4_ = FALSE;
				_data_->_tmp7_ = NULL;
				_data_->_tmp7_ = _data_->iter;
				if (!(_data_->_tmp7_ != NULL)) {
					break;
				}
				_data_->_tmp9_ = NULL;
				_data_->_tmp9_ = _data_->iter;
				_data_->_tmp10_ = 0;
				_data_->_tmp10_ = _data_->_tmp9_->type;
				if (_data_->_tmp10_ != XML_ELEMENT_NODE) {
					_data_->_tmp8_ = TRUE;
				} else {
					_data_->_tmp11_ = NULL;
					_data_->_tmp11_ = _data_->iter;
					_data_->_tmp12_ = NULL;
					_data_->_tmp12_ = _data_->_tmp11_->name;
					_data_->_tmp8_ = g_strcmp0 (_data_->_tmp12_, "buddy") != 0;
				}
				if (_data_->_tmp8_) {
					continue;
				}
				_data_->_tmp13_ = NULL;
				_data_->_tmp13_ = _data_->iter;
				_data_->_tmp14_ = NULL;
				_data_->_tmp14_ = (gchar*) xmlGetProp (_data_->_tmp13_, (xmlChar*) "proto");
				_data_->blist_protocol = _data_->_tmp14_;
				_data_->_tmp15_ = NULL;
				_data_->_tmp15_ = _data_->blist_protocol;
				if (_data_->_tmp15_ == NULL) {
					_g_free0 (_data_->blist_protocol);
					continue;
				}
				_data_->_tmp16_ = NULL;
				_data_->_tmp16_ = _data_->blist_protocol;
				_data_->_tmp17_ = NULL;
				_data_->_tmp17_ = folks_importers_pidgin_blist_protocol_to_tp_protocol (_data_->self, _data_->_tmp16_);
				_data_->tp_protocol = _data_->_tmp17_;
				_data_->_tmp18_ = NULL;
				_data_->_tmp18_ = _data_->tp_protocol;
				if (_data_->_tmp18_ == NULL) {
					_g_free0 (_data_->tp_protocol);
					_g_free0 (_data_->blist_protocol);
					continue;
				}
				{
					_data_->_tmp19_ = NULL;
					_data_->_tmp19_ = _data_->iter;
					_data_->_tmp20_ = NULL;
					_data_->_tmp20_ = _data_->_tmp19_->children;
					_data_->subiter = _data_->_tmp20_;
					{
						_data_->_tmp21_ = TRUE;
						while (TRUE) {
							if (!_data_->_tmp21_) {
								_data_->_tmp22_ = NULL;
								_data_->_tmp22_ = _data_->subiter;
								_data_->_tmp23_ = NULL;
								_data_->_tmp23_ = _data_->_tmp22_->next;
								_data_->subiter = _data_->_tmp23_;
							}
							_data_->_tmp21_ = FALSE;
							_data_->_tmp24_ = NULL;
							_data_->_tmp24_ = _data_->subiter;
							if (!(_data_->_tmp24_ != NULL)) {
								break;
							}
							_data_->_tmp25_ = NULL;
							_data_->_tmp25_ = _data_->subiter;
							_data_->_tmp26_ = 0;
							_data_->_tmp26_ = _data_->_tmp25_->type;
							if (_data_->_tmp26_ != XML_ELEMENT_NODE) {
								continue;
							}
							_data_->_tmp27_ = NULL;
							_data_->_tmp27_ = _data_->subiter;
							_data_->_tmp28_ = NULL;
							_data_->_tmp28_ = _data_->_tmp27_->name;
							if (g_strcmp0 (_data_->_tmp28_, "alias") == 0) {
								_data_->_tmp29_ = NULL;
								_data_->_tmp29_ = _data_->subiter;
								_data_->_tmp30_ = NULL;
								_data_->_tmp30_ = (gchar*) xmlNodeGetContent (_data_->_tmp29_);
								_g_free0 (_data_->alias);
								_data_->alias = _data_->_tmp30_;
							} else {
								_data_->_tmp31_ = NULL;
								_data_->_tmp31_ = _data_->subiter;
								_data_->_tmp32_ = NULL;
								_data_->_tmp32_ = _data_->_tmp31_->name;
								if (g_strcmp0 (_data_->_tmp32_, "name") == 0) {
									_data_->_tmp33_ = NULL;
									_data_->_tmp33_ = _data_->subiter;
									_data_->_tmp34_ = NULL;
									_data_->_tmp34_ = (gchar*) xmlNodeGetContent (_data_->_tmp33_);
									_data_->im_address = _data_->_tmp34_;
									_data_->_tmp35_ = NULL;
									_data_->_tmp35_ = _data_->im_addresses;
									_data_->_tmp36_ = NULL;
									_data_->_tmp36_ = _data_->tp_protocol;
									_data_->_tmp37_ = NULL;
									_data_->_tmp37_ = _data_->im_address;
									_data_->_tmp38_ = NULL;
									_data_->_tmp38_ = folks_im_field_details_new (_data_->_tmp37_, NULL);
									_data_->_tmp39_ = NULL;
									_data_->_tmp39_ = _data_->_tmp38_;
									gee_multi_map_set ((GeeMultiMap*) _data_->_tmp35_, _data_->_tmp36_, _data_->_tmp39_);
									_g_object_unref0 (_data_->_tmp39_);
									_data_->_tmp40_ = NULL;
									_data_->_tmp40_ = _data_->im_address_string;
									_data_->_tmp41_ = NULL;
									_data_->_tmp41_ = _data_->im_address;
									_data_->_tmp42_ = NULL;
									_data_->_tmp42_ = g_strdup_printf ("    %s\n", _data_->_tmp41_);
									_data_->_tmp43_ = NULL;
									_data_->_tmp43_ = _data_->_tmp42_;
									_data_->_tmp44_ = NULL;
									_data_->_tmp44_ = g_strconcat (_data_->_tmp40_, _data_->_tmp43_, NULL);
									_g_free0 (_data_->im_address_string);
									_data_->im_address_string = _data_->_tmp44_;
									_g_free0 (_data_->_tmp43_);
									_g_free0 (_data_->im_address);
								}
							}
						}
					}
				}
				_g_free0 (_data_->tp_protocol);
				_g_free0 (_data_->blist_protocol);
			}
		}
	}
	_data_->_tmp46_ = NULL;
	_data_->_tmp46_ = _data_->im_addresses;
	_data_->_tmp47_ = 0;
	_data_->_tmp47_ = gee_multi_map_get_size ((GeeMultiMap*) _data_->_tmp46_);
	_data_->_tmp48_ = 0;
	_data_->_tmp48_ = _data_->_tmp47_;
	if (_data_->_tmp48_ < 2) {
		_data_->_tmp51_ = NULL;
		_data_->_tmp51_ = _data_->alias;
		if (_data_->_tmp51_ == NULL) {
			_data_->_tmp50_ = TRUE;
		} else {
			_data_->_tmp52_ = NULL;
			_data_->_tmp52_ = _data_->alias;
			_data_->_tmp53_ = NULL;
			_data_->_tmp53_ = string_strip (_data_->_tmp52_);
			_data_->_tmp54_ = NULL;
			_data_->_tmp54_ = _data_->_tmp53_;
			_data_->_tmp50_ = g_strcmp0 (_data_->_tmp54_, "") == 0;
			_g_free0 (_data_->_tmp54_);
		}
		if (_data_->_tmp50_) {
			_data_->_tmp49_ = TRUE;
		} else {
			_data_->_tmp55_ = NULL;
			_data_->_tmp55_ = _data_->alias;
			_data_->_tmp56_ = NULL;
			_data_->_tmp56_ = string_strip (_data_->_tmp55_);
			_data_->_tmp57_ = NULL;
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp58_ = NULL;
			_data_->_tmp58_ = _data_->im_address_string;
			_data_->_tmp59_ = NULL;
			_data_->_tmp59_ = string_strip (_data_->_tmp58_);
			_data_->_tmp60_ = NULL;
			_data_->_tmp60_ = _data_->_tmp59_;
			_data_->_tmp49_ = g_strcmp0 (_data_->_tmp57_, _data_->_tmp60_) == 0;
			_g_free0 (_data_->_tmp60_);
			_g_free0 (_data_->_tmp57_);
		}
		_data_->_tmp45_ = _data_->_tmp49_;
	} else {
		_data_->_tmp45_ = FALSE;
	}
	if (_data_->_tmp45_) {
		_data_->_tmp61_ = NULL;
		_data_->_tmp61_ = stdout;
		_data_->_tmp62_ = NULL;
		_data_->_tmp62_ = _ ("Ignoring buddy with no alias and only one IM address:\n%s");
		_data_->_tmp63_ = NULL;
		_data_->_tmp63_ = _data_->im_address_string;
		fprintf (_data_->_tmp61_, _data_->_tmp62_, _data_->_tmp63_);
		_data_->result = NULL;
		_g_free0 (_data_->im_address_string);
		_g_object_unref0 (_data_->im_addresses);
		_g_free0 (_data_->alias);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp64_ = NULL;
	_data_->_tmp64_ = g_str_hash;
	_data_->_tmp65_ = NULL;
	_data_->_tmp65_ = g_str_equal;
	_data_->_tmp66_ = NULL;
	_data_->_tmp66_ = g_hash_table_new_full (_data_->_tmp64_, _data_->_tmp65_, _g_free0_, __vala_GValue_free0_);
	_data_->details = _data_->_tmp66_;
	memset (&_data_->_tmp67_, 0, sizeof (GValue));
	g_value_init (&_data_->_tmp67_, GEE_TYPE_MULTI_MAP);
	_data_->im_addresses_value = _data_->_tmp67_;
	_data_->_tmp68_ = NULL;
	_data_->_tmp68_ = _data_->im_addresses;
	g_value_set_object (&_data_->im_addresses_value, (GObject*) _data_->_tmp68_);
	_data_->_tmp69_ = NULL;
	_data_->_tmp69_ = _data_->details;
	_data_->_tmp70_ = NULL;
	_data_->_tmp70_ = g_strdup ("im-addresses");
	memset (&_data_->_tmp71_, 0, sizeof (GValue));
	_data_->_tmp71_ = _data_->im_addresses_value;
	memset (&_data_->_tmp72_, 0, sizeof (GValue));
	_data_->_tmp72_ = _data_->_tmp71_;
	_data_->_tmp73_ = NULL;
	_data_->_tmp73_ = __g_value_dup0 (&_data_->_tmp72_);
	g_hash_table_insert (_data_->_tmp69_, _data_->_tmp70_, _data_->_tmp73_);
	{
		_data_->_tmp75_ = NULL;
		_data_->_tmp75_ = _data_->self->priv->destination_store;
		_data_->_tmp76_ = NULL;
		_data_->_tmp76_ = _data_->details;
		_data_->_state_ = 1;
		folks_persona_store_add_persona_from_details (_data_->_tmp75_, _data_->_tmp76_, folks_importers_pidgin_parse_contact_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp77_ = NULL;
		_data_->_tmp77_ = folks_persona_store_add_persona_from_details_finish (_data_->_tmp75_, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp74_ = _data_->_tmp77_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			if (_data_->_inner_error_->domain == FOLKS_PERSONA_STORE_ERROR) {
				goto __catch7_folks_persona_store_error;
			}
			_g_object_unref0 (_data_->persona);
			G_IS_VALUE (&_data_->im_addresses_value) ? (g_value_unset (&_data_->im_addresses_value), NULL) : NULL;
			_g_hash_table_unref0 (_data_->details);
			_g_free0 (_data_->im_address_string);
			_g_object_unref0 (_data_->im_addresses);
			_g_free0 (_data_->alias);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
		_data_->_tmp78_ = NULL;
		_data_->_tmp78_ = _data_->_tmp74_;
		_data_->_tmp74_ = NULL;
		_g_object_unref0 (_data_->persona);
		_data_->persona = _data_->_tmp78_;
		_g_object_unref0 (_data_->_tmp74_);
	}
	goto __finally7;
	__catch7_folks_persona_store_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp79_ = NULL;
		_data_->_tmp79_ = stderr;
		_data_->_tmp80_ = NULL;
		_data_->_tmp80_ = _ ("Failed to create new contact for buddy with alias ‘%s’ and IM addresse" \
"s:\n" \
"%s\n" \
"Error: %s\n");
		_data_->_tmp81_ = NULL;
		_data_->_tmp81_ = _data_->alias;
		_data_->_tmp82_ = NULL;
		_data_->_tmp82_ = _data_->im_address_string;
		_data_->_tmp83_ = NULL;
		_data_->_tmp83_ = _data_->e;
		_data_->_tmp84_ = NULL;
		_data_->_tmp84_ = _data_->_tmp83_->message;
		fprintf (_data_->_tmp79_, _data_->_tmp80_, _data_->_tmp81_, _data_->_tmp82_, _data_->_tmp84_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->persona);
		G_IS_VALUE (&_data_->im_addresses_value) ? (g_value_unset (&_data_->im_addresses_value), NULL) : NULL;
		_g_hash_table_unref0 (_data_->details);
		_g_free0 (_data_->im_address_string);
		_g_object_unref0 (_data_->im_addresses);
		_g_free0 (_data_->alias);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally7:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->persona);
		G_IS_VALUE (&_data_->im_addresses_value) ? (g_value_unset (&_data_->im_addresses_value), NULL) : NULL;
		_g_hash_table_unref0 (_data_->details);
		_g_free0 (_data_->im_address_string);
		_g_object_unref0 (_data_->im_addresses);
		_g_free0 (_data_->alias);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_data_->_tmp86_ = NULL;
	_data_->_tmp86_ = _data_->alias;
	if (_data_->_tmp86_ != NULL) {
		_data_->_tmp87_ = NULL;
		_data_->_tmp87_ = _data_->persona;
		_data_->_tmp85_ = G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp87_, FOLKS_TYPE_ALIAS_DETAILS);
	} else {
		_data_->_tmp85_ = FALSE;
	}
	if (_data_->_tmp85_) {
		_data_->_tmp88_ = NULL;
		_data_->_tmp88_ = _data_->persona;
		_data_->_tmp89_ = NULL;
		_data_->_tmp89_ = _data_->alias;
		folks_alias_details_set_alias (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp88_, FOLKS_TYPE_ALIAS_DETAILS, FolksAliasDetails), _data_->_tmp89_);
	}
	_data_->_tmp90_ = NULL;
	_data_->_tmp90_ = stdout;
	_data_->_tmp91_ = NULL;
	_data_->_tmp91_ = _ ("Created contact ‘%s’ for buddy with alias ‘%s’ and IM addresses:\n" \
"%s");
	_data_->_tmp92_ = NULL;
	_data_->_tmp92_ = _data_->persona;
	_data_->_tmp93_ = NULL;
	_data_->_tmp93_ = folks_persona_get_uid (_data_->_tmp92_);
	_data_->_tmp94_ = NULL;
	_data_->_tmp94_ = _data_->_tmp93_;
	_data_->_tmp95_ = NULL;
	_data_->_tmp95_ = _data_->alias;
	_data_->_tmp96_ = NULL;
	_data_->_tmp96_ = _data_->im_address_string;
	fprintf (_data_->_tmp90_, _data_->_tmp91_, _data_->_tmp94_, _data_->_tmp95_, _data_->_tmp96_);
	_data_->_tmp97_ = 0U;
	_data_->_tmp97_ = _data_->self->priv->persona_count;
	_data_->self->priv->persona_count = _data_->_tmp97_ + 1;
	_data_->result = _data_->persona;
	G_IS_VALUE (&_data_->im_addresses_value) ? (g_value_unset (&_data_->im_addresses_value), NULL) : NULL;
	_g_hash_table_unref0 (_data_->details);
	_g_free0 (_data_->im_address_string);
	_g_object_unref0 (_data_->im_addresses);
	_g_free0 (_data_->alias);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_g_object_unref0 (_data_->persona);
	G_IS_VALUE (&_data_->im_addresses_value) ? (g_value_unset (&_data_->im_addresses_value), NULL) : NULL;
	_g_hash_table_unref0 (_data_->details);
	_g_free0 (_data_->im_address_string);
	_g_object_unref0 (_data_->im_addresses);
	_g_free0 (_data_->alias);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* end = NULL;
	gchar* _tmp0_ = NULL;
	glong _tmp1_ = 0L;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	_tmp0_ = str;
	_tmp1_ = maxlen;
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
	end = _tmp2_;
	_tmp3_ = end;
	if (_tmp3_ == NULL) {
		glong _tmp4_ = 0L;
		_tmp4_ = maxlen;
		result = _tmp4_;
		return result;
	} else {
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		_tmp5_ = end;
		_tmp6_ = str;
		result = (glong) (_tmp5_ - _tmp6_);
		return result;
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_ = 0L;
	glong _tmp8_ = 0L;
	glong _tmp14_ = 0L;
	glong _tmp17_ = 0L;
	glong _tmp18_ = 0L;
	glong _tmp19_ = 0L;
	glong _tmp20_ = 0L;
	glong _tmp21_ = 0L;
	gchar* _tmp22_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = offset;
	if (_tmp1_ >= ((glong) 0)) {
		glong _tmp2_ = 0L;
		_tmp2_ = len;
		_tmp0_ = _tmp2_ >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		glong _tmp3_ = 0L;
		glong _tmp4_ = 0L;
		glong _tmp5_ = 0L;
		_tmp3_ = offset;
		_tmp4_ = len;
		_tmp5_ = string_strnlen ((gchar*) self, _tmp3_ + _tmp4_);
		string_length = _tmp5_;
	} else {
		gint _tmp6_ = 0;
		gint _tmp7_ = 0;
		_tmp6_ = strlen (self);
		_tmp7_ = _tmp6_;
		string_length = (glong) _tmp7_;
	}
	_tmp8_ = offset;
	if (_tmp8_ < ((glong) 0)) {
		glong _tmp9_ = 0L;
		glong _tmp10_ = 0L;
		glong _tmp11_ = 0L;
		_tmp9_ = string_length;
		_tmp10_ = offset;
		offset = _tmp9_ + _tmp10_;
		_tmp11_ = offset;
		g_return_val_if_fail (_tmp11_ >= ((glong) 0), NULL);
	} else {
		glong _tmp12_ = 0L;
		glong _tmp13_ = 0L;
		_tmp12_ = offset;
		_tmp13_ = string_length;
		g_return_val_if_fail (_tmp12_ <= _tmp13_, NULL);
	}
	_tmp14_ = len;
	if (_tmp14_ < ((glong) 0)) {
		glong _tmp15_ = 0L;
		glong _tmp16_ = 0L;
		_tmp15_ = string_length;
		_tmp16_ = offset;
		len = _tmp15_ - _tmp16_;
	}
	_tmp17_ = offset;
	_tmp18_ = len;
	_tmp19_ = string_length;
	g_return_val_if_fail ((_tmp17_ + _tmp18_) <= _tmp19_, NULL);
	_tmp20_ = offset;
	_tmp21_ = len;
	_tmp22_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) _tmp21_);
	result = _tmp22_;
	return result;
}


static gchar* folks_importers_pidgin_blist_protocol_to_tp_protocol (FolksImportersPidgin* self, const gchar* blist_protocol) {
	gchar* result = NULL;
	gchar* tp_protocol = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp6_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (blist_protocol != NULL, NULL);
	_tmp0_ = blist_protocol;
	_tmp1_ = g_strdup (_tmp0_);
	tp_protocol = _tmp1_;
	_tmp2_ = blist_protocol;
	_tmp3_ = g_str_has_prefix (_tmp2_, "prpl-");
	if (_tmp3_) {
		const gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp4_ = blist_protocol;
		_tmp5_ = string_substring (_tmp4_, (glong) 5, (glong) -1);
		_g_free0 (tp_protocol);
		tp_protocol = _tmp5_;
	}
	_tmp6_ = tp_protocol;
	if (g_strcmp0 (_tmp6_, "bonjour") == 0) {
		gchar* _tmp7_ = NULL;
		_tmp7_ = g_strdup ("local-xmpp");
		_g_free0 (tp_protocol);
		tp_protocol = _tmp7_;
	} else {
		const gchar* _tmp8_ = NULL;
		_tmp8_ = tp_protocol;
		if (g_strcmp0 (_tmp8_, "novell") == 0) {
			gchar* _tmp9_ = NULL;
			_tmp9_ = g_strdup ("groupwise");
			_g_free0 (tp_protocol);
			tp_protocol = _tmp9_;
		} else {
			const gchar* _tmp10_ = NULL;
			_tmp10_ = tp_protocol;
			if (g_strcmp0 (_tmp10_, "gg") == 0) {
				gchar* _tmp11_ = NULL;
				_tmp11_ = g_strdup ("gadugadu");
				_g_free0 (tp_protocol);
				tp_protocol = _tmp11_;
			} else {
				const gchar* _tmp12_ = NULL;
				_tmp12_ = tp_protocol;
				if (g_strcmp0 (_tmp12_, "meanwhile") == 0) {
					gchar* _tmp13_ = NULL;
					_tmp13_ = g_strdup ("sametime");
					_g_free0 (tp_protocol);
					tp_protocol = _tmp13_;
				} else {
					const gchar* _tmp14_ = NULL;
					_tmp14_ = tp_protocol;
					if (g_strcmp0 (_tmp14_, "simple") == 0) {
						gchar* _tmp15_ = NULL;
						_tmp15_ = g_strdup ("sip");
						_g_free0 (tp_protocol);
						tp_protocol = _tmp15_;
					}
				}
			}
		}
	}
	result = tp_protocol;
	return result;
}


FolksImportersPidgin* folks_importers_pidgin_construct (GType object_type) {
	FolksImportersPidgin * self = NULL;
	self = (FolksImportersPidgin*) folks_importer_construct (object_type);
	return self;
}


FolksImportersPidgin* folks_importers_pidgin_new (void) {
	return folks_importers_pidgin_construct (FOLKS_IMPORTERS_TYPE_PIDGIN);
}


static void folks_importers_pidgin_class_init (FolksImportersPidginClass * klass) {
	folks_importers_pidgin_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FolksImportersPidginPrivate));
	((FolksImporterClass *) klass)->import = folks_importers_pidgin_real_import;
	((FolksImporterClass *) klass)->import_finish = folks_importers_pidgin_real_import_finish;
	G_OBJECT_CLASS (klass)->finalize = folks_importers_pidgin_finalize;
}


static void folks_importers_pidgin_instance_init (FolksImportersPidgin * self) {
	self->priv = FOLKS_IMPORTERS_PIDGIN_GET_PRIVATE (self);
	self->priv->persona_count = (guint) 0;
}


static void folks_importers_pidgin_finalize (GObject* obj) {
	FolksImportersPidgin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_IMPORTERS_TYPE_PIDGIN, FolksImportersPidgin);
	_g_object_unref0 (self->priv->destination_store);
	G_OBJECT_CLASS (folks_importers_pidgin_parent_class)->finalize (obj);
}


GType folks_importers_pidgin_get_type (void) {
	static volatile gsize folks_importers_pidgin_type_id__volatile = 0;
	if (g_once_init_enter (&folks_importers_pidgin_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksImportersPidginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_importers_pidgin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksImportersPidgin), 0, (GInstanceInitFunc) folks_importers_pidgin_instance_init, NULL };
		GType folks_importers_pidgin_type_id;
		folks_importers_pidgin_type_id = g_type_register_static (FOLKS_TYPE_IMPORTER, "FolksImportersPidgin", &g_define_type_info, 0);
		g_once_init_leave (&folks_importers_pidgin_type_id__volatile, folks_importers_pidgin_type_id);
	}
	return folks_importers_pidgin_type_id__volatile;
}



