/* message.c generated by valac 0.56.19, the Vala compiler
 * generated from message.vala, do not modify */

#include "libdino.h"
#include <glib.h>
#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <glib-object.h>
#include "qlite.h"

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	DINO_ENTITIES_MESSAGE_0_PROPERTY,
	DINO_ENTITIES_MESSAGE_ID_PROPERTY,
	DINO_ENTITIES_MESSAGE_ACCOUNT_PROPERTY,
	DINO_ENTITIES_MESSAGE_COUNTERPART_PROPERTY,
	DINO_ENTITIES_MESSAGE_OURPART_PROPERTY,
	DINO_ENTITIES_MESSAGE_FROM_PROPERTY,
	DINO_ENTITIES_MESSAGE_TO_PROPERTY,
	DINO_ENTITIES_MESSAGE_DIRECTION_PROPERTY,
	DINO_ENTITIES_MESSAGE_REAL_JID_PROPERTY,
	DINO_ENTITIES_MESSAGE_TYPE__PROPERTY,
	DINO_ENTITIES_MESSAGE_BODY_PROPERTY,
	DINO_ENTITIES_MESSAGE_STANZA_ID_PROPERTY,
	DINO_ENTITIES_MESSAGE_SERVER_ID_PROPERTY,
	DINO_ENTITIES_MESSAGE_TIME_PROPERTY,
	DINO_ENTITIES_MESSAGE_LOCAL_TIME_PROPERTY,
	DINO_ENTITIES_MESSAGE_ENCRYPTION_PROPERTY,
	DINO_ENTITIES_MESSAGE_MARKED_PROPERTY,
	DINO_ENTITIES_MESSAGE_QUOTED_ITEM_ID_PROPERTY,
	DINO_ENTITIES_MESSAGE_NUM_PROPERTIES
};
static GParamSpec* dino_entities_message_properties[DINO_ENTITIES_MESSAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _qlite_database_unref0(var) ((var == NULL) ? NULL : (var = (qlite_database_unref (var), NULL)))
#define _qlite_statement_builder_unref0(var) ((var == NULL) ? NULL : (var = (qlite_statement_builder_unref (var), NULL)))
#define _xmpp_xep_fallback_indication_fallback_location_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_fallback_indication_fallback_location_unref (var), NULL)))
#define _qlite_row_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_unref (var), NULL)))
#define _qlite_row_iterator_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_iterator_unref (var), NULL)))
#define _xmpp_xep_fallback_indication_fallback_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_fallback_indication_fallback_unref (var), NULL)))

struct _DinoEntitiesMessagePrivate {
	gint _id;
	DinoEntitiesAccount* _account;
	XmppJid* _counterpart;
	XmppJid* _ourpart;
	gboolean _direction;
	XmppJid* _real_jid;
	DinoEntitiesMessageType _type_;
	gchar* body_;
	gchar* _stanza_id;
	gchar* _server_id;
	GDateTime* _time;
	GDateTime* _local_time;
	DinoEntitiesEncryption _encryption;
	DinoEntitiesMessageMarked marked_;
	gint _quoted_item_id;
	GeeList* fallbacks;
	GeeList* markups;
	DinoDatabase* db;
};

static gint DinoEntitiesMessage_private_offset;
static gpointer dino_entities_message_parent_class = NULL;
DinoEntitiesMessageMarked* dino_entities_message_MARKED_RECEIVED = NULL;
gint dino_entities_message_MARKED_RECEIVED_length1 = 0;

static void dino_entities_message_set_quoted_item_id (DinoEntitiesMessage* self,
                                               gint value);
static void dino_entities_message_on_update (DinoEntitiesMessage* self,
                                      GObject* o,
                                      GParamSpec* sp);
static void _dino_entities_message_on_update_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self);
static void dino_entities_message_fetch_body_meta (DinoEntitiesMessage* self);
static void dino_entities_message_finalize (GObject * obj);
static GType dino_entities_message_get_type_once (void);
static void _vala_dino_entities_message_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_dino_entities_message_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
dino_entities_message_get_instance_private (DinoEntitiesMessage* self)
{
	return G_STRUCT_MEMBER_P (self, DinoEntitiesMessage_private_offset);
}

static GType
dino_entities_message_marked_get_type_once (void)
{
	static const GEnumValue values[] = {{DINO_ENTITIES_MESSAGE_MARKED_NONE, "DINO_ENTITIES_MESSAGE_MARKED_NONE", "none"}, {DINO_ENTITIES_MESSAGE_MARKED_RECEIVED, "DINO_ENTITIES_MESSAGE_MARKED_RECEIVED", "received"}, {DINO_ENTITIES_MESSAGE_MARKED_READ, "DINO_ENTITIES_MESSAGE_MARKED_READ", "read"}, {DINO_ENTITIES_MESSAGE_MARKED_ACKNOWLEDGED, "DINO_ENTITIES_MESSAGE_MARKED_ACKNOWLEDGED", "acknowledged"}, {DINO_ENTITIES_MESSAGE_MARKED_UNSENT, "DINO_ENTITIES_MESSAGE_MARKED_UNSENT", "unsent"}, {DINO_ENTITIES_MESSAGE_MARKED_WONTSEND, "DINO_ENTITIES_MESSAGE_MARKED_WONTSEND", "wontsend"}, {DINO_ENTITIES_MESSAGE_MARKED_SENDING, "DINO_ENTITIES_MESSAGE_MARKED_SENDING", "sending"}, {DINO_ENTITIES_MESSAGE_MARKED_SENT, "DINO_ENTITIES_MESSAGE_MARKED_SENT", "sent"}, {DINO_ENTITIES_MESSAGE_MARKED_ERROR, "DINO_ENTITIES_MESSAGE_MARKED_ERROR", "error"}, {0, NULL, NULL}};
	GType dino_entities_message_marked_type_id;
	dino_entities_message_marked_type_id = g_enum_register_static ("DinoEntitiesMessageMarked", values);
	return dino_entities_message_marked_type_id;
}

GType
dino_entities_message_marked_get_type (void)
{
	static volatile gsize dino_entities_message_marked_type_id__once = 0;
	if (g_once_init_enter (&dino_entities_message_marked_type_id__once)) {
		GType dino_entities_message_marked_type_id;
		dino_entities_message_marked_type_id = dino_entities_message_marked_get_type_once ();
		g_once_init_leave (&dino_entities_message_marked_type_id__once, dino_entities_message_marked_type_id);
	}
	return dino_entities_message_marked_type_id__once;
}

gboolean
dino_entities_message_type_is_muc_semantic (DinoEntitiesMessageType self)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	if (self == DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self == DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT_PM;
	}
	result = _tmp0_;
	return result;
}

static GType
dino_entities_message_type_get_type_once (void)
{
	static const GEnumValue values[] = {{DINO_ENTITIES_MESSAGE_TYPE_ERROR, "DINO_ENTITIES_MESSAGE_TYPE_ERROR", "error"}, {DINO_ENTITIES_MESSAGE_TYPE_CHAT, "DINO_ENTITIES_MESSAGE_TYPE_CHAT", "chat"}, {DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT, "DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT", "groupchat"}, {DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT_PM, "DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT_PM", "groupchat-pm"}, {DINO_ENTITIES_MESSAGE_TYPE_UNKNOWN, "DINO_ENTITIES_MESSAGE_TYPE_UNKNOWN", "unknown"}, {0, NULL, NULL}};
	GType dino_entities_message_type_type_id;
	dino_entities_message_type_type_id = g_enum_register_static ("DinoEntitiesMessageType", values);
	return dino_entities_message_type_type_id;
}

GType
dino_entities_message_type_get_type (void)
{
	static volatile gsize dino_entities_message_type_type_id__once = 0;
	if (g_once_init_enter (&dino_entities_message_type_type_id__once)) {
		GType dino_entities_message_type_type_id;
		dino_entities_message_type_type_id = dino_entities_message_type_get_type_once ();
		g_once_init_leave (&dino_entities_message_type_type_id__once, dino_entities_message_type_type_id);
	}
	return dino_entities_message_type_type_id__once;
}

DinoEntitiesMessage*
dino_entities_message_construct (GType object_type,
                                 const gchar* body)
{
	DinoEntitiesMessage * self = NULL;
	self = (DinoEntitiesMessage*) g_object_new (object_type, NULL);
	dino_entities_message_set_body (self, body);
	return self;
}

DinoEntitiesMessage*
dino_entities_message_new (const gchar* body)
{
	return dino_entities_message_construct (DINO_ENTITIES_TYPE_MESSAGE, body);
}

static gpointer
_qlite_database_ref0 (gpointer self)
{
	return self ? qlite_database_ref (self) : NULL;
}

static void
_dino_entities_message_on_update_g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self)
{
	dino_entities_message_on_update ((DinoEntitiesMessage*) self, _sender, pspec);
}

