/* import-pidgin.c generated by valac 0.17.2.19-5f50d, the Vala compiler
 * generated from import-pidgin.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <folks/folks.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <libxml/parser.h>
#include <libxml/tree.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_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* filename;
	gboolean _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gboolean _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	GFile* _tmp13_;
	GFile* file;
	GFile* _tmp14_;
	gboolean _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	GError* _tmp18_;
	GFileInfo* file_info;
	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_;
	const gchar* _tmp32_;
	xmlDoc* _tmp33_;
	xmlDoc* xml_doc;
	xmlDoc* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	GError* _tmp37_;
	xmlDoc* _tmp38_;
	xmlNode* _tmp39_;
	xmlNode* root_node;
	gboolean _tmp40_;
	gboolean _tmp41_;
	xmlNode* _tmp42_;
	xmlNode* _tmp43_;
	const gchar* _tmp44_;
	gboolean _tmp45_;
	xmlNode* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gboolean _tmp49_;
	xmlDoc* _tmp50_;
	const gchar* _tmp51_;
	const gchar* _tmp52_;
	GError* _tmp53_;
	xmlNode* _tmp54_;
	xmlNode* _tmp55_;
	xmlNode* iter;
	gboolean _tmp56_;
	gboolean _tmp57_;
	xmlNode* _tmp58_;
	xmlNode* _tmp59_;
	xmlNode* _tmp60_;
	gboolean _tmp61_;
	xmlNode* _tmp62_;
	xmlElementType _tmp63_;
	xmlNode* _tmp64_;
	const gchar* _tmp65_;
	gboolean _tmp66_;
	xmlNode* _tmp67_;
	xmlDoc* _tmp68_;
	FILE* _tmp69_;
	guint _tmp70_;
	const gchar* _tmp71_;
	gchar* _tmp72_;
	gchar* _tmp73_;
	guint _tmp74_;
	const gchar* _tmp75_;
	guint _tmp76_;
	GError * _inner_error_;
};

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

struct _FolksImportersPidginParseGroupData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksImportersPidgin* self;
	xmlNode* group_node;
	xmlNode* _tmp0_;
	gchar* _tmp1_;
	gchar* group_name;
	xmlNode* _tmp2_;
	xmlNode* _tmp3_;
	xmlNode* iter;
	gboolean _tmp4_;
	gboolean _tmp5_;
	xmlNode* _tmp6_;
	xmlNode* _tmp7_;
	xmlNode* _tmp8_;
	gboolean _tmp9_;
	xmlNode* _tmp10_;
	xmlElementType _tmp11_;
	xmlNode* _tmp12_;
	const gchar* _tmp13_;
	gboolean _tmp14_;
	xmlNode* _tmp15_;
	FolksPersona* _tmp16_;
	FolksPersona* persona;
	gboolean _tmp17_;
	FolksPersona* _tmp18_;
	FolksPersona* _tmp19_;
	gboolean _tmp20_;
	FolksPersona* _tmp21_;
	FolksGroupDetails* _tmp22_;
	FolksGroupDetails* group_details;
	FolksGroupDetails* _tmp23_;
	const gchar* _tmp24_;
	GError* e;
	FILE* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	FolksPersona* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	GError* _tmp32_;
	const gchar* _tmp33_;
	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* _tmp0_;
	GeeHashMultiMap* im_addresses;
	gchar* _tmp1_;
	gchar* im_address_string;
	xmlNode* _tmp2_;
	xmlNode* _tmp3_;
	xmlNode* iter;
	gboolean _tmp4_;
	gboolean _tmp5_;
	xmlNode* _tmp6_;
	xmlNode* _tmp7_;
	xmlNode* _tmp8_;
	gboolean _tmp9_;
	xmlNode* _tmp10_;
	xmlElementType _tmp11_;
	xmlNode* _tmp12_;
	const gchar* _tmp13_;
	gboolean _tmp14_;
	xmlNode* _tmp15_;
	gchar* _tmp16_;
	gchar* blist_protocol;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* tp_protocol;
	const gchar* _tmp20_;
	xmlNode* _tmp21_;
	xmlNode* _tmp22_;
	xmlNode* subiter;
	gboolean _tmp23_;
	gboolean _tmp24_;
	xmlNode* _tmp25_;
	xmlNode* _tmp26_;
	xmlNode* _tmp27_;
	xmlNode* _tmp28_;
	xmlElementType _tmp29_;
	xmlNode* _tmp30_;
	const gchar* _tmp31_;
	xmlNode* _tmp32_;
	gchar* _tmp33_;
	xmlNode* _tmp34_;
	const gchar* _tmp35_;
	xmlNode* _tmp36_;
	gchar* _tmp37_;
	gchar* im_address;
	GeeHashMultiMap* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	FolksImFieldDetails* _tmp41_;
	FolksImFieldDetails* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gboolean _tmp48_;
	GeeHashMultiMap* _tmp49_;
	gint _tmp50_;
	gint _tmp51_;
	gboolean _tmp52_;
	gboolean _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	gboolean _tmp58_;
	const gchar* _tmp59_;
	gchar* _tmp60_;
	gchar* _tmp61_;
	const gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	gboolean _tmp65_;
	gboolean _tmp66_;
	FILE* _tmp67_;
	const gchar* _tmp68_;
	const gchar* _tmp69_;
	GHashFunc _tmp70_;
	GEqualFunc _tmp71_;
	GHashTable* _tmp72_;
	GHashTable* details;
	GValue _tmp73_;
	GValue im_addresses_value;
	GeeHashMultiMap* _tmp74_;
	GHashTable* _tmp75_;
	gchar* _tmp76_;
	GValue _tmp77_;
	GValue _tmp78_;
	GValue* _tmp79_;
	FolksPersona* persona;
	FolksPersonaStore* _tmp80_;
	GHashTable* _tmp81_;
	FolksPersona* _tmp82_;
	FolksPersona* _tmp83_;
	GError* e;
	FILE* _tmp84_;
	const gchar* _tmp85_;
	const gchar* _tmp86_;
	const gchar* _tmp87_;
	GError* _tmp88_;
	const gchar* _tmp89_;
	gboolean _tmp90_;
	const gchar* _tmp91_;
	FolksPersona* _tmp92_;
	gboolean _tmp93_;
	FolksPersona* _tmp94_;
	const gchar* _tmp95_;
	FILE* _tmp96_;
	const gchar* _tmp97_;
	FolksPersona* _tmp98_;
	const gchar* _tmp99_;
	const gchar* _tmp100_;
	const gchar* _tmp101_;
	const gchar* _tmp102_;
	guint _tmp103_;
	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_;
	FolksPersonaStore* _tmp1_;
	FolksPersonaStore* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	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_);
	_data_->destination_store = _tmp2_;
	_tmp3_ = source_filename;
	_tmp4_ = g_strdup (_tmp3_);
	_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* _tmp0_ = NULL;
	gchar* _result_;
	const gchar* _tmp1_;
	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_ = _data_->destination_store;
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_g_object_unref0 (_data_->self->priv->destination_store);
	_data_->self->priv->destination_store = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->source_filename;
	_data_->_tmp3_ = g_strdup (_data_->_tmp2_);
	_data_->filename = _data_->_tmp3_;
	_data_->_tmp5_ = _data_->filename;
	if (_data_->_tmp5_ == NULL) {
		_data_->_tmp4_ = TRUE;
	} else {
		_data_->_tmp6_ = _data_->filename;
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = string_strip (_data_->_tmp6_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp4_ = g_strcmp0 (_data_->_tmp8_, "") == 0;
		_g_free0 (_data_->_tmp8_);
	}
	_data_->_tmp9_ = _data_->_tmp4_;
	if (_data_->_tmp9_) {
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = g_get_home_dir ();
		_data_->_tmp11_ = NULL;
		_data_->_tmp11_ = g_build_filename (_data_->_tmp10_, ".purple", "blist.xml", NULL, NULL);
		_g_free0 (_data_->filename);
		_data_->filename = _data_->_tmp11_;
	}
	_data_->_tmp12_ = _data_->filename;
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = g_file_new_for_path (_data_->_tmp12_);
	_data_->file = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->file;
	_data_->_tmp15_ = FALSE;
	_data_->_tmp15_ = g_file_query_exists (_data_->_tmp14_, NULL);
	if (!_data_->_tmp15_) {
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _ ("File %s does not exist.");
		_data_->_tmp17_ = _data_->filename;
		_data_->_tmp18_ = g_error_new (FOLKS_IMPORT_ERROR, FOLKS_IMPORT_ERROR_MALFORMED_INPUT, _data_->_tmp16_, _data_->_tmp17_);
		_data_->_inner_error_ = _data_->_tmp18_;
		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_ = _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_->_tmp21_ = _data_->_tmp20_;
		if (_data_->_inner_error_ != NULL) {
			goto __catch5_g_error;
		}
		_g_object_unref0 (_data_->file_info);
		_data_->file_info = _data_->_tmp21_;
	}
	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_ = _data_->filename;
		_data_->_tmp24_ = _data_->e;
		_data_->_tmp25_ = _data_->_tmp24_->message;
		_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 (_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_ = _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_ = _data_->filename;
		_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_ = _data_->filename;
	_data_->_tmp33_ = NULL;
	_data_->_tmp33_ = xmlParseFile (_data_->_tmp32_);
	_data_->xml_doc = _data_->_tmp33_;
	_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_ = _data_->filename;
		_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_ = _data_->xml_doc;
	_data_->_tmp39_ = NULL;
	_data_->_tmp39_ = xmlDocGetRootElement (_data_->_tmp38_);
	_data_->root_node = _data_->_tmp39_;
	_data_->_tmp42_ = _data_->root_node;
	if (_data_->_tmp42_ == NULL) {
		_data_->_tmp41_ = TRUE;
	} else {
		_data_->_tmp43_ = _data_->root_node;
		_data_->_tmp44_ = _data_->_tmp43_->name;
		_data_->_tmp41_ = g_strcmp0 (_data_->_tmp44_, "purple") != 0;
	}
	_data_->_tmp45_ = _data_->_tmp41_;
	if (_data_->_tmp45_) {
		_data_->_tmp40_ = TRUE;
	} else {
		_data_->_tmp46_ = _data_->root_node;
		_data_->_tmp47_ = NULL;
		_data_->_tmp47_ = xmlGetProp (_data_->_tmp46_, "version");
		_data_->_tmp48_ = _data_->_tmp47_;
		_data_->_tmp40_ = g_strcmp0 (_data_->_tmp48_, "1.0") != 0;
		_g_free0 (_data_->_tmp48_);
	}
	_data_->_tmp49_ = _data_->_tmp40_;
	if (_data_->_tmp49_) {
		_data_->_tmp50_ = _data_->xml_doc;
		xmlFreeDoc (_data_->_tmp50_);
		_data_->_tmp51_ = NULL;
		_data_->_tmp51_ = _ ("The Pidgin buddy list file ‘%s’ could not be loaded: the root element " \
"could not be found or was not recognized.");
		_data_->_tmp52_ = _data_->filename;
		_data_->_tmp53_ = g_error_new (FOLKS_IMPORT_ERROR, FOLKS_IMPORT_ERROR_MALFORMED_INPUT, _data_->_tmp51_, _data_->_tmp52_);
		_data_->_inner_error_ = _data_->_tmp53_;
		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_->_tmp54_ = _data_->root_node;
		_data_->_tmp55_ = _data_->_tmp54_->children;
		_data_->iter = _data_->_tmp55_;
		{
			_data_->_tmp56_ = TRUE;
			while (TRUE) {
				_data_->_tmp57_ = _data_->_tmp56_;
				if (!_data_->_tmp57_) {
					_data_->_tmp58_ = _data_->iter;
					_data_->_tmp59_ = _data_->_tmp58_->next;
					_data_->iter = _data_->_tmp59_;
				}
				_data_->_tmp56_ = FALSE;
				_data_->_tmp60_ = _data_->iter;
				if (!(_data_->_tmp60_ != NULL)) {
					break;
				}
				_data_->_tmp62_ = _data_->iter;
				_data_->_tmp63_ = _data_->_tmp62_->type;
				if (_data_->_tmp63_ != XML_ELEMENT_NODE) {
					_data_->_tmp61_ = TRUE;
				} else {
					_data_->_tmp64_ = _data_->iter;
					_data_->_tmp65_ = _data_->_tmp64_->name;
					_data_->_tmp61_ = g_strcmp0 (_data_->_tmp65_, "blist") != 0;
				}
				_data_->_tmp66_ = _data_->_tmp61_;
				if (_data_->_tmp66_) {
					continue;
				}
				_data_->_tmp67_ = _data_->iter;
				_data_->_state_ = 2;
				folks_importers_pidgin_parse_blist (_data_->self, _data_->_tmp67_, folks_importers_pidgin_import_ready, _data_);
				return FALSE;
				_state_2:
				folks_importers_pidgin_parse_blist_finish (_data_->self, _data_->_res_);
			}
		}
	}
	_data_->_tmp68_ = _data_->xml_doc;
	xmlFreeDoc (_data_->_tmp68_);
	_data_->_tmp69_ = stdout;
	_data_->_tmp70_ = _data_->self->priv->persona_count;
	_data_->_tmp71_ = NULL;
	_data_->_tmp71_ = ngettext ("Imported %u buddy from '%s'.", "Imported %u buddies from '%s'.", (gulong) _data_->_tmp70_);
	_data_->_tmp72_ = g_strconcat (_data_->_tmp71_, "\n", NULL);
	_data_->_tmp73_ = _data_->_tmp72_;
	_data_->_tmp74_ = _data_->self->priv->persona_count;
	_data_->_tmp75_ = _data_->filename;
	fprintf (_data_->_tmp69_, _data_->_tmp73_, _data_->_tmp74_, _data_->_tmp75_);
	_g_free0 (_data_->_tmp73_);
	_data_->_tmp76_ = _data_->self->priv->persona_count;
	_data_->result = _data_->_tmp76_;
	_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_;
	xmlNode* _tmp1_;
	_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_ = _data_->blist_node;
		_data_->_tmp1_ = _data_->_tmp0_->children;
		_data_->iter = _data_->_tmp1_;
		{
			_data_->_tmp2_ = TRUE;
			while (TRUE) {
				_data_->_tmp3_ = _data_->_tmp2_;
				if (!_data_->_tmp3_) {
					_data_->_tmp4_ = _data_->iter;
					_data_->_tmp5_ = _data_->_tmp4_->next;
					_data_->iter = _data_->_tmp5_;
				}
				_data_->_tmp2_ = FALSE;
				_data_->_tmp6_ = _data_->iter;
				if (!(_data_->_tmp6_ != NULL)) {
					break;
				}
				_data_->_tmp8_ = _data_->iter;
				_data_->_tmp9_ = _data_->_tmp8_->type;
				if (_data_->_tmp9_ != XML_ELEMENT_NODE) {
					_data_->_tmp7_ = TRUE;
				} else {
					_data_->_tmp10_ = _data_->iter;
					_data_->_tmp11_ = _data_->_tmp10_->name;
					_data_->_tmp7_ = g_strcmp0 (_data_->_tmp11_, "group") != 0;
				}
				_data_->_tmp12_ = _data_->_tmp7_;
				if (_data_->_tmp12_) {
					continue;
				}
				_data_->_tmp13_ = _data_->iter;
				_data_->_state_ = 1;
				folks_importers_pidgin_parse_group (_data_->self, _data_->_tmp13_, 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_;
	xmlNode* _tmp1_;
	_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_ = _data_->group_node;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = xmlGetProp (_data_->_tmp0_, "name");
	_data_->group_name = _data_->_tmp1_;
	{
		_data_->_tmp2_ = _data_->group_node;
		_data_->_tmp3_ = _data_->_tmp2_->children;
		_data_->iter = _data_->_tmp3_;
		{
			_data_->_tmp4_ = TRUE;
			while (TRUE) {
				_data_->_tmp5_ = _data_->_tmp4_;
				if (!_data_->_tmp5_) {
					_data_->_tmp6_ = _data_->iter;
					_data_->_tmp7_ = _data_->_tmp6_->next;
					_data_->iter = _data_->_tmp7_;
				}
				_data_->_tmp4_ = FALSE;
				_data_->_tmp8_ = _data_->iter;
				if (!(_data_->_tmp8_ != NULL)) {
					break;
				}
				_data_->_tmp10_ = _data_->iter;
				_data_->_tmp11_ = _data_->_tmp10_->type;
				if (_data_->_tmp11_ != XML_ELEMENT_NODE) {
					_data_->_tmp9_ = TRUE;
				} else {
					_data_->_tmp12_ = _data_->iter;
					_data_->_tmp13_ = _data_->_tmp12_->name;
					_data_->_tmp9_ = g_strcmp0 (_data_->_tmp13_, "contact") != 0;
				}
				_data_->_tmp14_ = _data_->_tmp9_;
				if (_data_->_tmp14_) {
					continue;
				}
				_data_->_tmp15_ = _data_->iter;
				_data_->_state_ = 1;
				folks_importers_pidgin_parse_contact (_data_->self, _data_->_tmp15_, folks_importers_pidgin_parse_group_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp16_ = NULL;
				_data_->_tmp16_ = folks_importers_pidgin_parse_contact_finish (_data_->self, _data_->_res_);
				_data_->persona = _data_->_tmp16_;
				_data_->_tmp18_ = _data_->persona;
				if (_data_->_tmp18_ == NULL) {
					_data_->_tmp17_ = TRUE;
				} else {
					_data_->_tmp19_ = _data_->persona;
					_data_->_tmp17_ = !G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp19_, FOLKS_TYPE_GROUP_DETAILS);
				}
				_data_->_tmp20_ = _data_->_tmp17_;
				if (_data_->_tmp20_) {
					_g_object_unref0 (_data_->persona);
					continue;
				}
				{
					_data_->_tmp21_ = _data_->persona;
					_data_->_tmp22_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp21_, FOLKS_TYPE_GROUP_DETAILS, FolksGroupDetails));
					_data_->group_details = _data_->_tmp22_;
					_data_->_tmp23_ = _data_->group_details;
					_data_->_tmp24_ = _data_->group_name;
					_data_->_state_ = 2;
					folks_group_details_change_group (_data_->_tmp23_, _data_->_tmp24_, TRUE, folks_importers_pidgin_parse_group_ready, _data_);
					return FALSE;
					_state_2:
					folks_group_details_change_group_finish (_data_->_tmp23_, _data_->_res_, &_data_->_inner_error_);
					if (_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_->_tmp25_ = stderr;
					_data_->_tmp26_ = NULL;
					_data_->_tmp26_ = _ ("Error changing group of contact ‘%s’: %s");
					_data_->_tmp27_ = g_strconcat (_data_->_tmp26_, "\n", NULL);
					_data_->_tmp28_ = _data_->_tmp27_;
					_data_->_tmp29_ = _data_->persona;
					_data_->_tmp30_ = folks_persona_get_iid (_data_->_tmp29_);
					_data_->_tmp31_ = _data_->_tmp30_;
					_data_->_tmp32_ = _data_->e;
					_data_->_tmp33_ = _data_->_tmp32_->message;
					fprintf (_data_->_tmp25_, _data_->_tmp28_, _data_->_tmp31_, _data_->_tmp33_);
					_g_free0 (_data_->_tmp28_);
					_g_error_free0 (_data_->e);
				}
				__finally6:
				if (_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_;
	xmlNode* _tmp1_;
	_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_ = 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);
	_data_->im_addresses = _data_->_tmp0_;
	_data_->_tmp1_ = g_strdup ("");
	_data_->im_address_string = _data_->_tmp1_;
	{
		_data_->_tmp2_ = _data_->contact_node;
		_data_->_tmp3_ = _data_->_tmp2_->children;
		_data_->iter = _data_->_tmp3_;
		{
			_data_->_tmp4_ = TRUE;
			while (TRUE) {
				_data_->_tmp5_ = _data_->_tmp4_;
				if (!_data_->_tmp5_) {
					_data_->_tmp6_ = _data_->iter;
					_data_->_tmp7_ = _data_->_tmp6_->next;
					_data_->iter = _data_->_tmp7_;
				}
				_data_->_tmp4_ = FALSE;
				_data_->_tmp8_ = _data_->iter;
				if (!(_data_->_tmp8_ != NULL)) {
					break;
				}
				_data_->_tmp10_ = _data_->iter;
				_data_->_tmp11_ = _data_->_tmp10_->type;
				if (_data_->_tmp11_ != XML_ELEMENT_NODE) {
					_data_->_tmp9_ = TRUE;
				} else {
					_data_->_tmp12_ = _data_->iter;
					_data_->_tmp13_ = _data_->_tmp12_->name;
					_data_->_tmp9_ = g_strcmp0 (_data_->_tmp13_, "buddy") != 0;
				}
				_data_->_tmp14_ = _data_->_tmp9_;
				if (_data_->_tmp14_) {
					continue;
				}
				_data_->_tmp15_ = _data_->iter;
				_data_->_tmp16_ = NULL;
				_data_->_tmp16_ = xmlGetProp (_data_->_tmp15_, "proto");
				_data_->blist_protocol = _data_->_tmp16_;
				_data_->_tmp17_ = _data_->blist_protocol;
				if (_data_->_tmp17_ == NULL) {
					_g_free0 (_data_->blist_protocol);
					continue;
				}
				_data_->_tmp18_ = _data_->blist_protocol;
				_data_->_tmp19_ = NULL;
				_data_->_tmp19_ = folks_importers_pidgin_blist_protocol_to_tp_protocol (_data_->self, _data_->_tmp18_);
				_data_->tp_protocol = _data_->_tmp19_;
				_data_->_tmp20_ = _data_->tp_protocol;
				if (_data_->_tmp20_ == NULL) {
					_g_free0 (_data_->tp_protocol);
					_g_free0 (_data_->blist_protocol);
					continue;
				}
				{
					_data_->_tmp21_ = _data_->iter;
					_data_->_tmp22_ = _data_->_tmp21_->children;
					_data_->subiter = _data_->_tmp22_;
					{
						_data_->_tmp23_ = TRUE;
						while (TRUE) {
							_data_->_tmp24_ = _data_->_tmp23_;
							if (!_data_->_tmp24_) {
								_data_->_tmp25_ = _data_->subiter;
								_data_->_tmp26_ = _data_->_tmp25_->next;
								_data_->subiter = _data_->_tmp26_;
							}
							_data_->_tmp23_ = FALSE;
							_data_->_tmp27_ = _data_->subiter;
							if (!(_data_->_tmp27_ != NULL)) {
								break;
							}
							_data_->_tmp28_ = _data_->subiter;
							_data_->_tmp29_ = _data_->_tmp28_->type;
							if (_data_->_tmp29_ != XML_ELEMENT_NODE) {
								continue;
							}
							_data_->_tmp30_ = _data_->subiter;
							_data_->_tmp31_ = _data_->_tmp30_->name;
							if (g_strcmp0 (_data_->_tmp31_, "alias") == 0) {
								_data_->_tmp32_ = _data_->subiter;
								_data_->_tmp33_ = NULL;
								_data_->_tmp33_ = xmlNodeGetContent (_data_->_tmp32_);
								_g_free0 (_data_->alias);
								_data_->alias = _data_->_tmp33_;
							} else {
								_data_->_tmp34_ = _data_->subiter;
								_data_->_tmp35_ = _data_->_tmp34_->name;
								if (g_strcmp0 (_data_->_tmp35_, "name") == 0) {
									_data_->_tmp36_ = _data_->subiter;
									_data_->_tmp37_ = NULL;
									_data_->_tmp37_ = xmlNodeGetContent (_data_->_tmp36_);
									_data_->im_address = _data_->_tmp37_;
									_data_->_tmp38_ = _data_->im_addresses;
									_data_->_tmp39_ = _data_->tp_protocol;
									_data_->_tmp40_ = _data_->im_address;
									_data_->_tmp41_ = folks_im_field_details_new (_data_->_tmp40_, NULL);
									_data_->_tmp42_ = _data_->_tmp41_;
									gee_multi_map_set ((GeeMultiMap*) _data_->_tmp38_, _data_->_tmp39_, _data_->_tmp42_);
									_g_object_unref0 (_data_->_tmp42_);
									_data_->_tmp43_ = _data_->im_address_string;
									_data_->_tmp44_ = _data_->im_address;
									_data_->_tmp45_ = NULL;
									_data_->_tmp45_ = g_strdup_printf ("    %s\n", _data_->_tmp44_);
									_data_->_tmp46_ = _data_->_tmp45_;
									_data_->_tmp47_ = g_strconcat (_data_->_tmp43_, _data_->_tmp46_, NULL);
									_g_free0 (_data_->im_address_string);
									_data_->im_address_string = _data_->_tmp47_;
									_g_free0 (_data_->_tmp46_);
									_g_free0 (_data_->im_address);
								}
							}
						}
					}
				}
				_g_free0 (_data_->tp_protocol);
				_g_free0 (_data_->blist_protocol);
			}
		}
	}
	_data_->_tmp49_ = _data_->im_addresses;
	_data_->_tmp50_ = gee_multi_map_get_size ((GeeMultiMap*) _data_->_tmp49_);
	_data_->_tmp51_ = _data_->_tmp50_;
	if (_data_->_tmp51_ < 2) {
		_data_->_tmp54_ = _data_->alias;
		if (_data_->_tmp54_ == NULL) {
			_data_->_tmp53_ = TRUE;
		} else {
			_data_->_tmp55_ = _data_->alias;
			_data_->_tmp56_ = NULL;
			_data_->_tmp56_ = string_strip (_data_->_tmp55_);
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp53_ = g_strcmp0 (_data_->_tmp57_, "") == 0;
			_g_free0 (_data_->_tmp57_);
		}
		_data_->_tmp58_ = _data_->_tmp53_;
		if (_data_->_tmp58_) {
			_data_->_tmp52_ = TRUE;
		} else {
			_data_->_tmp59_ = _data_->alias;
			_data_->_tmp60_ = NULL;
			_data_->_tmp60_ = string_strip (_data_->_tmp59_);
			_data_->_tmp61_ = _data_->_tmp60_;
			_data_->_tmp62_ = _data_->im_address_string;
			_data_->_tmp63_ = NULL;
			_data_->_tmp63_ = string_strip (_data_->_tmp62_);
			_data_->_tmp64_ = _data_->_tmp63_;
			_data_->_tmp52_ = g_strcmp0 (_data_->_tmp61_, _data_->_tmp64_) == 0;
			_g_free0 (_data_->_tmp64_);
			_g_free0 (_data_->_tmp61_);
		}
		_data_->_tmp65_ = _data_->_tmp52_;
		_data_->_tmp48_ = _data_->_tmp65_;
	} else {
		_data_->_tmp48_ = FALSE;
	}
	_data_->_tmp66_ = _data_->_tmp48_;
	if (_data_->_tmp66_) {
		_data_->_tmp67_ = stdout;
		_data_->_tmp68_ = NULL;
		_data_->_tmp68_ = _ ("Ignoring buddy with no alias and only one IM address:\n%s");
		_data_->_tmp69_ = _data_->im_address_string;
		fprintf (_data_->_tmp67_, _data_->_tmp68_, _data_->_tmp69_);
		_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_->_tmp70_ = g_str_hash;
	_data_->_tmp71_ = g_str_equal;
	_data_->_tmp72_ = g_hash_table_new_full (_data_->_tmp70_, _data_->_tmp71_, _g_free0_, __vala_GValue_free0_);
	_data_->details = _data_->_tmp72_;
	memset (&_data_->_tmp73_, 0, sizeof (GValue));
	g_value_init (&_data_->_tmp73_, GEE_TYPE_MULTI_MAP);
	_data_->im_addresses_value = _data_->_tmp73_;
	_data_->_tmp74_ = _data_->im_addresses;
	g_value_set_object (&_data_->im_addresses_value, (GObject*) _data_->_tmp74_);
	_data_->_tmp75_ = _data_->details;
	_data_->_tmp76_ = g_strdup ("im-addresses");
	_data_->_tmp77_ = _data_->im_addresses_value;
	_data_->_tmp78_ = _data_->_tmp77_;
	_data_->_tmp79_ = __g_value_dup0 (&_data_->_tmp78_);
	g_hash_table_insert (_data_->_tmp75_, _data_->_tmp76_, _data_->_tmp79_);
	{
		_data_->_tmp80_ = _data_->self->priv->destination_store;
		_data_->_tmp81_ = _data_->details;
		_data_->_state_ = 1;
		folks_persona_store_add_persona_from_details (_data_->_tmp80_, _data_->_tmp81_, folks_importers_pidgin_parse_contact_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp82_ = NULL;
		_data_->_tmp82_ = folks_persona_store_add_persona_from_details_finish (_data_->_tmp80_, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp83_ = _data_->_tmp82_;
		if (_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;
		}
		_g_object_unref0 (_data_->persona);
		_data_->persona = _data_->_tmp83_;
	}
	goto __finally7;
	__catch7_folks_persona_store_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp84_ = stderr;
		_data_->_tmp85_ = NULL;
		_data_->_tmp85_ = _ ("Failed to create new contact for buddy with alias ‘%s’ and IM addresse" \
"s:\n" \
"%s\n" \
"Error: %s\n");
		_data_->_tmp86_ = _data_->alias;
		_data_->_tmp87_ = _data_->im_address_string;
		_data_->_tmp88_ = _data_->e;
		_data_->_tmp89_ = _data_->_tmp88_->message;
		fprintf (_data_->_tmp84_, _data_->_tmp85_, _data_->_tmp86_, _data_->_tmp87_, _data_->_tmp89_);
		_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 (_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_->_tmp91_ = _data_->alias;
	if (_data_->_tmp91_ != NULL) {
		_data_->_tmp92_ = _data_->persona;
		_data_->_tmp90_ = G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp92_, FOLKS_TYPE_ALIAS_DETAILS);
	} else {
		_data_->_tmp90_ = FALSE;
	}
	_data_->_tmp93_ = _data_->_tmp90_;
	if (_data_->_tmp93_) {
		_data_->_tmp94_ = _data_->persona;
		_data_->_tmp95_ = _data_->alias;
		folks_alias_details_set_alias (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp94_, FOLKS_TYPE_ALIAS_DETAILS, FolksAliasDetails), _data_->_tmp95_);
	}
	_data_->_tmp96_ = stdout;
	_data_->_tmp97_ = NULL;
	_data_->_tmp97_ = _ ("Created contact ‘%s’ for buddy with alias ‘%s’ and IM addresses:\n" \
"%s");
	_data_->_tmp98_ = _data_->persona;
	_data_->_tmp99_ = folks_persona_get_uid (_data_->_tmp98_);
	_data_->_tmp100_ = _data_->_tmp99_;
	_data_->_tmp101_ = _data_->alias;
	_data_->_tmp102_ = _data_->im_address_string;
	fprintf (_data_->_tmp96_, _data_->_tmp97_, _data_->_tmp100_, _data_->_tmp101_, _data_->_tmp102_);
	_data_->_tmp103_ = _data_->self->priv->persona_count;
	_data_->self->priv->persona_count = _data_->_tmp103_ + 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* _tmp0_;
	glong _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* end;
	gchar* _tmp3_;
	_tmp0_ = str;
	_tmp1_ = maxlen;
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
	end = _tmp2_;
	_tmp3_ = end;
	if (_tmp3_ == NULL) {
		glong _tmp4_;
		_tmp4_ = maxlen;
		result = _tmp4_;
		return result;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_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_;
	gboolean _tmp3_;
	glong _tmp9_;
	glong _tmp15_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	glong _tmp21_;
	glong _tmp22_;
	gchar* _tmp23_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = offset;
	if (_tmp1_ >= ((glong) 0)) {
		glong _tmp2_;
		_tmp2_ = len;
		_tmp0_ = _tmp2_ >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	_tmp3_ = _tmp0_;
	if (_tmp3_) {
		glong _tmp4_;
		glong _tmp5_;
		glong _tmp6_ = 0L;
		_tmp4_ = offset;
		_tmp5_ = len;
		_tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_);
		string_length = _tmp6_;
	} else {
		gint _tmp7_;
		gint _tmp8_;
		_tmp7_ = strlen (self);
		_tmp8_ = _tmp7_;
		string_length = (glong) _tmp8_;
	}
	_tmp9_ = offset;
	if (_tmp9_ < ((glong) 0)) {
		glong _tmp10_;
		glong _tmp11_;
		glong _tmp12_;
		_tmp10_ = string_length;
		_tmp11_ = offset;
		offset = _tmp10_ + _tmp11_;
		_tmp12_ = offset;
		g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL);
	} else {
		glong _tmp13_;
		glong _tmp14_;
		_tmp13_ = offset;
		_tmp14_ = string_length;
		g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL);
	}
	_tmp15_ = len;
	if (_tmp15_ < ((glong) 0)) {
		glong _tmp16_;
		glong _tmp17_;
		_tmp16_ = string_length;
		_tmp17_ = offset;
		len = _tmp16_ - _tmp17_;
	}
	_tmp18_ = offset;
	_tmp19_ = len;
	_tmp20_ = string_length;
	g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL);
	_tmp21_ = offset;
	_tmp22_ = len;
	_tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_);
	result = _tmp23_;
	return result;
}


static gchar* folks_importers_pidgin_blist_protocol_to_tp_protocol (FolksImportersPidgin* self, const gchar* blist_protocol) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* tp_protocol;
	const gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp6_;
	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_;
		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_;
		_tmp7_ = g_strdup ("local-xmpp");
		_g_free0 (tp_protocol);
		tp_protocol = _tmp7_;
	} else {
		const gchar* _tmp8_;
		_tmp8_ = tp_protocol;
		if (g_strcmp0 (_tmp8_, "novell") == 0) {
			gchar* _tmp9_;
			_tmp9_ = g_strdup ("groupwise");
			_g_free0 (tp_protocol);
			tp_protocol = _tmp9_;
		} else {
			const gchar* _tmp10_;
			_tmp10_ = tp_protocol;
			if (g_strcmp0 (_tmp10_, "gg") == 0) {
				gchar* _tmp11_;
				_tmp11_ = g_strdup ("gadugadu");
				_g_free0 (tp_protocol);
				tp_protocol = _tmp11_;
			} else {
				const gchar* _tmp12_;
				_tmp12_ = tp_protocol;
				if (g_strcmp0 (_tmp12_, "meanwhile") == 0) {
					gchar* _tmp13_;
					_tmp13_ = g_strdup ("sametime");
					_g_free0 (tp_protocol);
					tp_protocol = _tmp13_;
				} else {
					const gchar* _tmp14_;
					_tmp14_ = tp_protocol;
					if (g_strcmp0 (_tmp14_, "simple") == 0) {
						gchar* _tmp15_;
						_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));
	FOLKS_IMPORTER_CLASS (klass)->import = folks_importers_pidgin_real_import;
	FOLKS_IMPORTER_CLASS (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;
}



