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

#include "libdino.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include "xmpp-vala.h"
#include "qlite.h"
#include <gobject/gvaluecollector.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_REACTIONS_0_PROPERTY,
	DINO_REACTIONS_ID_PROPERTY,
	DINO_REACTIONS_NUM_PROPERTIES
};
static GParamSpec* dino_reactions_properties[DINO_REACTIONS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _qlite_database_unref0(var) ((var == NULL) ? NULL : (var = (qlite_database_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
typedef struct _Block35Data Block35Data;
typedef struct _Block36Data Block36Data;

#define DINO_REACTIONS_TYPE_REACTIONS_TIME (dino_reactions_reactions_time_get_type ())
#define DINO_REACTIONS_REACTIONS_TIME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_REACTIONS_TYPE_REACTIONS_TIME, DinoReactionsReactionsTime))
#define DINO_REACTIONS_REACTIONS_TIME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_REACTIONS_TYPE_REACTIONS_TIME, DinoReactionsReactionsTimeClass))
#define DINO_REACTIONS_IS_REACTIONS_TIME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_REACTIONS_TYPE_REACTIONS_TIME))
#define DINO_REACTIONS_IS_REACTIONS_TIME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_REACTIONS_TYPE_REACTIONS_TIME))
#define DINO_REACTIONS_REACTIONS_TIME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_REACTIONS_TYPE_REACTIONS_TIME, DinoReactionsReactionsTimeClass))

typedef struct _DinoReactionsReactionsTime DinoReactionsReactionsTime;
typedef struct _DinoReactionsReactionsTimeClass DinoReactionsReactionsTimeClass;
typedef struct _DinoReactionsReactionsTimePrivate DinoReactionsReactionsTimePrivate;
#define _dino_reactions_reactions_time_unref0(var) ((var == NULL) ? NULL : (var = (dino_reactions_reactions_time_unref (var), NULL)))
#define _qlite_statement_builder_unref0(var) ((var == NULL) ? NULL : (var = (qlite_statement_builder_unref (var), NULL)))
#define _qlite_row_option_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_option_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 _dino_reaction_users_unref0(var) ((var == NULL) ? NULL : (var = (dino_reaction_users_unref (var), NULL)))
typedef struct _Block37Data Block37Data;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_time_zone_unref0(var) ((var == NULL) ? NULL : (var = (g_time_zone_unref (var), NULL)))
#define _dino_reaction_info_unref0(var) ((var == NULL) ? NULL : (var = (dino_reaction_info_unref (var), NULL)))
typedef struct _DinoReactionsOnReactionReceivedData DinoReactionsOnReactionReceivedData;
typedef struct _Block38Data Block38Data;
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _DinoReactionsParamSpecReactionsTime DinoReactionsParamSpecReactionsTime;
enum  {
	DINO_REACTIONS_REACTION_ADDED_SIGNAL,
	DINO_REACTIONS_REACTION_REMOVED_SIGNAL,
	DINO_REACTIONS_NUM_SIGNALS
};
static guint dino_reactions_signals[DINO_REACTIONS_NUM_SIGNALS] = {0};
typedef struct _DinoParamSpecReactionUsers DinoParamSpecReactionUsers;
typedef struct _DinoParamSpecReactionInfo DinoParamSpecReactionInfo;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _DinoReactionsPrivate {
	DinoStreamInteractor* stream_interactor;
	DinoDatabase* db;
	GeeHashMap* reaction_infos;
};

struct _Block35Data {
	int _ref_count_;
	DinoReactions* self;
	XmppXepReactionsModule* reactions_module;
	DinoEntitiesConversation* conversation;
	DinoContentItem* content_item;
	GeeList* reactions;
};

struct _Block36Data {
	int _ref_count_;
	Block35Data * _data35_;
	gint64 now_millis;
};

struct _DinoReactionsReactionsTime {
	GTypeInstance parent_instance;
	volatile int ref_count;
	DinoReactionsReactionsTimePrivate * priv;
	GeeList* emojis;
	gint64 time;
};

struct _DinoReactionsReactionsTimeClass {
	GTypeClass parent_class;
	void (*finalize) (DinoReactionsReactionsTime *self);
};

struct _Block37Data {
	int _ref_count_;
	DinoReactions* self;
	DinoEntitiesAccount* account;
};

struct _DinoReactionsOnReactionReceivedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoReactions* self;
	DinoEntitiesAccount* account;
	XmppJid* from_jid;
	gchar* message_id;
	GeeList* reactions;
	XmppMessageStanza* stanza;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	DinoEntitiesConversation* muc_conversation;
	DinoStreamInteractor* _tmp2_;
	DinoModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	DinoConversationManager* _tmp5_;
	XmppJid* _tmp6_;
	XmppJid* _tmp7_;
	XmppJid* _tmp8_;
	DinoEntitiesConversation* _tmp9_;
	DinoEntitiesConversation* _tmp10_;
	gboolean muc_supports_reactions;
	DinoEntitiesConversation* _tmp11_;
	DinoEntitiesMessage* reaction_message;
	DinoStreamInteractor* _tmp12_;
	DinoModuleIdentity* _tmp13_;
	gpointer _tmp14_;
	DinoMessageProcessor* _tmp15_;
	DinoEntitiesMessage* _tmp16_;
	DinoEntitiesMessage* _tmp17_;
	DinoEntitiesConversation* conversation;
	DinoStreamInteractor* _tmp18_;
	DinoModuleIdentity* _tmp19_;
	gpointer _tmp20_;
	DinoConversationManager* _tmp21_;
	DinoEntitiesMessage* _tmp22_;
	DinoEntitiesConversation* _tmp23_;
	DinoEntitiesConversation* _tmp24_;
	gint content_item_id;
	DinoStreamInteractor* _tmp25_;
	DinoModuleIdentity* _tmp26_;
	gpointer _tmp27_;
	DinoContentItemStore* _tmp28_;
	DinoEntitiesConversation* _tmp29_;
	gint _tmp30_;
	DinoReactionInfo* reaction_info;
	DinoEntitiesConversation* _tmp31_;
	DinoEntitiesConversation* _tmp32_;
	XmppJid* _tmp33_;
	GeeList* _tmp34_;
	XmppMessageStanza* _tmp35_;
	GTimeZone* _tmp36_;
	GTimeZone* _tmp37_;
	GDateTime* _tmp38_;
	DinoReactionInfo* _tmp39_;
	DinoReactionInfo* _tmp40_;
	DinoReactionInfo* _tmp41_;
	DinoDatabase* _tmp42_;
	XmppJid* _tmp43_;
	XmppJid* _tmp44_;
	XmppJid* _tmp45_;
	XmppJid* _tmp46_;
	XmppJid* _tmp47_;
	XmppJid* _tmp48_;
	gchar* _tmp49_;
	gchar* _tmp50_;
	GeeHashMap* _tmp51_;
	GeeHashMap* _tmp52_;
	GeeArrayList* _tmp53_;
	GeeArrayList* _tmp54_;
	GeeHashMap* _tmp55_;
	gpointer _tmp56_;
	GeeList* _tmp57_;
	DinoReactionInfo* _tmp58_;
};

struct _Block38Data {
	int _ref_count_;
	DinoReactions* self;
	DinoEntitiesConversation* conversation;
};

struct _DinoReactionsParamSpecReactionsTime {
	GParamSpec parent_instance;
};

struct _DinoReactionUsersPrivate {
	gchar* _reaction;
	GeeList* _jids;
};

struct _DinoParamSpecReactionUsers {
	GParamSpec parent_instance;
};

struct _DinoReactionInfoPrivate {
	DinoEntitiesConversation* _conversation;
	XmppJid* _from_jid;
	GeeList* _reactions;
	XmppMessageStanza* _stanza;
	GDateTime* _received_time;
};

struct _DinoParamSpecReactionInfo {
	GParamSpec parent_instance;
};

static gint DinoReactions_private_offset;
static gpointer dino_reactions_parent_class = NULL;
DinoModuleIdentity* dino_reactions_IDENTITY = NULL;
static gpointer dino_reactions_reactions_time_parent_class = NULL;
static DinoStreamInteractionModuleIface * dino_reactions_dino_stream_interaction_module_parent_iface = NULL;
static gint DinoReactionUsers_private_offset;
static gpointer dino_reaction_users_parent_class = NULL;
static gint DinoReactionInfo_private_offset;
static gpointer dino_reaction_info_parent_class = NULL;

static DinoReactions* dino_reactions_new (DinoStreamInteractor* stream_interactor,
                                   DinoDatabase* database);
static DinoReactions* dino_reactions_construct (GType object_type,
                                         DinoStreamInteractor* stream_interactor,
                                         DinoDatabase* database);
static void dino_reactions_on_account_added (DinoReactions* self,
                                      DinoEntitiesAccount* account);
static void _dino_reactions_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                            DinoEntitiesAccount* account,
                                                                            gpointer self);
static void dino_reactions_on_new_item (DinoReactions* self,
                                 DinoContentItem* item,
                                 DinoEntitiesConversation* conversation);
static void _dino_reactions_on_new_item_dino_content_item_store_new_item (DinoContentItemStore* _sender,
                                                                   DinoContentItem* item,
                                                                   DinoEntitiesConversation* conversation,
                                                                   gpointer self);
static GeeList* dino_reactions_get_own_reactions (DinoReactions* self,
                                           DinoEntitiesConversation* conversation,
                                           DinoContentItem* content_item);
static void dino_reactions_send_reactions (DinoReactions* self,
                                    DinoEntitiesConversation* conversation,
                                    DinoContentItem* content_item,
                                    GeeList* reactions,
                                    GError** error);
static gboolean* _bool_dup (gboolean* self);
static Block35Data* block35_data_ref (Block35Data* _data35_);
static void block35_data_unref (void * _userdata_);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static void _____lambda139_ (Block36Data* _data36_,
                      GObject* _,
                      GAsyncResult* res);
static void dino_reactions_save_chat_reactions (DinoReactions* self,
                                         DinoEntitiesAccount* account,
                                         XmppJid* jid,
                                         gint content_item_id,
                                         gint64 reaction_time,
                                         GeeList* reactions);
static void ______lambda139__gasync_ready_callback (GObject* source_object,
                                             GAsyncResult* res,
                                             gpointer self);
static gpointer dino_reactions_reactions_time_ref (gpointer instance);
static void dino_reactions_reactions_time_unref (gpointer instance);
static GParamSpec* dino_reactions_param_spec_reactions_time (const gchar* name,
                                                      const gchar* nick,
                                                      const gchar* blurb,
                                                      GType object_type,
                                                      GParamFlags flags) G_GNUC_UNUSED ;
static void dino_reactions_value_set_reactions_time (GValue* value,
                                              gpointer v_object) G_GNUC_UNUSED ;
static void dino_reactions_value_take_reactions_time (GValue* value,
                                               gpointer v_object) G_GNUC_UNUSED ;
static gpointer dino_reactions_value_get_reactions_time (const GValue* value) G_GNUC_UNUSED ;
static GType dino_reactions_reactions_time_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static DinoReactionsReactionsTime* dino_reactions_get_chat_user_reactions (DinoReactions* self,
                                                                    DinoEntitiesAccount* account,
                                                                    gint content_item_id,
                                                                    XmppJid* jid);
static DinoReactionsReactionsTime* dino_reactions_get_muc_user_reactions (DinoReactions* self,
                                                                   DinoEntitiesAccount* account,
                                                                   gint content_item_id,
                                                                   const gchar* occupant_id,
                                                                   XmppJid* real_jid);
static DinoReactionsReactionsTime* dino_reactions_reactions_time_new (void);
static DinoReactionsReactionsTime* dino_reactions_reactions_time_construct (GType object_type);
static GeeList* dino_reactions_string_to_emoji_list (DinoReactions* self,
                                              const gchar* emoji_str);
static gboolean _xmpp_jid_equals_func_gee_equal_data_func (gconstpointer a,
                                                    gconstpointer b,
                                                    gpointer self);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
static void __lambda137_ (Block37Data* _data37_,
                   XmppXmppStream* stream,
                   XmppJid* from_jid,
                   const gchar* message_id,
                   GeeList* reactions,
                   XmppMessageStanza* stanza);
static void dino_reactions_on_reaction_received (DinoReactions* self,
                                          DinoEntitiesAccount* account,
                                          XmppJid* from_jid,
                                          const gchar* message_id,
                                          GeeList* reactions,
                                          XmppMessageStanza* stanza,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dino_reactions_on_reaction_received_finish (DinoReactions* self,
                                                 GAsyncResult* _res_);
static void ___lambda137__xmpp_xep_reactions_module_received_reactions (XmppXepReactionsModule* _sender,
                                                                 XmppXmppStream* stream,
                                                                 XmppJid* from_jid,
                                                                 const gchar* message_id,
                                                                 GeeList* reactions,
                                                                 XmppMessageStanza* stanza,
                                                                 gpointer self);
static void dino_reactions_on_reaction_received_data_free (gpointer _data);
static gboolean dino_reactions_on_reaction_received_co (DinoReactionsOnReactionReceivedData* _data_);
static void dino_reactions_on_reaction_received_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void dino_reactions_process_reaction_for_message (DinoReactions* self,
                                                  gint content_item_id,
                                                  DinoReactionInfo* reaction_info);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
static gboolean __lambda138_ (Block38Data* _data38_,
                       DinoReactionInfo* info);
static gboolean ___lambda138__gee_predicate (gconstpointer g,
                                      gpointer self);
static DinoEntitiesMessage* dino_reactions_get_message_for_reaction (DinoReactions* self,
                                                              DinoEntitiesConversation* conversation,
                                                              const gchar* message_id);
static void dino_reactions_save_muc_reactions (DinoReactions* self,
                                        DinoEntitiesAccount* account,
                                        gint content_item_id,
                                        XmppJid* jid,
                                        const gchar* occupant_id,
                                        XmppJid* real_jid,
                                        gint64 reaction_time,
                                        GeeList* reactions);
static void g_cclosure_user_marshal_VOID__OBJECT_INT_XMPP_JID_STRING (GClosure * closure,
                                                               GValue * return_value,
                                                               guint n_param_values,
                                                               const GValue * param_values,
                                                               gpointer invocation_hint,
                                                               gpointer marshal_data);
static void dino_reactions_reactions_time_finalize (DinoReactionsReactionsTime * obj);
static GType dino_reactions_reactions_time_get_type_once (void);
static void dino_reactions_finalize (GObject * obj);
static GType dino_reactions_get_type_once (void);
static void _vala_dino_reactions_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void dino_reaction_users_finalize (DinoReactionUsers * obj);
static GType dino_reaction_users_get_type_once (void);
static void dino_reaction_info_finalize (DinoReactionInfo * obj);
static GType dino_reaction_info_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_reactions_get_instance_private (DinoReactions* self)
{
	return G_STRUCT_MEMBER_P (self, DinoReactions_private_offset);
}

void
dino_reactions_start (DinoStreamInteractor* stream_interactor,
                      DinoDatabase* database)
{
	DinoReactions* m = NULL;
	DinoReactions* _tmp0_;
	g_return_if_fail (stream_interactor != NULL);
	g_return_if_fail (database != NULL);
	_tmp0_ = dino_reactions_new (stream_interactor, database);
	m = _tmp0_;
	dino_stream_interactor_add_module (stream_interactor, (DinoStreamInteractionModule*) m);
	_g_object_unref0 (m);
}

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

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

static void
_dino_reactions_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                       DinoEntitiesAccount* account,
                                                                       gpointer self)
{
	dino_reactions_on_account_added ((DinoReactions*) self, account);
}

static void
_dino_reactions_on_new_item_dino_content_item_store_new_item (DinoContentItemStore* _sender,
                                                              DinoContentItem* item,
                                                              DinoEntitiesConversation* conversation,
                                                              gpointer self)
{
	dino_reactions_on_new_item ((DinoReactions*) self, item, conversation);
}

static DinoReactions*
dino_reactions_construct (GType object_type,
                          DinoStreamInteractor* stream_interactor,
                          DinoDatabase* database)
{
	DinoReactions * self = NULL;
	DinoStreamInteractor* _tmp0_;
	DinoDatabase* _tmp1_;
	DinoModuleIdentity* _tmp2_;
	gpointer _tmp3_;
	DinoContentItemStore* _tmp4_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	g_return_val_if_fail (database != NULL, NULL);
	self = (DinoReactions*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp0_;
	_tmp1_ = _qlite_database_ref0 (database);
	_qlite_database_unref0 (self->priv->db);
	self->priv->db = _tmp1_;
	g_signal_connect_object (stream_interactor, "account-added", (GCallback) _dino_reactions_on_account_added_dino_stream_interactor_account_added, self, 0);
	_tmp2_ = dino_content_item_store_IDENTITY;
	_tmp3_ = dino_stream_interactor_get_module (stream_interactor, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp2_);
	_tmp4_ = (DinoContentItemStore*) _tmp3_;
	g_signal_connect_object (_tmp4_, "new-item", (GCallback) _dino_reactions_on_new_item_dino_content_item_store_new_item, self, 0);
	_g_object_unref0 (_tmp4_);
	return self;
}

static DinoReactions*
dino_reactions_new (DinoStreamInteractor* stream_interactor,
                    DinoDatabase* database)
{
	return dino_reactions_construct (DINO_TYPE_REACTIONS, stream_interactor, database);
}

void
dino_reactions_add_reaction (DinoReactions* self,
                             DinoEntitiesConversation* conversation,
                             DinoContentItem* content_item,
                             const gchar* reaction)
{
	GeeList* reactions = NULL;
	GeeList* _tmp0_;
	GeeList* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (content_item != NULL);
	g_return_if_fail (reaction != NULL);
	_tmp0_ = dino_reactions_get_own_reactions (self, conversation, content_item);
	reactions = _tmp0_;
	_tmp1_ = reactions;
	if (!gee_collection_contains ((GeeCollection*) _tmp1_, reaction)) {
		GeeList* _tmp2_;
		_tmp2_ = reactions;
		gee_collection_add ((GeeCollection*) _tmp2_, reaction);
	}
	{
		GeeList* _tmp3_;
		DinoEntitiesAccount* _tmp4_;
		DinoEntitiesAccount* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		DinoEntitiesAccount* _tmp8_;
		DinoEntitiesAccount* _tmp9_;
		XmppJid* _tmp10_;
		XmppJid* _tmp11_;
		XmppJid* _tmp12_;
		_tmp3_ = reactions;
		dino_reactions_send_reactions (self, conversation, content_item, _tmp3_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_IO_ERROR) {
				goto __catch0_g_io_error;
			}
			_g_object_unref0 (reactions);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp4_ = dino_entities_conversation_get_account (conversation);
		_tmp5_ = _tmp4_;
		_tmp6_ = dino_content_item_get_id (content_item);
		_tmp7_ = _tmp6_;
		_tmp8_ = dino_entities_conversation_get_account (conversation);
		_tmp9_ = _tmp8_;
		_tmp10_ = dino_entities_account_get_bare_jid (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = _tmp11_;
		g_signal_emit (self, dino_reactions_signals[DINO_REACTIONS_REACTION_ADDED_SIGNAL], 0, _tmp5_, _tmp7_, _tmp12_, reaction);
		_xmpp_jid_unref0 (_tmp12_);
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (reactions);
		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;
	}
	_g_object_unref0 (reactions);
}

void
dino_reactions_remove_reaction (DinoReactions* self,
                                DinoEntitiesConversation* conversation,
                                DinoContentItem* content_item,
                                const gchar* reaction)
{
	GeeList* reactions = NULL;
	GeeList* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (content_item != NULL);
	g_return_if_fail (reaction != NULL);
	_tmp0_ = dino_reactions_get_own_reactions (self, conversation, content_item);
	reactions = _tmp0_;
	gee_collection_remove ((GeeCollection*) reactions, reaction);
	{
		DinoEntitiesAccount* _tmp1_;
		DinoEntitiesAccount* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		DinoEntitiesAccount* _tmp5_;
		DinoEntitiesAccount* _tmp6_;
		XmppJid* _tmp7_;
		XmppJid* _tmp8_;
		XmppJid* _tmp9_;
		dino_reactions_send_reactions (self, conversation, content_item, reactions, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_IO_ERROR) {
				goto __catch0_g_io_error;
			}
			_g_object_unref0 (reactions);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp1_ = dino_entities_conversation_get_account (conversation);
		_tmp2_ = _tmp1_;
		_tmp3_ = dino_content_item_get_id (content_item);
		_tmp4_ = _tmp3_;
		_tmp5_ = dino_entities_conversation_get_account (conversation);
		_tmp6_ = _tmp5_;
		_tmp7_ = dino_entities_account_get_bare_jid (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		g_signal_emit (self, dino_reactions_signals[DINO_REACTIONS_REACTION_REMOVED_SIGNAL], 0, _tmp2_, _tmp4_, _tmp9_, reaction);
		_xmpp_jid_unref0 (_tmp9_);
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (reactions);
		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;
	}
	_g_object_unref0 (reactions);
}

GeeList*
dino_reactions_get_item_reactions (DinoReactions* self,
                                   DinoEntitiesConversation* conversation,
                                   DinoContentItem* content_item)
{
	DinoEntitiesConversationType _tmp0_;
	DinoEntitiesConversationType _tmp1_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (conversation != NULL, NULL);
	g_return_val_if_fail (content_item != NULL, NULL);
	_tmp0_ = dino_entities_conversation_get_type_ (conversation);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
		DinoEntitiesAccount* _tmp2_;
		DinoEntitiesAccount* _tmp3_;
		GeeList* _tmp4_;
		_tmp2_ = dino_entities_conversation_get_account (conversation);
		_tmp3_ = _tmp2_;
		_tmp4_ = dino_reactions_get_chat_message_reactions (self, _tmp3_, content_item);
		result = _tmp4_;
		return result;
	} else {
		DinoEntitiesAccount* _tmp5_;
		DinoEntitiesAccount* _tmp6_;
		GeeList* _tmp7_;
		_tmp5_ = dino_entities_conversation_get_account (conversation);
		_tmp6_ = _tmp5_;
		_tmp7_ = dino_reactions_get_muc_message_reactions (self, _tmp6_, content_item);
		result = _tmp7_;
		return result;
	}
}

static gboolean*
_bool_dup (gboolean* self)
{
	gboolean* dup;
	dup = g_new0 (gboolean, 1);
	memcpy (dup, self, sizeof (gboolean));
	return dup;
}

static gpointer
__bool_dup0 (gpointer self)
{
	return self ? _bool_dup (self) : NULL;
}

gboolean
dino_reactions_conversation_supports_reactions (DinoReactions* self,
                                                DinoEntitiesConversation* conversation)
{
	DinoEntitiesConversationType _tmp0_;
	DinoEntitiesConversationType _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (conversation != NULL, FALSE);
	_tmp0_ = dino_entities_conversation_get_type_ (conversation);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
		result = TRUE;
		return result;
	} else {
		DinoEntityInfo* entity_info = NULL;
		DinoStreamInteractor* _tmp2_;
		DinoModuleIdentity* _tmp3_;
		gpointer _tmp4_;
		gboolean server_supports_sid = FALSE;
		DinoEntityInfo* _tmp5_;
		DinoEntitiesAccount* _tmp6_;
		DinoEntitiesAccount* _tmp7_;
		XmppJid* _tmp8_;
		XmppJid* _tmp9_;
		XmppJid* _tmp10_;
		XmppJid* _tmp11_;
		XmppJid* _tmp12_;
		gboolean _tmp13_;
		gboolean* supports_occupant_ids = NULL;
		DinoEntityInfo* _tmp14_;
		DinoEntitiesAccount* _tmp15_;
		DinoEntitiesAccount* _tmp16_;
		XmppJid* _tmp17_;
		XmppJid* _tmp18_;
		gboolean _tmp19_;
		gboolean* _tmp20_;
		gboolean* _tmp21_;
		DinoStreamInteractor* _tmp22_;
		DinoModuleIdentity* _tmp23_;
		gpointer _tmp24_;
		DinoMucManager* _tmp25_;
		DinoEntitiesAccount* _tmp26_;
		DinoEntitiesAccount* _tmp27_;
		XmppJid* _tmp28_;
		XmppJid* _tmp29_;
		gboolean _tmp30_;
		_tmp2_ = self->priv->stream_interactor;
		_tmp3_ = dino_entity_info_IDENTITY;
		_tmp4_ = dino_stream_interactor_get_module (_tmp2_, DINO_TYPE_ENTITY_INFO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
		entity_info = (DinoEntityInfo*) _tmp4_;
		_tmp5_ = entity_info;
		_tmp6_ = dino_entities_conversation_get_account (conversation);
		_tmp7_ = _tmp6_;
		_tmp8_ = dino_entities_conversation_get_counterpart (conversation);
		_tmp9_ = _tmp8_;
		_tmp10_ = xmpp_jid_get_bare_jid (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = _tmp11_;
		_tmp13_ = dino_entity_info_has_feature_cached (_tmp5_, _tmp7_, _tmp12_, XMPP_XEP_UNIQUE_STABLE_STANZA_IDS_NS_URI);
		_xmpp_jid_unref0 (_tmp12_);
		server_supports_sid = _tmp13_;
		if (!server_supports_sid) {
			result = FALSE;
			_g_object_unref0 (entity_info);
			return result;
		}
		_tmp14_ = entity_info;
		_tmp15_ = dino_entities_conversation_get_account (conversation);
		_tmp16_ = _tmp15_;
		_tmp17_ = dino_entities_conversation_get_counterpart (conversation);
		_tmp18_ = _tmp17_;
		_tmp19_ = dino_entity_info_has_feature_cached (_tmp14_, _tmp16_, _tmp18_, XMPP_XEP_OCCUPANT_IDS_NS_URI);
		_tmp20_ = __bool_dup0 (&_tmp19_);
		supports_occupant_ids = _tmp20_;
		_tmp21_ = supports_occupant_ids;
		if (*_tmp21_) {
			result = TRUE;
			_g_free0 (supports_occupant_ids);
			_g_object_unref0 (entity_info);
			return result;
		}
		_tmp22_ = self->priv->stream_interactor;
		_tmp23_ = dino_muc_manager_IDENTITY;
		_tmp24_ = dino_stream_interactor_get_module (_tmp22_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp23_);
		_tmp25_ = (DinoMucManager*) _tmp24_;
		_tmp26_ = dino_entities_conversation_get_account (conversation);
		_tmp27_ = _tmp26_;
		_tmp28_ = dino_entities_conversation_get_counterpart (conversation);
		_tmp29_ = _tmp28_;
		_tmp30_ = dino_muc_manager_is_private_room (_tmp25_, _tmp27_, _tmp29_);
		_g_object_unref0 (_tmp25_);
		result = _tmp30_;
		_g_free0 (supports_occupant_ids);
		_g_object_unref0 (entity_info);
		return result;
	}
}

static Block35Data*
block35_data_ref (Block35Data* _data35_)
{
	g_atomic_int_inc (&_data35_->_ref_count_);
	return _data35_;
}

static void
block35_data_unref (void * _userdata_)
{
	Block35Data* _data35_;
	_data35_ = (Block35Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data35_->_ref_count_)) {
		DinoReactions* self;
		self = _data35_->self;
		_g_object_unref0 (_data35_->reactions_module);
		_g_object_unref0 (_data35_->conversation);
		_g_object_unref0 (_data35_->content_item);
		_g_object_unref0 (_data35_->reactions);
		_g_object_unref0 (self);
		g_slice_free (Block35Data, _data35_);
	}
}

static Block36Data*
block36_data_ref (Block36Data* _data36_)
{
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}

static void
block36_data_unref (void * _userdata_)
{
	Block36Data* _data36_;
	_data36_ = (Block36Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data36_->_ref_count_)) {
		DinoReactions* self;
		self = _data36_->_data35_->self;
		block35_data_unref (_data36_->_data35_);
		_data36_->_data35_ = NULL;
		g_slice_free (Block36Data, _data36_);
	}
}

static void
_____lambda139_ (Block36Data* _data36_,
                 GObject* _,
                 GAsyncResult* res)
{
	Block35Data* _data35_;
	DinoReactions* self;
	GError* _inner_error0_ = NULL;
	_data35_ = _data36_->_data35_;
	self = _data35_->self;
	g_return_if_fail (res != NULL);
	{
		XmppXepReactionsModule* _tmp0_;
		DinoEntitiesAccount* _tmp1_;
		DinoEntitiesAccount* _tmp2_;
		DinoEntitiesAccount* _tmp3_;
		DinoEntitiesAccount* _tmp4_;
		XmppJid* _tmp5_;
		XmppJid* _tmp6_;
		XmppJid* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp0_ = _data35_->reactions_module;
		xmpp_xep_reactions_module_send_reaction_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_IO_ERROR) {
				goto __catch0_g_io_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp1_ = dino_entities_conversation_get_account (_data35_->conversation);
		_tmp2_ = _tmp1_;
		_tmp3_ = dino_entities_conversation_get_account (_data35_->conversation);
		_tmp4_ = _tmp3_;
		_tmp5_ = dino_entities_account_get_bare_jid (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp8_ = dino_content_item_get_id (_data35_->content_item);
		_tmp9_ = _tmp8_;
		dino_reactions_save_chat_reactions (self, _tmp2_, _tmp7_, _tmp9_, _data36_->now_millis, _data35_->reactions);
		_xmpp_jid_unref0 (_tmp7_);
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
______lambda139__gasync_ready_callback (GObject* source_object,
                                        GAsyncResult* res,
                                        gpointer self)
{
	_____lambda139_ (self, source_object, res);
	block36_data_unref (self);
}

static void
dino_reactions_send_reactions (DinoReactions* self,
                               DinoEntitiesConversation* conversation,
                               DinoContentItem* content_item,
                               GeeList* reactions,
                               GError** error)
{
	Block35Data* _data35_;
	DinoEntitiesConversation* _tmp0_;
	DinoContentItem* _tmp1_;
	GeeList* _tmp2_;
	gchar* message_id = NULL;
	DinoStreamInteractor* _tmp3_;
	DinoModuleIdentity* _tmp4_;
	gpointer _tmp5_;
	DinoContentItemStore* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	XmppXmppStream* stream = NULL;
	DinoStreamInteractor* _tmp11_;
	DinoEntitiesAccount* _tmp12_;
	DinoEntitiesAccount* _tmp13_;
	XmppXmppStream* _tmp14_;
	XmppXmppStream* _tmp15_;
	XmppXmppStream* _tmp17_;
	XmppModuleIdentity* _tmp18_;
	gpointer _tmp19_;
	DinoEntitiesConversationType _tmp20_;
	DinoEntitiesConversationType _tmp21_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (content_item != NULL);
	g_return_if_fail (reactions != NULL);
	_data35_ = g_slice_new0 (Block35Data);
	_data35_->_ref_count_ = 1;
	_data35_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (conversation);
	_g_object_unref0 (_data35_->conversation);
	_data35_->conversation = _tmp0_;
	_tmp1_ = _g_object_ref0 (content_item);
	_g_object_unref0 (_data35_->content_item);
	_data35_->content_item = _tmp1_;
	_tmp2_ = _g_object_ref0 (reactions);
	_g_object_unref0 (_data35_->reactions);
	_data35_->reactions = _tmp2_;
	_tmp3_ = self->priv->stream_interactor;
	_tmp4_ = dino_content_item_store_IDENTITY;
	_tmp5_ = dino_stream_interactor_get_module (_tmp3_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp4_);
	_tmp6_ = (DinoContentItemStore*) _tmp5_;
	_tmp7_ = dino_content_item_store_get_message_id_for_content_item (_tmp6_, _data35_->conversation, _data35_->content_item);
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	message_id = _tmp8_;
	_tmp9_ = message_id;
	if (_tmp9_ == NULL) {
		GError* _tmp10_;
		_tmp10_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "No message for content_item");
		_inner_error0_ = _tmp10_;
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (message_id);
			block35_data_unref (_data35_);
			_data35_ = NULL;
			return;
		} else {
			_g_free0 (message_id);
			block35_data_unref (_data35_);
			_data35_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp11_ = self->priv->stream_interactor;
	_tmp12_ = dino_entities_conversation_get_account (_data35_->conversation);
	_tmp13_ = _tmp12_;
	_tmp14_ = dino_stream_interactor_get_stream (_tmp11_, _tmp13_);
	stream = _tmp14_;
	_tmp15_ = stream;
	if (_tmp15_ == NULL) {
		GError* _tmp16_;
		_tmp16_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_CONNECTED, "No stream");
		_inner_error0_ = _tmp16_;
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (stream);
			_g_free0 (message_id);
			block35_data_unref (_data35_);
			_data35_ = NULL;
			return;
		} else {
			_g_object_unref0 (stream);
			_g_free0 (message_id);
			block35_data_unref (_data35_);
			_data35_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp17_ = stream;
	_tmp18_ = xmpp_xep_reactions_module_IDENTITY;
	_tmp19_ = xmpp_xmpp_stream_get_module (_tmp17_, XMPP_XEP_REACTIONS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp18_);
	_data35_->reactions_module = (XmppXepReactionsModule*) _tmp19_;
	_tmp20_ = dino_entities_conversation_get_type_ (_data35_->conversation);
	_tmp21_ = _tmp20_;
	if (_tmp21_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT) {
		XmppXepReactionsModule* _tmp22_;
		XmppXmppStream* _tmp23_;
		XmppJid* _tmp24_;
		XmppJid* _tmp25_;
		const gchar* _tmp26_;
		_tmp22_ = _data35_->reactions_module;
		_tmp23_ = stream;
		_tmp24_ = dino_entities_conversation_get_counterpart (_data35_->conversation);
		_tmp25_ = _tmp24_;
		_tmp26_ = message_id;
		xmpp_xep_reactions_module_send_reaction (_tmp22_, _tmp23_, _tmp25_, "groupchat", _tmp26_, _data35_->reactions, NULL, NULL);
	} else {
		DinoEntitiesConversationType _tmp27_;
		DinoEntitiesConversationType _tmp28_;
		_tmp27_ = dino_entities_conversation_get_type_ (_data35_->conversation);
		_tmp28_ = _tmp27_;
		if (_tmp28_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT_PM) {
			XmppXepReactionsModule* _tmp29_;
			XmppXmppStream* _tmp30_;
			XmppJid* _tmp31_;
			XmppJid* _tmp32_;
			const gchar* _tmp33_;
			_tmp29_ = _data35_->reactions_module;
			_tmp30_ = stream;
			_tmp31_ = dino_entities_conversation_get_counterpart (_data35_->conversation);
			_tmp32_ = _tmp31_;
			_tmp33_ = message_id;
			xmpp_xep_reactions_module_send_reaction (_tmp29_, _tmp30_, _tmp32_, "chat", _tmp33_, _data35_->reactions, NULL, NULL);
		} else {
			DinoEntitiesConversationType _tmp34_;
			DinoEntitiesConversationType _tmp35_;
			_tmp34_ = dino_entities_conversation_get_type_ (_data35_->conversation);
			_tmp35_ = _tmp34_;
			if (_tmp35_ == DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
				Block36Data* _data36_;
				XmppXepReactionsModule* _tmp36_;
				XmppXmppStream* _tmp37_;
				XmppJid* _tmp38_;
				XmppJid* _tmp39_;
				const gchar* _tmp40_;
				_data36_ = g_slice_new0 (Block36Data);
				_data36_->_ref_count_ = 1;
				_data36_->_data35_ = block35_data_ref (_data35_);
				_data36_->now_millis = g_get_real_time () / 1000;
				_tmp36_ = _data35_->reactions_module;
				_tmp37_ = stream;
				_tmp38_ = dino_entities_conversation_get_counterpart (_data35_->conversation);
				_tmp39_ = _tmp38_;
				_tmp40_ = message_id;
				xmpp_xep_reactions_module_send_reaction (_tmp36_, _tmp37_, _tmp39_, "chat", _tmp40_, _data35_->reactions, ______lambda139__gasync_ready_callback, block36_data_ref (_data36_));
				block36_data_unref (_data36_);
				_data36_ = NULL;
			}
		}
	}
	_g_object_unref0 (stream);
	_g_free0 (message_id);
	block35_data_unref (_data35_);
	_data35_ = NULL;
}

static GeeList*
dino_reactions_get_own_reactions (DinoReactions* self,
                                  DinoEntitiesConversation* conversation,
                                  DinoContentItem* content_item)
{
	DinoEntitiesConversationType _tmp0_;
	DinoEntitiesConversationType _tmp1_;
	GeeArrayList* _tmp43_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (conversation != NULL, NULL);
	g_return_val_if_fail (content_item != NULL, NULL);
	_tmp0_ = dino_entities_conversation_get_type_ (conversation);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
		DinoEntitiesAccount* _tmp2_;
		DinoEntitiesAccount* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		DinoEntitiesAccount* _tmp6_;
		DinoEntitiesAccount* _tmp7_;
		XmppJid* _tmp8_;
		XmppJid* _tmp9_;
		XmppJid* _tmp10_;
		DinoReactionsReactionsTime* _tmp11_;
		DinoReactionsReactionsTime* _tmp12_;
		GeeList* _tmp13_;
		GeeList* _tmp14_;
		GeeList* _tmp15_;
		_tmp2_ = dino_entities_conversation_get_account (conversation);
		_tmp3_ = _tmp2_;
		_tmp4_ = dino_content_item_get_id (content_item);
		_tmp5_ = _tmp4_;
		_tmp6_ = dino_entities_conversation_get_account (conversation);
		_tmp7_ = _tmp6_;
		_tmp8_ = dino_entities_account_get_bare_jid (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp11_ = dino_reactions_get_chat_user_reactions (self, _tmp3_, _tmp5_, _tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = _tmp12_->emojis;
		_tmp14_ = _g_object_ref0 (_tmp13_);
		_tmp15_ = _tmp14_;
		_dino_reactions_reactions_time_unref0 (_tmp12_);
		_xmpp_jid_unref0 (_tmp10_);
		result = _tmp15_;
		return result;
	} else {
		DinoEntitiesConversationType _tmp16_;
		DinoEntitiesConversationType _tmp17_;
		_tmp16_ = dino_entities_conversation_get_type_ (conversation);
		_tmp17_ = _tmp16_;
		if (_tmp17_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT) {
			gchar* own_occupant_id = NULL;
			DinoStreamInteractor* _tmp18_;
			DinoModuleIdentity* _tmp19_;
			gpointer _tmp20_;
			DinoMucManager* _tmp21_;
			DinoEntitiesAccount* _tmp22_;
			DinoEntitiesAccount* _tmp23_;
			XmppJid* _tmp24_;
			XmppJid* _tmp25_;
			gchar* _tmp26_;
			gchar* _tmp27_;
			DinoEntitiesAccount* _tmp28_;
			DinoEntitiesAccount* _tmp29_;
			gint _tmp30_;
			gint _tmp31_;
			const gchar* _tmp32_;
			DinoEntitiesAccount* _tmp33_;
			DinoEntitiesAccount* _tmp34_;
			XmppJid* _tmp35_;
			XmppJid* _tmp36_;
			XmppJid* _tmp37_;
			DinoReactionsReactionsTime* _tmp38_;
			DinoReactionsReactionsTime* _tmp39_;
			GeeList* _tmp40_;
			GeeList* _tmp41_;
			GeeList* _tmp42_;
			_tmp18_ = self->priv->stream_interactor;
			_tmp19_ = dino_muc_manager_IDENTITY;
			_tmp20_ = dino_stream_interactor_get_module (_tmp18_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp19_);
			_tmp21_ = (DinoMucManager*) _tmp20_;
			_tmp22_ = dino_entities_conversation_get_account (conversation);
			_tmp23_ = _tmp22_;
			_tmp24_ = dino_content_item_get_jid (content_item);
			_tmp25_ = _tmp24_;
			_tmp26_ = dino_muc_manager_get_own_occupant_id (_tmp21_, _tmp23_, _tmp25_);
			_tmp27_ = _tmp26_;
			_g_object_unref0 (_tmp21_);
			own_occupant_id = _tmp27_;
			_tmp28_ = dino_entities_conversation_get_account (conversation);
			_tmp29_ = _tmp28_;
			_tmp30_ = dino_content_item_get_id (content_item);
			_tmp31_ = _tmp30_;
			_tmp32_ = own_occupant_id;
			_tmp33_ = dino_entities_conversation_get_account (conversation);
			_tmp34_ = _tmp33_;
			_tmp35_ = dino_entities_account_get_bare_jid (_tmp34_);
			_tmp36_ = _tmp35_;
			_tmp37_ = _tmp36_;
			_tmp38_ = dino_reactions_get_muc_user_reactions (self, _tmp29_, _tmp31_, _tmp32_, _tmp37_);
			_tmp39_ = _tmp38_;
			_tmp40_ = _tmp39_->emojis;
			_tmp41_ = _g_object_ref0 (_tmp40_);
			_tmp42_ = _tmp41_;
			_dino_reactions_reactions_time_unref0 (_tmp39_);
			_xmpp_jid_unref0 (_tmp37_);
			result = _tmp42_;
			_g_free0 (own_occupant_id);
			return result;
		}
	}
	_tmp43_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	result = (GeeList*) _tmp43_;
	return result;
}

static DinoReactionsReactionsTime*
dino_reactions_get_chat_user_reactions (DinoReactions* self,
                                        DinoEntitiesAccount* account,
                                        gint content_item_id,
                                        XmppJid* jid)
{
	gint jid_id = 0;
	DinoDatabase* _tmp0_;
	QliteQueryBuilder* query = NULL;
	DinoDatabase* _tmp1_;
	DinoDatabaseReactionTable* _tmp2_;
	DinoDatabaseReactionTable* _tmp3_;
	QliteQueryBuilder* _tmp4_;
	QliteQueryBuilder* _tmp5_;
	DinoDatabase* _tmp6_;
	DinoDatabaseReactionTable* _tmp7_;
	DinoDatabaseReactionTable* _tmp8_;
	QliteColumn* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	QliteQueryBuilder* _tmp12_;
	QliteQueryBuilder* _tmp13_;
	DinoDatabase* _tmp14_;
	DinoDatabaseReactionTable* _tmp15_;
	DinoDatabaseReactionTable* _tmp16_;
	QliteColumn* _tmp17_;
	QliteQueryBuilder* _tmp18_;
	QliteQueryBuilder* _tmp19_;
	DinoDatabase* _tmp20_;
	DinoDatabaseReactionTable* _tmp21_;
	DinoDatabaseReactionTable* _tmp22_;
	QliteColumn* _tmp23_;
	QliteQueryBuilder* _tmp24_;
	QliteQueryBuilder* _tmp25_;
	QliteRowOption* row = NULL;
	QliteQueryBuilder* _tmp26_;
	QliteQueryBuilder* _tmp27_;
	QliteQueryBuilder* _tmp28_;
	QliteRowOption* _tmp29_;
	QliteRowOption* _tmp30_;
	DinoReactionsReactionsTime* ret = NULL;
	DinoReactionsReactionsTime* _tmp31_;
	QliteRowOption* _tmp32_;
	DinoReactionsReactionsTime* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (account != NULL, NULL);
	g_return_val_if_fail (jid != NULL, NULL);
	_tmp0_ = self->priv->db;
	jid_id = dino_database_get_jid_id (_tmp0_, jid);
	_tmp1_ = self->priv->db;
	_tmp2_ = dino_database_get_reaction (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = qlite_table_select ((QliteTable*) _tmp3_, NULL, (gint) 0);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->db;
	_tmp7_ = dino_database_get_reaction (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_->account_id;
	_tmp10_ = dino_entities_account_get_id (account);
	_tmp11_ = _tmp10_;
	_tmp12_ = qlite_query_builder_with (_tmp5_, G_TYPE_INT, NULL, NULL, _tmp9_, "=", (gpointer) ((gintptr) _tmp11_));
	_tmp13_ = _tmp12_;
	_tmp14_ = self->priv->db;
	_tmp15_ = dino_database_get_reaction (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_->content_item_id;
	_tmp18_ = qlite_query_builder_with (_tmp13_, G_TYPE_INT, NULL, NULL, _tmp17_, "=", (gpointer) ((gintptr) content_item_id));
	_tmp19_ = _tmp18_;
	_tmp20_ = self->priv->db;
	_tmp21_ = dino_database_get_reaction (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = _tmp22_->jid_id;
	_tmp24_ = qlite_query_builder_with (_tmp19_, G_TYPE_INT, NULL, NULL, _tmp23_, "=", (gpointer) ((gintptr) jid_id));
	_tmp25_ = _tmp24_;
	_qlite_statement_builder_unref0 (_tmp19_);
	_qlite_statement_builder_unref0 (_tmp13_);
	_qlite_statement_builder_unref0 (_tmp5_);
	query = _tmp25_;
	_tmp26_ = query;
	_tmp27_ = qlite_query_builder_single (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = qlite_query_builder_row (_tmp28_);
	_tmp30_ = _tmp29_;
	_qlite_statement_builder_unref0 (_tmp28_);
	row = _tmp30_;
	_tmp31_ = dino_reactions_reactions_time_new ();
	ret = _tmp31_;
	_tmp32_ = row;
	if (qlite_row_option_is_present (_tmp32_)) {
		DinoReactionsReactionsTime* _tmp33_;
		QliteRowOption* _tmp34_;
		DinoDatabase* _tmp35_;
		DinoDatabaseReactionTable* _tmp36_;
		DinoDatabaseReactionTable* _tmp37_;
		QliteColumn* _tmp38_;
		gpointer _tmp39_;
		gchar* _tmp40_;
		GeeList* _tmp41_;
		DinoReactionsReactionsTime* _tmp42_;
		QliteRowOption* _tmp43_;
		DinoDatabase* _tmp44_;
		DinoDatabaseReactionTable* _tmp45_;
		DinoDatabaseReactionTable* _tmp46_;
		QliteColumn* _tmp47_;
		gpointer _tmp48_;
		_tmp33_ = ret;
		_tmp34_ = row;
		_tmp35_ = self->priv->db;
		_tmp36_ = dino_database_get_reaction (_tmp35_);
		_tmp37_ = _tmp36_;
		_tmp38_ = _tmp37_->emojis;
		_tmp39_ = qlite_row_option_get (_tmp34_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp38_, NULL);
		_tmp40_ = (gchar*) _tmp39_;
		_tmp41_ = dino_reactions_string_to_emoji_list (self, _tmp40_);
		_g_object_unref0 (_tmp33_->emojis);
		_tmp33_->emojis = _tmp41_;
		_g_free0 (_tmp40_);
		_tmp42_ = ret;
		_tmp43_ = row;
		_tmp44_ = self->priv->db;
		_tmp45_ = dino_database_get_reaction (_tmp44_);
		_tmp46_ = _tmp45_;
		_tmp47_ = _tmp46_->time;
		_tmp48_ = qlite_row_option_get (_tmp43_, G_TYPE_LONG, NULL, NULL, _tmp47_, NULL);
		_tmp42_->time = (gint64) ((glong) ((gintptr) _tmp48_));
	} else {
		DinoReactionsReactionsTime* _tmp49_;
		GeeArrayList* _tmp50_;
		DinoReactionsReactionsTime* _tmp51_;
		_tmp49_ = ret;
		_tmp50_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
		_g_object_unref0 (_tmp49_->emojis);
		_tmp49_->emojis = (GeeList*) _tmp50_;
		_tmp51_ = ret;
		_tmp51_->time = (gint64) -1;
	}
	result = ret;
	_qlite_row_option_unref0 (row);
	_qlite_statement_builder_unref0 (query);
	return result;
}

static DinoReactionsReactionsTime*
dino_reactions_get_muc_user_reactions (DinoReactions* self,
                                       DinoEntitiesAccount* account,
                                       gint content_item_id,
                                       const gchar* occupant_id,
                                       XmppJid* real_jid)
{
	gboolean _tmp0_ = FALSE;
	QliteQueryBuilder* query = NULL;
	DinoDatabase* _tmp1_;
	DinoDatabaseReactionTable* _tmp2_;
	DinoDatabaseReactionTable* _tmp3_;
	QliteQueryBuilder* _tmp4_;
	QliteQueryBuilder* _tmp5_;
	DinoDatabase* _tmp6_;
	DinoDatabaseReactionTable* _tmp7_;
	DinoDatabaseReactionTable* _tmp8_;
	QliteColumn* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	QliteQueryBuilder* _tmp12_;
	QliteQueryBuilder* _tmp13_;
	DinoDatabase* _tmp14_;
	DinoDatabaseReactionTable* _tmp15_;
	DinoDatabaseReactionTable* _tmp16_;
	QliteColumn* _tmp17_;
	QliteQueryBuilder* _tmp18_;
	QliteQueryBuilder* _tmp19_;
	DinoDatabase* _tmp20_;
	DinoDatabaseOccupantIdTable* _tmp21_;
	DinoDatabaseOccupantIdTable* _tmp22_;
	DinoDatabase* _tmp23_;
	DinoDatabaseOccupantIdTable* _tmp24_;
	DinoDatabaseOccupantIdTable* _tmp25_;
	QliteColumn* _tmp26_;
	DinoDatabase* _tmp27_;
	DinoDatabaseReactionTable* _tmp28_;
	DinoDatabaseReactionTable* _tmp29_;
	QliteColumn* _tmp30_;
	QliteQueryBuilder* _tmp31_;
	QliteQueryBuilder* _tmp32_;
	QliteRowOption* row = NULL;
	QliteQueryBuilder* _tmp48_;
	QliteQueryBuilder* _tmp49_;
	QliteQueryBuilder* _tmp50_;
	QliteRowOption* _tmp51_;
	QliteRowOption* _tmp52_;
	DinoReactionsReactionsTime* ret = NULL;
	DinoReactionsReactionsTime* _tmp53_;
	QliteRowOption* _tmp54_;
	DinoReactionsReactionsTime* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (account != NULL, NULL);
	if (occupant_id == NULL) {
		_tmp0_ = real_jid == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		g_critical ("reactions.vala:139: Need occupant id or real jid of a reaction");
	}
	_tmp1_ = self->priv->db;
	_tmp2_ = dino_database_get_reaction (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = qlite_table_select ((QliteTable*) _tmp3_, NULL, (gint) 0);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->db;
	_tmp7_ = dino_database_get_reaction (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_->account_id;
	_tmp10_ = dino_entities_account_get_id (account);
	_tmp11_ = _tmp10_;
	_tmp12_ = qlite_query_builder_with (_tmp5_, G_TYPE_INT, NULL, NULL, _tmp9_, "=", (gpointer) ((gintptr) _tmp11_));
	_tmp13_ = _tmp12_;
	_tmp14_ = self->priv->db;
	_tmp15_ = dino_database_get_reaction (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_->content_item_id;
	_tmp18_ = qlite_query_builder_with (_tmp13_, G_TYPE_INT, NULL, NULL, _tmp17_, "=", (gpointer) ((gintptr) content_item_id));
	_tmp19_ = _tmp18_;
	_tmp20_ = self->priv->db;
	_tmp21_ = dino_database_get_occupantid (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = self->priv->db;
	_tmp24_ = dino_database_get_occupantid (_tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = _tmp25_->id;
	_tmp27_ = self->priv->db;
	_tmp28_ = dino_database_get_reaction (_tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = _tmp29_->occupant_id;
	_tmp31_ = qlite_query_builder_outer_join_with (_tmp19_, G_TYPE_INT, NULL, NULL, (QliteTable*) _tmp22_, _tmp26_, _tmp30_, NULL);
	_tmp32_ = _tmp31_;
	_qlite_statement_builder_unref0 (_tmp19_);
	_qlite_statement_builder_unref0 (_tmp13_);
	_qlite_statement_builder_unref0 (_tmp5_);
	query = _tmp32_;
	if (occupant_id != NULL) {
		QliteQueryBuilder* _tmp33_;
		DinoDatabase* _tmp34_;
		DinoDatabaseOccupantIdTable* _tmp35_;
		DinoDatabaseOccupantIdTable* _tmp36_;
		QliteColumn* _tmp37_;
		QliteQueryBuilder* _tmp38_;
		QliteQueryBuilder* _tmp39_;
		_tmp33_ = query;
		_tmp34_ = self->priv->db;
		_tmp35_ = dino_database_get_occupantid (_tmp34_);
		_tmp36_ = _tmp35_;
		_tmp37_ = _tmp36_->occupant_id;
		_tmp38_ = qlite_query_builder_with (_tmp33_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp37_, "=", occupant_id);
		_tmp39_ = _tmp38_;
		_qlite_statement_builder_unref0 (_tmp39_);
	} else {
		if (real_jid != NULL) {
			QliteQueryBuilder* _tmp40_;
			DinoDatabase* _tmp41_;
			DinoDatabaseReactionTable* _tmp42_;
			DinoDatabaseReactionTable* _tmp43_;
			QliteColumn* _tmp44_;
			DinoDatabase* _tmp45_;
			QliteQueryBuilder* _tmp46_;
			QliteQueryBuilder* _tmp47_;
			_tmp40_ = query;
			_tmp41_ = self->priv->db;
			_tmp42_ = dino_database_get_reaction (_tmp41_);
			_tmp43_ = _tmp42_;
			_tmp44_ = _tmp43_->jid_id;
			_tmp45_ = self->priv->db;
			_tmp46_ = qlite_query_builder_with (_tmp40_, G_TYPE_INT, NULL, NULL, _tmp44_, "=", (gpointer) ((gintptr) dino_database_get_jid_id (_tmp45_, real_jid)));
			_tmp47_ = _tmp46_;
			_qlite_statement_builder_unref0 (_tmp47_);
		}
	}
	_tmp48_ = query;
	_tmp49_ = qlite_query_builder_single (_tmp48_);
	_tmp50_ = _tmp49_;
	_tmp51_ = qlite_query_builder_row (_tmp50_);
	_tmp52_ = _tmp51_;
	_qlite_statement_builder_unref0 (_tmp50_);
	row = _tmp52_;
	_tmp53_ = dino_reactions_reactions_time_new ();
	ret = _tmp53_;
	_tmp54_ = row;
	if (qlite_row_option_is_present (_tmp54_)) {
		DinoReactionsReactionsTime* _tmp55_;
		QliteRowOption* _tmp56_;
		DinoDatabase* _tmp57_;
		DinoDatabaseReactionTable* _tmp58_;
		DinoDatabaseReactionTable* _tmp59_;
		QliteColumn* _tmp60_;
		gpointer _tmp61_;
		gchar* _tmp62_;
		GeeList* _tmp63_;
		DinoReactionsReactionsTime* _tmp64_;
		QliteRowOption* _tmp65_;
		DinoDatabase* _tmp66_;
		DinoDatabaseReactionTable* _tmp67_;
		DinoDatabaseReactionTable* _tmp68_;
		QliteColumn* _tmp69_;
		gpointer _tmp70_;
		_tmp55_ = ret;
		_tmp56_ = row;
		_tmp57_ = self->priv->db;
		_tmp58_ = dino_database_get_reaction (_tmp57_);
		_tmp59_ = _tmp58_;
		_tmp60_ = _tmp59_->emojis;
		_tmp61_ = qlite_row_option_get (_tmp56_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp60_, NULL);
		_tmp62_ = (gchar*) _tmp61_;
		_tmp63_ = dino_reactions_string_to_emoji_list (self, _tmp62_);
		_g_object_unref0 (_tmp55_->emojis);
		_tmp55_->emojis = _tmp63_;
		_g_free0 (_tmp62_);
		_tmp64_ = ret;
		_tmp65_ = row;
		_tmp66_ = self->priv->db;
		_tmp67_ = dino_database_get_reaction (_tmp66_);
		_tmp68_ = _tmp67_;
		_tmp69_ = _tmp68_->time;
		_tmp70_ = qlite_row_option_get (_tmp65_, G_TYPE_LONG, NULL, NULL, _tmp69_, NULL);
		_tmp64_->time = (gint64) ((glong) ((gintptr) _tmp70_));
	} else {
		DinoReactionsReactionsTime* _tmp71_;
		GeeArrayList* _tmp72_;
		DinoReactionsReactionsTime* _tmp73_;
		_tmp71_ = ret;
		_tmp72_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
		_g_object_unref0 (_tmp71_->emojis);
		_tmp71_->emojis = (GeeList*) _tmp72_;
		_tmp73_ = ret;
		_tmp73_->time = (gint64) -1;
	}
	result = ret;
	_qlite_row_option_unref0 (row);
	_qlite_statement_builder_unref0 (query);
	return result;
}

static GeeList*
dino_reactions_string_to_emoji_list (DinoReactions* self,
                                     const gchar* emoji_str)
{
	GeeArrayList* ret = NULL;
	GeeArrayList* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (emoji_str != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	ret = _tmp0_;
	_tmp2_ = _tmp1_ = g_strsplit (emoji_str, ",", 0);
	{
		gchar** emoji_collection = NULL;
		gint emoji_collection_length1 = 0;
		gint _emoji_collection_size_ = 0;
		gint emoji_it = 0;
		emoji_collection = _tmp2_;
		emoji_collection_length1 = _vala_array_length (_tmp1_);
		for (emoji_it = 0; emoji_it < emoji_collection_length1; emoji_it = emoji_it + 1) {
			gchar* _tmp3_;
			gchar* emoji = NULL;
			_tmp3_ = g_strdup (emoji_collection[emoji_it]);
			emoji = _tmp3_;
			{
				const gchar* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				_tmp4_ = emoji;
				_tmp5_ = strlen (_tmp4_);
				_tmp6_ = _tmp5_;
				if (_tmp6_ != 0) {
					GeeArrayList* _tmp7_;
					const gchar* _tmp8_;
					_tmp7_ = ret;
					_tmp8_ = emoji;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, _tmp8_);
				}
				_g_free0 (emoji);
			}
		}
		emoji_collection = (_vala_array_free (emoji_collection, emoji_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	result = (GeeList*) ret;
	return result;
}

static gboolean
_xmpp_jid_equals_func_gee_equal_data_func (gconstpointer a,
                                           gconstpointer b,
                                           gpointer self)
{
	gboolean result;
	result = xmpp_jid_equals_func ((XmppJid*) a, (XmppJid*) b);
	return result;
}

GeeList*
dino_reactions_get_chat_message_reactions (DinoReactions* self,
                                           DinoEntitiesAccount* account,
                                           DinoContentItem* content_item)
{
	QliteQueryBuilder* select = NULL;
	DinoDatabase* _tmp0_;
	DinoDatabaseReactionTable* _tmp1_;
	DinoDatabaseReactionTable* _tmp2_;
	QliteQueryBuilder* _tmp3_;
	QliteQueryBuilder* _tmp4_;
	DinoDatabase* _tmp5_;
	DinoDatabaseReactionTable* _tmp6_;
	DinoDatabaseReactionTable* _tmp7_;
	QliteColumn* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	QliteQueryBuilder* _tmp11_;
	QliteQueryBuilder* _tmp12_;
	DinoDatabase* _tmp13_;
	DinoDatabaseReactionTable* _tmp14_;
	DinoDatabaseReactionTable* _tmp15_;
	QliteColumn* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	QliteQueryBuilder* _tmp19_;
	QliteQueryBuilder* _tmp20_;
	DinoDatabase* _tmp21_;
	DinoDatabaseReactionTable* _tmp22_;
	DinoDatabaseReactionTable* _tmp23_;
	QliteColumn* _tmp24_;
	QliteQueryBuilder* _tmp25_;
	QliteQueryBuilder* _tmp26_;
	GeeArrayList* ret = NULL;
	GeeArrayList* _tmp27_;
	GeeHashMap* index = NULL;
	GeeHashMap* _tmp28_;
	GError* _inner_error0_ = NULL;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (account != NULL, NULL);
	g_return_val_if_fail (content_item != NULL, NULL);
	_tmp0_ = self->priv->db;
	_tmp1_ = dino_database_get_reaction (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = qlite_table_select ((QliteTable*) _tmp2_, NULL, (gint) 0);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->db;
	_tmp6_ = dino_database_get_reaction (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->account_id;
	_tmp9_ = dino_entities_account_get_id (account);
	_tmp10_ = _tmp9_;
	_tmp11_ = qlite_query_builder_with (_tmp4_, G_TYPE_INT, NULL, NULL, _tmp8_, "=", (gpointer) ((gintptr) _tmp10_));
	_tmp12_ = _tmp11_;
	_tmp13_ = self->priv->db;
	_tmp14_ = dino_database_get_reaction (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = _tmp15_->content_item_id;
	_tmp17_ = dino_content_item_get_id (content_item);
	_tmp18_ = _tmp17_;
	_tmp19_ = qlite_query_builder_with (_tmp12_, G_TYPE_INT, NULL, NULL, _tmp16_, "=", (gpointer) ((gintptr) _tmp18_));
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->db;
	_tmp22_ = dino_database_get_reaction (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = _tmp23_->time;
	_tmp25_ = qlite_query_builder_order_by (_tmp20_, _tmp24_, "DESC");
	_tmp26_ = _tmp25_;
	_qlite_statement_builder_unref0 (_tmp20_);
	_qlite_statement_builder_unref0 (_tmp12_);
	_qlite_statement_builder_unref0 (_tmp4_);
	select = _tmp26_;
	_tmp27_ = gee_array_list_new (DINO_TYPE_REACTION_USERS, (GBoxedCopyFunc) dino_reaction_users_ref, (GDestroyNotify) dino_reaction_users_unref, NULL, NULL, NULL);
	ret = _tmp27_;
	_tmp28_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, DINO_TYPE_REACTION_USERS, (GBoxedCopyFunc) dino_reaction_users_ref, (GDestroyNotify) dino_reaction_users_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	index = _tmp28_;
	{
		QliteRowIterator* _row_it = NULL;
		QliteQueryBuilder* _tmp29_;
		QliteRowIterator* _tmp30_;
		_tmp29_ = select;
		_tmp30_ = qlite_query_builder_iterator (_tmp29_);
		_row_it = _tmp30_;
		while (TRUE) {
			QliteRowIterator* _tmp31_;
			QliteRow* row = NULL;
			QliteRowIterator* _tmp32_;
			QliteRow* _tmp33_;
			gchar* emoji_str = NULL;
			QliteRow* _tmp34_;
			DinoDatabase* _tmp35_;
			DinoDatabaseReactionTable* _tmp36_;
			DinoDatabaseReactionTable* _tmp37_;
			QliteColumn* _tmp38_;
			gpointer _tmp39_;
			XmppJid* jid = NULL;
			DinoDatabase* _tmp40_;
			QliteRow* _tmp41_;
			DinoDatabase* _tmp42_;
			DinoDatabaseReactionTable* _tmp43_;
			DinoDatabaseReactionTable* _tmp44_;
			QliteColumn* _tmp45_;
			gpointer _tmp46_;
			XmppJid* _tmp47_;
			const gchar* _tmp48_;
			gchar** _tmp49_;
			gchar** _tmp50_;
			_tmp31_ = _row_it;
			if (!qlite_row_iterator_next (_tmp31_)) {
				break;
			}
			_tmp32_ = _row_it;
			_tmp33_ = qlite_row_iterator_get (_tmp32_);
			row = _tmp33_;
			_tmp34_ = row;
			_tmp35_ = self->priv->db;
			_tmp36_ = dino_database_get_reaction (_tmp35_);
			_tmp37_ = _tmp36_;
			_tmp38_ = _tmp37_->emojis;
			_tmp39_ = qlite_row_get (_tmp34_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp38_);
			emoji_str = (gchar*) _tmp39_;
			_tmp40_ = self->priv->db;
			_tmp41_ = row;
			_tmp42_ = self->priv->db;
			_tmp43_ = dino_database_get_reaction (_tmp42_);
			_tmp44_ = _tmp43_;
			_tmp45_ = _tmp44_->jid_id;
			_tmp46_ = qlite_row_get (_tmp41_, G_TYPE_INT, NULL, NULL, _tmp45_);
			_tmp47_ = dino_database_get_jid_by_id (_tmp40_, (gint) ((gintptr) _tmp46_), &_inner_error0_);
			jid = _tmp47_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_free0 (emoji_str);
				_qlite_row_unref0 (row);
				_qlite_row_iterator_unref0 (_row_it);
				_g_object_unref0 (index);
				_g_object_unref0 (ret);
				_qlite_statement_builder_unref0 (select);
				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;
			}
			_tmp48_ = emoji_str;
			_tmp50_ = _tmp49_ = g_strsplit (_tmp48_, ",", 0);
			{
				gchar** emoji_collection = NULL;
				gint emoji_collection_length1 = 0;
				gint _emoji_collection_size_ = 0;
				gint emoji_it = 0;
				emoji_collection = _tmp50_;
				emoji_collection_length1 = _vala_array_length (_tmp49_);
				for (emoji_it = 0; emoji_it < emoji_collection_length1; emoji_it = emoji_it + 1) {
					gchar* _tmp51_;
					gchar* emoji = NULL;
					_tmp51_ = g_strdup (emoji_collection[emoji_it]);
					emoji = _tmp51_;
					{
						GeeHashMap* _tmp52_;
						const gchar* _tmp53_;
						GeeHashMap* _tmp66_;
						const gchar* _tmp67_;
						gpointer _tmp68_;
						DinoReactionUsers* _tmp69_;
						GeeList* _tmp70_;
						GeeList* _tmp71_;
						XmppJid* _tmp72_;
						_tmp52_ = index;
						_tmp53_ = emoji;
						if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp52_, _tmp53_)) {
							GeeHashMap* _tmp54_;
							const gchar* _tmp55_;
							const gchar* _tmp56_;
							gchar* _tmp57_;
							GeeArrayList* _tmp58_;
							DinoReactionUsers* _tmp59_ = NULL;
							DinoReactionUsers* _tmp60_;
							GeeArrayList* _tmp61_;
							GeeHashMap* _tmp62_;
							const gchar* _tmp63_;
							gpointer _tmp64_;
							DinoReactionUsers* _tmp65_;
							_tmp54_ = index;
							_tmp55_ = emoji;
							_tmp56_ = emoji;
							_tmp57_ = g_strdup (_tmp56_);
							_tmp58_ = gee_array_list_new (XMPP_TYPE_JID, (GBoxedCopyFunc) xmpp_jid_ref, (GDestroyNotify) xmpp_jid_unref, _xmpp_jid_equals_func_gee_equal_data_func, NULL, NULL);
							_tmp59_ = dino_reaction_users_new ();
							dino_reaction_users_set_reaction (_tmp59_, _tmp57_);
							_g_free0 (_tmp57_);
							dino_reaction_users_set_jids (_tmp59_, (GeeList*) _tmp58_);
							_g_object_unref0 (_tmp58_);
							_tmp60_ = _tmp59_;
							gee_abstract_map_set ((GeeAbstractMap*) _tmp54_, _tmp55_, _tmp60_);
							_dino_reaction_users_unref0 (_tmp60_);
							_tmp61_ = ret;
							_tmp62_ = index;
							_tmp63_ = emoji;
							_tmp64_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp62_, _tmp63_);
							_tmp65_ = (DinoReactionUsers*) _tmp64_;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp61_, _tmp65_);
							_dino_reaction_users_unref0 (_tmp65_);
						}
						_tmp66_ = index;
						_tmp67_ = emoji;
						_tmp68_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp66_, _tmp67_);
						_tmp69_ = (DinoReactionUsers*) _tmp68_;
						_tmp70_ = dino_reaction_users_get_jids (_tmp69_);
						_tmp71_ = _tmp70_;
						_tmp72_ = jid;
						gee_collection_add ((GeeCollection*) _tmp71_, _tmp72_);
						_dino_reaction_users_unref0 (_tmp69_);
						_g_free0 (emoji);
					}
				}
				emoji_collection = (_vala_array_free (emoji_collection, emoji_collection_length1, (GDestroyNotify) g_free), NULL);
			}
			_xmpp_jid_unref0 (jid);
			_g_free0 (emoji_str);
			_qlite_row_unref0 (row);
		}
		_qlite_row_iterator_unref0 (_row_it);
	}
	result = (GeeList*) ret;
	_g_object_unref0 (index);
	_qlite_statement_builder_unref0 (select);
	return result;
}

GeeList*
dino_reactions_get_muc_message_reactions (DinoReactions* self,
                                          DinoEntitiesAccount* account,
                                          DinoContentItem* content_item)
{
	QliteQueryBuilder* select = NULL;
	DinoDatabase* _tmp0_;
	DinoDatabaseReactionTable* _tmp1_;
	DinoDatabaseReactionTable* _tmp2_;
	QliteQueryBuilder* _tmp3_;
	QliteQueryBuilder* _tmp4_;
	DinoDatabase* _tmp5_;
	DinoDatabaseReactionTable* _tmp6_;
	DinoDatabaseReactionTable* _tmp7_;
	QliteColumn* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	QliteQueryBuilder* _tmp11_;
	QliteQueryBuilder* _tmp12_;
	DinoDatabase* _tmp13_;
	DinoDatabaseReactionTable* _tmp14_;
	DinoDatabaseReactionTable* _tmp15_;
	QliteColumn* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	QliteQueryBuilder* _tmp19_;
	QliteQueryBuilder* _tmp20_;
	DinoDatabase* _tmp21_;
	DinoDatabaseOccupantIdTable* _tmp22_;
	DinoDatabaseOccupantIdTable* _tmp23_;
	DinoDatabase* _tmp24_;
	DinoDatabaseOccupantIdTable* _tmp25_;
	DinoDatabaseOccupantIdTable* _tmp26_;
	QliteColumn* _tmp27_;
	DinoDatabase* _tmp28_;
	DinoDatabaseReactionTable* _tmp29_;
	DinoDatabaseReactionTable* _tmp30_;
	QliteColumn* _tmp31_;
	QliteQueryBuilder* _tmp32_;
	QliteQueryBuilder* _tmp33_;
	DinoDatabase* _tmp34_;
	DinoDatabaseJidTable* _tmp35_;
	DinoDatabaseJidTable* _tmp36_;
	DinoDatabase* _tmp37_;
	DinoDatabaseJidTable* _tmp38_;
	DinoDatabaseJidTable* _tmp39_;
	QliteColumn* _tmp40_;
	DinoDatabase* _tmp41_;
	DinoDatabaseReactionTable* _tmp42_;
	DinoDatabaseReactionTable* _tmp43_;
	QliteColumn* _tmp44_;
	QliteQueryBuilder* _tmp45_;
	QliteQueryBuilder* _tmp46_;
	DinoDatabase* _tmp47_;
	DinoDatabaseReactionTable* _tmp48_;
	DinoDatabaseReactionTable* _tmp49_;
	QliteColumn* _tmp50_;
	QliteQueryBuilder* _tmp51_;
	QliteQueryBuilder* _tmp52_;
	gchar* own_occupant_id = NULL;
	DinoStreamInteractor* _tmp53_;
	DinoModuleIdentity* _tmp54_;
	gpointer _tmp55_;
	DinoMucManager* _tmp56_;
	XmppJid* _tmp57_;
	XmppJid* _tmp58_;
	gchar* _tmp59_;
	gchar* _tmp60_;
	GeeArrayList* ret = NULL;
	GeeArrayList* _tmp61_;
	GeeHashMap* index = NULL;
	GeeHashMap* _tmp62_;
	GError* _inner_error0_ = NULL;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (account != NULL, NULL);
	g_return_val_if_fail (content_item != NULL, NULL);
	_tmp0_ = self->priv->db;
	_tmp1_ = dino_database_get_reaction (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = qlite_table_select ((QliteTable*) _tmp2_, NULL, (gint) 0);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->db;
	_tmp6_ = dino_database_get_reaction (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->account_id;
	_tmp9_ = dino_entities_account_get_id (account);
	_tmp10_ = _tmp9_;
	_tmp11_ = qlite_query_builder_with (_tmp4_, G_TYPE_INT, NULL, NULL, _tmp8_, "=", (gpointer) ((gintptr) _tmp10_));
	_tmp12_ = _tmp11_;
	_tmp13_ = self->priv->db;
	_tmp14_ = dino_database_get_reaction (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = _tmp15_->content_item_id;
	_tmp17_ = dino_content_item_get_id (content_item);
	_tmp18_ = _tmp17_;
	_tmp19_ = qlite_query_builder_with (_tmp12_, G_TYPE_INT, NULL, NULL, _tmp16_, "=", (gpointer) ((gintptr) _tmp18_));
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->db;
	_tmp22_ = dino_database_get_occupantid (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = self->priv->db;
	_tmp25_ = dino_database_get_occupantid (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = _tmp26_->id;
	_tmp28_ = self->priv->db;
	_tmp29_ = dino_database_get_reaction (_tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = _tmp30_->occupant_id;
	_tmp32_ = qlite_query_builder_outer_join_with (_tmp20_, G_TYPE_INT, NULL, NULL, (QliteTable*) _tmp23_, _tmp27_, _tmp31_, NULL);
	_tmp33_ = _tmp32_;
	_tmp34_ = self->priv->db;
	_tmp35_ = dino_database_get_jid (_tmp34_);
	_tmp36_ = _tmp35_;
	_tmp37_ = self->priv->db;
	_tmp38_ = dino_database_get_jid (_tmp37_);
	_tmp39_ = _tmp38_;
	_tmp40_ = _tmp39_->id;
	_tmp41_ = self->priv->db;
	_tmp42_ = dino_database_get_reaction (_tmp41_);
	_tmp43_ = _tmp42_;
	_tmp44_ = _tmp43_->jid_id;
	_tmp45_ = qlite_query_builder_outer_join_with (_tmp33_, G_TYPE_INT, NULL, NULL, (QliteTable*) _tmp36_, _tmp40_, _tmp44_, NULL);
	_tmp46_ = _tmp45_;
	_tmp47_ = self->priv->db;
	_tmp48_ = dino_database_get_reaction (_tmp47_);
	_tmp49_ = _tmp48_;
	_tmp50_ = _tmp49_->time;
	_tmp51_ = qlite_query_builder_order_by (_tmp46_, _tmp50_, "DESC");
	_tmp52_ = _tmp51_;
	_qlite_statement_builder_unref0 (_tmp46_);
	_qlite_statement_builder_unref0 (_tmp33_);
	_qlite_statement_builder_unref0 (_tmp20_);
	_qlite_statement_builder_unref0 (_tmp12_);
	_qlite_statement_builder_unref0 (_tmp4_);
	select = _tmp52_;
	_tmp53_ = self->priv->stream_interactor;
	_tmp54_ = dino_muc_manager_IDENTITY;
	_tmp55_ = dino_stream_interactor_get_module (_tmp53_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp54_);
	_tmp56_ = (DinoMucManager*) _tmp55_;
	_tmp57_ = dino_content_item_get_jid (content_item);
	_tmp58_ = _tmp57_;
	_tmp59_ = dino_muc_manager_get_own_occupant_id (_tmp56_, account, _tmp58_);
	_tmp60_ = _tmp59_;
	_g_object_unref0 (_tmp56_);
	own_occupant_id = _tmp60_;
	_tmp61_ = gee_array_list_new (DINO_TYPE_REACTION_USERS, (GBoxedCopyFunc) dino_reaction_users_ref, (GDestroyNotify) dino_reaction_users_unref, NULL, NULL, NULL);
	ret = _tmp61_;
	_tmp62_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, DINO_TYPE_REACTION_USERS, (GBoxedCopyFunc) dino_reaction_users_ref, (GDestroyNotify) dino_reaction_users_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	index = _tmp62_;
	{
		QliteRowIterator* _row_it = NULL;
		QliteQueryBuilder* _tmp63_;
		QliteRowIterator* _tmp64_;
		_tmp63_ = select;
		_tmp64_ = qlite_query_builder_iterator (_tmp63_);
		_row_it = _tmp64_;
		while (TRUE) {
			QliteRowIterator* _tmp65_;
			QliteRow* row = NULL;
			QliteRowIterator* _tmp66_;
			QliteRow* _tmp67_;
			gchar* emoji_str = NULL;
			QliteRow* _tmp68_;
			DinoDatabase* _tmp69_;
			DinoDatabaseReactionTable* _tmp70_;
			DinoDatabaseReactionTable* _tmp71_;
			QliteColumn* _tmp72_;
			gpointer _tmp73_;
			XmppJid* jid = NULL;
			DinoDatabase* _tmp74_;
			DinoDatabaseJidTable* _tmp75_;
			DinoDatabaseJidTable* _tmp76_;
			QliteColumn* _tmp77_;
			QliteRow* _tmp78_;
			const gchar* _tmp118_;
			gchar** _tmp119_;
			gchar** _tmp120_;
			_tmp65_ = _row_it;
			if (!qlite_row_iterator_next (_tmp65_)) {
				break;
			}
			_tmp66_ = _row_it;
			_tmp67_ = qlite_row_iterator_get (_tmp66_);
			row = _tmp67_;
			_tmp68_ = row;
			_tmp69_ = self->priv->db;
			_tmp70_ = dino_database_get_reaction (_tmp69_);
			_tmp71_ = _tmp70_;
			_tmp72_ = _tmp71_->emojis;
			_tmp73_ = qlite_row_get (_tmp68_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp72_);
			emoji_str = (gchar*) _tmp73_;
			jid = NULL;
			_tmp74_ = self->priv->db;
			_tmp75_ = dino_database_get_jid (_tmp74_);
			_tmp76_ = _tmp75_;
			_tmp77_ = _tmp76_->bare_jid;
			_tmp78_ = row;
			if (!qlite_column_is_null (_tmp77_, _tmp78_, QLITE_COLUMN_DEFAULT_TABLE_NAME)) {
				XmppJid* _tmp79_ = NULL;
				QliteRow* _tmp80_;
				DinoDatabase* _tmp81_;
				DinoDatabaseJidTable* _tmp82_;
				DinoDatabaseJidTable* _tmp83_;
				QliteColumn* _tmp84_;
				gpointer _tmp85_;
				gchar* _tmp86_;
				XmppJid* _tmp87_;
				XmppJid* _tmp88_;
				XmppJid* _tmp89_;
				_tmp80_ = row;
				_tmp81_ = self->priv->db;
				_tmp82_ = dino_database_get_jid (_tmp81_);
				_tmp83_ = _tmp82_;
				_tmp84_ = _tmp83_->bare_jid;
				_tmp85_ = qlite_row_get (_tmp80_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp84_);
				_tmp86_ = (gchar*) _tmp85_;
				_tmp87_ = xmpp_jid_new (_tmp86_, &_inner_error0_);
				_tmp88_ = _tmp87_;
				_g_free0 (_tmp86_);
				_tmp79_ = _tmp88_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_xmpp_jid_unref0 (jid);
					_g_free0 (emoji_str);
					_qlite_row_unref0 (row);
					_qlite_row_iterator_unref0 (_row_it);
					_g_object_unref0 (index);
					_g_object_unref0 (ret);
					_g_free0 (own_occupant_id);
					_qlite_statement_builder_unref0 (select);
					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;
				}
				_tmp89_ = _tmp79_;
				_tmp79_ = NULL;
				_xmpp_jid_unref0 (jid);
				jid = _tmp89_;
				_xmpp_jid_unref0 (_tmp79_);
			} else {
				DinoDatabase* _tmp90_;
				DinoDatabaseOccupantIdTable* _tmp91_;
				DinoDatabaseOccupantIdTable* _tmp92_;
				QliteColumn* _tmp93_;
				QliteRow* _tmp94_;
				_tmp90_ = self->priv->db;
				_tmp91_ = dino_database_get_occupantid (_tmp90_);
				_tmp92_ = _tmp91_;
				_tmp93_ = _tmp92_->occupant_id;
				_tmp94_ = row;
				if (!qlite_column_is_null (_tmp93_, _tmp94_, QLITE_COLUMN_DEFAULT_TABLE_NAME)) {
					QliteRow* _tmp95_;
					DinoDatabase* _tmp96_;
					DinoDatabaseOccupantIdTable* _tmp97_;
					DinoDatabaseOccupantIdTable* _tmp98_;
					QliteColumn* _tmp99_;
					gpointer _tmp100_;
					gchar* _tmp101_;
					const gchar* _tmp102_;
					gboolean _tmp103_;
					_tmp95_ = row;
					_tmp96_ = self->priv->db;
					_tmp97_ = dino_database_get_occupantid (_tmp96_);
					_tmp98_ = _tmp97_;
					_tmp99_ = _tmp98_->occupant_id;
					_tmp100_ = qlite_row_get (_tmp95_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp99_);
					_tmp101_ = (gchar*) _tmp100_;
					_tmp102_ = own_occupant_id;
					_tmp103_ = g_strcmp0 (_tmp101_, _tmp102_) == 0;
					_g_free0 (_tmp101_);
					if (_tmp103_) {
						XmppJid* _tmp104_;
						XmppJid* _tmp105_;
						_tmp104_ = dino_entities_account_get_bare_jid (account);
						_tmp105_ = _tmp104_;
						_xmpp_jid_unref0 (jid);
						jid = _tmp105_;
					} else {
						gchar* nick = NULL;
						QliteRow* _tmp106_;
						DinoDatabase* _tmp107_;
						DinoDatabaseOccupantIdTable* _tmp108_;
						DinoDatabaseOccupantIdTable* _tmp109_;
						QliteColumn* _tmp110_;
						gpointer _tmp111_;
						XmppJid* _tmp112_ = NULL;
						XmppJid* _tmp113_;
						XmppJid* _tmp114_;
						const gchar* _tmp115_;
						XmppJid* _tmp116_;
						XmppJid* _tmp117_;
						_tmp106_ = row;
						_tmp107_ = self->priv->db;
						_tmp108_ = dino_database_get_occupantid (_tmp107_);
						_tmp109_ = _tmp108_;
						_tmp110_ = _tmp109_->last_nick;
						_tmp111_ = qlite_row_get (_tmp106_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp110_);
						nick = (gchar*) _tmp111_;
						_tmp113_ = dino_content_item_get_jid (content_item);
						_tmp114_ = _tmp113_;
						_tmp115_ = nick;
						_tmp116_ = xmpp_jid_with_resource (_tmp114_, _tmp115_, &_inner_error0_);
						_tmp112_ = _tmp116_;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							_g_free0 (nick);
							_xmpp_jid_unref0 (jid);
							_g_free0 (emoji_str);
							_qlite_row_unref0 (row);
							_qlite_row_iterator_unref0 (_row_it);
							_g_object_unref0 (index);
							_g_object_unref0 (ret);
							_g_free0 (own_occupant_id);
							_qlite_statement_builder_unref0 (select);
							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;
						}
						_tmp117_ = _tmp112_;
						_tmp112_ = NULL;
						_xmpp_jid_unref0 (jid);
						jid = _tmp117_;
						_xmpp_jid_unref0 (_tmp112_);
						_g_free0 (nick);
					}
				} else {
					g_warning ("reactions.vala:222: Reaction with neither JID nor occupant id");
				}
			}
			_tmp118_ = emoji_str;
			_tmp120_ = _tmp119_ = g_strsplit (_tmp118_, ",", 0);
			{
				gchar** emoji_collection = NULL;
				gint emoji_collection_length1 = 0;
				gint _emoji_collection_size_ = 0;
				gint emoji_it = 0;
				emoji_collection = _tmp120_;
				emoji_collection_length1 = _vala_array_length (_tmp119_);
				for (emoji_it = 0; emoji_it < emoji_collection_length1; emoji_it = emoji_it + 1) {
					gchar* _tmp121_;
					gchar* emoji = NULL;
					_tmp121_ = g_strdup (emoji_collection[emoji_it]);
					emoji = _tmp121_;
					{
						GeeHashMap* _tmp122_;
						const gchar* _tmp123_;
						GeeHashMap* _tmp136_;
						const gchar* _tmp137_;
						gpointer _tmp138_;
						DinoReactionUsers* _tmp139_;
						GeeList* _tmp140_;
						GeeList* _tmp141_;
						XmppJid* _tmp142_;
						_tmp122_ = index;
						_tmp123_ = emoji;
						if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp122_, _tmp123_)) {
							GeeHashMap* _tmp124_;
							const gchar* _tmp125_;
							const gchar* _tmp126_;
							gchar* _tmp127_;
							GeeArrayList* _tmp128_;
							DinoReactionUsers* _tmp129_ = NULL;
							DinoReactionUsers* _tmp130_;
							GeeArrayList* _tmp131_;
							GeeHashMap* _tmp132_;
							const gchar* _tmp133_;
							gpointer _tmp134_;
							DinoReactionUsers* _tmp135_;
							_tmp124_ = index;
							_tmp125_ = emoji;
							_tmp126_ = emoji;
							_tmp127_ = g_strdup (_tmp126_);
							_tmp128_ = gee_array_list_new (XMPP_TYPE_JID, (GBoxedCopyFunc) xmpp_jid_ref, (GDestroyNotify) xmpp_jid_unref, _xmpp_jid_equals_func_gee_equal_data_func, NULL, NULL);
							_tmp129_ = dino_reaction_users_new ();
							dino_reaction_users_set_reaction (_tmp129_, _tmp127_);
							_g_free0 (_tmp127_);
							dino_reaction_users_set_jids (_tmp129_, (GeeList*) _tmp128_);
							_g_object_unref0 (_tmp128_);
							_tmp130_ = _tmp129_;
							gee_abstract_map_set ((GeeAbstractMap*) _tmp124_, _tmp125_, _tmp130_);
							_dino_reaction_users_unref0 (_tmp130_);
							_tmp131_ = ret;
							_tmp132_ = index;
							_tmp133_ = emoji;
							_tmp134_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp132_, _tmp133_);
							_tmp135_ = (DinoReactionUsers*) _tmp134_;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp131_, _tmp135_);
							_dino_reaction_users_unref0 (_tmp135_);
						}
						_tmp136_ = index;
						_tmp137_ = emoji;
						_tmp138_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp136_, _tmp137_);
						_tmp139_ = (DinoReactionUsers*) _tmp138_;
						_tmp140_ = dino_reaction_users_get_jids (_tmp139_);
						_tmp141_ = _tmp140_;
						_tmp142_ = jid;
						gee_collection_add ((GeeCollection*) _tmp141_, _tmp142_);
						_dino_reaction_users_unref0 (_tmp139_);
						_g_free0 (emoji);
					}
				}
				emoji_collection = (_vala_array_free (emoji_collection, emoji_collection_length1, (GDestroyNotify) g_free), NULL);
			}
			_xmpp_jid_unref0 (jid);
			_g_free0 (emoji_str);
			_qlite_row_unref0 (row);
		}
		_qlite_row_iterator_unref0 (_row_it);
	}
	result = (GeeList*) ret;
	_g_object_unref0 (index);
	_g_free0 (own_occupant_id);
	_qlite_statement_builder_unref0 (select);
	return result;
}

static Block37Data*
block37_data_ref (Block37Data* _data37_)
{
	g_atomic_int_inc (&_data37_->_ref_count_);
	return _data37_;
}

static void
block37_data_unref (void * _userdata_)
{
	Block37Data* _data37_;
	_data37_ = (Block37Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data37_->_ref_count_)) {
		DinoReactions* self;
		self = _data37_->self;
		_g_object_unref0 (_data37_->account);
		_g_object_unref0 (self);
		g_slice_free (Block37Data, _data37_);
	}
}

static void
__lambda137_ (Block37Data* _data37_,
              XmppXmppStream* stream,
              XmppJid* from_jid,
              const gchar* message_id,
              GeeList* reactions,
              XmppMessageStanza* stanza)
{
	DinoReactions* self;
	self = _data37_->self;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (from_jid != NULL);
	g_return_if_fail (message_id != NULL);
	g_return_if_fail (reactions != NULL);
	g_return_if_fail (stanza != NULL);
	dino_reactions_on_reaction_received (self, _data37_->account, from_jid, message_id, reactions, stanza, NULL, NULL);
}

static void
___lambda137__xmpp_xep_reactions_module_received_reactions (XmppXepReactionsModule* _sender,
                                                            XmppXmppStream* stream,
                                                            XmppJid* from_jid,
                                                            const gchar* message_id,
                                                            GeeList* reactions,
                                                            XmppMessageStanza* stanza,
                                                            gpointer self)
{
	__lambda137_ (self, stream, from_jid, message_id, reactions, stanza);
}

static void
dino_reactions_on_account_added (DinoReactions* self,
                                 DinoEntitiesAccount* account)
{
	Block37Data* _data37_;
	DinoEntitiesAccount* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoModuleManager* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppXepReactionsModule* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	_data37_ = g_slice_new0 (Block37Data);
	_data37_->_ref_count_ = 1;
	_data37_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (account);
	_g_object_unref0 (_data37_->account);
	_data37_->account = _tmp0_;
	_tmp1_ = self->priv->stream_interactor;
	_tmp2_ = _tmp1_->module_manager;
	_tmp3_ = xmpp_xep_reactions_module_IDENTITY;
	_tmp4_ = dino_module_manager_get_module (_tmp2_, XMPP_XEP_REACTIONS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data37_->account, _tmp3_);
	_tmp5_ = (XmppXepReactionsModule*) _tmp4_;
	g_signal_connect_data (_tmp5_, "received-reactions", (GCallback) ___lambda137__xmpp_xep_reactions_module_received_reactions, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	_g_object_unref0 (_tmp5_);
	block37_data_unref (_data37_);
	_data37_ = NULL;
}

static void
dino_reactions_on_reaction_received_data_free (gpointer _data)
{
	DinoReactionsOnReactionReceivedData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->account);
	_xmpp_jid_unref0 (_data_->from_jid);
	_g_free0 (_data_->message_id);
	_g_object_unref0 (_data_->reactions);
	_g_object_unref0 (_data_->stanza);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoReactionsOnReactionReceivedData, _data_);
}

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

static void
dino_reactions_on_reaction_received (DinoReactions* self,
                                     DinoEntitiesAccount* account,
                                     XmppJid* from_jid,
                                     const gchar* message_id,
                                     GeeList* reactions,
                                     XmppMessageStanza* stanza,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DinoReactionsOnReactionReceivedData* _data_;
	DinoReactions* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	XmppJid* _tmp2_;
	gchar* _tmp3_;
	GeeList* _tmp4_;
	XmppMessageStanza* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	g_return_if_fail (from_jid != NULL);
	g_return_if_fail (message_id != NULL);
	g_return_if_fail (reactions != NULL);
	g_return_if_fail (stanza != NULL);
	_data_ = g_slice_new0 (DinoReactionsOnReactionReceivedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_reactions_on_reaction_received_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (account);
	_g_object_unref0 (_data_->account);
	_data_->account = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (from_jid);
	_xmpp_jid_unref0 (_data_->from_jid);
	_data_->from_jid = _tmp2_;
	_tmp3_ = g_strdup (message_id);
	_g_free0 (_data_->message_id);
	_data_->message_id = _tmp3_;
	_tmp4_ = _g_object_ref0 (reactions);
	_g_object_unref0 (_data_->reactions);
	_data_->reactions = _tmp4_;
	_tmp5_ = _g_object_ref0 (stanza);
	_g_object_unref0 (_data_->stanza);
	_data_->stanza = _tmp5_;
	dino_reactions_on_reaction_received_co (_data_);
}

static void
dino_reactions_on_reaction_received_finish (DinoReactions* self,
                                            GAsyncResult* _res_)
{
	DinoReactionsOnReactionReceivedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dino_reactions_on_reaction_received_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DinoReactionsOnReactionReceivedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_reactions_on_reaction_received_co (_data_);
}

static gboolean
dino_reactions_on_reaction_received_co (DinoReactionsOnReactionReceivedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->stanza);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (g_strcmp0 (_data_->_tmp1_, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT) == 0) {
		_data_->_tmp2_ = _data_->self->priv->stream_interactor;
		_data_->_tmp3_ = dino_conversation_manager_IDENTITY;
		_data_->_tmp4_ = dino_stream_interactor_get_module (_data_->_tmp2_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp3_);
		_data_->_tmp5_ = (DinoConversationManager*) _data_->_tmp4_;
		_data_->_tmp6_ = dino_entities_account_get_bare_jid (_data_->account);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp9_ = dino_conversation_manager_approx_conversation_for_stanza (_data_->_tmp5_, _data_->from_jid, _data_->_tmp8_, _data_->account, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT);
		_data_->_tmp10_ = _data_->_tmp9_;
		_xmpp_jid_unref0 (_data_->_tmp8_);
		_g_object_unref0 (_data_->_tmp5_);
		_data_->muc_conversation = _data_->_tmp10_;
		_data_->_tmp11_ = _data_->muc_conversation;
		_data_->muc_supports_reactions = dino_reactions_conversation_supports_reactions (_data_->self, _data_->_tmp11_);
		if (!_data_->muc_supports_reactions) {
			_g_object_unref0 (_data_->muc_conversation);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_object_unref0 (_data_->muc_conversation);
	}
	_data_->_tmp12_ = _data_->self->priv->stream_interactor;
	_data_->_tmp13_ = dino_message_processor_IDENTITY;
	_data_->_tmp14_ = dino_stream_interactor_get_module (_data_->_tmp12_, DINO_TYPE_MESSAGE_PROCESSOR, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp13_);
	_data_->_tmp15_ = (DinoMessageProcessor*) _data_->_tmp14_;
	_data_->_state_ = 1;
	dino_message_processor_parse_message_stanza (_data_->_tmp15_, _data_->account, _data_->stanza, dino_reactions_on_reaction_received_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp16_ = dino_message_processor_parse_message_stanza_finish (_data_->_tmp15_, _data_->_res_);
	_data_->_tmp17_ = _data_->_tmp16_;
	_g_object_unref0 (_data_->_tmp15_);
	_data_->reaction_message = _data_->_tmp17_;
	_data_->_tmp18_ = _data_->self->priv->stream_interactor;
	_data_->_tmp19_ = dino_conversation_manager_IDENTITY;
	_data_->_tmp20_ = dino_stream_interactor_get_module (_data_->_tmp18_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp19_);
	_data_->_tmp21_ = (DinoConversationManager*) _data_->_tmp20_;
	_data_->_tmp22_ = _data_->reaction_message;
	_data_->_tmp23_ = dino_conversation_manager_get_conversation_for_message (_data_->_tmp21_, _data_->_tmp22_);
	_data_->_tmp24_ = _data_->_tmp23_;
	_g_object_unref0 (_data_->_tmp21_);
	_data_->conversation = _data_->_tmp24_;
	_data_->_tmp25_ = _data_->self->priv->stream_interactor;
	_data_->_tmp26_ = dino_content_item_store_IDENTITY;
	_data_->_tmp27_ = dino_stream_interactor_get_module (_data_->_tmp25_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp26_);
	_data_->_tmp28_ = (DinoContentItemStore*) _data_->_tmp27_;
	_data_->_tmp29_ = _data_->conversation;
	_data_->_tmp30_ = dino_content_item_store_get_content_item_id_for_message_id (_data_->_tmp28_, _data_->_tmp29_, _data_->message_id);
	_g_object_unref0 (_data_->_tmp28_);
	_data_->content_item_id = _data_->_tmp30_;
	_data_->_tmp31_ = _data_->conversation;
	_data_->_tmp32_ = _g_object_ref0 (_data_->_tmp31_);
	_data_->_tmp33_ = _xmpp_jid_ref0 (_data_->from_jid);
	_data_->_tmp34_ = _g_object_ref0 (_data_->reactions);
	_data_->_tmp35_ = _g_object_ref0 (_data_->stanza);
	_data_->_tmp36_ = g_time_zone_new_local ();
	_data_->_tmp37_ = _data_->_tmp36_;
	_data_->_tmp38_ = g_date_time_new_now (_data_->_tmp37_);
	_data_->_tmp39_ = NULL;
	_data_->_tmp39_ = dino_reaction_info_new ();
	dino_reaction_info_set_conversation (_data_->_tmp39_, _data_->_tmp32_);
	_g_object_unref0 (_data_->_tmp32_);
	dino_reaction_info_set_from_jid (_data_->_tmp39_, _data_->_tmp33_);
	_xmpp_jid_unref0 (_data_->_tmp33_);
	dino_reaction_info_set_reactions (_data_->_tmp39_, _data_->_tmp34_);
	_g_object_unref0 (_data_->_tmp34_);
	dino_reaction_info_set_stanza (_data_->_tmp39_, _data_->_tmp35_);
	_g_object_unref0 (_data_->_tmp35_);
	dino_reaction_info_set_received_time (_data_->_tmp39_, _data_->_tmp38_);
	_g_date_time_unref0 (_data_->_tmp38_);
	_data_->_tmp40_ = _data_->_tmp39_;
	_g_time_zone_unref0 (_data_->_tmp37_);
	_data_->reaction_info = _data_->_tmp40_;
	if (_data_->content_item_id != -1) {
		_data_->_tmp41_ = _data_->reaction_info;
		dino_reactions_process_reaction_for_message (_data_->self, _data_->content_item_id, _data_->_tmp41_);
		_dino_reaction_info_unref0 (_data_->reaction_info);
		_g_object_unref0 (_data_->conversation);
		_g_object_unref0 (_data_->reaction_message);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp42_ = _data_->self->priv->db;
	_data_->_tmp43_ = xmpp_stanza_get_from ((XmppStanza*) _data_->stanza);
	_data_->_tmp44_ = _data_->_tmp43_;
	_data_->_tmp45_ = _data_->_tmp44_;
	_data_->_tmp46_ = xmpp_jid_get_bare_jid (_data_->_tmp45_);
	_data_->_tmp47_ = _data_->_tmp46_;
	_data_->_tmp48_ = _data_->_tmp47_;
	_data_->_tmp49_ = g_strdup_printf ("%i", dino_database_get_jid_id (_data_->_tmp42_, _data_->_tmp48_));
	_data_->_tmp50_ = _data_->_tmp49_;
	g_debug ("reactions.vala:263: Got reaction for %s but dont have message yet %s", _data_->message_id, _data_->_tmp50_);
	_g_free0 (_data_->_tmp50_);
	_xmpp_jid_unref0 (_data_->_tmp48_);
	_xmpp_jid_unref0 (_data_->_tmp45_);
	_data_->_tmp51_ = _data_->self->priv->reaction_infos;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp51_, _data_->message_id)) {
		_data_->_tmp52_ = _data_->self->priv->reaction_infos;
		_data_->_tmp53_ = gee_array_list_new (DINO_TYPE_REACTION_INFO, (GBoxedCopyFunc) dino_reaction_info_ref, (GDestroyNotify) dino_reaction_info_unref, NULL, NULL, NULL);
		_data_->_tmp54_ = _data_->_tmp53_;
		gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp52_, _data_->message_id, (GeeList*) _data_->_tmp54_);
		_g_object_unref0 (_data_->_tmp54_);
	}
	_data_->_tmp55_ = _data_->self->priv->reaction_infos;
	_data_->_tmp56_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp55_, _data_->message_id);
	_data_->_tmp57_ = (GeeList*) _data_->_tmp56_;
	_data_->_tmp58_ = _data_->reaction_info;
	gee_collection_add ((GeeCollection*) _data_->_tmp57_, _data_->_tmp58_);
	_g_object_unref0 (_data_->_tmp57_);
	_dino_reaction_info_unref0 (_data_->reaction_info);
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->reaction_message);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static Block38Data*
block38_data_ref (Block38Data* _data38_)
{
	g_atomic_int_inc (&_data38_->_ref_count_);
	return _data38_;
}

static void
block38_data_unref (void * _userdata_)
{
	Block38Data* _data38_;
	_data38_ = (Block38Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data38_->_ref_count_)) {
		DinoReactions* self;
		self = _data38_->self;
		_g_object_unref0 (_data38_->conversation);
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}

static gboolean
__lambda138_ (Block38Data* _data38_,
              DinoReactionInfo* info)
{
	DinoReactions* self;
	DinoEntitiesConversation* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	gboolean result;
	self = _data38_->self;
	g_return_val_if_fail (info != NULL, FALSE);
	_tmp0_ = dino_reaction_info_get_conversation (info);
	_tmp1_ = _tmp0_;
	result = dino_entities_conversation_equals (_tmp1_, _data38_->conversation);
	return result;
}

static gboolean
___lambda138__gee_predicate (gconstpointer g,
                             gpointer self)
{
	gboolean result;
	result = __lambda138_ (self, (DinoReactionInfo*) g);
	return result;
}

static void
dino_reactions_on_new_item (DinoReactions* self,
                            DinoContentItem* item,
                            DinoEntitiesConversation* conversation)
{
	Block38Data* _data38_;
	DinoEntitiesConversation* _tmp0_;
	gchar* stanza_id = NULL;
	DinoStreamInteractor* _tmp1_;
	DinoModuleIdentity* _tmp2_;
	gpointer _tmp3_;
	DinoContentItemStore* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	GeeList* reaction_info_list = NULL;
	GeeHashMap* _tmp8_;
	const gchar* _tmp9_;
	gpointer _tmp10_;
	GeeList* _tmp11_;
	DinoEntitiesMessage* message = NULL;
	DinoStreamInteractor* _tmp12_;
	DinoModuleIdentity* _tmp13_;
	gpointer _tmp14_;
	DinoContentItemStore* _tmp15_;
	DinoEntitiesMessage* _tmp16_;
	DinoEntitiesMessage* _tmp17_;
	DinoEntitiesMessage* _tmp18_;
	GeeArrayList* applicable_reactions = NULL;
	GeeArrayList* _tmp19_;
	GeeArrayList* _tmp20_;
	GeeList* _tmp21_;
	GeeIterator* _tmp22_;
	GeeIterator* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (conversation != NULL);
	_data38_ = g_slice_new0 (Block38Data);
	_data38_->_ref_count_ = 1;
	_data38_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (conversation);
	_g_object_unref0 (_data38_->conversation);
	_data38_->conversation = _tmp0_;
	_tmp1_ = self->priv->stream_interactor;
	_tmp2_ = dino_content_item_store_IDENTITY;
	_tmp3_ = dino_stream_interactor_get_module (_tmp1_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp2_);
	_tmp4_ = (DinoContentItemStore*) _tmp3_;
	_tmp5_ = dino_content_item_store_get_message_id_for_content_item (_tmp4_, _data38_->conversation, item);
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp4_);
	stanza_id = _tmp6_;
	_tmp7_ = stanza_id;
	if (_tmp7_ == NULL) {
		_g_free0 (stanza_id);
		block38_data_unref (_data38_);
		_data38_ = NULL;
		return;
	}
	_tmp8_ = self->priv->reaction_infos;
	_tmp9_ = stanza_id;
	_tmp10_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp8_, _tmp9_);
	reaction_info_list = (GeeList*) _tmp10_;
	_tmp11_ = reaction_info_list;
	if (_tmp11_ == NULL) {
		_g_object_unref0 (reaction_info_list);
		_g_free0 (stanza_id);
		block38_data_unref (_data38_);
		_data38_ = NULL;
		return;
	}
	_tmp12_ = self->priv->stream_interactor;
	_tmp13_ = dino_content_item_store_IDENTITY;
	_tmp14_ = dino_stream_interactor_get_module (_tmp12_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp13_);
	_tmp15_ = (DinoContentItemStore*) _tmp14_;
	_tmp16_ = dino_content_item_store_get_message_for_content_item (_tmp15_, _data38_->conversation, item);
	_tmp17_ = _tmp16_;
	_g_object_unref0 (_tmp15_);
	message = _tmp17_;
	_tmp18_ = message;
	if (_tmp18_ == NULL) {
		_g_object_unref0 (message);
		_g_object_unref0 (reaction_info_list);
		_g_free0 (stanza_id);
		block38_data_unref (_data38_);
		_data38_ = NULL;
		return;
	}
	_tmp19_ = gee_array_list_new (DINO_TYPE_REACTION_INFO, (GBoxedCopyFunc) dino_reaction_info_ref, (GDestroyNotify) dino_reaction_info_unref, NULL, NULL, NULL);
	applicable_reactions = _tmp19_;
	_tmp20_ = applicable_reactions;
	_tmp21_ = reaction_info_list;
	_tmp22_ = gee_traversable_filter ((GeeTraversable*) _tmp21_, ___lambda138__gee_predicate, block38_data_ref (_data38_), block38_data_unref);
	_tmp23_ = _tmp22_;
	gee_collection_add_all_iterator ((GeeCollection*) _tmp20_, _tmp23_);
	_g_object_unref0 (_tmp23_);
	{
		GeeArrayList* _applicable_reaction_list = NULL;
		GeeArrayList* _tmp24_;
		gint _applicable_reaction_size = 0;
		GeeArrayList* _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		gint _applicable_reaction_index = 0;
		_tmp24_ = applicable_reactions;
		_applicable_reaction_list = _tmp24_;
		_tmp25_ = _applicable_reaction_list;
		_tmp26_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp25_);
		_tmp27_ = _tmp26_;
		_applicable_reaction_size = _tmp27_;
		_applicable_reaction_index = -1;
		while (TRUE) {
			gint _tmp28_;
			gint _tmp29_;
			DinoReactionInfo* applicable_reaction = NULL;
			GeeArrayList* _tmp30_;
			gpointer _tmp31_;
			GeeList* _tmp32_;
			DinoReactionInfo* _tmp33_;
			GeeList* _tmp34_;
			gboolean _tmp35_;
			gboolean _tmp36_;
			const gchar* _tmp39_;
			gint _tmp40_;
			gint _tmp41_;
			DinoReactionInfo* _tmp42_;
			_applicable_reaction_index = _applicable_reaction_index + 1;
			_tmp28_ = _applicable_reaction_index;
			_tmp29_ = _applicable_reaction_size;
			if (!(_tmp28_ < _tmp29_)) {
				break;
			}
			_tmp30_ = _applicable_reaction_list;
			_tmp31_ = gee_abstract_list_get ((GeeAbstractList*) _tmp30_, _applicable_reaction_index);
			applicable_reaction = (DinoReactionInfo*) _tmp31_;
			_tmp32_ = reaction_info_list;
			_tmp33_ = applicable_reaction;
			gee_collection_remove ((GeeCollection*) _tmp32_, _tmp33_);
			_tmp34_ = reaction_info_list;
			_tmp35_ = gee_collection_get_is_empty ((GeeCollection*) _tmp34_);
			_tmp36_ = _tmp35_;
			if (_tmp36_) {
				GeeHashMap* _tmp37_;
				const gchar* _tmp38_;
				_tmp37_ = self->priv->reaction_infos;
				_tmp38_ = stanza_id;
				gee_abstract_map_unset ((GeeAbstractMap*) _tmp37_, _tmp38_, NULL);
			}
			_tmp39_ = stanza_id;
			g_debug ("reactions.vala:294: Got ContentItem for reaction %s", _tmp39_);
			_tmp40_ = dino_content_item_get_id (item);
			_tmp41_ = _tmp40_;
			_tmp42_ = applicable_reaction;
			dino_reactions_process_reaction_for_message (self, _tmp41_, _tmp42_);
			_dino_reaction_info_unref0 (applicable_reaction);
		}
	}
	_g_object_unref0 (applicable_reactions);
	_g_object_unref0 (message);
	_g_object_unref0 (reaction_info_list);
	_g_free0 (stanza_id);
	block38_data_unref (_data38_);
	_data38_ = NULL;
}

static DinoEntitiesMessage*
dino_reactions_get_message_for_reaction (DinoReactions* self,
                                         DinoEntitiesConversation* conversation,
                                         const gchar* message_id)
{
	DinoEntitiesConversationType _tmp0_;
	DinoEntitiesConversationType _tmp1_;
	DinoEntitiesMessage* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (conversation != NULL, NULL);
	g_return_val_if_fail (message_id != NULL, NULL);
	_tmp0_ = dino_entities_conversation_get_type_ (conversation);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
		DinoStreamInteractor* _tmp2_;
		DinoModuleIdentity* _tmp3_;
		gpointer _tmp4_;
		DinoMessageStorage* _tmp5_;
		DinoEntitiesMessage* _tmp6_;
		DinoEntitiesMessage* _tmp7_;
		_tmp2_ = self->priv->stream_interactor;
		_tmp3_ = dino_message_storage_IDENTITY;
		_tmp4_ = dino_stream_interactor_get_module (_tmp2_, DINO_TYPE_MESSAGE_STORAGE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
		_tmp5_ = (DinoMessageStorage*) _tmp4_;
		_tmp6_ = dino_message_storage_get_message_by_stanza_id (_tmp5_, message_id, conversation);
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp5_);
		result = _tmp7_;
		return result;
	} else {
		DinoStreamInteractor* _tmp8_;
		DinoModuleIdentity* _tmp9_;
		gpointer _tmp10_;
		DinoMessageStorage* _tmp11_;
		DinoEntitiesMessage* _tmp12_;
		DinoEntitiesMessage* _tmp13_;
		_tmp8_ = self->priv->stream_interactor;
		_tmp9_ = dino_message_storage_IDENTITY;
		_tmp10_ = dino_stream_interactor_get_module (_tmp8_, DINO_TYPE_MESSAGE_STORAGE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp9_);
		_tmp11_ = (DinoMessageStorage*) _tmp10_;
		_tmp12_ = dino_message_storage_get_message_by_server_id (_tmp11_, message_id, conversation);
		_tmp13_ = _tmp12_;
		_g_object_unref0 (_tmp11_);
		result = _tmp13_;
		return result;
	}
}

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

static void
dino_reactions_process_reaction_for_message (DinoReactions* self,
                                             gint content_item_id,
                                             DinoReactionInfo* reaction_info)
{
	DinoEntitiesAccount* account = NULL;
	DinoEntitiesConversation* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	DinoEntitiesAccount* _tmp3_;
	DinoEntitiesAccount* _tmp4_;
	XmppMessageStanza* stanza = NULL;
	XmppMessageStanza* _tmp5_;
	XmppMessageStanza* _tmp6_;
	XmppMessageStanza* _tmp7_;
	XmppJid* from_jid = NULL;
	XmppJid* _tmp8_;
	XmppJid* _tmp9_;
	XmppJid* _tmp10_;
	GeeList* reactions = NULL;
	GeeList* _tmp11_;
	GeeList* _tmp12_;
	GeeList* _tmp13_;
	GDateTime* reaction_time = NULL;
	XmppXepDelayedDeliveryMessageFlag* delayed_message_flag = NULL;
	XmppMessageStanza* _tmp14_;
	XmppXepDelayedDeliveryMessageFlag* _tmp15_;
	XmppXepDelayedDeliveryMessageFlag* _tmp16_;
	GDateTime* _tmp21_;
	GDateTime* time_now = NULL;
	GDateTime* _tmp29_;
	GDateTime* _tmp30_;
	GDateTime* _tmp33_;
	GDateTime* _tmp34_;
	gint64 reaction_time_long = 0LL;
	GDateTime* _tmp38_;
	GDateTime* _tmp39_;
	gchar* occupant_id = NULL;
	XmppMessageStanza* _tmp40_;
	XmppStanzaNode* _tmp41_;
	gchar* _tmp42_;
	XmppJid* real_jid = NULL;
	DinoStreamInteractor* _tmp43_;
	DinoModuleIdentity* _tmp44_;
	gpointer _tmp45_;
	DinoMucManager* _tmp46_;
	XmppJid* _tmp47_;
	DinoEntitiesAccount* _tmp48_;
	XmppJid* _tmp49_;
	XmppJid* _tmp50_;
	gboolean _tmp51_ = FALSE;
	gboolean _tmp52_ = FALSE;
	XmppMessageStanza* _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	DinoReactionsReactionsTime* reactions_time = NULL;
	XmppMessageStanza* _tmp58_;
	const gchar* _tmp59_;
	const gchar* _tmp60_;
	DinoReactionsReactionsTime* _tmp68_;
	XmppMessageStanza* _tmp69_;
	const gchar* _tmp70_;
	const gchar* _tmp71_;
	GeeList* current_reactions = NULL;
	DinoReactionsReactionsTime* _tmp80_;
	GeeList* _tmp81_;
	GeeList* _tmp82_;
	XmppJid* signal_jid = NULL;
	XmppJid* _tmp83_;
	XmppJid* _tmp84_;
	gboolean _tmp85_ = FALSE;
	XmppMessageStanza* _tmp86_;
	const gchar* _tmp87_;
	const gchar* _tmp88_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reaction_info != NULL);
	_tmp0_ = dino_reaction_info_get_conversation (reaction_info);
	_tmp1_ = _tmp0_;
	_tmp2_ = dino_entities_conversation_get_account (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	account = _tmp4_;
	_tmp5_ = dino_reaction_info_get_stanza (reaction_info);
	_tmp6_ = _tmp5_;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	stanza = _tmp7_;
	_tmp8_ = dino_reaction_info_get_from_jid (reaction_info);
	_tmp9_ = _tmp8_;
	_tmp10_ = _xmpp_jid_ref0 (_tmp9_);
	from_jid = _tmp10_;
	_tmp11_ = dino_reaction_info_get_reactions (reaction_info);
	_tmp12_ = _tmp11_;
	_tmp13_ = _g_object_ref0 (_tmp12_);
	reactions = _tmp13_;
	reaction_time = NULL;
	_tmp14_ = stanza;
	_tmp15_ = xmpp_xep_delayed_delivery_message_flag_get_flag (_tmp14_);
	delayed_message_flag = _tmp15_;
	_tmp16_ = delayed_message_flag;
	if (_tmp16_ != NULL) {
		XmppXepDelayedDeliveryMessageFlag* _tmp17_;
		GDateTime* _tmp18_;
		GDateTime* _tmp19_;
		GDateTime* _tmp20_;
		_tmp17_ = delayed_message_flag;
		_tmp18_ = xmpp_xep_delayed_delivery_message_flag_get_datetime (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = _g_date_time_ref0 (_tmp19_);
		_g_date_time_unref0 (reaction_time);
		reaction_time = _tmp20_;
	}
	_tmp21_ = reaction_time;
	if (_tmp21_ == NULL) {
		XmppMessageArchiveManagementMessageFlag* mam_message_flag = NULL;
		XmppMessageStanza* _tmp22_;
		XmppMessageArchiveManagementMessageFlag* _tmp23_;
		XmppMessageArchiveManagementMessageFlag* _tmp24_;
		_tmp22_ = stanza;
		_tmp23_ = xmpp_message_archive_management_message_flag_get_flag (_tmp22_);
		mam_message_flag = _tmp23_;
		_tmp24_ = mam_message_flag;
		if (_tmp24_ != NULL) {
			XmppMessageArchiveManagementMessageFlag* _tmp25_;
			GDateTime* _tmp26_;
			GDateTime* _tmp27_;
			GDateTime* _tmp28_;
			_tmp25_ = mam_message_flag;
			_tmp26_ = xmpp_message_archive_management_message_flag_get_server_time (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp28_ = _g_date_time_ref0 (_tmp27_);
			_g_date_time_unref0 (reaction_time);
			reaction_time = _tmp28_;
		}
		_g_object_unref0 (mam_message_flag);
	}
	_tmp29_ = g_date_time_new_now_local ();
	time_now = _tmp29_;
	_tmp30_ = reaction_time;
	if (_tmp30_ == NULL) {
		GDateTime* _tmp31_;
		GDateTime* _tmp32_;
		_tmp31_ = time_now;
		_tmp32_ = _g_date_time_ref0 (_tmp31_);
		_g_date_time_unref0 (reaction_time);
		reaction_time = _tmp32_;
	}
	_tmp33_ = reaction_time;
	_tmp34_ = time_now;
	if (g_date_time_compare (_tmp33_, _tmp34_) > 0) {
		GDateTime* _tmp35_;
		GDateTime* _tmp36_;
		GDateTime* _tmp37_;
		_tmp35_ = dino_reaction_info_get_received_time (reaction_info);
		_tmp36_ = _tmp35_;
		_tmp37_ = _g_date_time_ref0 (_tmp36_);
		_g_date_time_unref0 (reaction_time);
		reaction_time = _tmp37_;
	}
	_tmp38_ = reaction_time;
	_tmp39_ = reaction_time;
	reaction_time_long = (gint64) ((g_date_time_to_unix (_tmp38_) * 1000) + (g_date_time_get_microsecond (_tmp39_) / 1000));
	_tmp40_ = stanza;
	_tmp41_ = ((XmppStanza*) _tmp40_)->stanza;
	_tmp42_ = xmpp_xep_occupant_ids_get_occupant_id (_tmp41_);
	occupant_id = _tmp42_;
	_tmp43_ = self->priv->stream_interactor;
	_tmp44_ = dino_muc_manager_IDENTITY;
	_tmp45_ = dino_stream_interactor_get_module (_tmp43_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp44_);
	_tmp46_ = (DinoMucManager*) _tmp45_;
	_tmp47_ = from_jid;
	_tmp48_ = account;
	_tmp49_ = dino_muc_manager_get_real_jid (_tmp46_, _tmp47_, _tmp48_);
	_tmp50_ = _tmp49_;
	_g_object_unref0 (_tmp46_);
	real_jid = _tmp50_;
	_tmp53_ = stanza;
	_tmp54_ = xmpp_stanza_get_type_ ((XmppStanza*) _tmp53_);
	_tmp55_ = _tmp54_;
	if (g_strcmp0 (_tmp55_, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT) == 0) {
		const gchar* _tmp56_;
		_tmp56_ = occupant_id;
		_tmp52_ = _tmp56_ == NULL;
	} else {
		_tmp52_ = FALSE;
	}
	if (_tmp52_) {
		XmppJid* _tmp57_;
		_tmp57_ = real_jid;
		_tmp51_ = _tmp57_ == NULL;
	} else {
		_tmp51_ = FALSE;
	}
	if (_tmp51_) {
		g_warning ("reactions.vala:335: Attempting to add reaction to message w/o knowing " \
"occupant id or real jid");
		_xmpp_jid_unref0 (real_jid);
		_g_free0 (occupant_id);
		_g_date_time_unref0 (time_now);
		_g_object_unref0 (delayed_message_flag);
		_g_date_time_unref0 (reaction_time);
		_g_object_unref0 (reactions);
		_xmpp_jid_unref0 (from_jid);
		_g_object_unref0 (stanza);
		_g_object_unref0 (account);
		return;
	}
	reactions_time = NULL;
	_tmp58_ = stanza;
	_tmp59_ = xmpp_stanza_get_type_ ((XmppStanza*) _tmp58_);
	_tmp60_ = _tmp59_;
	if (g_strcmp0 (_tmp60_, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT) == 0) {
		DinoEntitiesAccount* _tmp61_;
		const gchar* _tmp62_;
		XmppJid* _tmp63_;
		DinoReactionsReactionsTime* _tmp64_;
		_tmp61_ = account;
		_tmp62_ = occupant_id;
		_tmp63_ = real_jid;
		_tmp64_ = dino_reactions_get_muc_user_reactions (self, _tmp61_, content_item_id, _tmp62_, _tmp63_);
		_dino_reactions_reactions_time_unref0 (reactions_time);
		reactions_time = _tmp64_;
	} else {
		DinoEntitiesAccount* _tmp65_;
		XmppJid* _tmp66_;
		DinoReactionsReactionsTime* _tmp67_;
		_tmp65_ = account;
		_tmp66_ = from_jid;
		_tmp67_ = dino_reactions_get_chat_user_reactions (self, _tmp65_, content_item_id, _tmp66_);
		_dino_reactions_reactions_time_unref0 (reactions_time);
		reactions_time = _tmp67_;
	}
	_tmp68_ = reactions_time;
	if (reaction_time_long <= _tmp68_->time) {
		_dino_reactions_reactions_time_unref0 (reactions_time);
		_xmpp_jid_unref0 (real_jid);
		_g_free0 (occupant_id);
		_g_date_time_unref0 (time_now);
		_g_object_unref0 (delayed_message_flag);
		_g_date_time_unref0 (reaction_time);
		_g_object_unref0 (reactions);
		_xmpp_jid_unref0 (from_jid);
		_g_object_unref0 (stanza);
		_g_object_unref0 (account);
		return;
	}
	_tmp69_ = stanza;
	_tmp70_ = xmpp_stanza_get_type_ ((XmppStanza*) _tmp69_);
	_tmp71_ = _tmp70_;
	if (g_strcmp0 (_tmp71_, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT) == 0) {
		DinoEntitiesAccount* _tmp72_;
		XmppJid* _tmp73_;
		const gchar* _tmp74_;
		XmppJid* _tmp75_;
		GeeList* _tmp76_;
		_tmp72_ = account;
		_tmp73_ = from_jid;
		_tmp74_ = occupant_id;
		_tmp75_ = real_jid;
		_tmp76_ = reactions;
		dino_reactions_save_muc_reactions (self, _tmp72_, content_item_id, _tmp73_, _tmp74_, _tmp75_, reaction_time_long, _tmp76_);
	} else {
		DinoEntitiesAccount* _tmp77_;
		XmppJid* _tmp78_;
		GeeList* _tmp79_;
		_tmp77_ = account;
		_tmp78_ = from_jid;
		_tmp79_ = reactions;
		dino_reactions_save_chat_reactions (self, _tmp77_, _tmp78_, content_item_id, reaction_time_long, _tmp79_);
	}
	_tmp80_ = reactions_time;
	_tmp81_ = _tmp80_->emojis;
	_tmp82_ = _g_object_ref0 (_tmp81_);
	current_reactions = _tmp82_;
	_tmp83_ = from_jid;
	_tmp84_ = _xmpp_jid_ref0 (_tmp83_);
	signal_jid = _tmp84_;
	_tmp86_ = stanza;
	_tmp87_ = xmpp_stanza_get_type_ ((XmppStanza*) _tmp86_);
	_tmp88_ = _tmp87_;
	if (g_strcmp0 (_tmp88_, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT) == 0) {
		XmppJid* _tmp89_;
		DinoStreamInteractor* _tmp90_;
		DinoModuleIdentity* _tmp91_;
		gpointer _tmp92_;
		DinoMucManager* _tmp93_;
		XmppJid* _tmp94_;
		DinoEntitiesAccount* _tmp95_;
		XmppJid* _tmp96_;
		XmppJid* _tmp97_;
		_tmp89_ = signal_jid;
		_tmp90_ = self->priv->stream_interactor;
		_tmp91_ = dino_muc_manager_IDENTITY;
		_tmp92_ = dino_stream_interactor_get_module (_tmp90_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp91_);
		_tmp93_ = (DinoMucManager*) _tmp92_;
		_tmp94_ = from_jid;
		_tmp95_ = account;
		_tmp96_ = dino_muc_manager_get_own_jid (_tmp93_, _tmp94_, _tmp95_);
		_tmp97_ = _tmp96_;
		_tmp85_ = xmpp_jid_equals (_tmp89_, _tmp97_);
		_xmpp_jid_unref0 (_tmp97_);
		_g_object_unref0 (_tmp93_);
	} else {
		_tmp85_ = FALSE;
	}
	if (_tmp85_) {
		DinoEntitiesAccount* _tmp98_;
		XmppJid* _tmp99_;
		XmppJid* _tmp100_;
		_tmp98_ = account;
		_tmp99_ = dino_entities_account_get_bare_jid (_tmp98_);
		_tmp100_ = _tmp99_;
		_xmpp_jid_unref0 (signal_jid);
		signal_jid = _tmp100_;
	} else {
		XmppMessageStanza* _tmp101_;
		const gchar* _tmp102_;
		const gchar* _tmp103_;
		_tmp101_ = stanza;
		_tmp102_ = xmpp_stanza_get_type_ ((XmppStanza*) _tmp101_);
		_tmp103_ = _tmp102_;
		if (g_strcmp0 (_tmp103_, XMPP_MESSAGE_STANZA_TYPE_CHAT) == 0) {
			XmppJid* _tmp104_;
			XmppJid* _tmp105_;
			XmppJid* _tmp106_;
			_tmp104_ = signal_jid;
			_tmp105_ = xmpp_jid_get_bare_jid (_tmp104_);
			_tmp106_ = _tmp105_;
			_xmpp_jid_unref0 (signal_jid);
			signal_jid = _tmp106_;
		}
	}
	{
		GeeList* _current_reaction_list = NULL;
		GeeList* _tmp107_;
		gint _current_reaction_size = 0;
		GeeList* _tmp108_;
		gint _tmp109_;
		gint _tmp110_;
		gint _current_reaction_index = 0;
		_tmp107_ = current_reactions;
		_current_reaction_list = _tmp107_;
		_tmp108_ = _current_reaction_list;
		_tmp109_ = gee_collection_get_size ((GeeCollection*) _tmp108_);
		_tmp110_ = _tmp109_;
		_current_reaction_size = _tmp110_;
		_current_reaction_index = -1;
		while (TRUE) {
			gint _tmp111_;
			gint _tmp112_;
			gchar* current_reaction = NULL;
			GeeList* _tmp113_;
			gpointer _tmp114_;
			GeeList* _tmp115_;
			const gchar* _tmp116_;
			_current_reaction_index = _current_reaction_index + 1;
			_tmp111_ = _current_reaction_index;
			_tmp112_ = _current_reaction_size;
			if (!(_tmp111_ < _tmp112_)) {
				break;
			}
			_tmp113_ = _current_reaction_list;
			_tmp114_ = gee_list_get (_tmp113_, _current_reaction_index);
			current_reaction = (gchar*) _tmp114_;
			_tmp115_ = reactions;
			_tmp116_ = current_reaction;
			if (!gee_collection_contains ((GeeCollection*) _tmp115_, _tmp116_)) {
				DinoEntitiesAccount* _tmp117_;
				XmppJid* _tmp118_;
				const gchar* _tmp119_;
				_tmp117_ = account;
				_tmp118_ = signal_jid;
				_tmp119_ = current_reaction;
				g_signal_emit (self, dino_reactions_signals[DINO_REACTIONS_REACTION_REMOVED_SIGNAL], 0, _tmp117_, content_item_id, _tmp118_, _tmp119_);
			}
			_g_free0 (current_reaction);
		}
	}
	{
		GeeList* _new_reaction_list = NULL;
		GeeList* _tmp120_;
		gint _new_reaction_size = 0;
		GeeList* _tmp121_;
		gint _tmp122_;
		gint _tmp123_;
		gint _new_reaction_index = 0;
		_tmp120_ = reactions;
		_new_reaction_list = _tmp120_;
		_tmp121_ = _new_reaction_list;
		_tmp122_ = gee_collection_get_size ((GeeCollection*) _tmp121_);
		_tmp123_ = _tmp122_;
		_new_reaction_size = _tmp123_;
		_new_reaction_index = -1;
		while (TRUE) {
			gint _tmp124_;
			gint _tmp125_;
			gchar* new_reaction = NULL;
			GeeList* _tmp126_;
			gpointer _tmp127_;
			GeeList* _tmp128_;
			const gchar* _tmp129_;
			_new_reaction_index = _new_reaction_index + 1;
			_tmp124_ = _new_reaction_index;
			_tmp125_ = _new_reaction_size;
			if (!(_tmp124_ < _tmp125_)) {
				break;
			}
			_tmp126_ = _new_reaction_list;
			_tmp127_ = gee_list_get (_tmp126_, _new_reaction_index);
			new_reaction = (gchar*) _tmp127_;
			_tmp128_ = current_reactions;
			_tmp129_ = new_reaction;
			if (!gee_collection_contains ((GeeCollection*) _tmp128_, _tmp129_)) {
				DinoEntitiesAccount* _tmp130_;
				XmppJid* _tmp131_;
				const gchar* _tmp132_;
				_tmp130_ = account;
				_tmp131_ = signal_jid;
				_tmp132_ = new_reaction;
				g_signal_emit (self, dino_reactions_signals[DINO_REACTIONS_REACTION_ADDED_SIGNAL], 0, _tmp130_, content_item_id, _tmp131_, _tmp132_);
			}
			_g_free0 (new_reaction);
		}
	}
	g_debug ("reactions.vala:380: reactions were: ");
	{
		GeeList* _reac_list = NULL;
		GeeList* _tmp133_;
		gint _reac_size = 0;
		GeeList* _tmp134_;
		gint _tmp135_;
		gint _tmp136_;
		gint _reac_index = 0;
		_tmp133_ = current_reactions;
		_reac_list = _tmp133_;
		_tmp134_ = _reac_list;
		_tmp135_ = gee_collection_get_size ((GeeCollection*) _tmp134_);
		_tmp136_ = _tmp135_;
		_reac_size = _tmp136_;
		_reac_index = -1;
		while (TRUE) {
			gint _tmp137_;
			gint _tmp138_;
			gchar* reac = NULL;
			GeeList* _tmp139_;
			gpointer _tmp140_;
			const gchar* _tmp141_;
			_reac_index = _reac_index + 1;
			_tmp137_ = _reac_index;
			_tmp138_ = _reac_size;
			if (!(_tmp137_ < _tmp138_)) {
				break;
			}
			_tmp139_ = _reac_list;
			_tmp140_ = gee_list_get (_tmp139_, _reac_index);
			reac = (gchar*) _tmp140_;
			_tmp141_ = reac;
			g_debug ("reactions.vala:382: %s", _tmp141_);
			_g_free0 (reac);
		}
	}
	g_debug ("reactions.vala:384: reactions new : ");
	{
		GeeList* _reac_list = NULL;
		GeeList* _tmp142_;
		gint _reac_size = 0;
		GeeList* _tmp143_;
		gint _tmp144_;
		gint _tmp145_;
		gint _reac_index = 0;
		_tmp142_ = reactions;
		_reac_list = _tmp142_;
		_tmp143_ = _reac_list;
		_tmp144_ = gee_collection_get_size ((GeeCollection*) _tmp143_);
		_tmp145_ = _tmp144_;
		_reac_size = _tmp145_;
		_reac_index = -1;
		while (TRUE) {
			gint _tmp146_;
			gint _tmp147_;
			gchar* reac = NULL;
			GeeList* _tmp148_;
			gpointer _tmp149_;
			const gchar* _tmp150_;
			_reac_index = _reac_index + 1;
			_tmp146_ = _reac_index;
			_tmp147_ = _reac_size;
			if (!(_tmp146_ < _tmp147_)) {
				break;
			}
			_tmp148_ = _reac_list;
			_tmp149_ = gee_list_get (_tmp148_, _reac_index);
			reac = (gchar*) _tmp149_;
			_tmp150_ = reac;
			g_debug ("reactions.vala:386: %s", _tmp150_);
			_g_free0 (reac);
		}
	}
	_xmpp_jid_unref0 (signal_jid);
	_g_object_unref0 (current_reactions);
	_dino_reactions_reactions_time_unref0 (reactions_time);
	_xmpp_jid_unref0 (real_jid);
	_g_free0 (occupant_id);
	_g_date_time_unref0 (time_now);
	_g_object_unref0 (delayed_message_flag);
	_g_date_time_unref0 (reaction_time);
	_g_object_unref0 (reactions);
	_xmpp_jid_unref0 (from_jid);
	_g_object_unref0 (stanza);
	_g_object_unref0 (account);
}

static void
dino_reactions_save_chat_reactions (DinoReactions* self,
                                    DinoEntitiesAccount* account,
                                    XmppJid* jid,
                                    gint content_item_id,
                                    gint64 reaction_time,
                                    GeeList* reactions)
{
	GString* emoji_builder = NULL;
	GString* _tmp0_;
	DinoDatabase* _tmp9_;
	DinoDatabaseReactionTable* _tmp10_;
	DinoDatabaseReactionTable* _tmp11_;
	QliteUpsertBuilder* _tmp12_;
	QliteUpsertBuilder* _tmp13_;
	DinoDatabase* _tmp14_;
	DinoDatabaseReactionTable* _tmp15_;
	DinoDatabaseReactionTable* _tmp16_;
	QliteColumn* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	QliteUpsertBuilder* _tmp20_;
	QliteUpsertBuilder* _tmp21_;
	DinoDatabase* _tmp22_;
	DinoDatabaseReactionTable* _tmp23_;
	DinoDatabaseReactionTable* _tmp24_;
	QliteColumn* _tmp25_;
	QliteUpsertBuilder* _tmp26_;
	QliteUpsertBuilder* _tmp27_;
	DinoDatabase* _tmp28_;
	DinoDatabaseReactionTable* _tmp29_;
	DinoDatabaseReactionTable* _tmp30_;
	QliteColumn* _tmp31_;
	DinoDatabase* _tmp32_;
	QliteUpsertBuilder* _tmp33_;
	QliteUpsertBuilder* _tmp34_;
	DinoDatabase* _tmp35_;
	DinoDatabaseReactionTable* _tmp36_;
	DinoDatabaseReactionTable* _tmp37_;
	QliteColumn* _tmp38_;
	GString* _tmp39_;
	const gchar* _tmp40_;
	QliteUpsertBuilder* _tmp41_;
	QliteUpsertBuilder* _tmp42_;
	DinoDatabase* _tmp43_;
	DinoDatabaseReactionTable* _tmp44_;
	DinoDatabaseReactionTable* _tmp45_;
	QliteColumn* _tmp46_;
	QliteUpsertBuilder* _tmp47_;
	QliteUpsertBuilder* _tmp48_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (reactions != NULL);
	_tmp0_ = g_string_new ("");
	emoji_builder = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint _tmp3_;
				gint _tmp4_;
				GString* _tmp6_;
				gpointer _tmp7_;
				gchar* _tmp8_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = gee_collection_get_size ((GeeCollection*) reactions);
				_tmp4_ = _tmp3_;
				if (!(i < _tmp4_)) {
					break;
				}
				if (i != 0) {
					GString* _tmp5_;
					_tmp5_ = emoji_builder;
					g_string_append (_tmp5_, ",");
				}
				_tmp6_ = emoji_builder;
				_tmp7_ = gee_list_get (reactions, i);
				_tmp8_ = (gchar*) _tmp7_;
				g_string_append (_tmp6_, _tmp8_);
				_g_free0 (_tmp8_);
			}
		}
	}
	_tmp9_ = self->priv->db;
	_tmp10_ = dino_database_get_reaction (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = qlite_table_upsert ((QliteTable*) _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = self->priv->db;
	_tmp15_ = dino_database_get_reaction (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_->account_id;
	_tmp18_ = dino_entities_account_get_id (account);
	_tmp19_ = _tmp18_;
	_tmp20_ = qlite_upsert_builder_value (_tmp13_, G_TYPE_INT, NULL, NULL, _tmp17_, (gpointer) ((gintptr) _tmp19_), TRUE);
	_tmp21_ = _tmp20_;
	_tmp22_ = self->priv->db;
	_tmp23_ = dino_database_get_reaction (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = _tmp24_->content_item_id;
	_tmp26_ = qlite_upsert_builder_value (_tmp21_, G_TYPE_INT, NULL, NULL, _tmp25_, (gpointer) ((gintptr) content_item_id), TRUE);
	_tmp27_ = _tmp26_;
	_tmp28_ = self->priv->db;
	_tmp29_ = dino_database_get_reaction (_tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = _tmp30_->jid_id;
	_tmp32_ = self->priv->db;
	_tmp33_ = qlite_upsert_builder_value (_tmp27_, G_TYPE_INT, NULL, NULL, _tmp31_, (gpointer) ((gintptr) dino_database_get_jid_id (_tmp32_, jid)), TRUE);
	_tmp34_ = _tmp33_;
	_tmp35_ = self->priv->db;
	_tmp36_ = dino_database_get_reaction (_tmp35_);
	_tmp37_ = _tmp36_;
	_tmp38_ = _tmp37_->emojis;
	_tmp39_ = emoji_builder;
	_tmp40_ = _tmp39_->str;
	_tmp41_ = qlite_upsert_builder_value (_tmp34_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp38_, _tmp40_, FALSE);
	_tmp42_ = _tmp41_;
	_tmp43_ = self->priv->db;
	_tmp44_ = dino_database_get_reaction (_tmp43_);
	_tmp45_ = _tmp44_;
	_tmp46_ = _tmp45_->time;
	_tmp47_ = qlite_upsert_builder_value (_tmp42_, G_TYPE_LONG, NULL, NULL, _tmp46_, (gpointer) ((gintptr) reaction_time), FALSE);
	_tmp48_ = _tmp47_;
	qlite_upsert_builder_perform (_tmp48_);
	_qlite_statement_builder_unref0 (_tmp48_);
	_qlite_statement_builder_unref0 (_tmp42_);
	_qlite_statement_builder_unref0 (_tmp34_);
	_qlite_statement_builder_unref0 (_tmp27_);
	_qlite_statement_builder_unref0 (_tmp21_);
	_qlite_statement_builder_unref0 (_tmp13_);
	_g_string_free0 (emoji_builder);
}

static void
dino_reactions_save_muc_reactions (DinoReactions* self,
                                   DinoEntitiesAccount* account,
                                   gint content_item_id,
                                   XmppJid* jid,
                                   const gchar* occupant_id,
                                   XmppJid* real_jid,
                                   gint64 reaction_time,
                                   GeeList* reactions)
{
	gboolean _tmp0_ = FALSE;
	gint jid_id = 0;
	DinoDatabase* _tmp1_;
	GString* emoji_builder = NULL;
	GString* _tmp2_;
	QliteUpsertBuilder* builder = NULL;
	DinoDatabase* _tmp11_;
	DinoDatabaseReactionTable* _tmp12_;
	DinoDatabaseReactionTable* _tmp13_;
	QliteUpsertBuilder* _tmp14_;
	QliteUpsertBuilder* _tmp15_;
	DinoDatabase* _tmp16_;
	DinoDatabaseReactionTable* _tmp17_;
	DinoDatabaseReactionTable* _tmp18_;
	QliteColumn* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	QliteUpsertBuilder* _tmp22_;
	QliteUpsertBuilder* _tmp23_;
	DinoDatabase* _tmp24_;
	DinoDatabaseReactionTable* _tmp25_;
	DinoDatabaseReactionTable* _tmp26_;
	QliteColumn* _tmp27_;
	QliteUpsertBuilder* _tmp28_;
	QliteUpsertBuilder* _tmp29_;
	DinoDatabase* _tmp30_;
	DinoDatabaseReactionTable* _tmp31_;
	DinoDatabaseReactionTable* _tmp32_;
	QliteColumn* _tmp33_;
	GString* _tmp34_;
	const gchar* _tmp35_;
	QliteUpsertBuilder* _tmp36_;
	QliteUpsertBuilder* _tmp37_;
	DinoDatabase* _tmp38_;
	DinoDatabaseReactionTable* _tmp39_;
	DinoDatabaseReactionTable* _tmp40_;
	QliteColumn* _tmp41_;
	QliteUpsertBuilder* _tmp42_;
	QliteUpsertBuilder* _tmp43_;
	QliteUpsertBuilder* _tmp127_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (reactions != NULL);
	if (occupant_id != NULL) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = real_jid != NULL;
	}
	_vala_assert (_tmp0_, "occupant_id != null || real_jid != null");
	_tmp1_ = self->priv->db;
	jid_id = dino_database_get_jid_id (_tmp1_, jid);
	_tmp2_ = g_string_new ("");
	emoji_builder = _tmp2_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gint _tmp5_;
				gint _tmp6_;
				GString* _tmp8_;
				gpointer _tmp9_;
				gchar* _tmp10_;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = gee_collection_get_size ((GeeCollection*) reactions);
				_tmp6_ = _tmp5_;
				if (!(i < _tmp6_)) {
					break;
				}
				if (i != 0) {
					GString* _tmp7_;
					_tmp7_ = emoji_builder;
					g_string_append (_tmp7_, ",");
				}
				_tmp8_ = emoji_builder;
				_tmp9_ = gee_list_get (reactions, i);
				_tmp10_ = (gchar*) _tmp9_;
				g_string_append (_tmp8_, _tmp10_);
				_g_free0 (_tmp10_);
			}
		}
	}
	_tmp11_ = self->priv->db;
	_tmp12_ = dino_database_get_reaction (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = qlite_table_upsert ((QliteTable*) _tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = self->priv->db;
	_tmp17_ = dino_database_get_reaction (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = _tmp18_->account_id;
	_tmp20_ = dino_entities_account_get_id (account);
	_tmp21_ = _tmp20_;
	_tmp22_ = qlite_upsert_builder_value (_tmp15_, G_TYPE_INT, NULL, NULL, _tmp19_, (gpointer) ((gintptr) _tmp21_), TRUE);
	_tmp23_ = _tmp22_;
	_tmp24_ = self->priv->db;
	_tmp25_ = dino_database_get_reaction (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = _tmp26_->content_item_id;
	_tmp28_ = qlite_upsert_builder_value (_tmp23_, G_TYPE_INT, NULL, NULL, _tmp27_, (gpointer) ((gintptr) content_item_id), TRUE);
	_tmp29_ = _tmp28_;
	_tmp30_ = self->priv->db;
	_tmp31_ = dino_database_get_reaction (_tmp30_);
	_tmp32_ = _tmp31_;
	_tmp33_ = _tmp32_->emojis;
	_tmp34_ = emoji_builder;
	_tmp35_ = _tmp34_->str;
	_tmp36_ = qlite_upsert_builder_value (_tmp29_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp33_, _tmp35_, FALSE);
	_tmp37_ = _tmp36_;
	_tmp38_ = self->priv->db;
	_tmp39_ = dino_database_get_reaction (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = _tmp40_->time;
	_tmp42_ = qlite_upsert_builder_value (_tmp37_, G_TYPE_LONG, NULL, NULL, _tmp41_, (gpointer) ((gintptr) reaction_time), FALSE);
	_tmp43_ = _tmp42_;
	_qlite_statement_builder_unref0 (_tmp37_);
	_qlite_statement_builder_unref0 (_tmp29_);
	_qlite_statement_builder_unref0 (_tmp23_);
	_qlite_statement_builder_unref0 (_tmp15_);
	builder = _tmp43_;
	if (real_jid != NULL) {
		QliteUpsertBuilder* _tmp44_;
		DinoDatabase* _tmp45_;
		DinoDatabaseReactionTable* _tmp46_;
		DinoDatabaseReactionTable* _tmp47_;
		QliteColumn* _tmp48_;
		DinoDatabase* _tmp49_;
		QliteUpsertBuilder* _tmp50_;
		QliteUpsertBuilder* _tmp51_;
		_tmp44_ = builder;
		_tmp45_ = self->priv->db;
		_tmp46_ = dino_database_get_reaction (_tmp45_);
		_tmp47_ = _tmp46_;
		_tmp48_ = _tmp47_->jid_id;
		_tmp49_ = self->priv->db;
		_tmp50_ = qlite_upsert_builder_value (_tmp44_, G_TYPE_INT, NULL, NULL, _tmp48_, (gpointer) ((gintptr) dino_database_get_jid_id (_tmp49_, real_jid)), occupant_id == NULL);
		_tmp51_ = _tmp50_;
		_qlite_statement_builder_unref0 (_tmp51_);
	}
	if (occupant_id != NULL) {
		QliteRowOption* row = NULL;
		DinoDatabase* _tmp52_;
		DinoDatabaseOccupantIdTable* _tmp53_;
		DinoDatabaseOccupantIdTable* _tmp54_;
		QliteQueryBuilder* _tmp55_;
		QliteQueryBuilder* _tmp56_;
		DinoDatabase* _tmp57_;
		DinoDatabaseOccupantIdTable* _tmp58_;
		DinoDatabaseOccupantIdTable* _tmp59_;
		QliteColumn* _tmp60_;
		gint _tmp61_;
		gint _tmp62_;
		QliteQueryBuilder* _tmp63_;
		QliteQueryBuilder* _tmp64_;
		DinoDatabase* _tmp65_;
		DinoDatabaseOccupantIdTable* _tmp66_;
		DinoDatabaseOccupantIdTable* _tmp67_;
		QliteColumn* _tmp68_;
		QliteQueryBuilder* _tmp69_;
		QliteQueryBuilder* _tmp70_;
		DinoDatabase* _tmp71_;
		DinoDatabaseOccupantIdTable* _tmp72_;
		DinoDatabaseOccupantIdTable* _tmp73_;
		QliteColumn* _tmp74_;
		QliteQueryBuilder* _tmp75_;
		QliteQueryBuilder* _tmp76_;
		QliteQueryBuilder* _tmp77_;
		QliteQueryBuilder* _tmp78_;
		QliteRowOption* _tmp79_;
		QliteRowOption* _tmp80_;
		gint occupant_db_id = 0;
		QliteRowOption* _tmp81_;
		QliteUpsertBuilder* _tmp120_;
		DinoDatabase* _tmp121_;
		DinoDatabaseReactionTable* _tmp122_;
		DinoDatabaseReactionTable* _tmp123_;
		QliteColumn* _tmp124_;
		QliteUpsertBuilder* _tmp125_;
		QliteUpsertBuilder* _tmp126_;
		_tmp52_ = self->priv->db;
		_tmp53_ = dino_database_get_occupantid (_tmp52_);
		_tmp54_ = _tmp53_;
		_tmp55_ = qlite_table_select ((QliteTable*) _tmp54_, NULL, (gint) 0);
		_tmp56_ = _tmp55_;
		_tmp57_ = self->priv->db;
		_tmp58_ = dino_database_get_occupantid (_tmp57_);
		_tmp59_ = _tmp58_;
		_tmp60_ = _tmp59_->account_id;
		_tmp61_ = dino_entities_account_get_id (account);
		_tmp62_ = _tmp61_;
		_tmp63_ = qlite_query_builder_with (_tmp56_, G_TYPE_INT, NULL, NULL, _tmp60_, "=", (gpointer) ((gintptr) _tmp62_));
		_tmp64_ = _tmp63_;
		_tmp65_ = self->priv->db;
		_tmp66_ = dino_database_get_occupantid (_tmp65_);
		_tmp67_ = _tmp66_;
		_tmp68_ = _tmp67_->jid_id;
		_tmp69_ = qlite_query_builder_with (_tmp64_, G_TYPE_INT, NULL, NULL, _tmp68_, "=", (gpointer) ((gintptr) jid_id));
		_tmp70_ = _tmp69_;
		_tmp71_ = self->priv->db;
		_tmp72_ = dino_database_get_occupantid (_tmp71_);
		_tmp73_ = _tmp72_;
		_tmp74_ = _tmp73_->occupant_id;
		_tmp75_ = qlite_query_builder_with (_tmp70_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp74_, "=", occupant_id);
		_tmp76_ = _tmp75_;
		_tmp77_ = qlite_query_builder_single (_tmp76_);
		_tmp78_ = _tmp77_;
		_tmp79_ = qlite_query_builder_row (_tmp78_);
		_tmp80_ = _tmp79_;
		_qlite_statement_builder_unref0 (_tmp78_);
		_qlite_statement_builder_unref0 (_tmp76_);
		_qlite_statement_builder_unref0 (_tmp70_);
		_qlite_statement_builder_unref0 (_tmp64_);
		_qlite_statement_builder_unref0 (_tmp56_);
		row = _tmp80_;
		occupant_db_id = -1;
		_tmp81_ = row;
		if (qlite_row_option_is_present (_tmp81_)) {
			QliteRowOption* _tmp82_;
			DinoDatabase* _tmp83_;
			DinoDatabaseOccupantIdTable* _tmp84_;
			DinoDatabaseOccupantIdTable* _tmp85_;
			QliteColumn* _tmp86_;
			gpointer _tmp87_;
			_tmp82_ = row;
			_tmp83_ = self->priv->db;
			_tmp84_ = dino_database_get_occupantid (_tmp83_);
			_tmp85_ = _tmp84_;
			_tmp86_ = _tmp85_->id;
			_tmp87_ = qlite_row_option_get (_tmp82_, G_TYPE_INT, NULL, NULL, _tmp86_, NULL);
			occupant_db_id = (gint) ((gintptr) _tmp87_);
		} else {
			DinoDatabase* _tmp88_;
			DinoDatabaseOccupantIdTable* _tmp89_;
			DinoDatabaseOccupantIdTable* _tmp90_;
			QliteUpsertBuilder* _tmp91_;
			QliteUpsertBuilder* _tmp92_;
			DinoDatabase* _tmp93_;
			DinoDatabaseOccupantIdTable* _tmp94_;
			DinoDatabaseOccupantIdTable* _tmp95_;
			QliteColumn* _tmp96_;
			gint _tmp97_;
			gint _tmp98_;
			QliteUpsertBuilder* _tmp99_;
			QliteUpsertBuilder* _tmp100_;
			DinoDatabase* _tmp101_;
			DinoDatabaseOccupantIdTable* _tmp102_;
			DinoDatabaseOccupantIdTable* _tmp103_;
			QliteColumn* _tmp104_;
			QliteUpsertBuilder* _tmp105_;
			QliteUpsertBuilder* _tmp106_;
			DinoDatabase* _tmp107_;
			DinoDatabaseOccupantIdTable* _tmp108_;
			DinoDatabaseOccupantIdTable* _tmp109_;
			QliteColumn* _tmp110_;
			QliteUpsertBuilder* _tmp111_;
			QliteUpsertBuilder* _tmp112_;
			DinoDatabase* _tmp113_;
			DinoDatabaseOccupantIdTable* _tmp114_;
			DinoDatabaseOccupantIdTable* _tmp115_;
			QliteColumn* _tmp116_;
			const gchar* _tmp117_;
			QliteUpsertBuilder* _tmp118_;
			QliteUpsertBuilder* _tmp119_;
			_tmp88_ = self->priv->db;
			_tmp89_ = dino_database_get_occupantid (_tmp88_);
			_tmp90_ = _tmp89_;
			_tmp91_ = qlite_table_upsert ((QliteTable*) _tmp90_);
			_tmp92_ = _tmp91_;
			_tmp93_ = self->priv->db;
			_tmp94_ = dino_database_get_occupantid (_tmp93_);
			_tmp95_ = _tmp94_;
			_tmp96_ = _tmp95_->account_id;
			_tmp97_ = dino_entities_account_get_id (account);
			_tmp98_ = _tmp97_;
			_tmp99_ = qlite_upsert_builder_value (_tmp92_, G_TYPE_INT, NULL, NULL, _tmp96_, (gpointer) ((gintptr) _tmp98_), TRUE);
			_tmp100_ = _tmp99_;
			_tmp101_ = self->priv->db;
			_tmp102_ = dino_database_get_occupantid (_tmp101_);
			_tmp103_ = _tmp102_;
			_tmp104_ = _tmp103_->jid_id;
			_tmp105_ = qlite_upsert_builder_value (_tmp100_, G_TYPE_INT, NULL, NULL, _tmp104_, (gpointer) ((gintptr) jid_id), TRUE);
			_tmp106_ = _tmp105_;
			_tmp107_ = self->priv->db;
			_tmp108_ = dino_database_get_occupantid (_tmp107_);
			_tmp109_ = _tmp108_;
			_tmp110_ = _tmp109_->occupant_id;
			_tmp111_ = qlite_upsert_builder_value (_tmp106_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp110_, occupant_id, TRUE);
			_tmp112_ = _tmp111_;
			_tmp113_ = self->priv->db;
			_tmp114_ = dino_database_get_occupantid (_tmp113_);
			_tmp115_ = _tmp114_;
			_tmp116_ = _tmp115_->last_nick;
			_tmp117_ = jid->resourcepart;
			_tmp118_ = qlite_upsert_builder_value (_tmp112_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp116_, _tmp117_, FALSE);
			_tmp119_ = _tmp118_;
			occupant_db_id = (gint) qlite_upsert_builder_perform (_tmp119_);
			_qlite_statement_builder_unref0 (_tmp119_);
			_qlite_statement_builder_unref0 (_tmp112_);
			_qlite_statement_builder_unref0 (_tmp106_);
			_qlite_statement_builder_unref0 (_tmp100_);
			_qlite_statement_builder_unref0 (_tmp92_);
		}
		_tmp120_ = builder;
		_tmp121_ = self->priv->db;
		_tmp122_ = dino_database_get_reaction (_tmp121_);
		_tmp123_ = _tmp122_;
		_tmp124_ = _tmp123_->occupant_id;
		_tmp125_ = qlite_upsert_builder_value (_tmp120_, G_TYPE_INT, NULL, NULL, _tmp124_, (gpointer) ((gintptr) occupant_db_id), TRUE);
		_tmp126_ = _tmp125_;
		_qlite_statement_builder_unref0 (_tmp126_);
		_qlite_row_option_unref0 (row);
	}
	_tmp127_ = builder;
	qlite_upsert_builder_perform (_tmp127_);
	_qlite_statement_builder_unref0 (builder);
	_g_string_free0 (emoji_builder);
}

static const gchar*
dino_reactions_real_get_id (DinoStreamInteractionModule* base)
{
	const gchar* result;
	DinoReactions* self;
	DinoModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	self = (DinoReactions*) base;
	_tmp0_ = dino_reactions_IDENTITY;
	_tmp1_ = dino_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
g_cclosure_user_marshal_VOID__OBJECT_INT_XMPP_JID_STRING (GClosure * closure,
                                                          GValue * return_value,
                                                          guint n_param_values,
                                                          const GValue * param_values,
                                                          gpointer invocation_hint,
                                                          gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_INT_XMPP_JID_STRING) (gpointer data1, gpointer arg_1, gint arg_2, gpointer arg_3, const char* arg_4, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_INT_XMPP_JID_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_INT_XMPP_JID_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_int (param_values + 2), xmpp_value_get_jid (param_values + 3), g_value_get_string (param_values + 4), data2);
}

static DinoReactionsReactionsTime*
dino_reactions_reactions_time_construct (GType object_type)
{
	DinoReactionsReactionsTime* self = NULL;
	self = (DinoReactionsReactionsTime*) g_type_create_instance (object_type);
	return self;
}

static DinoReactionsReactionsTime*
dino_reactions_reactions_time_new (void)
{
	return dino_reactions_reactions_time_construct (DINO_REACTIONS_TYPE_REACTIONS_TIME);
}

static void
dino_reactions_value_reactions_time_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
dino_reactions_value_reactions_time_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		dino_reactions_reactions_time_unref (value->data[0].v_pointer);
	}
}

static void
dino_reactions_value_reactions_time_copy_value (const GValue* src_value,
                                                GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = dino_reactions_reactions_time_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
dino_reactions_value_reactions_time_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
dino_reactions_value_reactions_time_collect_value (GValue* value,
                                                   guint n_collect_values,
                                                   GTypeCValue* collect_values,
                                                   guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		DinoReactionsReactionsTime * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = dino_reactions_reactions_time_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
dino_reactions_value_reactions_time_lcopy_value (const GValue* value,
                                                 guint n_collect_values,
                                                 GTypeCValue* collect_values,
                                                 guint collect_flags)
{
	DinoReactionsReactionsTime ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = dino_reactions_reactions_time_ref (value->data[0].v_pointer);
	}
	return NULL;
}

static GParamSpec*
dino_reactions_param_spec_reactions_time (const gchar* name,
                                          const gchar* nick,
                                          const gchar* blurb,
                                          GType object_type,
                                          GParamFlags flags)
{
	DinoReactionsParamSpecReactionsTime* spec;
	g_return_val_if_fail (g_type_is_a (object_type, DINO_REACTIONS_TYPE_REACTIONS_TIME), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

static gpointer
dino_reactions_value_get_reactions_time (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_REACTIONS_TYPE_REACTIONS_TIME), NULL);
	return value->data[0].v_pointer;
}

static void
dino_reactions_value_set_reactions_time (GValue* value,
                                         gpointer v_object)
{
	DinoReactionsReactionsTime * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_REACTIONS_TYPE_REACTIONS_TIME));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_REACTIONS_TYPE_REACTIONS_TIME));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		dino_reactions_reactions_time_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_reactions_reactions_time_unref (old);
	}
}

static void
dino_reactions_value_take_reactions_time (GValue* value,
                                          gpointer v_object)
{
	DinoReactionsReactionsTime * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_REACTIONS_TYPE_REACTIONS_TIME));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_REACTIONS_TYPE_REACTIONS_TIME));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_reactions_reactions_time_unref (old);
	}
}

static void
dino_reactions_reactions_time_class_init (DinoReactionsReactionsTimeClass * klass,
                                          gpointer klass_data)
{
	dino_reactions_reactions_time_parent_class = g_type_class_peek_parent (klass);
	((DinoReactionsReactionsTimeClass *) klass)->finalize = dino_reactions_reactions_time_finalize;
}

static void
dino_reactions_reactions_time_instance_init (DinoReactionsReactionsTime * self,
                                             gpointer klass)
{
	self->emojis = NULL;
	self->time = (gint64) -1;
	self->ref_count = 1;
}

static void
dino_reactions_reactions_time_finalize (DinoReactionsReactionsTime * obj)
{
	DinoReactionsReactionsTime * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_REACTIONS_TYPE_REACTIONS_TIME, DinoReactionsReactionsTime);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->emojis);
}

static GType
dino_reactions_reactions_time_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { dino_reactions_value_reactions_time_init, dino_reactions_value_reactions_time_free_value, dino_reactions_value_reactions_time_copy_value, dino_reactions_value_reactions_time_peek_pointer, "p", dino_reactions_value_reactions_time_collect_value, "p", dino_reactions_value_reactions_time_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (DinoReactionsReactionsTimeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_reactions_reactions_time_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoReactionsReactionsTime), 0, (GInstanceInitFunc) dino_reactions_reactions_time_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType dino_reactions_reactions_time_type_id;
	dino_reactions_reactions_time_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DinoReactionsReactionsTime", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return dino_reactions_reactions_time_type_id;
}

static GType
dino_reactions_reactions_time_get_type (void)
{
	static volatile gsize dino_reactions_reactions_time_type_id__once = 0;
	if (g_once_init_enter (&dino_reactions_reactions_time_type_id__once)) {
		GType dino_reactions_reactions_time_type_id;
		dino_reactions_reactions_time_type_id = dino_reactions_reactions_time_get_type_once ();
		g_once_init_leave (&dino_reactions_reactions_time_type_id__once, dino_reactions_reactions_time_type_id);
	}
	return dino_reactions_reactions_time_type_id__once;
}

static gpointer
dino_reactions_reactions_time_ref (gpointer instance)
{
	DinoReactionsReactionsTime * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

static void
dino_reactions_reactions_time_unref (gpointer instance)
{
	DinoReactionsReactionsTime * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		DINO_REACTIONS_REACTIONS_TIME_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
dino_reactions_class_init (DinoReactionsClass * klass,
                           gpointer klass_data)
{
	DinoModuleIdentity* _tmp0_;
	dino_reactions_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoReactions_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_reactions_get_property;
	G_OBJECT_CLASS (klass)->finalize = dino_reactions_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_REACTIONS_ID_PROPERTY, dino_reactions_properties[DINO_REACTIONS_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	dino_reactions_signals[DINO_REACTIONS_REACTION_ADDED_SIGNAL] = g_signal_new ("reaction-added", DINO_TYPE_REACTIONS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_INT_XMPP_JID_STRING, G_TYPE_NONE, 4, DINO_ENTITIES_TYPE_ACCOUNT, G_TYPE_INT, XMPP_TYPE_JID, G_TYPE_STRING);
	dino_reactions_signals[DINO_REACTIONS_REACTION_REMOVED_SIGNAL] = g_signal_new ("reaction-removed", DINO_TYPE_REACTIONS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_INT_XMPP_JID_STRING, G_TYPE_NONE, 4, DINO_ENTITIES_TYPE_ACCOUNT, G_TYPE_INT, XMPP_TYPE_JID, G_TYPE_STRING);
	_tmp0_ = dino_module_identity_new (DINO_TYPE_REACTIONS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, "reactions");
	dino_reactions_IDENTITY = _tmp0_;
}

static void
dino_reactions_dino_stream_interaction_module_interface_init (DinoStreamInteractionModuleIface * iface,
                                                              gpointer iface_data)
{
	dino_reactions_dino_stream_interaction_module_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_id = dino_reactions_real_get_id;
}

static void
dino_reactions_instance_init (DinoReactions * self,
                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = dino_reactions_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->reaction_infos = _tmp0_;
}

static void
dino_reactions_finalize (GObject * obj)
{
	DinoReactions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_REACTIONS, DinoReactions);
	_g_object_unref0 (self->priv->stream_interactor);
	_qlite_database_unref0 (self->priv->db);
	_g_object_unref0 (self->priv->reaction_infos);
	G_OBJECT_CLASS (dino_reactions_parent_class)->finalize (obj);
}

static GType
dino_reactions_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoReactionsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_reactions_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoReactions), 0, (GInstanceInitFunc) dino_reactions_instance_init, NULL };
	static const GInterfaceInfo dino_stream_interaction_module_info = { (GInterfaceInitFunc) dino_reactions_dino_stream_interaction_module_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_reactions_type_id;
	dino_reactions_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoReactions", &g_define_type_info, 0);
	g_type_add_interface_static (dino_reactions_type_id, DINO_TYPE_STREAM_INTERACTION_MODULE, &dino_stream_interaction_module_info);
	DinoReactions_private_offset = g_type_add_instance_private (dino_reactions_type_id, sizeof (DinoReactionsPrivate));
	return dino_reactions_type_id;
}

GType
dino_reactions_get_type (void)
{
	static volatile gsize dino_reactions_type_id__once = 0;
	if (g_once_init_enter (&dino_reactions_type_id__once)) {
		GType dino_reactions_type_id;
		dino_reactions_type_id = dino_reactions_get_type_once ();
		g_once_init_leave (&dino_reactions_type_id__once, dino_reactions_type_id);
	}
	return dino_reactions_type_id__once;
}

static void
_vala_dino_reactions_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	DinoReactions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_TYPE_REACTIONS, DinoReactions);
	switch (property_id) {
		case DINO_REACTIONS_ID_PROPERTY:
		g_value_set_string (value, dino_stream_interaction_module_get_id ((DinoStreamInteractionModule*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
dino_reaction_users_get_instance_private (DinoReactionUsers* self)
{
	return G_STRUCT_MEMBER_P (self, DinoReactionUsers_private_offset);
}

DinoReactionUsers*
dino_reaction_users_construct (GType object_type)
{
	DinoReactionUsers* self = NULL;
	self = (DinoReactionUsers*) g_type_create_instance (object_type);
	return self;
}

DinoReactionUsers*
dino_reaction_users_new (void)
{
	return dino_reaction_users_construct (DINO_TYPE_REACTION_USERS);
}

const gchar*
dino_reaction_users_get_reaction (DinoReactionUsers* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_reaction;
	result = _tmp0_;
	return result;
}

void
dino_reaction_users_set_reaction (DinoReactionUsers* self,
                                  const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_reaction);
	self->priv->_reaction = _tmp0_;
}

GeeList*
dino_reaction_users_get_jids (DinoReactionUsers* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_jids;
	result = _tmp0_;
	return result;
}

void
dino_reaction_users_set_jids (DinoReactionUsers* self,
                              GeeList* value)
{
	GeeList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_jids);
	self->priv->_jids = _tmp0_;
}

static void
dino_value_reaction_users_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
dino_value_reaction_users_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		dino_reaction_users_unref (value->data[0].v_pointer);
	}
}

static void
dino_value_reaction_users_copy_value (const GValue* src_value,
                                      GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = dino_reaction_users_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
dino_value_reaction_users_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
dino_value_reaction_users_collect_value (GValue* value,
                                         guint n_collect_values,
                                         GTypeCValue* collect_values,
                                         guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		DinoReactionUsers * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = dino_reaction_users_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
dino_value_reaction_users_lcopy_value (const GValue* value,
                                       guint n_collect_values,
                                       GTypeCValue* collect_values,
                                       guint collect_flags)
{
	DinoReactionUsers ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = dino_reaction_users_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
dino_param_spec_reaction_users (const gchar* name,
                                const gchar* nick,
                                const gchar* blurb,
                                GType object_type,
                                GParamFlags flags)
{
	DinoParamSpecReactionUsers* spec;
	g_return_val_if_fail (g_type_is_a (object_type, DINO_TYPE_REACTION_USERS), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
dino_value_get_reaction_users (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_REACTION_USERS), NULL);
	return value->data[0].v_pointer;
}

void
dino_value_set_reaction_users (GValue* value,
                               gpointer v_object)
{
	DinoReactionUsers * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_REACTION_USERS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_REACTION_USERS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		dino_reaction_users_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_reaction_users_unref (old);
	}
}

void
dino_value_take_reaction_users (GValue* value,
                                gpointer v_object)
{
	DinoReactionUsers * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_REACTION_USERS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_REACTION_USERS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_reaction_users_unref (old);
	}
}

static void
dino_reaction_users_class_init (DinoReactionUsersClass * klass,
                                gpointer klass_data)
{
	dino_reaction_users_parent_class = g_type_class_peek_parent (klass);
	((DinoReactionUsersClass *) klass)->finalize = dino_reaction_users_finalize;
	g_type_class_adjust_private_offset (klass, &DinoReactionUsers_private_offset);
}

static void
dino_reaction_users_instance_init (DinoReactionUsers * self,
                                   gpointer klass)
{
	self->priv = dino_reaction_users_get_instance_private (self);
	self->ref_count = 1;
}

static void
dino_reaction_users_finalize (DinoReactionUsers * obj)
{
	DinoReactionUsers * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_REACTION_USERS, DinoReactionUsers);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->_reaction);
	_g_object_unref0 (self->priv->_jids);
}

static GType
dino_reaction_users_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { dino_value_reaction_users_init, dino_value_reaction_users_free_value, dino_value_reaction_users_copy_value, dino_value_reaction_users_peek_pointer, "p", dino_value_reaction_users_collect_value, "p", dino_value_reaction_users_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (DinoReactionUsersClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_reaction_users_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoReactionUsers), 0, (GInstanceInitFunc) dino_reaction_users_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType dino_reaction_users_type_id;
	dino_reaction_users_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DinoReactionUsers", &g_define_type_info, &g_define_type_fundamental_info, 0);
	DinoReactionUsers_private_offset = g_type_add_instance_private (dino_reaction_users_type_id, sizeof (DinoReactionUsersPrivate));
	return dino_reaction_users_type_id;
}

GType
dino_reaction_users_get_type (void)
{
	static volatile gsize dino_reaction_users_type_id__once = 0;
	if (g_once_init_enter (&dino_reaction_users_type_id__once)) {
		GType dino_reaction_users_type_id;
		dino_reaction_users_type_id = dino_reaction_users_get_type_once ();
		g_once_init_leave (&dino_reaction_users_type_id__once, dino_reaction_users_type_id);
	}
	return dino_reaction_users_type_id__once;
}

gpointer
dino_reaction_users_ref (gpointer instance)
{
	DinoReactionUsers * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
dino_reaction_users_unref (gpointer instance)
{
	DinoReactionUsers * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		DINO_REACTION_USERS_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
dino_reaction_info_get_instance_private (DinoReactionInfo* self)
{
	return G_STRUCT_MEMBER_P (self, DinoReactionInfo_private_offset);
}

DinoReactionInfo*
dino_reaction_info_construct (GType object_type)
{
	DinoReactionInfo* self = NULL;
	self = (DinoReactionInfo*) g_type_create_instance (object_type);
	return self;
}

DinoReactionInfo*
dino_reaction_info_new (void)
{
	return dino_reaction_info_construct (DINO_TYPE_REACTION_INFO);
}

DinoEntitiesConversation*
dino_reaction_info_get_conversation (DinoReactionInfo* self)
{
	DinoEntitiesConversation* result;
	DinoEntitiesConversation* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_conversation;
	result = _tmp0_;
	return result;
}

void
dino_reaction_info_set_conversation (DinoReactionInfo* self,
                                     DinoEntitiesConversation* value)
{
	DinoEntitiesConversation* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_conversation);
	self->priv->_conversation = _tmp0_;
}

XmppJid*
dino_reaction_info_get_from_jid (DinoReactionInfo* self)
{
	XmppJid* result;
	XmppJid* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_from_jid;
	result = _tmp0_;
	return result;
}

void
dino_reaction_info_set_from_jid (DinoReactionInfo* self,
                                 XmppJid* value)
{
	XmppJid* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _xmpp_jid_ref0 (value);
	_xmpp_jid_unref0 (self->priv->_from_jid);
	self->priv->_from_jid = _tmp0_;
}

GeeList*
dino_reaction_info_get_reactions (DinoReactionInfo* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_reactions;
	result = _tmp0_;
	return result;
}

void
dino_reaction_info_set_reactions (DinoReactionInfo* self,
                                  GeeList* value)
{
	GeeList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_reactions);
	self->priv->_reactions = _tmp0_;
}

XmppMessageStanza*
dino_reaction_info_get_stanza (DinoReactionInfo* self)
{
	XmppMessageStanza* result;
	XmppMessageStanza* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stanza;
	result = _tmp0_;
	return result;
}

void
dino_reaction_info_set_stanza (DinoReactionInfo* self,
                               XmppMessageStanza* value)
{
	XmppMessageStanza* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_stanza);
	self->priv->_stanza = _tmp0_;
}