DinoEntitiesMessage*
dino_entities_message_construct_from_row (GType object_type,
                                          DinoDatabase* db,
                                          QliteRow* row,
                                          GError** error)
{
	DinoEntitiesMessage * self = NULL;
	DinoDatabase* _tmp0_;
	DinoDatabaseMessageTable* _tmp1_;
	DinoDatabaseMessageTable* _tmp2_;
	QliteColumn* _tmp3_;
	gpointer _tmp4_;
	DinoDatabaseMessageTable* _tmp5_;
	DinoDatabaseMessageTable* _tmp6_;
	QliteColumn* _tmp7_;
	gpointer _tmp8_;
	DinoEntitiesAccount* _tmp9_;
	DinoEntitiesAccount* _tmp10_;
	DinoDatabaseMessageTable* _tmp11_;
	DinoDatabaseMessageTable* _tmp12_;
	QliteColumn* _tmp13_;
	gpointer _tmp14_;
	gchar* _tmp15_;
	DinoDatabaseMessageTable* _tmp16_;
	DinoDatabaseMessageTable* _tmp17_;
	QliteColumn* _tmp18_;
	gpointer _tmp19_;
	gchar* _tmp20_;
	DinoDatabaseMessageTable* _tmp21_;
	DinoDatabaseMessageTable* _tmp22_;
	QliteColumn* _tmp23_;
	gpointer _tmp24_;
	XmppJid* _tmp25_ = NULL;
	DinoDatabaseMessageTable* _tmp26_;
	DinoDatabaseMessageTable* _tmp27_;
	QliteColumn* _tmp28_;
	gpointer _tmp29_;
	XmppJid* _tmp30_;
	gchar* counterpart_resource = NULL;
	DinoDatabaseMessageTable* _tmp31_;
	DinoDatabaseMessageTable* _tmp32_;
	QliteColumn* _tmp33_;
	gpointer _tmp34_;
	const gchar* _tmp35_;
	gchar* our_resource = NULL;
	DinoDatabaseMessageTable* _tmp40_;
	DinoDatabaseMessageTable* _tmp41_;
	QliteColumn* _tmp42_;
	gpointer _tmp43_;
	gboolean _tmp44_ = FALSE;
	DinoEntitiesMessageType _tmp45_;
	DinoDatabaseMessageTable* _tmp64_;
	DinoDatabaseMessageTable* _tmp65_;
	QliteColumn* _tmp66_;
	gpointer _tmp67_;
	DinoDatabaseMessageTable* _tmp68_;
	DinoDatabaseMessageTable* _tmp69_;
	QliteColumn* _tmp70_;
	gpointer _tmp71_;
	GDateTime* _tmp72_;
	GDateTime* _tmp73_;
	DinoDatabaseMessageTable* _tmp74_;
	DinoDatabaseMessageTable* _tmp75_;
	QliteColumn* _tmp76_;
	gpointer _tmp77_;
	GDateTime* _tmp78_;
	GDateTime* _tmp79_;
	DinoDatabaseMessageTable* _tmp80_;
	DinoDatabaseMessageTable* _tmp81_;
	QliteColumn* _tmp82_;
	gpointer _tmp83_;
	gchar* _tmp84_;
	DinoDatabaseMessageTable* _tmp85_;
	DinoDatabaseMessageTable* _tmp86_;
	QliteColumn* _tmp87_;
	gpointer _tmp88_;
	DinoDatabaseMessageTable* _tmp89_;
	DinoDatabaseMessageTable* _tmp90_;
	QliteColumn* _tmp91_;
	gpointer _tmp92_;
	gchar* real_jid_str = NULL;
	DinoDatabaseRealJidTable* _tmp93_;
	DinoDatabaseRealJidTable* _tmp94_;
	QliteColumn* _tmp95_;
	gpointer _tmp96_;
	const gchar* _tmp97_;
	DinoDatabaseMessageCorrectionTable* _tmp101_;
	DinoDatabaseMessageCorrectionTable* _tmp102_;
	QliteColumn* _tmp103_;
	gpointer _tmp104_;
	DinoDatabaseReplyTable* _tmp105_;
	DinoDatabaseReplyTable* _tmp106_;
	QliteColumn* _tmp107_;
	gpointer _tmp108_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (db != NULL, NULL);
	g_return_val_if_fail (row != NULL, NULL);
	self = (DinoEntitiesMessage*) g_object_new (object_type, NULL);
	_tmp0_ = _qlite_database_ref0 (db);
	_qlite_database_unref0 (self->priv->db);
	self->priv->db = _tmp0_;
	_tmp1_ = dino_database_get_message (db);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_->id;
	_tmp4_ = qlite_row_get (row, G_TYPE_INT, NULL, NULL, _tmp3_);
	dino_entities_message_set_id (self, (gint) ((gintptr) _tmp4_));
	_tmp5_ = dino_database_get_message (db);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_->account_id;
	_tmp8_ = qlite_row_get (row, G_TYPE_INT, NULL, NULL, _tmp7_);
	_tmp9_ = dino_database_get_account_by_id (db, (gint) ((gintptr) _tmp8_));
	_tmp10_ = _tmp9_;
	dino_entities_message_set_account (self, _tmp10_);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = dino_database_get_message (db);
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_->stanza_id;
	_tmp14_ = qlite_row_get (row, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp13_);
	_tmp15_ = (gchar*) _tmp14_;
	dino_entities_message_set_stanza_id (self, _tmp15_);
	_g_free0 (_tmp15_);
	_tmp16_ = dino_database_get_message (db);
	_tmp17_ = _tmp16_;
	_tmp18_ = _tmp17_->server_id;
	_tmp19_ = qlite_row_get (row, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp18_);
	_tmp20_ = (gchar*) _tmp19_;
	dino_entities_message_set_server_id (self, _tmp20_);
	_g_free0 (_tmp20_);
	_tmp21_ = dino_database_get_message (db);
	_tmp22_ = _tmp21_;
	_tmp23_ = _tmp22_->type_;
	_tmp24_ = qlite_row_get (row, G_TYPE_INT, NULL, NULL, _tmp23_);
	dino_entities_message_set_type_ (self, (DinoEntitiesMessageType) ((gint) ((gintptr) _tmp24_)));
	_tmp26_ = dino_database_get_message (db);
	_tmp27_ = _tmp26_;
	_tmp28_ = _tmp27_->counterpart_id;
	_tmp29_ = qlite_row_get (row, G_TYPE_INT, NULL, NULL, _tmp28_);
	_tmp30_ = dino_database_get_jid_by_id (db, (gint) ((gintptr) _tmp29_), &_inner_error0_);
	_tmp25_ = _tmp30_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	dino_entities_message_set_counterpart (self, _tmp25_);
	_tmp31_ = dino_database_get_message (db);
	_tmp32_ = _tmp31_;
	_tmp33_ = _tmp32_->counterpart_resource;
	_tmp34_ = qlite_row_get (row, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp33_);
	counterpart_resource = (gchar*) _tmp34_;
	_tmp35_ = counterpart_resource;
	if (_tmp35_ != NULL) {
		XmppJid* _tmp36_ = NULL;
		XmppJid* _tmp37_;
		const gchar* _tmp38_;
		XmppJid* _tmp39_;
		_tmp37_ = self->priv->_counterpart;
		_tmp38_ = counterpart_resource;
		_tmp39_ = xmpp_jid_with_resource (_tmp37_, _tmp38_, &_inner_error0_);
		_tmp36_ = _tmp39_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
				g_propagate_error (error, _inner_error0_);
				_g_free0 (counterpart_resource);
				_xmpp_jid_unref0 (_tmp25_);
				_g_object_unref0 (self);
				return NULL;
			} else {
				_g_free0 (counterpart_resource);
				_xmpp_jid_unref0 (_tmp25_);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return NULL;
			}
		}
		dino_entities_message_set_counterpart (self, _tmp36_);
		_xmpp_jid_unref0 (_tmp36_);
	}
	_tmp40_ = dino_database_get_message (db);
	_tmp41_ = _tmp40_;
	_tmp42_ = _tmp41_->our_resource;
	_tmp43_ = qlite_row_get (row, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp42_);
	our_resource = (gchar*) _tmp43_;
	_tmp45_ = self->priv->_type_;
	if (_tmp45_ == DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT) {
		const gchar* _tmp46_;
		_tmp46_ = our_resource;
		_tmp44_ = _tmp46_ != NULL;
	} else {
		_tmp44_ = FALSE;
	}
	if (_tmp44_) {
		XmppJid* _tmp47_ = NULL;
		XmppJid* _tmp48_;
		const gchar* _tmp49_;
		XmppJid* _tmp50_;
		_tmp48_ = self->priv->_counterpart;
		_tmp49_ = our_resource;
		_tmp50_ = xmpp_jid_with_resource (_tmp48_, _tmp49_, &_inner_error0_);
		_tmp47_ = _tmp50_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
				g_propagate_error (error, _inner_error0_);
				_g_free0 (our_resource);
				_g_free0 (counterpart_resource);
				_xmpp_jid_unref0 (_tmp25_);
				_g_object_unref0 (self);
				return NULL;
			} else {
				_g_free0 (our_resource);
				_g_free0 (counterpart_resource);
				_xmpp_jid_unref0 (_tmp25_);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return NULL;
			}
		}
		dino_entities_message_set_ourpart (self, _tmp47_);
		_xmpp_jid_unref0 (_tmp47_);
	} else {
		const gchar* _tmp51_;
		_tmp51_ = our_resource;
		if (_tmp51_ != NULL) {
			XmppJid* _tmp52_ = NULL;
			DinoEntitiesAccount* _tmp53_;
			XmppJid* _tmp54_;
			XmppJid* _tmp55_;
			XmppJid* _tmp56_;
			const gchar* _tmp57_;
			XmppJid* _tmp58_;
			XmppJid* _tmp59_;
			_tmp53_ = self->priv->_account;
			_tmp54_ = dino_entities_account_get_bare_jid (_tmp53_);
			_tmp55_ = _tmp54_;
			_tmp56_ = _tmp55_;
			_tmp57_ = our_resource;
			_tmp58_ = xmpp_jid_with_resource (_tmp56_, _tmp57_, &_inner_error0_);
			_tmp59_ = _tmp58_;
			_xmpp_jid_unref0 (_tmp56_);
			_tmp52_ = _tmp59_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
					g_propagate_error (error, _inner_error0_);
					_g_free0 (our_resource);
					_g_free0 (counterpart_resource);
					_xmpp_jid_unref0 (_tmp25_);
					_g_object_unref0 (self);
					return NULL;
				} else {
					_g_free0 (our_resource);
					_g_free0 (counterpart_resource);
					_xmpp_jid_unref0 (_tmp25_);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return NULL;
				}
			}
			dino_entities_message_set_ourpart (self, _tmp52_);
			_xmpp_jid_unref0 (_tmp52_);
		} else {
			DinoEntitiesAccount* _tmp60_;
			XmppJid* _tmp61_;
			XmppJid* _tmp62_;
			XmppJid* _tmp63_;
			_tmp60_ = self->priv->_account;
			_tmp61_ = dino_entities_account_get_bare_jid (_tmp60_);
			_tmp62_ = _tmp61_;
			_tmp63_ = _tmp62_;
			dino_entities_message_set_ourpart (self, _tmp63_);
			_xmpp_jid_unref0 (_tmp63_);
		}
	}
	_tmp64_ = dino_database_get_message (db);
	_tmp65_ = _tmp64_;
	_tmp66_ = _tmp65_->direction;
	_tmp67_ = qlite_row_get (row, G_TYPE_BOOLEAN, NULL, NULL, _tmp66_);
	dino_entities_message_set_direction (self, (gboolean) ((gintptr) _tmp67_));
	_tmp68_ = dino_database_get_message (db);
	_tmp69_ = _tmp68_;
	_tmp70_ = _tmp69_->time;
	_tmp71_ = qlite_row_get (row, G_TYPE_LONG, NULL, NULL, _tmp70_);
	_tmp72_ = g_date_time_new_from_unix_utc ((gint64) ((glong) ((gintptr) _tmp71_)));
	_tmp73_ = _tmp72_;
	dino_entities_message_set_time (self, _tmp73_);
	_g_date_time_unref0 (_tmp73_);
	_tmp74_ = dino_database_get_message (db);
	_tmp75_ = _tmp74_;
	_tmp76_ = _tmp75_->local_time;
	_tmp77_ = qlite_row_get (row, G_TYPE_LONG, NULL, NULL, _tmp76_);
	_tmp78_ = g_date_time_new_from_unix_utc ((gint64) ((glong) ((gintptr) _tmp77_)));
	_tmp79_ = _tmp78_;
	dino_entities_message_set_local_time (self, _tmp79_);
	_g_date_time_unref0 (_tmp79_);
	_tmp80_ = dino_database_get_message (db);
	_tmp81_ = _tmp80_;
	_tmp82_ = _tmp81_->body;
	_tmp83_ = qlite_row_get (row, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp82_);
	_tmp84_ = (gchar*) _tmp83_;
	dino_entities_message_set_body (self, _tmp84_);
	_g_free0 (_tmp84_);
	_tmp85_ = dino_database_get_message (db);
	_tmp86_ = _tmp85_;
	_tmp87_ = _tmp86_->marked;
	_tmp88_ = qlite_row_get (row, G_TYPE_INT, NULL, NULL, _tmp87_);
	dino_entities_message_set_marked (self, (DinoEntitiesMessageMarked) ((gint) ((gintptr) _tmp88_)));
	_tmp89_ = dino_database_get_message (db);
	_tmp90_ = _tmp89_;
	_tmp91_ = _tmp90_->encryption;
	_tmp92_ = qlite_row_get (row, G_TYPE_INT, NULL, NULL, _tmp91_);
	dino_entities_message_set_encryption (self, (DinoEntitiesEncryption) ((gint) ((gintptr) _tmp92_)));
	_tmp93_ = dino_database_get_real_jid (db);
	_tmp94_ = _tmp93_;
	_tmp95_ = _tmp94_->real_jid;
	_tmp96_ = qlite_row_get (row, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp95_);
	real_jid_str = (gchar*) _tmp96_;
	_tmp97_ = real_jid_str;
	if (_tmp97_ != NULL) {
		XmppJid* _tmp98_ = NULL;
		const gchar* _tmp99_;
		XmppJid* _tmp100_;
		_tmp99_ = real_jid_str;
		_tmp100_ = xmpp_jid_new (_tmp99_, &_inner_error0_);
		_tmp98_ = _tmp100_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
				g_propagate_error (error, _inner_error0_);
				_g_free0 (real_jid_str);
				_g_free0 (our_resource);
				_g_free0 (counterpart_resource);
				_xmpp_jid_unref0 (_tmp25_);
				_g_object_unref0 (self);
				return NULL;
			} else {
				_g_free0 (real_jid_str);
				_g_free0 (our_resource);
				_g_free0 (counterpart_resource);
				_xmpp_jid_unref0 (_tmp25_);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return NULL;
			}
		}
		dino_entities_message_set_real_jid (self, _tmp98_);
		_xmpp_jid_unref0 (_tmp98_);
	}
	_tmp101_ = dino_database_get_message_correction (db);
	_tmp102_ = _tmp101_;
	_tmp103_ = _tmp102_->to_stanza_id;
	_tmp104_ = qlite_row_get (row, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp103_);
	_g_free0 (self->edit_to);
	self->edit_to = (gchar*) _tmp104_;
	_tmp105_ = dino_database_get_reply (db);
	_tmp106_ = _tmp105_;
	_tmp107_ = _tmp106_->quoted_content_item_id;
	_tmp108_ = qlite_row_get (row, G_TYPE_INT, NULL, NULL, _tmp107_);
	dino_entities_message_set_quoted_item_id (self, (gint) ((gintptr) _tmp108_));
	g_signal_connect_object ((GObject*) self, "notify", (GCallback) _dino_entities_message_on_update_g_object_notify, self, 0);
	_g_free0 (real_jid_str);
	_g_free0 (our_resource);
	_g_free0 (counterpart_resource);
	_xmpp_jid_unref0 (_tmp25_);
	return self;
}

DinoEntitiesMessage*
dino_entities_message_new_from_row (DinoDatabase* db,
                                    QliteRow* row,
                                    GError** error)
{
	return dino_entities_message_construct_from_row (DINO_ENTITIES_TYPE_MESSAGE, db, row, error);
}