GDateTime*
dino_reaction_info_get_received_time (DinoReactionInfo* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_received_time;
	result = _tmp0_;
	return result;
}

void
dino_reaction_info_set_received_time (DinoReactionInfo* self,
                                      GDateTime* value)
{
	GDateTime* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_date_time_ref0 (value);
	_g_date_time_unref0 (self->priv->_received_time);
	self->priv->_received_time = _tmp0_;
}

static void
dino_value_reaction_info_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
dino_value_reaction_info_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		dino_reaction_info_unref (value->data[0].v_pointer);
	}
}

static void
dino_value_reaction_info_copy_value (const GValue* src_value,
                                     GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = dino_reaction_info_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
dino_value_reaction_info_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
dino_value_reaction_info_collect_value (GValue* value,
                                        guint n_collect_values,
                                        GTypeCValue* collect_values,
                                        guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		DinoReactionInfo * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = dino_reaction_info_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
dino_value_reaction_info_lcopy_value (const GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
	DinoReactionInfo ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = dino_reaction_info_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
dino_param_spec_reaction_info (const gchar* name,
                               const gchar* nick,
                               const gchar* blurb,
                               GType object_type,
                               GParamFlags flags)
{
	DinoParamSpecReactionInfo* spec;
	g_return_val_if_fail (g_type_is_a (object_type, DINO_TYPE_REACTION_INFO), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
dino_value_get_reaction_info (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_REACTION_INFO), NULL);
	return value->data[0].v_pointer;
}

void
dino_value_set_reaction_info (GValue* value,
                              gpointer v_object)
{
	DinoReactionInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_REACTION_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_REACTION_INFO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		dino_reaction_info_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_reaction_info_unref (old);
	}
}

void
dino_value_take_reaction_info (GValue* value,
                               gpointer v_object)
{
	DinoReactionInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_REACTION_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_REACTION_INFO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_reaction_info_unref (old);
	}
}

static void
dino_reaction_info_class_init (DinoReactionInfoClass * klass,
                               gpointer klass_data)
{
	dino_reaction_info_parent_class = g_type_class_peek_parent (klass);
	((DinoReactionInfoClass *) klass)->finalize = dino_reaction_info_finalize;
	g_type_class_adjust_private_offset (klass, &DinoReactionInfo_private_offset);
}

static void
dino_reaction_info_instance_init (DinoReactionInfo * self,
                                  gpointer klass)
{
	self->priv = dino_reaction_info_get_instance_private (self);
	self->ref_count = 1;
}

static void
dino_reaction_info_finalize (DinoReactionInfo * obj)
{
	DinoReactionInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_REACTION_INFO, DinoReactionInfo);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_conversation);
	_xmpp_jid_unref0 (self->priv->_from_jid);
	_g_object_unref0 (self->priv->_reactions);
	_g_object_unref0 (self->priv->_stanza);
	_g_date_time_unref0 (self->priv->_received_time);
}