void
dino_entities_message_persist (DinoEntitiesMessage* self,
                               DinoDatabase* db)
{
	gint _tmp0_;
	DinoDatabase* _tmp1_;
	QliteInsertBuilder* builder = NULL;
	DinoDatabaseMessageTable* _tmp2_;
	DinoDatabaseMessageTable* _tmp3_;
	QliteInsertBuilder* _tmp4_;
	QliteInsertBuilder* _tmp5_;
	DinoDatabaseMessageTable* _tmp6_;
	DinoDatabaseMessageTable* _tmp7_;
	QliteColumn* _tmp8_;
	DinoEntitiesAccount* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	QliteInsertBuilder* _tmp12_;
	QliteInsertBuilder* _tmp13_;
	DinoDatabaseMessageTable* _tmp14_;
	DinoDatabaseMessageTable* _tmp15_;
	QliteColumn* _tmp16_;
	XmppJid* _tmp17_;
	QliteInsertBuilder* _tmp18_;
	QliteInsertBuilder* _tmp19_;
	DinoDatabaseMessageTable* _tmp20_;
	DinoDatabaseMessageTable* _tmp21_;
	QliteColumn* _tmp22_;
	XmppJid* _tmp23_;
	const gchar* _tmp24_;
	QliteInsertBuilder* _tmp25_;
	QliteInsertBuilder* _tmp26_;
	DinoDatabaseMessageTable* _tmp27_;
	DinoDatabaseMessageTable* _tmp28_;
	QliteColumn* _tmp29_;
	XmppJid* _tmp30_;
	const gchar* _tmp31_;
	QliteInsertBuilder* _tmp32_;
	QliteInsertBuilder* _tmp33_;
	DinoDatabaseMessageTable* _tmp34_;
	DinoDatabaseMessageTable* _tmp35_;
	QliteColumn* _tmp36_;
	gboolean _tmp37_;
	QliteInsertBuilder* _tmp38_;
	QliteInsertBuilder* _tmp39_;
	DinoDatabaseMessageTable* _tmp40_;
	DinoDatabaseMessageTable* _tmp41_;
	QliteColumn* _tmp42_;
	DinoEntitiesMessageType _tmp43_;
	QliteInsertBuilder* _tmp44_;
	QliteInsertBuilder* _tmp45_;
	DinoDatabaseMessageTable* _tmp46_;
	DinoDatabaseMessageTable* _tmp47_;
	QliteColumn* _tmp48_;
	GDateTime* _tmp49_;
	QliteInsertBuilder* _tmp50_;
	QliteInsertBuilder* _tmp51_;
	DinoDatabaseMessageTable* _tmp52_;
	DinoDatabaseMessageTable* _tmp53_;
	QliteColumn* _tmp54_;
	GDateTime* _tmp55_;
	QliteInsertBuilder* _tmp56_;
	QliteInsertBuilder* _tmp57_;
	DinoDatabaseMessageTable* _tmp58_;
	DinoDatabaseMessageTable* _tmp59_;
	QliteColumn* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	QliteInsertBuilder* _tmp63_;
	QliteInsertBuilder* _tmp64_;
	DinoDatabaseMessageTable* _tmp65_;
	DinoDatabaseMessageTable* _tmp66_;
	QliteColumn* _tmp67_;
	DinoEntitiesEncryption _tmp68_;
	QliteInsertBuilder* _tmp69_;
	QliteInsertBuilder* _tmp70_;
	DinoDatabaseMessageTable* _tmp71_;
	DinoDatabaseMessageTable* _tmp72_;
	QliteColumn* _tmp73_;
	DinoEntitiesMessageMarked _tmp74_;
	DinoEntitiesMessageMarked _tmp75_;
	QliteInsertBuilder* _tmp76_;
	QliteInsertBuilder* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp86_;
	QliteInsertBuilder* _tmp94_;
	XmppJid* _tmp95_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (db != NULL);
	_tmp0_ = self->priv->_id;
	if (_tmp0_ != -1) {
		return;
	}
	_tmp1_ = _qlite_database_ref0 (db);
	_qlite_database_unref0 (self->priv->db);
	self->priv->db = _tmp1_;
	_tmp2_ = dino_database_get_message (db);
	_tmp3_ = _tmp2_;
	_tmp4_ = qlite_table_insert ((QliteTable*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = dino_database_get_message (db);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->account_id;
	_tmp9_ = self->priv->_account;
	_tmp10_ = dino_entities_account_get_id (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = qlite_insert_builder_value (_tmp5_, G_TYPE_INT, NULL, NULL, _tmp8_, (gpointer) ((gintptr) _tmp11_));
	_tmp13_ = _tmp12_;
	_tmp14_ = dino_database_get_message (db);
	_tmp15_ = _tmp14_;
	_tmp16_ = _tmp15_->counterpart_id;
	_tmp17_ = self->priv->_counterpart;
	_tmp18_ = qlite_insert_builder_value (_tmp13_, G_TYPE_INT, NULL, NULL, _tmp16_, (gpointer) ((gintptr) dino_database_get_jid_id (db, _tmp17_)));
	_tmp19_ = _tmp18_;
	_tmp20_ = dino_database_get_message (db);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_->counterpart_resource;
	_tmp23_ = self->priv->_counterpart;
	_tmp24_ = _tmp23_->resourcepart;
	_tmp25_ = qlite_insert_builder_value (_tmp19_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp22_, _tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = dino_database_get_message (db);
	_tmp28_ = _tmp27_;
	_tmp29_ = _tmp28_->our_resource;
	_tmp30_ = self->priv->_ourpart;
	_tmp31_ = _tmp30_->resourcepart;
	_tmp32_ = qlite_insert_builder_value (_tmp26_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp29_, _tmp31_);
	_tmp33_ = _tmp32_;
	_tmp34_ = dino_database_get_message (db);
	_tmp35_ = _tmp34_;
	_tmp36_ = _tmp35_->direction;
	_tmp37_ = self->priv->_direction;
	_tmp38_ = qlite_insert_builder_value (_tmp33_, G_TYPE_BOOLEAN, NULL, NULL, _tmp36_, (gpointer) ((gintptr) _tmp37_));
	_tmp39_ = _tmp38_;
	_tmp40_ = dino_database_get_message (db);
	_tmp41_ = _tmp40_;
	_tmp42_ = _tmp41_->type_;
	_tmp43_ = self->priv->_type_;
	_tmp44_ = qlite_insert_builder_value (_tmp39_, G_TYPE_INT, NULL, NULL, _tmp42_, (gpointer) ((gintptr) _tmp43_));
	_tmp45_ = _tmp44_;
	_tmp46_ = dino_database_get_message (db);
	_tmp47_ = _tmp46_;
	_tmp48_ = _tmp47_->time;
	_tmp49_ = self->priv->_time;
	_tmp50_ = qlite_insert_builder_value (_tmp45_, G_TYPE_LONG, NULL, NULL, _tmp48_, (gpointer) ((gintptr) g_date_time_to_unix (_tmp49_)));
	_tmp51_ = _tmp50_;
	_tmp52_ = dino_database_get_message (db);
	_tmp53_ = _tmp52_;
	_tmp54_ = _tmp53_->local_time;
	_tmp55_ = self->priv->_local_time;
	_tmp56_ = qlite_insert_builder_value (_tmp51_, G_TYPE_LONG, NULL, NULL, _tmp54_, (gpointer) ((gintptr) g_date_time_to_unix (_tmp55_)));
	_tmp57_ = _tmp56_;
	_tmp58_ = dino_database_get_message (db);
	_tmp59_ = _tmp58_;
	_tmp60_ = _tmp59_->body;
	_tmp61_ = dino_entities_message_get_body (self);
	_tmp62_ = _tmp61_;
	_tmp63_ = qlite_insert_builder_value (_tmp57_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp60_, _tmp62_);
	_tmp64_ = _tmp63_;
	_tmp65_ = dino_database_get_message (db);
	_tmp66_ = _tmp65_;
	_tmp67_ = _tmp66_->encryption;
	_tmp68_ = self->priv->_encryption;
	_tmp69_ = qlite_insert_builder_value (_tmp64_, G_TYPE_INT, NULL, NULL, _tmp67_, (gpointer) ((gintptr) _tmp68_));
	_tmp70_ = _tmp69_;
	_tmp71_ = dino_database_get_message (db);
	_tmp72_ = _tmp71_;
	_tmp73_ = _tmp72_->marked;
	_tmp74_ = dino_entities_message_get_marked (self);
	_tmp75_ = _tmp74_;
	_tmp76_ = qlite_insert_builder_value (_tmp70_, G_TYPE_INT, NULL, NULL, _tmp73_, (gpointer) ((gintptr) _tmp75_));
	_tmp77_ = _tmp76_;
	_qlite_statement_builder_unref0 (_tmp70_);
	_qlite_statement_builder_unref0 (_tmp64_);
	_qlite_statement_builder_unref0 (_tmp57_);
	_qlite_statement_builder_unref0 (_tmp51_);
	_qlite_statement_builder_unref0 (_tmp45_);
	_qlite_statement_builder_unref0 (_tmp39_);
	_qlite_statement_builder_unref0 (_tmp33_);
	_qlite_statement_builder_unref0 (_tmp26_);
	_qlite_statement_builder_unref0 (_tmp19_);
	_qlite_statement_builder_unref0 (_tmp13_);
	_qlite_statement_builder_unref0 (_tmp5_);
	builder = _tmp77_;
	_tmp78_ = self->priv->_stanza_id;
	if (_tmp78_ != NULL) {
		QliteInsertBuilder* _tmp79_;
		DinoDatabaseMessageTable* _tmp80_;
		DinoDatabaseMessageTable* _tmp81_;
		QliteColumn* _tmp82_;
		const gchar* _tmp83_;
		QliteInsertBuilder* _tmp84_;
		QliteInsertBuilder* _tmp85_;
		_tmp79_ = builder;
		_tmp80_ = dino_database_get_message (db);
		_tmp81_ = _tmp80_;
		_tmp82_ = _tmp81_->stanza_id;
		_tmp83_ = self->priv->_stanza_id;
		_tmp84_ = qlite_insert_builder_value (_tmp79_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp82_, _tmp83_);
		_tmp85_ = _tmp84_;
		_qlite_statement_builder_unref0 (_tmp85_);
	}
	_tmp86_ = self->priv->_server_id;
	if (_tmp86_ != NULL) {
		QliteInsertBuilder* _tmp87_;
		DinoDatabaseMessageTable* _tmp88_;
		DinoDatabaseMessageTable* _tmp89_;
		QliteColumn* _tmp90_;
		const gchar* _tmp91_;
		QliteInsertBuilder* _tmp92_;
		QliteInsertBuilder* _tmp93_;
		_tmp87_ = builder;
		_tmp88_ = dino_database_get_message (db);
		_tmp89_ = _tmp88_;
		_tmp90_ = _tmp89_->server_id;
		_tmp91_ = self->priv->_server_id;
		_tmp92_ = qlite_insert_builder_value (_tmp87_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp90_, _tmp91_);
		_tmp93_ = _tmp92_;
		_qlite_statement_builder_unref0 (_tmp93_);
	}
	_tmp94_ = builder;
	dino_entities_message_set_id (self, (gint) qlite_insert_builder_perform (_tmp94_));
	_tmp95_ = self->priv->_real_jid;
	if (_tmp95_ != NULL) {
		DinoDatabaseRealJidTable* _tmp96_;
		DinoDatabaseRealJidTable* _tmp97_;
		QliteInsertBuilder* _tmp98_;
		QliteInsertBuilder* _tmp99_;
		DinoDatabaseRealJidTable* _tmp100_;
		DinoDatabaseRealJidTable* _tmp101_;
		QliteColumn* _tmp102_;
		gint _tmp103_;
		QliteInsertBuilder* _tmp104_;
		QliteInsertBuilder* _tmp105_;
		DinoDatabaseRealJidTable* _tmp106_;
		DinoDatabaseRealJidTable* _tmp107_;
		QliteColumn* _tmp108_;
		XmppJid* _tmp109_;
		gchar* _tmp110_;
		gchar* _tmp111_;
		QliteInsertBuilder* _tmp112_;
		QliteInsertBuilder* _tmp113_;
		_tmp96_ = dino_database_get_real_jid (db);
		_tmp97_ = _tmp96_;
		_tmp98_ = qlite_table_insert ((QliteTable*) _tmp97_);
		_tmp99_ = _tmp98_;
		_tmp100_ = dino_database_get_real_jid (db);
		_tmp101_ = _tmp100_;
		_tmp102_ = _tmp101_->message_id;
		_tmp103_ = self->priv->_id;
		_tmp104_ = qlite_insert_builder_value (_tmp99_, G_TYPE_INT, NULL, NULL, _tmp102_, (gpointer) ((gintptr) _tmp103_));
		_tmp105_ = _tmp104_;
		_tmp106_ = dino_database_get_real_jid (db);
		_tmp107_ = _tmp106_;
		_tmp108_ = _tmp107_->real_jid;
		_tmp109_ = self->priv->_real_jid;
		_tmp110_ = xmpp_jid_to_string (_tmp109_);
		_tmp111_ = _tmp110_;
		_tmp112_ = qlite_insert_builder_value (_tmp105_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp108_, _tmp111_);
		_tmp113_ = _tmp112_;
		qlite_insert_builder_perform (_tmp113_);
		_qlite_statement_builder_unref0 (_tmp113_);
		_g_free0 (_tmp111_);
		_qlite_statement_builder_unref0 (_tmp105_);
		_qlite_statement_builder_unref0 (_tmp99_);
	}
	g_signal_connect_object ((GObject*) self, "notify", (GCallback) _dino_entities_message_on_update_g_object_notify, self, 0);
	_qlite_statement_builder_unref0 (builder);
}

void
dino_entities_message_set_quoted_item (DinoEntitiesMessage* self,
                                       gint quoted_content_item_id)
{
	gint _tmp0_;
	DinoDatabase* _tmp1_;
	DinoDatabaseReplyTable* _tmp2_;
	DinoDatabaseReplyTable* _tmp3_;
	QliteUpsertBuilder* _tmp4_;
	QliteUpsertBuilder* _tmp5_;
	DinoDatabase* _tmp6_;
	DinoDatabaseReplyTable* _tmp7_;
	DinoDatabaseReplyTable* _tmp8_;
	QliteColumn* _tmp9_;
	gint _tmp10_;
	QliteUpsertBuilder* _tmp11_;
	QliteUpsertBuilder* _tmp12_;
	DinoDatabase* _tmp13_;
	DinoDatabaseReplyTable* _tmp14_;
	DinoDatabaseReplyTable* _tmp15_;
	QliteColumn* _tmp16_;
	QliteUpsertBuilder* _tmp17_;
	QliteUpsertBuilder* _tmp18_;
	DinoDatabase* _tmp19_;
	DinoDatabaseReplyTable* _tmp20_;
	DinoDatabaseReplyTable* _tmp21_;
	QliteColumn* _tmp22_;
	QliteUpsertBuilder* _tmp23_;
	QliteUpsertBuilder* _tmp24_;
	DinoDatabase* _tmp25_;
	DinoDatabaseReplyTable* _tmp26_;
	DinoDatabaseReplyTable* _tmp27_;
	QliteColumn* _tmp28_;
	QliteUpsertBuilder* _tmp29_;
	QliteUpsertBuilder* _tmp30_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_id;
	if (_tmp0_ == -1) {
		g_warning ("message.vala:148: Message needs to be persisted before setting quoted " \
"item");
		return;
	}
	dino_entities_message_set_quoted_item_id (self, quoted_content_item_id);
	_tmp1_ = self->priv->db;
	_tmp2_ = dino_database_get_reply (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = qlite_table_upsert ((QliteTable*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->db;
	_tmp7_ = dino_database_get_reply (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_->message_id;
	_tmp10_ = self->priv->_id;
	_tmp11_ = qlite_upsert_builder_value (_tmp5_, G_TYPE_INT, NULL, NULL, _tmp9_, (gpointer) ((gintptr) _tmp10_), TRUE);
	_tmp12_ = _tmp11_;
	_tmp13_ = self->priv->db;
	_tmp14_ = dino_database_get_reply (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = _tmp15_->quoted_content_item_id;
	_tmp17_ = qlite_upsert_builder_value (_tmp12_, G_TYPE_INT, NULL, NULL, _tmp16_, (gpointer) ((gintptr) quoted_content_item_id), FALSE);
	_tmp18_ = _tmp17_;
	_tmp19_ = self->priv->db;
	_tmp20_ = dino_database_get_reply (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_->quoted_message_stanza_id;
	_tmp23_ = qlite_upsert_builder_value_null (_tmp18_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp22_, FALSE);
	_tmp24_ = _tmp23_;
	_tmp25_ = self->priv->db;
	_tmp26_ = dino_database_get_reply (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = _tmp27_->quoted_message_from;
	_tmp29_ = qlite_upsert_builder_value_null (_tmp24_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp28_, FALSE);
	_tmp30_ = _tmp29_;
	qlite_upsert_builder_perform (_tmp30_);
	_qlite_statement_builder_unref0 (_tmp30_);
	_qlite_statement_builder_unref0 (_tmp24_);
	_qlite_statement_builder_unref0 (_tmp18_);
	_qlite_statement_builder_unref0 (_tmp12_);
	_qlite_statement_builder_unref0 (_tmp5_);
}

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

GeeList*
dino_entities_message_get_fallbacks (DinoEntitiesMessage* self)
{
	GeeList* _tmp0_;
	GeeList* _tmp3_;
	GeeList* _tmp4_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->fallbacks;
	if (_tmp0_ != NULL) {
		GeeList* _tmp1_;
		GeeList* _tmp2_;
		_tmp1_ = self->priv->fallbacks;
		_tmp2_ = _g_object_ref0 (_tmp1_);
		result = _tmp2_;
		return result;
	}
	dino_entities_message_fetch_body_meta (self);
	_tmp3_ = self->priv->fallbacks;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	result = _tmp4_;
	return result;
}

GeeList*
dino_entities_message_get_markups (DinoEntitiesMessage* self)
{
	GeeList* _tmp0_;
	GeeList* _tmp3_;
	GeeList* _tmp4_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->markups;
	if (_tmp0_ != NULL) {
		GeeList* _tmp1_;
		GeeList* _tmp2_;
		_tmp1_ = self->priv->markups;
		_tmp2_ = _g_object_ref0 (_tmp1_);
		result = _tmp2_;
		return result;
	}
	dino_entities_message_fetch_body_meta (self);
	_tmp3_ = self->priv->markups;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	result = _tmp4_;
	return result;
}

void
dino_entities_message_persist_markups (DinoEntitiesMessage* self,
                                       GeeList* markups,
                                       gint message_id)
{
	GeeList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (markups != NULL);
	_tmp0_ = _g_object_ref0 (markups);
	_g_object_unref0 (self->priv->markups);
	self->priv->markups = _tmp0_;
	{
		GeeList* _span_list = NULL;
		gint _span_size = 0;
		GeeList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _span_index = 0;
		_span_list = markups;
		_tmp1_ = _span_list;
		_tmp2_ = gee_collection_get_size ((GeeCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_span_size = _tmp3_;
		_span_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			XmppXepMessageMarkupSpan* span = NULL;
			GeeList* _tmp6_;
			gpointer _tmp7_;
			_span_index = _span_index + 1;
			_tmp4_ = _span_index;
			_tmp5_ = _span_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _span_list;
			_tmp7_ = gee_list_get (_tmp6_, _span_index);
			span = (XmppXepMessageMarkupSpan*) _tmp7_;
			{
				GeeList* _ty_list = NULL;
				XmppXepMessageMarkupSpan* _tmp8_;
				GeeList* _tmp9_;
				GeeList* _tmp10_;
				gint _ty_size = 0;
				GeeList* _tmp11_;
				gint _tmp12_;
				gint _tmp13_;
				gint _ty_index = 0;
				_tmp8_ = span;
				_tmp9_ = xmpp_xep_message_markup_span_get_types (_tmp8_);
				_tmp10_ = _tmp9_;
				_ty_list = _tmp10_;
				_tmp11_ = _ty_list;
				_tmp12_ = gee_collection_get_size ((GeeCollection*) _tmp11_);
				_tmp13_ = _tmp12_;
				_ty_size = _tmp13_;
				_ty_index = -1;
				while (TRUE) {
					gint _tmp14_;
					gint _tmp15_;
					XmppXepMessageMarkupSpanType ty = 0;
					GeeList* _tmp16_;
					gpointer _tmp17_;
					DinoDatabase* _tmp18_;
					DinoDatabaseBodyMeta* _tmp19_;
					DinoDatabaseBodyMeta* _tmp20_;
					QliteInsertBuilder* _tmp21_;
					QliteInsertBuilder* _tmp22_;
					DinoDatabase* _tmp23_;
					DinoDatabaseBodyMeta* _tmp24_;
					DinoDatabaseBodyMeta* _tmp25_;
					QliteColumn* _tmp26_;
					QliteInsertBuilder* _tmp27_;
					QliteInsertBuilder* _tmp28_;
					DinoDatabase* _tmp29_;
					DinoDatabaseBodyMeta* _tmp30_;
					DinoDatabaseBodyMeta* _tmp31_;
					QliteColumn* _tmp32_;
					QliteInsertBuilder* _tmp33_;
					QliteInsertBuilder* _tmp34_;
					DinoDatabase* _tmp35_;
					DinoDatabaseBodyMeta* _tmp36_;
					DinoDatabaseBodyMeta* _tmp37_;
					QliteColumn* _tmp38_;
					gchar* _tmp39_;
					gchar* _tmp40_;
					QliteInsertBuilder* _tmp41_;
					QliteInsertBuilder* _tmp42_;
					DinoDatabase* _tmp43_;
					DinoDatabaseBodyMeta* _tmp44_;
					DinoDatabaseBodyMeta* _tmp45_;
					QliteColumn* _tmp46_;
					XmppXepMessageMarkupSpan* _tmp47_;
					gint _tmp48_;
					gint _tmp49_;
					QliteInsertBuilder* _tmp50_;
					QliteInsertBuilder* _tmp51_;
					DinoDatabase* _tmp52_;
					DinoDatabaseBodyMeta* _tmp53_;
					DinoDatabaseBodyMeta* _tmp54_;
					QliteColumn* _tmp55_;
					XmppXepMessageMarkupSpan* _tmp56_;
					gint _tmp57_;
					gint _tmp58_;
					QliteInsertBuilder* _tmp59_;
					QliteInsertBuilder* _tmp60_;
					_ty_index = _ty_index + 1;
					_tmp14_ = _ty_index;
					_tmp15_ = _ty_size;
					if (!(_tmp14_ < _tmp15_)) {
						break;
					}
					_tmp16_ = _ty_list;
					_tmp17_ = gee_list_get (_tmp16_, _ty_index);
					ty = (XmppXepMessageMarkupSpanType) ((gintptr) _tmp17_);
					_tmp18_ = self->priv->db;
					_tmp19_ = dino_database_get_body_meta (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = qlite_table_insert ((QliteTable*) _tmp20_);
					_tmp22_ = _tmp21_;
					_tmp23_ = self->priv->db;
					_tmp24_ = dino_database_get_body_meta (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp26_ = _tmp25_->info_type;
					_tmp27_ = qlite_insert_builder_value (_tmp22_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp26_, XMPP_XEP_MESSAGE_MARKUP_NS_URI);
					_tmp28_ = _tmp27_;
					_tmp29_ = self->priv->db;
					_tmp30_ = dino_database_get_body_meta (_tmp29_);
					_tmp31_ = _tmp30_;
					_tmp32_ = _tmp31_->message_id;
					_tmp33_ = qlite_insert_builder_value (_tmp28_, G_TYPE_INT, NULL, NULL, _tmp32_, (gpointer) ((gintptr) message_id));
					_tmp34_ = _tmp33_;
					_tmp35_ = self->priv->db;
					_tmp36_ = dino_database_get_body_meta (_tmp35_);
					_tmp37_ = _tmp36_;
					_tmp38_ = _tmp37_->info;
					_tmp39_ = xmpp_xep_message_markup_span_type_to_str (ty);
					_tmp40_ = _tmp39_;
					_tmp41_ = qlite_insert_builder_value (_tmp34_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp38_, _tmp40_);
					_tmp42_ = _tmp41_;
					_tmp43_ = self->priv->db;
					_tmp44_ = dino_database_get_body_meta (_tmp43_);
					_tmp45_ = _tmp44_;
					_tmp46_ = _tmp45_->from_char;
					_tmp47_ = span;
					_tmp48_ = xmpp_xep_message_markup_span_get_start_char (_tmp47_);
					_tmp49_ = _tmp48_;
					_tmp50_ = qlite_insert_builder_value (_tmp42_, G_TYPE_INT, NULL, NULL, _tmp46_, (gpointer) ((gintptr) _tmp49_));
					_tmp51_ = _tmp50_;
					_tmp52_ = self->priv->db;
					_tmp53_ = dino_database_get_body_meta (_tmp52_);
					_tmp54_ = _tmp53_;
					_tmp55_ = _tmp54_->to_char;
					_tmp56_ = span;
					_tmp57_ = xmpp_xep_message_markup_span_get_end_char (_tmp56_);
					_tmp58_ = _tmp57_;
					_tmp59_ = qlite_insert_builder_value (_tmp51_, G_TYPE_INT, NULL, NULL, _tmp55_, (gpointer) ((gintptr) _tmp58_));
					_tmp60_ = _tmp59_;
					qlite_insert_builder_perform (_tmp60_);
					_qlite_statement_builder_unref0 (_tmp60_);
					_qlite_statement_builder_unref0 (_tmp51_);
					_qlite_statement_builder_unref0 (_tmp42_);
					_g_free0 (_tmp40_);
					_qlite_statement_builder_unref0 (_tmp34_);
					_qlite_statement_builder_unref0 (_tmp28_);
					_qlite_statement_builder_unref0 (_tmp22_);
				}
			}
			_g_object_unref0 (span);
		}
	}
}

static void
dino_entities_message_fetch_body_meta (DinoEntitiesMessage* self)
{
	GeeHashMap* fallbacks_by_ns = NULL;
	GeeHashMap* _tmp0_;
	GeeArrayList* markups = NULL;
	GeeArrayList* _tmp1_;
	GeeArrayList* fallbacks = NULL;
	GeeArrayList* _tmp84_;
	GeeArrayList* _tmp102_;
	GeeList* _tmp103_;
	GeeArrayList* _tmp104_;
	GeeList* _tmp105_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	fallbacks_by_ns = _tmp0_;
	_tmp1_ = gee_array_list_new (XMPP_XEP_MESSAGE_MARKUP_TYPE_SPAN, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	markups = _tmp1_;
	{
		QliteRowIterator* _row_it = NULL;
		DinoDatabase* _tmp2_;
		DinoDatabaseBodyMeta* _tmp3_;
		DinoDatabaseBodyMeta* _tmp4_;
		QliteQueryBuilder* _tmp5_;
		QliteQueryBuilder* _tmp6_;
		DinoDatabase* _tmp7_;
		DinoDatabaseBodyMeta* _tmp8_;
		DinoDatabaseBodyMeta* _tmp9_;
		QliteColumn* _tmp10_;
		gint _tmp11_;
		QliteQueryBuilder* _tmp12_;
		QliteQueryBuilder* _tmp13_;
		QliteRowIterator* _tmp14_;
		QliteRowIterator* _tmp15_;
		_tmp2_ = self->priv->db;
		_tmp3_ = dino_database_get_body_meta (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = qlite_table_select ((QliteTable*) _tmp4_, NULL, (gint) 0);
		_tmp6_ = _tmp5_;
		_tmp7_ = self->priv->db;
		_tmp8_ = dino_database_get_body_meta (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_->message_id;
		_tmp11_ = self->priv->_id;
		_tmp12_ = qlite_query_builder_with (_tmp6_, G_TYPE_INT, NULL, NULL, _tmp10_, "=", (gpointer) ((gintptr) _tmp11_));
		_tmp13_ = _tmp12_;
		_tmp14_ = qlite_query_builder_iterator (_tmp13_);
		_tmp15_ = _tmp14_;
		_qlite_statement_builder_unref0 (_tmp13_);
		_qlite_statement_builder_unref0 (_tmp6_);
		_row_it = _tmp15_;
		while (TRUE) {
			QliteRowIterator* _tmp16_;
			QliteRow* row = NULL;
			QliteRowIterator* _tmp17_;
			QliteRow* _tmp18_;
			QliteRow* _tmp19_;
			DinoDatabase* _tmp20_;
			DinoDatabaseBodyMeta* _tmp21_;
			DinoDatabaseBodyMeta* _tmp22_;
			QliteColumn* _tmp23_;
			gpointer _tmp24_;
			gchar* _tmp25_;
			GQuark _tmp27_ = 0U;
			static GQuark _tmp26_label0 = 0;
			static GQuark _tmp26_label1 = 0;
			_tmp16_ = _row_it;
			if (!qlite_row_iterator_next (_tmp16_)) {
				break;
			}
			_tmp17_ = _row_it;
			_tmp18_ = qlite_row_iterator_get (_tmp17_);
			row = _tmp18_;
			_tmp19_ = row;
			_tmp20_ = self->priv->db;
			_tmp21_ = dino_database_get_body_meta (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp23_ = _tmp22_->info_type;
			_tmp24_ = qlite_row_get (_tmp19_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp23_);
			_tmp25_ = (gchar*) _tmp24_;
			_tmp27_ = (NULL == _tmp25_) ? 0 : g_quark_from_string (_tmp25_);
			g_free (_tmp25_);
			if (_tmp27_ == ((0 != _tmp26_label0) ? _tmp26_label0 : (_tmp26_label0 = g_quark_from_static_string (XMPP_XEP_FALLBACK_INDICATION_NS_URI)))) {
				switch (0) {
					default:
					{
						gchar* ns_uri = NULL;
						QliteRow* _tmp28_;
						DinoDatabase* _tmp29_;
						DinoDatabaseBodyMeta* _tmp30_;
						DinoDatabaseBodyMeta* _tmp31_;
						QliteColumn* _tmp32_;
						gpointer _tmp33_;
						GeeHashMap* _tmp34_;
						const gchar* _tmp35_;
						GeeHashMap* _tmp40_;
						const gchar* _tmp41_;
						gpointer _tmp42_;
						GeeArrayList* _tmp43_;
						QliteRow* _tmp44_;
						DinoDatabase* _tmp45_;
						DinoDatabaseBodyMeta* _tmp46_;
						DinoDatabaseBodyMeta* _tmp47_;
						QliteColumn* _tmp48_;
						gpointer _tmp49_;
						QliteRow* _tmp50_;
						DinoDatabase* _tmp51_;
						DinoDatabaseBodyMeta* _tmp52_;
						DinoDatabaseBodyMeta* _tmp53_;
						QliteColumn* _tmp54_;
						gpointer _tmp55_;
						XmppXepFallbackIndicationFallbackLocation* _tmp56_;
						XmppXepFallbackIndicationFallbackLocation* _tmp57_;
						_tmp28_ = row;
						_tmp29_ = self->priv->db;
						_tmp30_ = dino_database_get_body_meta (_tmp29_);
						_tmp31_ = _tmp30_;
						_tmp32_ = _tmp31_->info;
						_tmp33_ = qlite_row_get (_tmp28_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp32_);
						ns_uri = (gchar*) _tmp33_;
						_tmp34_ = fallbacks_by_ns;
						_tmp35_ = ns_uri;
						if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp34_, _tmp35_)) {
							GeeHashMap* _tmp36_;
							const gchar* _tmp37_;
							GeeArrayList* _tmp38_;
							GeeArrayList* _tmp39_;
							_tmp36_ = fallbacks_by_ns;
							_tmp37_ = ns_uri;
							_tmp38_ = gee_array_list_new (XMPP_XEP_FALLBACK_INDICATION_TYPE_FALLBACK_LOCATION, (GBoxedCopyFunc) xmpp_xep_fallback_indication_fallback_location_ref, (GDestroyNotify) xmpp_xep_fallback_indication_fallback_location_unref, NULL, NULL, NULL);
							_tmp39_ = _tmp38_;
							gee_abstract_map_set ((GeeAbstractMap*) _tmp36_, _tmp37_, _tmp39_);
							_g_object_unref0 (_tmp39_);
						}
						_tmp40_ = fallbacks_by_ns;
						_tmp41_ = ns_uri;
						_tmp42_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp40_, _tmp41_);
						_tmp43_ = (GeeArrayList*) _tmp42_;
						_tmp44_ = row;
						_tmp45_ = self->priv->db;
						_tmp46_ = dino_database_get_body_meta (_tmp45_);
						_tmp47_ = _tmp46_;
						_tmp48_ = _tmp47_->from_char;
						_tmp49_ = qlite_row_get (_tmp44_, G_TYPE_INT, NULL, NULL, _tmp48_);
						_tmp50_ = row;
						_tmp51_ = self->priv->db;
						_tmp52_ = dino_database_get_body_meta (_tmp51_);
						_tmp53_ = _tmp52_;
						_tmp54_ = _tmp53_->to_char;
						_tmp55_ = qlite_row_get (_tmp50_, G_TYPE_INT, NULL, NULL, _tmp54_);
						_tmp56_ = xmpp_xep_fallback_indication_fallback_location_new_partial_body ((gint) ((gintptr) _tmp49_), (gint) ((gintptr) _tmp55_));
						_tmp57_ = _tmp56_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp43_, _tmp57_);
						_xmpp_xep_fallback_indication_fallback_location_unref0 (_tmp57_);
						_g_object_unref0 (_tmp43_);
						_g_free0 (ns_uri);
						break;
					}
				}
			} else if (_tmp27_ == ((0 != _tmp26_label1) ? _tmp26_label1 : (_tmp26_label1 = g_quark_from_static_string (XMPP_XEP_MESSAGE_MARKUP_NS_URI)))) {
				switch (0) {
					default:
					{
						GeeArrayList* types = NULL;
						GeeArrayList* _tmp58_;
						GeeArrayList* _tmp59_;
						QliteRow* _tmp60_;
						DinoDatabase* _tmp61_;
						DinoDatabaseBodyMeta* _tmp62_;
						DinoDatabaseBodyMeta* _tmp63_;
						QliteColumn* _tmp64_;
						gpointer _tmp65_;
						gchar* _tmp66_;
						GeeArrayList* _tmp67_;
						GeeArrayList* _tmp68_;
						GeeList* _tmp69_;
						QliteRow* _tmp70_;
						DinoDatabase* _tmp71_;
						DinoDatabaseBodyMeta* _tmp72_;
						DinoDatabaseBodyMeta* _tmp73_;
						QliteColumn* _tmp74_;
						gpointer _tmp75_;
						QliteRow* _tmp76_;
						DinoDatabase* _tmp77_;
						DinoDatabaseBodyMeta* _tmp78_;
						DinoDatabaseBodyMeta* _tmp79_;
						QliteColumn* _tmp80_;
						gpointer _tmp81_;
						XmppXepMessageMarkupSpan* _tmp82_ = NULL;
						XmppXepMessageMarkupSpan* _tmp83_;
						_tmp58_ = gee_array_list_new (XMPP_XEP_MESSAGE_MARKUP_TYPE_SPAN_TYPE, NULL, NULL, NULL, NULL, NULL);
						types = _tmp58_;
						_tmp59_ = types;
						_tmp60_ = row;
						_tmp61_ = self->priv->db;
						_tmp62_ = dino_database_get_body_meta (_tmp61_);
						_tmp63_ = _tmp62_;
						_tmp64_ = _tmp63_->info;
						_tmp65_ = qlite_row_get (_tmp60_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp64_);
						_tmp66_ = (gchar*) _tmp65_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp59_, (gpointer) ((gintptr) xmpp_xep_message_markup_str_to_span_type (_tmp66_)));
						_g_free0 (_tmp66_);
						_tmp67_ = markups;
						_tmp68_ = types;
						_tmp69_ = _g_object_ref0 ((GeeList*) _tmp68_);
						_tmp70_ = row;
						_tmp71_ = self->priv->db;
						_tmp72_ = dino_database_get_body_meta (_tmp71_);
						_tmp73_ = _tmp72_;
						_tmp74_ = _tmp73_->from_char;
						_tmp75_ = qlite_row_get (_tmp70_, G_TYPE_INT, NULL, NULL, _tmp74_);
						_tmp76_ = row;
						_tmp77_ = self->priv->db;
						_tmp78_ = dino_database_get_body_meta (_tmp77_);
						_tmp79_ = _tmp78_;
						_tmp80_ = _tmp79_->to_char;
						_tmp81_ = qlite_row_get (_tmp76_, G_TYPE_INT, NULL, NULL, _tmp80_);
						_tmp82_ = xmpp_xep_message_markup_span_new ();
						xmpp_xep_message_markup_span_set_types (_tmp82_, _tmp69_);
						_g_object_unref0 (_tmp69_);
						xmpp_xep_message_markup_span_set_start_char (_tmp82_, (gint) ((gintptr) _tmp75_));
						xmpp_xep_message_markup_span_set_end_char (_tmp82_, (gint) ((gintptr) _tmp81_));
						_tmp83_ = _tmp82_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp67_, _tmp83_);
						_g_object_unref0 (_tmp83_);
						_g_object_unref0 (types);
						break;
					}
				}
			}
			_qlite_row_unref0 (row);
		}
		_qlite_row_iterator_unref0 (_row_it);
	}
	_tmp84_ = gee_array_list_new (XMPP_XEP_FALLBACK_INDICATION_TYPE_FALLBACK, (GBoxedCopyFunc) xmpp_xep_fallback_indication_fallback_ref, (GDestroyNotify) xmpp_xep_fallback_indication_fallback_unref, NULL, NULL, NULL);
	fallbacks = _tmp84_;
	{
		GeeIterator* _ns_uri_it = NULL;
		GeeHashMap* _tmp85_;
		GeeSet* _tmp86_;
		GeeSet* _tmp87_;
		GeeSet* _tmp88_;
		GeeIterator* _tmp89_;
		GeeIterator* _tmp90_;
		_tmp85_ = fallbacks_by_ns;
		_tmp86_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp85_);
		_tmp87_ = _tmp86_;
		_tmp88_ = _tmp87_;
		_tmp89_ = gee_iterable_iterator ((GeeIterable*) _tmp88_);
		_tmp90_ = _tmp89_;
		_g_object_unref0 (_tmp88_);
		_ns_uri_it = _tmp90_;
		while (TRUE) {
			GeeIterator* _tmp91_;
			gchar* ns_uri = NULL;
			GeeIterator* _tmp92_;
			gpointer _tmp93_;
			GeeArrayList* _tmp94_;
			const gchar* _tmp95_;
			GeeHashMap* _tmp96_;
			const gchar* _tmp97_;
			gpointer _tmp98_;
			GeeArrayList* _tmp99_;
			XmppXepFallbackIndicationFallback* _tmp100_;
			XmppXepFallbackIndicationFallback* _tmp101_;
			_tmp91_ = _ns_uri_it;
			if (!gee_iterator_next (_tmp91_)) {
				break;
			}
			_tmp92_ = _ns_uri_it;
			_tmp93_ = gee_iterator_get (_tmp92_);
			ns_uri = (gchar*) _tmp93_;
			_tmp94_ = fallbacks;
			_tmp95_ = ns_uri;
			_tmp96_ = fallbacks_by_ns;
			_tmp97_ = ns_uri;
			_tmp98_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp96_, _tmp97_);
			_tmp99_ = (GeeArrayList*) _tmp98_;
			_tmp100_ = xmpp_xep_fallback_indication_fallback_new (_tmp95_, (GeeList*) _tmp99_);
			_tmp101_ = _tmp100_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp94_, _tmp101_);
			_xmpp_xep_fallback_indication_fallback_unref0 (_tmp101_);
			_g_object_unref0 (_tmp99_);
			_g_free0 (ns_uri);
		}
		_g_object_unref0 (_ns_uri_it);
	}
	_tmp102_ = fallbacks;
	_tmp103_ = _g_object_ref0 ((GeeList*) _tmp102_);
	_g_object_unref0 (self->priv->fallbacks);
	self->priv->fallbacks = _tmp103_;
	_tmp104_ = markups;
	_tmp105_ = _g_object_ref0 ((GeeList*) _tmp104_);
	_g_object_unref0 (self->priv->markups);
	self->priv->markups = _tmp105_;
	_g_object_unref0 (fallbacks);
	_g_object_unref0 (markups);
	_g_object_unref0 (fallbacks_by_ns);
}

void
dino_entities_message_set_fallbacks (DinoEntitiesMessage* self,
                                     GeeList* fallbacks)
{
	gint _tmp0_;
	GeeList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (fallbacks != NULL);
	_tmp0_ = self->priv->_id;
	if (_tmp0_ == -1) {
		g_warning ("message.vala:223: Message needs to be persisted before setting fallbac" \
"ks");
		return;
	}
	_tmp1_ = _g_object_ref0 (fallbacks);
	_g_object_unref0 (self->priv->fallbacks);
	self->priv->fallbacks = _tmp1_;
	{
		GeeList* _fallback_list = NULL;
		gint _fallback_size = 0;
		GeeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _fallback_index = 0;
		_fallback_list = fallbacks;
		_tmp2_ = _fallback_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_fallback_size = _tmp4_;
		_fallback_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			XmppXepFallbackIndicationFallback* fallback = NULL;
			GeeList* _tmp7_;
			gpointer _tmp8_;
			_fallback_index = _fallback_index + 1;
			_tmp5_ = _fallback_index;
			_tmp6_ = _fallback_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _fallback_list;
			_tmp8_ = gee_list_get (_tmp7_, _fallback_index);
			fallback = (XmppXepFallbackIndicationFallback*) _tmp8_;
			{
				GeeList* _location_list = NULL;
				XmppXepFallbackIndicationFallback* _tmp9_;
				GeeList* _tmp10_;
				gint _location_size = 0;
				GeeList* _tmp11_;
				gint _tmp12_;
				gint _tmp13_;
				gint _location_index = 0;
				_tmp9_ = fallback;
				_tmp10_ = _tmp9_->locations;
				_location_list = _tmp10_;
				_tmp11_ = _location_list;
				_tmp12_ = gee_collection_get_size ((GeeCollection*) _tmp11_);
				_tmp13_ = _tmp12_;
				_location_size = _tmp13_;
				_location_index = -1;
				while (TRUE) {
					gint _tmp14_;
					gint _tmp15_;
					XmppXepFallbackIndicationFallbackLocation* location = NULL;
					GeeList* _tmp16_;
					gpointer _tmp17_;
					DinoDatabase* _tmp18_;
					DinoDatabaseBodyMeta* _tmp19_;
					DinoDatabaseBodyMeta* _tmp20_;
					QliteInsertBuilder* _tmp21_;
					QliteInsertBuilder* _tmp22_;
					DinoDatabase* _tmp23_;
					DinoDatabaseBodyMeta* _tmp24_;
					DinoDatabaseBodyMeta* _tmp25_;
					QliteColumn* _tmp26_;
					gint _tmp27_;
					QliteInsertBuilder* _tmp28_;
					QliteInsertBuilder* _tmp29_;
					DinoDatabase* _tmp30_;
					DinoDatabaseBodyMeta* _tmp31_;
					DinoDatabaseBodyMeta* _tmp32_;
					QliteColumn* _tmp33_;
					QliteInsertBuilder* _tmp34_;
					QliteInsertBuilder* _tmp35_;
					DinoDatabase* _tmp36_;
					DinoDatabaseBodyMeta* _tmp37_;
					DinoDatabaseBodyMeta* _tmp38_;
					QliteColumn* _tmp39_;
					XmppXepFallbackIndicationFallback* _tmp40_;
					const gchar* _tmp41_;
					const gchar* _tmp42_;
					QliteInsertBuilder* _tmp43_;
					QliteInsertBuilder* _tmp44_;
					DinoDatabase* _tmp45_;
					DinoDatabaseBodyMeta* _tmp46_;
					DinoDatabaseBodyMeta* _tmp47_;
					QliteColumn* _tmp48_;
					XmppXepFallbackIndicationFallbackLocation* _tmp49_;
					gint _tmp50_;
					gint _tmp51_;
					QliteInsertBuilder* _tmp52_;
					QliteInsertBuilder* _tmp53_;
					DinoDatabase* _tmp54_;
					DinoDatabaseBodyMeta* _tmp55_;
					DinoDatabaseBodyMeta* _tmp56_;
					QliteColumn* _tmp57_;
					XmppXepFallbackIndicationFallbackLocation* _tmp58_;
					gint _tmp59_;
					gint _tmp60_;
					QliteInsertBuilder* _tmp61_;
					QliteInsertBuilder* _tmp62_;
					_location_index = _location_index + 1;
					_tmp14_ = _location_index;
					_tmp15_ = _location_size;
					if (!(_tmp14_ < _tmp15_)) {
						break;
					}
					_tmp16_ = _location_list;
					_tmp17_ = gee_list_get (_tmp16_, _location_index);
					location = (XmppXepFallbackIndicationFallbackLocation*) _tmp17_;
					_tmp18_ = self->priv->db;
					_tmp19_ = dino_database_get_body_meta (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = qlite_table_insert ((QliteTable*) _tmp20_);
					_tmp22_ = _tmp21_;
					_tmp23_ = self->priv->db;
					_tmp24_ = dino_database_get_body_meta (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp26_ = _tmp25_->message_id;
					_tmp27_ = self->priv->_id;
					_tmp28_ = qlite_insert_builder_value (_tmp22_, G_TYPE_INT, NULL, NULL, _tmp26_, (gpointer) ((gintptr) _tmp27_));
					_tmp29_ = _tmp28_;
					_tmp30_ = self->priv->db;
					_tmp31_ = dino_database_get_body_meta (_tmp30_);
					_tmp32_ = _tmp31_;
					_tmp33_ = _tmp32_->info_type;
					_tmp34_ = qlite_insert_builder_value (_tmp29_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp33_, XMPP_XEP_FALLBACK_INDICATION_NS_URI);
					_tmp35_ = _tmp34_;
					_tmp36_ = self->priv->db;
					_tmp37_ = dino_database_get_body_meta (_tmp36_);
					_tmp38_ = _tmp37_;
					_tmp39_ = _tmp38_->info;
					_tmp40_ = fallback;
					_tmp41_ = xmpp_xep_fallback_indication_fallback_get_ns_uri (_tmp40_);
					_tmp42_ = _tmp41_;
					_tmp43_ = qlite_insert_builder_value (_tmp35_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp39_, _tmp42_);
					_tmp44_ = _tmp43_;
					_tmp45_ = self->priv->db;
					_tmp46_ = dino_database_get_body_meta (_tmp45_);
					_tmp47_ = _tmp46_;
					_tmp48_ = _tmp47_->from_char;
					_tmp49_ = location;
					_tmp50_ = xmpp_xep_fallback_indication_fallback_location_get_from_char (_tmp49_);
					_tmp51_ = _tmp50_;
					_tmp52_ = qlite_insert_builder_value (_tmp44_, G_TYPE_INT, NULL, NULL, _tmp48_, (gpointer) ((gintptr) _tmp51_));
					_tmp53_ = _tmp52_;
					_tmp54_ = self->priv->db;
					_tmp55_ = dino_database_get_body_meta (_tmp54_);
					_tmp56_ = _tmp55_;
					_tmp57_ = _tmp56_->to_char;
					_tmp58_ = location;
					_tmp59_ = xmpp_xep_fallback_indication_fallback_location_get_to_char (_tmp58_);
					_tmp60_ = _tmp59_;
					_tmp61_ = qlite_insert_builder_value (_tmp53_, G_TYPE_INT, NULL, NULL, _tmp57_, (gpointer) ((gintptr) _tmp60_));
					_tmp62_ = _tmp61_;
					qlite_insert_builder_perform (_tmp62_);
					_qlite_statement_builder_unref0 (_tmp62_);
					_qlite_statement_builder_unref0 (_tmp53_);
					_qlite_statement_builder_unref0 (_tmp44_);
					_qlite_statement_builder_unref0 (_tmp35_);
					_qlite_statement_builder_unref0 (_tmp29_);
					_qlite_statement_builder_unref0 (_tmp22_);
					_xmpp_xep_fallback_indication_fallback_location_unref0 (location);
				}
			}
			_xmpp_xep_fallback_indication_fallback_unref0 (fallback);
		}
	}
}

void
dino_entities_message_set_type_string (DinoEntitiesMessage* self,
                                       const gchar* type)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (type != NULL);
	_tmp0_ = type;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string (XMPP_MESSAGE_STANZA_TYPE_CHAT)))) {
		switch (0) {
			default:
			{
				dino_entities_message_set_type_ (self, DINO_ENTITIES_MESSAGE_TYPE_CHAT);
				break;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string (XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT)))) {
		switch (0) {
			default:
			{
				dino_entities_message_set_type_ (self, DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT);
				break;
			}
		}
	}
}

gchar*
dino_entities_message_get_type_string (DinoEntitiesMessage* self)
{
	DinoEntitiesMessageType _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_type_;
	switch (_tmp0_) {
		case DINO_ENTITIES_MESSAGE_TYPE_CHAT:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup (XMPP_MESSAGE_STANZA_TYPE_CHAT);
			result = _tmp1_;
			return result;
		}
		case DINO_ENTITIES_MESSAGE_TYPE_GROUPCHAT:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup (XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT);
			result = _tmp2_;
			return result;
		}
		default:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup (XMPP_MESSAGE_STANZA_TYPE_NORMAL);
			result = _tmp3_;
			return result;
		}
	}
}

gboolean
dino_entities_message_equals (DinoEntitiesMessage* self,
                              DinoEntitiesMessage* m)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (m == NULL) {
		result = FALSE;
		return result;
	}
	result = dino_entities_message_equals_func (self, m);
	return result;
}

gboolean
dino_entities_message_equals_func (DinoEntitiesMessage* m1,
                                   DinoEntitiesMessage* m2)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (m1 != NULL, FALSE);
	g_return_val_if_fail (m2 != NULL, FALSE);
	_tmp1_ = m1->priv->_stanza_id;
	_tmp2_ = m2->priv->_stanza_id;
	if (g_strcmp0 (_tmp1_, _tmp2_) == 0) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp3_ = dino_entities_message_get_body (m1);
		_tmp4_ = _tmp3_;
		_tmp5_ = dino_entities_message_get_body (m2);
		_tmp6_ = _tmp5_;
		_tmp0_ = g_strcmp0 (_tmp4_, _tmp6_) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

guint
dino_entities_message_hash_func (DinoEntitiesMessage* message)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	guint result;
	g_return_val_if_fail (message != NULL, 0U);
	_tmp0_ = dino_entities_message_get_body (message);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		result = (guint) 0;
		return result;
	}
	_tmp2_ = dino_entities_message_get_body (message);
	_tmp3_ = _tmp2_;
	result = g_str_hash (_tmp3_);
	return result;
}

static void
dino_entities_message_on_update (DinoEntitiesMessage* self,
                                 GObject* o,
                                 GParamSpec* sp)
{
	QliteUpdateBuilder* update_builder = NULL;
	DinoDatabase* _tmp0_;
	DinoDatabaseMessageTable* _tmp1_;
	DinoDatabaseMessageTable* _tmp2_;
	QliteUpdateBuilder* _tmp3_;
	QliteUpdateBuilder* _tmp4_;
	DinoDatabase* _tmp5_;
	DinoDatabaseMessageTable* _tmp6_;
	DinoDatabaseMessageTable* _tmp7_;
	QliteColumn* _tmp8_;
	gint _tmp9_;
	QliteUpdateBuilder* _tmp10_;
	QliteUpdateBuilder* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GQuark _tmp15_ = 0U;
	static GQuark _tmp14_label0 = 0;
	static GQuark _tmp14_label1 = 0;
	static GQuark _tmp14_label2 = 0;
	static GQuark _tmp14_label3 = 0;
	static GQuark _tmp14_label4 = 0;
	static GQuark _tmp14_label5 = 0;
	static GQuark _tmp14_label6 = 0;
	static GQuark _tmp14_label7 = 0;
	static GQuark _tmp14_label8 = 0;
	static GQuark _tmp14_label9 = 0;
	static GQuark _tmp14_label10 = 0;
	QliteUpdateBuilder* _tmp117_;
	const gchar* _tmp118_;
	const gchar* _tmp140_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (o != NULL);
	g_return_if_fail (sp != NULL);
	_tmp0_ = self->priv->db;
	_tmp1_ = dino_database_get_message (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = qlite_table_update ((QliteTable*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->db;
	_tmp6_ = dino_database_get_message (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->id;
	_tmp9_ = self->priv->_id;
	_tmp10_ = qlite_update_builder_with (_tmp4_, G_TYPE_INT, NULL, NULL, _tmp8_, "=", (gpointer) ((gintptr) _tmp9_));
	_tmp11_ = _tmp10_;
	_qlite_statement_builder_unref0 (_tmp4_);
	update_builder = _tmp11_;
	_tmp12_ = sp->name;
	_tmp13_ = _tmp12_;
	_tmp15_ = (NULL == _tmp13_) ? 0 : g_quark_from_string (_tmp13_);
	if (_tmp15_ == ((0 != _tmp14_label0) ? _tmp14_label0 : (_tmp14_label0 = g_quark_from_static_string ("stanza-id")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp16_;
				DinoDatabase* _tmp17_;
				DinoDatabaseMessageTable* _tmp18_;
				DinoDatabaseMessageTable* _tmp19_;
				QliteColumn* _tmp20_;
				const gchar* _tmp21_;
				QliteUpdateBuilder* _tmp22_;
				QliteUpdateBuilder* _tmp23_;
				_tmp16_ = update_builder;
				_tmp17_ = self->priv->db;
				_tmp18_ = dino_database_get_message (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp20_ = _tmp19_->stanza_id;
				_tmp21_ = self->priv->_stanza_id;
				_tmp22_ = qlite_update_builder_set (_tmp16_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp20_, _tmp21_);
				_tmp23_ = _tmp22_;
				_qlite_statement_builder_unref0 (_tmp23_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label1) ? _tmp14_label1 : (_tmp14_label1 = g_quark_from_static_string ("server-id")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp24_;
				DinoDatabase* _tmp25_;
				DinoDatabaseMessageTable* _tmp26_;
				DinoDatabaseMessageTable* _tmp27_;
				QliteColumn* _tmp28_;
				const gchar* _tmp29_;
				QliteUpdateBuilder* _tmp30_;
				QliteUpdateBuilder* _tmp31_;
				_tmp24_ = update_builder;
				_tmp25_ = self->priv->db;
				_tmp26_ = dino_database_get_message (_tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = _tmp27_->server_id;
				_tmp29_ = self->priv->_server_id;
				_tmp30_ = qlite_update_builder_set (_tmp24_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp28_, _tmp29_);
				_tmp31_ = _tmp30_;
				_qlite_statement_builder_unref0 (_tmp31_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label2) ? _tmp14_label2 : (_tmp14_label2 = g_quark_from_static_string ("counterpart")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp32_;
				DinoDatabase* _tmp33_;
				DinoDatabaseMessageTable* _tmp34_;
				DinoDatabaseMessageTable* _tmp35_;
				QliteColumn* _tmp36_;
				DinoDatabase* _tmp37_;
				XmppJid* _tmp38_;
				QliteUpdateBuilder* _tmp39_;
				QliteUpdateBuilder* _tmp40_;
				QliteUpdateBuilder* _tmp41_;
				DinoDatabase* _tmp42_;
				DinoDatabaseMessageTable* _tmp43_;
				DinoDatabaseMessageTable* _tmp44_;
				QliteColumn* _tmp45_;
				XmppJid* _tmp46_;
				const gchar* _tmp47_;
				QliteUpdateBuilder* _tmp48_;
				QliteUpdateBuilder* _tmp49_;
				_tmp32_ = update_builder;
				_tmp33_ = self->priv->db;
				_tmp34_ = dino_database_get_message (_tmp33_);
				_tmp35_ = _tmp34_;
				_tmp36_ = _tmp35_->counterpart_id;
				_tmp37_ = self->priv->db;
				_tmp38_ = self->priv->_counterpart;
				_tmp39_ = qlite_update_builder_set (_tmp32_, G_TYPE_INT, NULL, NULL, _tmp36_, (gpointer) ((gintptr) dino_database_get_jid_id (_tmp37_, _tmp38_)));
				_tmp40_ = _tmp39_;
				_qlite_statement_builder_unref0 (_tmp40_);
				_tmp41_ = update_builder;
				_tmp42_ = self->priv->db;
				_tmp43_ = dino_database_get_message (_tmp42_);
				_tmp44_ = _tmp43_;
				_tmp45_ = _tmp44_->counterpart_resource;
				_tmp46_ = self->priv->_counterpart;
				_tmp47_ = _tmp46_->resourcepart;
				_tmp48_ = qlite_update_builder_set (_tmp41_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp45_, _tmp47_);
				_tmp49_ = _tmp48_;
				_qlite_statement_builder_unref0 (_tmp49_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label3) ? _tmp14_label3 : (_tmp14_label3 = g_quark_from_static_string ("ourpart")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp50_;
				DinoDatabase* _tmp51_;
				DinoDatabaseMessageTable* _tmp52_;
				DinoDatabaseMessageTable* _tmp53_;
				QliteColumn* _tmp54_;
				XmppJid* _tmp55_;
				const gchar* _tmp56_;
				QliteUpdateBuilder* _tmp57_;
				QliteUpdateBuilder* _tmp58_;
				_tmp50_ = update_builder;
				_tmp51_ = self->priv->db;
				_tmp52_ = dino_database_get_message (_tmp51_);
				_tmp53_ = _tmp52_;
				_tmp54_ = _tmp53_->our_resource;
				_tmp55_ = self->priv->_ourpart;
				_tmp56_ = _tmp55_->resourcepart;
				_tmp57_ = qlite_update_builder_set (_tmp50_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp54_, _tmp56_);
				_tmp58_ = _tmp57_;
				_qlite_statement_builder_unref0 (_tmp58_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label4) ? _tmp14_label4 : (_tmp14_label4 = g_quark_from_static_string ("direction")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp59_;
				DinoDatabase* _tmp60_;
				DinoDatabaseMessageTable* _tmp61_;
				DinoDatabaseMessageTable* _tmp62_;
				QliteColumn* _tmp63_;
				gboolean _tmp64_;
				QliteUpdateBuilder* _tmp65_;
				QliteUpdateBuilder* _tmp66_;
				_tmp59_ = update_builder;
				_tmp60_ = self->priv->db;
				_tmp61_ = dino_database_get_message (_tmp60_);
				_tmp62_ = _tmp61_;
				_tmp63_ = _tmp62_->direction;
				_tmp64_ = self->priv->_direction;
				_tmp65_ = qlite_update_builder_set (_tmp59_, G_TYPE_BOOLEAN, NULL, NULL, _tmp63_, (gpointer) ((gintptr) _tmp64_));
				_tmp66_ = _tmp65_;
				_qlite_statement_builder_unref0 (_tmp66_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label5) ? _tmp14_label5 : (_tmp14_label5 = g_quark_from_static_string ("type-")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp67_;
				DinoDatabase* _tmp68_;
				DinoDatabaseMessageTable* _tmp69_;
				DinoDatabaseMessageTable* _tmp70_;
				QliteColumn* _tmp71_;
				DinoEntitiesMessageType _tmp72_;
				QliteUpdateBuilder* _tmp73_;
				QliteUpdateBuilder* _tmp74_;
				_tmp67_ = update_builder;
				_tmp68_ = self->priv->db;
				_tmp69_ = dino_database_get_message (_tmp68_);
				_tmp70_ = _tmp69_;
				_tmp71_ = _tmp70_->type_;
				_tmp72_ = self->priv->_type_;
				_tmp73_ = qlite_update_builder_set (_tmp67_, G_TYPE_INT, NULL, NULL, _tmp71_, (gpointer) ((gintptr) _tmp72_));
				_tmp74_ = _tmp73_;
				_qlite_statement_builder_unref0 (_tmp74_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label6) ? _tmp14_label6 : (_tmp14_label6 = g_quark_from_static_string ("time")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp75_;
				DinoDatabase* _tmp76_;
				DinoDatabaseMessageTable* _tmp77_;
				DinoDatabaseMessageTable* _tmp78_;
				QliteColumn* _tmp79_;
				GDateTime* _tmp80_;
				QliteUpdateBuilder* _tmp81_;
				QliteUpdateBuilder* _tmp82_;
				_tmp75_ = update_builder;
				_tmp76_ = self->priv->db;
				_tmp77_ = dino_database_get_message (_tmp76_);
				_tmp78_ = _tmp77_;
				_tmp79_ = _tmp78_->time;
				_tmp80_ = self->priv->_time;
				_tmp81_ = qlite_update_builder_set (_tmp75_, G_TYPE_LONG, NULL, NULL, _tmp79_, (gpointer) ((gintptr) g_date_time_to_unix (_tmp80_)));
				_tmp82_ = _tmp81_;
				_qlite_statement_builder_unref0 (_tmp82_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label7) ? _tmp14_label7 : (_tmp14_label7 = g_quark_from_static_string ("local-time")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp83_;
				DinoDatabase* _tmp84_;
				DinoDatabaseMessageTable* _tmp85_;
				DinoDatabaseMessageTable* _tmp86_;
				QliteColumn* _tmp87_;
				GDateTime* _tmp88_;
				QliteUpdateBuilder* _tmp89_;
				QliteUpdateBuilder* _tmp90_;
				_tmp83_ = update_builder;
				_tmp84_ = self->priv->db;
				_tmp85_ = dino_database_get_message (_tmp84_);
				_tmp86_ = _tmp85_;
				_tmp87_ = _tmp86_->local_time;
				_tmp88_ = self->priv->_local_time;
				_tmp89_ = qlite_update_builder_set (_tmp83_, G_TYPE_LONG, NULL, NULL, _tmp87_, (gpointer) ((gintptr) g_date_time_to_unix (_tmp88_)));
				_tmp90_ = _tmp89_;
				_qlite_statement_builder_unref0 (_tmp90_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label8) ? _tmp14_label8 : (_tmp14_label8 = g_quark_from_static_string ("body")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp91_;
				DinoDatabase* _tmp92_;
				DinoDatabaseMessageTable* _tmp93_;
				DinoDatabaseMessageTable* _tmp94_;
				QliteColumn* _tmp95_;
				const gchar* _tmp96_;
				const gchar* _tmp97_;
				QliteUpdateBuilder* _tmp98_;
				QliteUpdateBuilder* _tmp99_;
				_tmp91_ = update_builder;
				_tmp92_ = self->priv->db;
				_tmp93_ = dino_database_get_message (_tmp92_);
				_tmp94_ = _tmp93_;
				_tmp95_ = _tmp94_->body;
				_tmp96_ = dino_entities_message_get_body (self);
				_tmp97_ = _tmp96_;
				_tmp98_ = qlite_update_builder_set (_tmp91_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp95_, _tmp97_);
				_tmp99_ = _tmp98_;
				_qlite_statement_builder_unref0 (_tmp99_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label9) ? _tmp14_label9 : (_tmp14_label9 = g_quark_from_static_string ("encryption")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp100_;
				DinoDatabase* _tmp101_;
				DinoDatabaseMessageTable* _tmp102_;
				DinoDatabaseMessageTable* _tmp103_;
				QliteColumn* _tmp104_;
				DinoEntitiesEncryption _tmp105_;
				QliteUpdateBuilder* _tmp106_;
				QliteUpdateBuilder* _tmp107_;
				_tmp100_ = update_builder;
				_tmp101_ = self->priv->db;
				_tmp102_ = dino_database_get_message (_tmp101_);
				_tmp103_ = _tmp102_;
				_tmp104_ = _tmp103_->encryption;
				_tmp105_ = self->priv->_encryption;
				_tmp106_ = qlite_update_builder_set (_tmp100_, G_TYPE_INT, NULL, NULL, _tmp104_, (gpointer) ((gintptr) _tmp105_));
				_tmp107_ = _tmp106_;
				_qlite_statement_builder_unref0 (_tmp107_);
				break;
			}
		}
	} else if (_tmp15_ == ((0 != _tmp14_label10) ? _tmp14_label10 : (_tmp14_label10 = g_quark_from_static_string ("marked")))) {
		switch (0) {
			default:
			{
				QliteUpdateBuilder* _tmp108_;
				DinoDatabase* _tmp109_;
				DinoDatabaseMessageTable* _tmp110_;
				DinoDatabaseMessageTable* _tmp111_;
				QliteColumn* _tmp112_;
				DinoEntitiesMessageMarked _tmp113_;
				DinoEntitiesMessageMarked _tmp114_;
				QliteUpdateBuilder* _tmp115_;
				QliteUpdateBuilder* _tmp116_;
				_tmp108_ = update_builder;
				_tmp109_ = self->priv->db;
				_tmp110_ = dino_database_get_message (_tmp109_);
				_tmp111_ = _tmp110_;
				_tmp112_ = _tmp111_->marked;
				_tmp113_ = dino_entities_message_get_marked (self);
				_tmp114_ = _tmp113_;
				_tmp115_ = qlite_update_builder_set (_tmp108_, G_TYPE_INT, NULL, NULL, _tmp112_, (gpointer) ((gintptr) _tmp114_));
				_tmp116_ = _tmp115_;
				_qlite_statement_builder_unref0 (_tmp116_);
				break;
			}
		}
	}
	_tmp117_ = update_builder;
	qlite_update_builder_perform (_tmp117_);
	_tmp118_ = g_param_spec_get_name (sp);
	if (g_strcmp0 (_tmp118_, "real-jid") == 0) {
		DinoDatabase* _tmp119_;
		DinoDatabaseRealJidTable* _tmp120_;
		DinoDatabaseRealJidTable* _tmp121_;
		QliteUpsertBuilder* _tmp122_;
		QliteUpsertBuilder* _tmp123_;
		DinoDatabase* _tmp124_;
		DinoDatabaseRealJidTable* _tmp125_;
		DinoDatabaseRealJidTable* _tmp126_;
		QliteColumn* _tmp127_;
		gint _tmp128_;
		QliteUpsertBuilder* _tmp129_;
		QliteUpsertBuilder* _tmp130_;
		DinoDatabase* _tmp131_;
		DinoDatabaseRealJidTable* _tmp132_;
		DinoDatabaseRealJidTable* _tmp133_;
		QliteColumn* _tmp134_;
		XmppJid* _tmp135_;
		gchar* _tmp136_;
		gchar* _tmp137_;
		QliteUpsertBuilder* _tmp138_;
		QliteUpsertBuilder* _tmp139_;
		_tmp119_ = self->priv->db;
		_tmp120_ = dino_database_get_real_jid (_tmp119_);
		_tmp121_ = _tmp120_;
		_tmp122_ = qlite_table_upsert ((QliteTable*) _tmp121_);
		_tmp123_ = _tmp122_;
		_tmp124_ = self->priv->db;
		_tmp125_ = dino_database_get_real_jid (_tmp124_);
		_tmp126_ = _tmp125_;
		_tmp127_ = _tmp126_->message_id;
		_tmp128_ = self->priv->_id;
		_tmp129_ = qlite_upsert_builder_value (_tmp123_, G_TYPE_INT, NULL, NULL, _tmp127_, (gpointer) ((gintptr) _tmp128_), TRUE);
		_tmp130_ = _tmp129_;
		_tmp131_ = self->priv->db;
		_tmp132_ = dino_database_get_real_jid (_tmp131_);
		_tmp133_ = _tmp132_;
		_tmp134_ = _tmp133_->real_jid;
		_tmp135_ = self->priv->_real_jid;
		_tmp136_ = xmpp_jid_to_string (_tmp135_);
		_tmp137_ = _tmp136_;
		_tmp138_ = qlite_upsert_builder_value (_tmp130_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp134_, _tmp137_, FALSE);
		_tmp139_ = _tmp138_;
		qlite_upsert_builder_perform (_tmp139_);
		_qlite_statement_builder_unref0 (_tmp139_);
		_g_free0 (_tmp137_);
		_qlite_statement_builder_unref0 (_tmp130_);
		_qlite_statement_builder_unref0 (_tmp123_);
	}
	_tmp140_ = g_param_spec_get_name (sp);
	if (g_strcmp0 (_tmp140_, "quoted-item-id") == 0) {
		DinoDatabase* _tmp141_;
		DinoDatabaseReplyTable* _tmp142_;
		DinoDatabaseReplyTable* _tmp143_;
		QliteUpsertBuilder* _tmp144_;
		QliteUpsertBuilder* _tmp145_;
		DinoDatabase* _tmp146_;
		DinoDatabaseReplyTable* _tmp147_;
		DinoDatabaseReplyTable* _tmp148_;
		QliteColumn* _tmp149_;
		gint _tmp150_;
		QliteUpsertBuilder* _tmp151_;
		QliteUpsertBuilder* _tmp152_;
		DinoDatabase* _tmp153_;
		DinoDatabaseReplyTable* _tmp154_;
		DinoDatabaseReplyTable* _tmp155_;
		QliteColumn* _tmp156_;
		gint _tmp157_;
		QliteUpsertBuilder* _tmp158_;
		QliteUpsertBuilder* _tmp159_;
		_tmp141_ = self->priv->db;
		_tmp142_ = dino_database_get_reply (_tmp141_);
		_tmp143_ = _tmp142_;
		_tmp144_ = qlite_table_upsert ((QliteTable*) _tmp143_);
		_tmp145_ = _tmp144_;
		_tmp146_ = self->priv->db;
		_tmp147_ = dino_database_get_reply (_tmp146_);
		_tmp148_ = _tmp147_;
		_tmp149_ = _tmp148_->message_id;
		_tmp150_ = self->priv->_id;
		_tmp151_ = qlite_upsert_builder_value (_tmp145_, G_TYPE_INT, NULL, NULL, _tmp149_, (gpointer) ((gintptr) _tmp150_), TRUE);
		_tmp152_ = _tmp151_;
		_tmp153_ = self->priv->db;
		_tmp154_ = dino_database_get_reply (_tmp153_);
		_tmp155_ = _tmp154_;
		_tmp156_ = _tmp155_->quoted_content_item_id;
		_tmp157_ = self->priv->_quoted_item_id;
		_tmp158_ = qlite_upsert_builder_value (_tmp152_, G_TYPE_INT, NULL, NULL, _tmp156_, (gpointer) ((gintptr) _tmp157_), FALSE);
		_tmp159_ = _tmp158_;
		qlite_upsert_builder_perform (_tmp159_);
		_qlite_statement_builder_unref0 (_tmp159_);
		_qlite_statement_builder_unref0 (_tmp152_);
		_qlite_statement_builder_unref0 (_tmp145_);
	}
	_qlite_statement_builder_unref0 (update_builder);
}

gint
dino_entities_message_get_id (DinoEntitiesMessage* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_id;
	return result;
}

void
dino_entities_message_set_id (DinoEntitiesMessage* self,
                              gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_id (self);
	if (old_value != value) {
		self->priv->_id = value;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_ID_PROPERTY]);
	}
}

DinoEntitiesAccount*
dino_entities_message_get_account (DinoEntitiesMessage* self)
{
	DinoEntitiesAccount* result;
	DinoEntitiesAccount* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_account;
	result = _tmp0_;
	return result;
}

void
dino_entities_message_set_account (DinoEntitiesMessage* self,
                                   DinoEntitiesAccount* value)
{
	DinoEntitiesAccount* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_account (self);
	if (old_value != value) {
		DinoEntitiesAccount* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_account);
		self->priv->_account = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_ACCOUNT_PROPERTY]);
	}
}

XmppJid*
dino_entities_message_get_counterpart (DinoEntitiesMessage* self)
{
	XmppJid* result;
	XmppJid* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_counterpart;
	result = _tmp0_;
	return result;
}

static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

void
dino_entities_message_set_counterpart (DinoEntitiesMessage* self,
                                       XmppJid* value)
{
	XmppJid* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_counterpart (self);
	if (old_value != value) {
		XmppJid* _tmp0_;
		_tmp0_ = _xmpp_jid_ref0 (value);
		_xmpp_jid_unref0 (self->priv->_counterpart);
		self->priv->_counterpart = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_COUNTERPART_PROPERTY]);
	}
}

XmppJid*
dino_entities_message_get_ourpart (DinoEntitiesMessage* self)
{
	XmppJid* result;
	XmppJid* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_ourpart;
	result = _tmp0_;
	return result;
}

void
dino_entities_message_set_ourpart (DinoEntitiesMessage* self,
                                   XmppJid* value)
{
	XmppJid* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_ourpart (self);
	if (old_value != value) {
		XmppJid* _tmp0_;
		_tmp0_ = _xmpp_jid_ref0 (value);
		_xmpp_jid_unref0 (self->priv->_ourpart);
		self->priv->_ourpart = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_OURPART_PROPERTY]);
	}
}

XmppJid*
dino_entities_message_get_from (DinoEntitiesMessage* self)
{
	XmppJid* result;
	XmppJid* _tmp0_ = NULL;
	gboolean _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_direction;
	if (_tmp1_ == DINO_ENTITIES_MESSAGE_DIRECTION_SENT) {
		XmppJid* _tmp2_;
		_tmp2_ = self->priv->_ourpart;
		_tmp0_ = _tmp2_;
	} else {
		XmppJid* _tmp3_;
		_tmp3_ = self->priv->_counterpart;
		_tmp0_ = _tmp3_;
	}
	result = _tmp0_;
	return result;
}

XmppJid*
dino_entities_message_get_to (DinoEntitiesMessage* self)
{
	XmppJid* result;
	XmppJid* _tmp0_ = NULL;
	gboolean _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_direction;
	if (_tmp1_ == DINO_ENTITIES_MESSAGE_DIRECTION_SENT) {
		XmppJid* _tmp2_;
		_tmp2_ = self->priv->_counterpart;
		_tmp0_ = _tmp2_;
	} else {
		XmppJid* _tmp3_;
		_tmp3_ = self->priv->_ourpart;
		_tmp0_ = _tmp3_;
	}
	result = _tmp0_;
	return result;
}

gboolean
dino_entities_message_get_direction (DinoEntitiesMessage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_direction;
	return result;
}

void
dino_entities_message_set_direction (DinoEntitiesMessage* self,
                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_direction (self);
	if (old_value != value) {
		self->priv->_direction = value;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_DIRECTION_PROPERTY]);
	}
}

XmppJid*
dino_entities_message_get_real_jid (DinoEntitiesMessage* self)
{
	XmppJid* result;
	XmppJid* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_real_jid;
	result = _tmp0_;
	return result;
}

void
dino_entities_message_set_real_jid (DinoEntitiesMessage* self,
                                    XmppJid* value)
{
	XmppJid* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_real_jid (self);
	if (old_value != value) {
		XmppJid* _tmp0_;
		_tmp0_ = _xmpp_jid_ref0 (value);
		_xmpp_jid_unref0 (self->priv->_real_jid);
		self->priv->_real_jid = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_REAL_JID_PROPERTY]);
	}
}

DinoEntitiesMessageType
dino_entities_message_get_type_ (DinoEntitiesMessage* self)
{
	DinoEntitiesMessageType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_type_;
	return result;
}

void
dino_entities_message_set_type_ (DinoEntitiesMessage* self,
                                 DinoEntitiesMessageType value)
{
	DinoEntitiesMessageType old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_type_ (self);
	if (old_value != value) {
		self->priv->_type_ = value;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_TYPE__PROPERTY]);
	}
}