static GType
dino_reaction_info_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { dino_value_reaction_info_init, dino_value_reaction_info_free_value, dino_value_reaction_info_copy_value, dino_value_reaction_info_peek_pointer, "p", dino_value_reaction_info_collect_value, "p", dino_value_reaction_info_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (DinoReactionInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_reaction_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoReactionInfo), 0, (GInstanceInitFunc) dino_reaction_info_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType dino_reaction_info_type_id;
	dino_reaction_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DinoReactionInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
	DinoReactionInfo_private_offset = g_type_add_instance_private (dino_reaction_info_type_id, sizeof (DinoReactionInfoPrivate));
	return dino_reaction_info_type_id;
}

GType
dino_reaction_info_get_type (void)
{
	static volatile gsize dino_reaction_info_type_id__once = 0;
	if (g_once_init_enter (&dino_reaction_info_type_id__once)) {
		GType dino_reaction_info_type_id;
		dino_reaction_info_type_id = dino_reaction_info_get_type_once ();
		g_once_init_leave (&dino_reaction_info_type_id__once, dino_reaction_info_type_id);
	}
	return dino_reaction_info_type_id__once;
}

gpointer
dino_reaction_info_ref (gpointer instance)
{
	DinoReactionInfo * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
dino_reaction_info_unref (gpointer instance)
{
	DinoReactionInfo * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		DINO_REACTION_INFO_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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

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

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

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