const gchar*
dino_entities_message_get_body (DinoEntitiesMessage* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->body_;
	result = _tmp0_;
	return result;
}

void
dino_entities_message_set_body (DinoEntitiesMessage* self,
                                const gchar* value)
{
	gchar* _tmp0_ = NULL;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	if (value != NULL) {
		gchar* _tmp1_;
		_tmp1_ = g_utf8_make_valid (value, (gssize) -1);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		_g_free0 (_tmp0_);
		_tmp0_ = NULL;
	}
	_tmp2_ = _tmp0_;
	_tmp0_ = NULL;
	_g_free0 (self->priv->body_);
	self->priv->body_ = _tmp2_;
	_g_free0 (_tmp0_);
	g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_BODY_PROPERTY]);
}

const gchar*
dino_entities_message_get_stanza_id (DinoEntitiesMessage* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stanza_id;
	result = _tmp0_;
	return result;
}

void
dino_entities_message_set_stanza_id (DinoEntitiesMessage* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_stanza_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_stanza_id);
		self->priv->_stanza_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_STANZA_ID_PROPERTY]);
	}
}

const gchar*
dino_entities_message_get_server_id (DinoEntitiesMessage* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_server_id;
	result = _tmp0_;
	return result;
}

void
dino_entities_message_set_server_id (DinoEntitiesMessage* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_server_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_server_id);
		self->priv->_server_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_SERVER_ID_PROPERTY]);
	}
}

GDateTime*
dino_entities_message_get_time (DinoEntitiesMessage* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_time;
	result = _tmp0_;
	return result;
}

static gpointer
_g_date_time_ref0 (gpointer self)
{
	return self ? g_date_time_ref (self) : NULL;
}

void
dino_entities_message_set_time (DinoEntitiesMessage* self,
                                GDateTime* value)
{
	GDateTime* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_time (self);
	if (old_value != value) {
		GDateTime* _tmp0_;
		_tmp0_ = _g_date_time_ref0 (value);
		_g_date_time_unref0 (self->priv->_time);
		self->priv->_time = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_TIME_PROPERTY]);
	}
}

GDateTime*
dino_entities_message_get_local_time (DinoEntitiesMessage* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_local_time;
	result = _tmp0_;
	return result;
}

void
dino_entities_message_set_local_time (DinoEntitiesMessage* self,
                                      GDateTime* value)
{
	GDateTime* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_local_time (self);
	if (old_value != value) {
		GDateTime* _tmp0_;
		_tmp0_ = _g_date_time_ref0 (value);
		_g_date_time_unref0 (self->priv->_local_time);
		self->priv->_local_time = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_LOCAL_TIME_PROPERTY]);
	}
}

DinoEntitiesEncryption
dino_entities_message_get_encryption (DinoEntitiesMessage* self)
{
	DinoEntitiesEncryption result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_encryption;
	return result;
}

void
dino_entities_message_set_encryption (DinoEntitiesMessage* self,
                                      DinoEntitiesEncryption value)
{
	DinoEntitiesEncryption old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_encryption (self);
	if (old_value != value) {
		self->priv->_encryption = value;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_ENCRYPTION_PROPERTY]);
	}
}

DinoEntitiesMessageMarked
dino_entities_message_get_marked (DinoEntitiesMessage* self)
{
	DinoEntitiesMessageMarked result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->marked_;
	return result;
}

void
dino_entities_message_set_marked (DinoEntitiesMessage* self,
                                  DinoEntitiesMessageMarked value)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (value == DINO_ENTITIES_MESSAGE_MARKED_RECEIVED) {
		DinoEntitiesMessageMarked _tmp1_;
		DinoEntitiesMessageMarked _tmp2_;
		_tmp1_ = dino_entities_message_get_marked (self);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_ == DINO_ENTITIES_MESSAGE_MARKED_READ;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	self->priv->marked_ = value;
	g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_MARKED_PROPERTY]);
}

gint
dino_entities_message_get_quoted_item_id (DinoEntitiesMessage* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_quoted_item_id;
	return result;
}

static void
dino_entities_message_set_quoted_item_id (DinoEntitiesMessage* self,
                                          gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_entities_message_get_quoted_item_id (self);
	if (old_value != value) {
		self->priv->_quoted_item_id = value;
		g_object_notify_by_pspec ((GObject *) self, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_QUOTED_ITEM_ID_PROPERTY]);
	}
}

static void
dino_entities_message_class_init (DinoEntitiesMessageClass * klass,
                                  gpointer klass_data)
{
	DinoEntitiesMessageMarked* _tmp0_;
	dino_entities_message_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoEntitiesMessage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_entities_message_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_entities_message_set_property;
	G_OBJECT_CLASS (klass)->finalize = dino_entities_message_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_ID_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_ID_PROPERTY] = g_param_spec_int ("id", "id", "id", G_MININT, G_MAXINT, -1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_ACCOUNT_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", DINO_ENTITIES_TYPE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_COUNTERPART_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_COUNTERPART_PROPERTY] = xmpp_param_spec_jid ("counterpart", "counterpart", "counterpart", XMPP_TYPE_JID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_OURPART_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_OURPART_PROPERTY] = xmpp_param_spec_jid ("ourpart", "ourpart", "ourpart", XMPP_TYPE_JID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_FROM_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_FROM_PROPERTY] = xmpp_param_spec_jid ("from", "from", "from", XMPP_TYPE_JID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_TO_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_TO_PROPERTY] = xmpp_param_spec_jid ("to", "to", "to", XMPP_TYPE_JID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_DIRECTION_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_DIRECTION_PROPERTY] = g_param_spec_boolean ("direction", "direction", "direction", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_REAL_JID_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_REAL_JID_PROPERTY] = xmpp_param_spec_jid ("real-jid", "real-jid", "real-jid", XMPP_TYPE_JID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_TYPE__PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_TYPE__PROPERTY] = g_param_spec_enum ("type-", "type-", "type-", DINO_ENTITIES_MESSAGE_TYPE_TYPE, DINO_ENTITIES_MESSAGE_TYPE_UNKNOWN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_BODY_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_BODY_PROPERTY] = g_param_spec_string ("body", "body", "body", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_STANZA_ID_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_STANZA_ID_PROPERTY] = g_param_spec_string ("stanza-id", "stanza-id", "stanza-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_SERVER_ID_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_SERVER_ID_PROPERTY] = g_param_spec_string ("server-id", "server-id", "server-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_TIME_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_TIME_PROPERTY] = g_param_spec_boxed ("time", "time", "time", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/** UTC **/
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_LOCAL_TIME_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_LOCAL_TIME_PROPERTY] = g_param_spec_boxed ("local-time", "local-time", "local-time", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_ENCRYPTION_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_ENCRYPTION_PROPERTY] = g_param_spec_enum ("encryption", "encryption", "encryption", DINO_ENTITIES_TYPE_ENCRYPTION, DINO_ENTITIES_ENCRYPTION_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_MARKED_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_MARKED_PROPERTY] = g_param_spec_enum ("marked", "marked", "marked", DINO_ENTITIES_MESSAGE_TYPE_MARKED, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_ENTITIES_MESSAGE_QUOTED_ITEM_ID_PROPERTY, dino_entities_message_properties[DINO_ENTITIES_MESSAGE_QUOTED_ITEM_ID_PROPERTY] = g_param_spec_int ("quoted-item-id", "quoted-item-id", "quoted-item-id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	_tmp0_ = g_new0 (DinoEntitiesMessageMarked, 3);
	_tmp0_[0] = DINO_ENTITIES_MESSAGE_MARKED_READ;
	_tmp0_[1] = DINO_ENTITIES_MESSAGE_MARKED_RECEIVED;
	_tmp0_[2] = DINO_ENTITIES_MESSAGE_MARKED_ACKNOWLEDGED;
	dino_entities_message_MARKED_RECEIVED = _tmp0_;
	dino_entities_message_MARKED_RECEIVED_length1 = 3;
}

static void
dino_entities_message_instance_init (DinoEntitiesMessage * self,
                                     gpointer klass)
{
	self->priv = dino_entities_message_get_instance_private (self);
	self->priv->_id = -1;
	self->priv->_type_ = DINO_ENTITIES_MESSAGE_TYPE_UNKNOWN;
	self->priv->_encryption = DINO_ENTITIES_ENCRYPTION_NONE;
	self->priv->marked_ = DINO_ENTITIES_MESSAGE_MARKED_NONE;
	self->edit_to = NULL;
	self->priv->_quoted_item_id = 0;
	self->priv->fallbacks = NULL;
	self->priv->markups = NULL;
}

static void
dino_entities_message_finalize (GObject * obj)
{
	DinoEntitiesMessage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_ENTITIES_TYPE_MESSAGE, DinoEntitiesMessage);
	_g_object_unref0 (self->priv->_account);
	_xmpp_jid_unref0 (self->priv->_counterpart);
	_xmpp_jid_unref0 (self->priv->_ourpart);
	_xmpp_jid_unref0 (self->priv->_real_jid);
	_g_free0 (self->priv->body_);
	_g_free0 (self->priv->_stanza_id);
	_g_free0 (self->priv->_server_id);
	_g_date_time_unref0 (self->priv->_time);
	_g_date_time_unref0 (self->priv->_local_time);
	_g_free0 (self->edit_to);
	_g_object_unref0 (self->priv->fallbacks);
	_g_object_unref0 (self->priv->markups);
	_qlite_database_unref0 (self->priv->db);
	G_OBJECT_CLASS (dino_entities_message_parent_class)->finalize (obj);
}

static GType
dino_entities_message_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoEntitiesMessageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_entities_message_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoEntitiesMessage), 0, (GInstanceInitFunc) dino_entities_message_instance_init, NULL };
	GType dino_entities_message_type_id;
	dino_entities_message_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoEntitiesMessage", &g_define_type_info, 0);
	DinoEntitiesMessage_private_offset = g_type_add_instance_private (dino_entities_message_type_id, sizeof (DinoEntitiesMessagePrivate));
	return dino_entities_message_type_id;
}

GType
dino_entities_message_get_type (void)
{
	static volatile gsize dino_entities_message_type_id__once = 0;
	if (g_once_init_enter (&dino_entities_message_type_id__once)) {
		GType dino_entities_message_type_id;
		dino_entities_message_type_id = dino_entities_message_get_type_once ();
		g_once_init_leave (&dino_entities_message_type_id__once, dino_entities_message_type_id);
	}
	return dino_entities_message_type_id__once;
}

static void
_vala_dino_entities_message_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	DinoEntitiesMessage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_ENTITIES_TYPE_MESSAGE, DinoEntitiesMessage);
	switch (property_id) {
		case DINO_ENTITIES_MESSAGE_ID_PROPERTY:
		g_value_set_int (value, dino_entities_message_get_id (self));
		break;
		case DINO_ENTITIES_MESSAGE_ACCOUNT_PROPERTY:
		g_value_set_object (value, dino_entities_message_get_account (self));
		break;
		case DINO_ENTITIES_MESSAGE_COUNTERPART_PROPERTY:
		xmpp_value_set_jid (value, dino_entities_message_get_counterpart (self));
		break;
		case DINO_ENTITIES_MESSAGE_OURPART_PROPERTY:
		xmpp_value_set_jid (value, dino_entities_message_get_ourpart (self));
		break;
		case DINO_ENTITIES_MESSAGE_FROM_PROPERTY:
		xmpp_value_set_jid (value, dino_entities_message_get_from (self));
		break;
		case DINO_ENTITIES_MESSAGE_TO_PROPERTY:
		xmpp_value_set_jid (value, dino_entities_message_get_to (self));
		break;
		case DINO_ENTITIES_MESSAGE_DIRECTION_PROPERTY:
		g_value_set_boolean (value, dino_entities_message_get_direction (self));
		break;
		case DINO_ENTITIES_MESSAGE_REAL_JID_PROPERTY:
		xmpp_value_set_jid (value, dino_entities_message_get_real_jid (self));
		break;
		case DINO_ENTITIES_MESSAGE_TYPE__PROPERTY:
		g_value_set_enum (value, dino_entities_message_get_type_ (self));
		break;
		case DINO_ENTITIES_MESSAGE_BODY_PROPERTY:
		g_value_set_string (value, dino_entities_message_get_body (self));
		break;
		case DINO_ENTITIES_MESSAGE_STANZA_ID_PROPERTY:
		g_value_set_string (value, dino_entities_message_get_stanza_id (self));
		break;
		case DINO_ENTITIES_MESSAGE_SERVER_ID_PROPERTY:
		g_value_set_string (value, dino_entities_message_get_server_id (self));
		break;
		case DINO_ENTITIES_MESSAGE_TIME_PROPERTY:
		g_value_set_boxed (value, dino_entities_message_get_time (self));
		break;
		case DINO_ENTITIES_MESSAGE_LOCAL_TIME_PROPERTY:
		g_value_set_boxed (value, dino_entities_message_get_local_time (self));
		break;
		case DINO_ENTITIES_MESSAGE_ENCRYPTION_PROPERTY:
		g_value_set_enum (value, dino_entities_message_get_encryption (self));
		break;
		case DINO_ENTITIES_MESSAGE_MARKED_PROPERTY:
		g_value_set_enum (value, dino_entities_message_get_marked (self));
		break;
		case DINO_ENTITIES_MESSAGE_QUOTED_ITEM_ID_PROPERTY:
		g_value_set_int (value, dino_entities_message_get_quoted_item_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_entities_message_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	DinoEntitiesMessage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_ENTITIES_TYPE_MESSAGE, DinoEntitiesMessage);
	switch (property_id) {
		case DINO_ENTITIES_MESSAGE_ID_PROPERTY:
		dino_entities_message_set_id (self, g_value_get_int (value));
		break;
		case DINO_ENTITIES_MESSAGE_ACCOUNT_PROPERTY:
		dino_entities_message_set_account (self, g_value_get_object (value));
		break;
		case DINO_ENTITIES_MESSAGE_COUNTERPART_PROPERTY:
		dino_entities_message_set_counterpart (self, xmpp_value_get_jid (value));
		break;
		case DINO_ENTITIES_MESSAGE_OURPART_PROPERTY:
		dino_entities_message_set_ourpart (self, xmpp_value_get_jid (value));
		break;
		case DINO_ENTITIES_MESSAGE_DIRECTION_PROPERTY:
		dino_entities_message_set_direction (self, g_value_get_boolean (value));
		break;
		case DINO_ENTITIES_MESSAGE_REAL_JID_PROPERTY:
		dino_entities_message_set_real_jid (self, xmpp_value_get_jid (value));
		break;
		case DINO_ENTITIES_MESSAGE_TYPE__PROPERTY:
		dino_entities_message_set_type_ (self, g_value_get_enum (value));
		break;
		case DINO_ENTITIES_MESSAGE_BODY_PROPERTY:
		dino_entities_message_set_body (self, g_value_get_string (value));
		break;
		case DINO_ENTITIES_MESSAGE_STANZA_ID_PROPERTY:
		dino_entities_message_set_stanza_id (self, g_value_get_string (value));
		break;
		case DINO_ENTITIES_MESSAGE_SERVER_ID_PROPERTY:
		dino_entities_message_set_server_id (self, g_value_get_string (value));
		break;
		case DINO_ENTITIES_MESSAGE_TIME_PROPERTY:
		dino_entities_message_set_time (self, g_value_get_boxed (value));
		break;
		case DINO_ENTITIES_MESSAGE_LOCAL_TIME_PROPERTY:
		dino_entities_message_set_local_time (self, g_value_get_boxed (value));
		break;
		case DINO_ENTITIES_MESSAGE_ENCRYPTION_PROPERTY:
		dino_entities_message_set_encryption (self, g_value_get_enum (value));
		break;
		case DINO_ENTITIES_MESSAGE_MARKED_PROPERTY:
		dino_entities_message_set_marked (self, g_value_get_enum (value));
		break;
		case DINO_ENTITIES_MESSAGE_QUOTED_ITEM_ID_PROPERTY:
		dino_entities_message_set_quoted_item_id (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

