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

#include "libdino.h"
#include <gee.h>
#include <glib-object.h>
#include "xmpp-vala.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gio/gio.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_COUNTERPART_INTERACTION_MANAGER_0_PROPERTY,
	DINO_COUNTERPART_INTERACTION_MANAGER_ID_PROPERTY,
	DINO_COUNTERPART_INTERACTION_MANAGER_NUM_PROPERTIES
};
static GParamSpec* dino_counterpart_interaction_manager_properties[DINO_COUNTERPART_INTERACTION_MANAGER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block11Data Block11Data;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
typedef struct _Block12Data Block12Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _DinoCounterpartInteractionManagerOnChatStateReceivedData DinoCounterpartInteractionManagerOnChatStateReceivedData;
typedef struct _DinoCounterpartInteractionManagerOnChatMarkerReceivedData DinoCounterpartInteractionManagerOnChatMarkerReceivedData;
enum  {
	DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_STATE_SIGNAL,
	DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MARKER_SIGNAL,
	DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MESSAGE_RECEIVED_SIGNAL,
	DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MESSAGE_DISPLAYED_SIGNAL,
	DINO_COUNTERPART_INTERACTION_MANAGER_NUM_SIGNALS
};
static guint dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_NUM_SIGNALS] = {0};

struct _DinoCounterpartInteractionManagerPrivate {
	DinoStreamInteractor* stream_interactor;
	GeeHashMap* typing_since;
	GeeHashMap* marker_wo_message;
};

struct _Block11Data {
	int _ref_count_;
	DinoCounterpartInteractionManager* self;
	DinoStreamInteractor* stream_interactor;
};

struct _Block12Data {
	int _ref_count_;
	DinoCounterpartInteractionManager* self;
	DinoEntitiesAccount* account;
};

struct _DinoCounterpartInteractionManagerOnChatStateReceivedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoCounterpartInteractionManager* self;
	DinoEntitiesAccount* account;
	XmppJid* jid;
	gchar* state;
	XmppMessageStanza* stanza;
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	XmppJid* _tmp2_;
	gboolean _tmp3_;
	DinoEntitiesConversation* conversation;
	DinoStreamInteractor* _tmp4_;
	DinoModuleIdentity* _tmp5_;
	gpointer _tmp6_;
	DinoConversationManager* _tmp7_;
	XmppJid* _tmp8_;
	XmppJid* _tmp9_;
	XmppJid* _tmp10_;
	XmppJid* _tmp11_;
	XmppJid* _tmp12_;
	XmppJid* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	DinoEntitiesConversation* _tmp16_;
	DinoEntitiesConversation* _tmp17_;
	DinoEntitiesConversation* _tmp18_;
	DinoEntitiesConversation* _tmp19_;
	DinoEntitiesConversationType _tmp20_;
	DinoEntitiesConversationType _tmp21_;
	XmppJid* own_muc_jid;
	DinoStreamInteractor* _tmp22_;
	DinoModuleIdentity* _tmp23_;
	gpointer _tmp24_;
	DinoMucManager* _tmp25_;
	XmppJid* _tmp26_;
	XmppJid* _tmp27_;
	XmppJid* _tmp28_;
	XmppJid* _tmp29_;
	XmppJid* _tmp30_;
	gboolean _tmp31_;
	XmppJid* _tmp32_;
	XmppJid* _tmp33_;
	GeeHashMap* _tmp34_;
	DinoEntitiesConversation* _tmp35_;
	GeeHashMap* _tmp36_;
	DinoEntitiesConversation* _tmp37_;
	GeeHashMap* _tmp38_;
	GeeHashMap* _tmp39_;
	GeeHashMap* _tmp40_;
	DinoEntitiesConversation* _tmp41_;
	gpointer _tmp42_;
	GeeHashMap* _tmp43_;
	GDateTime* _tmp44_;
	GDateTime* _tmp45_;
	DinoEntitiesConversation* _tmp46_;
	DinoEntitiesConversation* _tmp47_;
};

struct _DinoCounterpartInteractionManagerOnChatMarkerReceivedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoCounterpartInteractionManager* self;
	DinoEntitiesAccount* account;
	XmppJid* jid;
	gchar* marker;
	gchar* stanza_id;
	XmppMessageStanza* message_stanza;
	DinoEntitiesConversation* conversation;
	DinoStreamInteractor* _tmp0_;
	DinoModuleIdentity* _tmp1_;
	gpointer _tmp2_;
	DinoConversationManager* _tmp3_;
	XmppJid* _tmp4_;
	XmppJid* _tmp5_;
	XmppJid* _tmp6_;
	XmppJid* _tmp7_;
	XmppJid* _tmp8_;
	XmppJid* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	DinoEntitiesConversation* _tmp12_;
	DinoEntitiesConversation* _tmp13_;
	DinoEntitiesConversation* _tmp14_;
	DinoEntitiesConversation* _tmp15_;
};

static gint DinoCounterpartInteractionManager_private_offset;
static gpointer dino_counterpart_interaction_manager_parent_class = NULL;
DinoModuleIdentity* dino_counterpart_interaction_manager_IDENTITY = NULL;
static DinoStreamInteractionModuleIface * dino_counterpart_interaction_manager_dino_stream_interaction_module_parent_iface = NULL;

static guint _dino_entities_conversation_hash_func_gee_hash_data_func (gconstpointer v,
                                                                gpointer self);
static gboolean _dino_entities_conversation_equals_func_gee_equal_data_func (gconstpointer a,
                                                                      gconstpointer b,
                                                                      gpointer self);
static DinoCounterpartInteractionManager* dino_counterpart_interaction_manager_new (DinoStreamInteractor* stream_interactor);
static DinoCounterpartInteractionManager* dino_counterpart_interaction_manager_construct (GType object_type,
                                                                                   DinoStreamInteractor* stream_interactor);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
static void dino_counterpart_interaction_manager_on_account_added (DinoCounterpartInteractionManager* self,
                                                            DinoEntitiesAccount* account);
static void _dino_counterpart_interaction_manager_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                                                  DinoEntitiesAccount* account,
                                                                                                  gpointer self);
static void __lambda106_ (DinoCounterpartInteractionManager* self,
                   DinoEntitiesMessage* message,
                   DinoEntitiesConversation* conversation);
static void dino_counterpart_interaction_manager_clear_chat_state (DinoCounterpartInteractionManager* self,
                                                            DinoEntitiesConversation* conversation,
                                                            XmppJid* jid);
static void ___lambda106__dino_message_processor_message_received (DinoMessageProcessor* _sender,
                                                            DinoEntitiesMessage* message,
                                                            DinoEntitiesConversation* conversation,
                                                            gpointer self);
static void dino_counterpart_interaction_manager_check_if_got_marker (DinoCounterpartInteractionManager* self,
                                                               DinoEntitiesMessage* message,
                                                               DinoEntitiesConversation* conversation);
static void _dino_counterpart_interaction_manager_check_if_got_marker_dino_message_processor_message_sent_or_received (DinoMessageProcessor* _sender,
                                                                                                                DinoEntitiesMessage* message,
                                                                                                                DinoEntitiesConversation* conversation,
                                                                                                                gpointer self);
static void __lambda107_ (Block11Data* _data11_,
                   XmppJid* jid,
                   DinoEntitiesAccount* account);
static void ___lambda107__dino_presence_manager_received_offline_presence (DinoPresenceManager* _sender,
                                                                    XmppJid* jid,
                                                                    DinoEntitiesAccount* account,
                                                                    gpointer self);
static void __lambda108_ (DinoCounterpartInteractionManager* self,
                   DinoEntitiesAccount* account);
static void dino_counterpart_interaction_manager_clear_all_chat_states (DinoCounterpartInteractionManager* self,
                                                                 DinoEntitiesAccount* account);
static void ___lambda108__dino_stream_interactor_stream_negotiated (DinoStreamInteractor* _sender,
                                                             DinoEntitiesAccount* account,
                                                             XmppXmppStream* stream,
                                                             gpointer self);
static gboolean __lambda109_ (DinoCounterpartInteractionManager* self);
static gboolean ___lambda109__gsource_func (gpointer self);
static Block12Data* block12_data_ref (Block12Data* _data12_);
static void block12_data_unref (void * _userdata_);
static void __lambda103_ (Block12Data* _data12_,
                   XmppXmppStream* stream,
                   XmppJid* jid,
                   const gchar* marker,
                   const gchar* id,
                   XmppMessageStanza* message_stanza);
static void dino_counterpart_interaction_manager_on_chat_marker_received (DinoCounterpartInteractionManager* self,
                                                                   DinoEntitiesAccount* account,
                                                                   XmppJid* jid,
                                                                   const gchar* marker,
                                                                   const gchar* stanza_id,
                                                                   XmppMessageStanza* message_stanza,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_);
static void dino_counterpart_interaction_manager_on_chat_marker_received_finish (DinoCounterpartInteractionManager* self,
                                                                          GAsyncResult* _res_);
static void ___lambda103__xmpp_xep_chat_markers_module_marker_received (XmppXepChatMarkersModule* _sender,
                                                                 XmppXmppStream* stream,
                                                                 XmppJid* jid,
                                                                 const gchar* marker,
                                                                 const gchar* id,
                                                                 XmppMessageStanza* message,
                                                                 gpointer self);
static void __lambda104_ (Block12Data* _data12_,
                   XmppXmppStream* stream,
                   XmppJid* jid,
                   const gchar* id,
                   XmppMessageStanza* stanza);
static void dino_counterpart_interaction_manager_on_receipt_received (DinoCounterpartInteractionManager* self,
                                                               DinoEntitiesAccount* account,
                                                               XmppJid* jid,
                                                               const gchar* id,
                                                               XmppMessageStanza* stanza);
static void ___lambda104__xmpp_xep_message_delivery_receipts_module_receipt_received (XmppXepMessageDeliveryReceiptsModule* _sender,
                                                                               XmppXmppStream* stream,
                                                                               XmppJid* jid,
                                                                               const gchar* id,
                                                                               XmppMessageStanza* stanza,
                                                                               gpointer self);
static void __lambda105_ (Block12Data* _data12_,
                   XmppXmppStream* stream,
                   XmppJid* jid,
                   const gchar* state,
                   XmppMessageStanza* stanza);
static void dino_counterpart_interaction_manager_on_chat_state_received (DinoCounterpartInteractionManager* self,
                                                                  DinoEntitiesAccount* account,
                                                                  XmppJid* jid,
                                                                  const gchar* state,
                                                                  XmppMessageStanza* stanza,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_);
static void dino_counterpart_interaction_manager_on_chat_state_received_finish (DinoCounterpartInteractionManager* self,
                                                                         GAsyncResult* _res_);
static void ___lambda105__xmpp_xep_chat_state_notifications_module_chat_state_received (XmppXepChatStateNotificationsModule* _sender,
                                                                                 XmppXmppStream* stream,
                                                                                 XmppJid* jid,
                                                                                 const gchar* state,
                                                                                 XmppMessageStanza* stanza,
                                                                                 gpointer self);
static void dino_counterpart_interaction_manager_on_chat_state_received_data_free (gpointer _data);
static gboolean dino_counterpart_interaction_manager_on_chat_state_received_co (DinoCounterpartInteractionManagerOnChatStateReceivedData* _data_);
static guint _xmpp_jid_hash_func_gee_hash_data_func (gconstpointer v,
                                              gpointer self);
static gboolean _xmpp_jid_equals_func_gee_equal_data_func (gconstpointer a,
                                                    gconstpointer b,
                                                    gpointer self);
static void dino_counterpart_interaction_manager_on_chat_marker_received_data_free (gpointer _data);
static gboolean dino_counterpart_interaction_manager_on_chat_marker_received_co (DinoCounterpartInteractionManagerOnChatMarkerReceivedData* _data_);
static void dino_counterpart_interaction_manager_handle_chat_marker (DinoCounterpartInteractionManager* self,
                                                              DinoEntitiesConversation* conversation,
                                                              XmppJid* jid,
                                                              const gchar* marker,
                                                              const gchar* stanza_id);
static void g_cclosure_user_marshal_VOID__OBJECT_STRING (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_OBJECT_ENUM (GClosure * closure,
                                                                GValue * return_value,
                                                                guint n_param_values,
                                                                const GValue * param_values,
                                                                gpointer invocation_hint,
                                                                gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_OBJECT (GClosure * closure,
                                                           GValue * return_value,
                                                           guint n_param_values,
                                                           const GValue * param_values,
                                                           gpointer invocation_hint,
                                                           gpointer marshal_data);
static void dino_counterpart_interaction_manager_finalize (GObject * obj);
static GType dino_counterpart_interaction_manager_get_type_once (void);
static void _vala_dino_counterpart_interaction_manager_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_counterpart_interaction_manager_get_instance_private (DinoCounterpartInteractionManager* self)
{
	return G_STRUCT_MEMBER_P (self, DinoCounterpartInteractionManager_private_offset);
}

static guint
_dino_entities_conversation_hash_func_gee_hash_data_func (gconstpointer v,
                                                          gpointer self)
{
	guint result;
	result = dino_entities_conversation_hash_func ((DinoEntitiesConversation*) v);
	return result;
}

static gboolean
_dino_entities_conversation_equals_func_gee_equal_data_func (gconstpointer a,
                                                             gconstpointer b,
                                                             gpointer self)
{
	gboolean result;
	result = dino_entities_conversation_equals_func ((DinoEntitiesConversation*) a, (DinoEntitiesConversation*) b);
	return result;
}

void
dino_counterpart_interaction_manager_start (DinoStreamInteractor* stream_interactor)
{
	DinoCounterpartInteractionManager* m = NULL;
	DinoCounterpartInteractionManager* _tmp0_;
	g_return_if_fail (stream_interactor != NULL);
	_tmp0_ = dino_counterpart_interaction_manager_new (stream_interactor);
	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 Block11Data*
block11_data_ref (Block11Data* _data11_)
{
	g_atomic_int_inc (&_data11_->_ref_count_);
	return _data11_;
}

static void
block11_data_unref (void * _userdata_)
{
	Block11Data* _data11_;
	_data11_ = (Block11Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
		DinoCounterpartInteractionManager* self;
		self = _data11_->self;
		_g_object_unref0 (_data11_->stream_interactor);
		_g_object_unref0 (self);
		g_slice_free (Block11Data, _data11_);
	}
}

static void
_dino_counterpart_interaction_manager_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                                             DinoEntitiesAccount* account,
                                                                                             gpointer self)
{
	dino_counterpart_interaction_manager_on_account_added ((DinoCounterpartInteractionManager*) self, account);
}

static void
__lambda106_ (DinoCounterpartInteractionManager* self,
              DinoEntitiesMessage* message,
              DinoEntitiesConversation* conversation)
{
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	g_return_if_fail (message != NULL);
	g_return_if_fail (conversation != NULL);
	_tmp0_ = dino_entities_message_get_from (message);
	_tmp1_ = _tmp0_;
	dino_counterpart_interaction_manager_clear_chat_state (self, conversation, _tmp1_);
}

static void
___lambda106__dino_message_processor_message_received (DinoMessageProcessor* _sender,
                                                       DinoEntitiesMessage* message,
                                                       DinoEntitiesConversation* conversation,
                                                       gpointer self)
{
	__lambda106_ ((DinoCounterpartInteractionManager*) self, message, conversation);
}

static void
_dino_counterpart_interaction_manager_check_if_got_marker_dino_message_processor_message_sent_or_received (DinoMessageProcessor* _sender,
                                                                                                           DinoEntitiesMessage* message,
                                                                                                           DinoEntitiesConversation* conversation,
                                                                                                           gpointer self)
{
	dino_counterpart_interaction_manager_check_if_got_marker ((DinoCounterpartInteractionManager*) self, message, conversation);
}

static void
__lambda107_ (Block11Data* _data11_,
              XmppJid* jid,
              DinoEntitiesAccount* account)
{
	DinoCounterpartInteractionManager* self;
	self = _data11_->self;
	g_return_if_fail (jid != NULL);
	g_return_if_fail (account != NULL);
	{
		GeeList* _conversation_list = NULL;
		DinoModuleIdentity* _tmp0_;
		gpointer _tmp1_;
		DinoConversationManager* _tmp2_;
		GeeList* _tmp3_;
		GeeList* _tmp4_;
		gint _conversation_size = 0;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _conversation_index = 0;
		_tmp0_ = dino_conversation_manager_IDENTITY;
		_tmp1_ = dino_stream_interactor_get_module (_data11_->stream_interactor, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
		_tmp2_ = (DinoConversationManager*) _tmp1_;
		_tmp3_ = dino_conversation_manager_get_conversations (_tmp2_, jid, account);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_conversation_list = _tmp4_;
		_tmp5_ = _conversation_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_conversation_size = _tmp7_;
		_conversation_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			DinoEntitiesConversation* conversation = NULL;
			GeeList* _tmp10_;
			gpointer _tmp11_;
			DinoEntitiesConversation* _tmp12_;
			_conversation_index = _conversation_index + 1;
			_tmp8_ = _conversation_index;
			_tmp9_ = _conversation_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _conversation_list;
			_tmp11_ = gee_list_get (_tmp10_, _conversation_index);
			conversation = (DinoEntitiesConversation*) _tmp11_;
			_tmp12_ = conversation;
			dino_counterpart_interaction_manager_clear_chat_state (self, _tmp12_, jid);
			_g_object_unref0 (conversation);
		}
		_g_object_unref0 (_conversation_list);
	}
}

static void
___lambda107__dino_presence_manager_received_offline_presence (DinoPresenceManager* _sender,
                                                               XmppJid* jid,
                                                               DinoEntitiesAccount* account,
                                                               gpointer self)
{
	__lambda107_ (self, jid, account);
}

static void
__lambda108_ (DinoCounterpartInteractionManager* self,
              DinoEntitiesAccount* account)
{
	g_return_if_fail (account != NULL);
	dino_counterpart_interaction_manager_clear_all_chat_states (self, account);
}

static void
___lambda108__dino_stream_interactor_stream_negotiated (DinoStreamInteractor* _sender,
                                                        DinoEntitiesAccount* account,
                                                        XmppXmppStream* stream,
                                                        gpointer self)
{
	__lambda108_ ((DinoCounterpartInteractionManager*) self, account);
}

static gboolean
__lambda109_ (DinoCounterpartInteractionManager* self)
{
	GDateTime* one_min_ago = NULL;
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	gboolean result;
	_tmp0_ = g_date_time_new_now_utc ();
	_tmp1_ = _tmp0_;
	_tmp2_ = g_date_time_add_seconds (_tmp1_, (gdouble) -1);
	_tmp3_ = _tmp2_;
	_g_date_time_unref0 (_tmp1_);
	one_min_ago = _tmp3_;
	{
		GeeIterator* _conversation_it = NULL;
		GeeHashMap* _tmp4_;
		GeeSet* _tmp5_;
		GeeSet* _tmp6_;
		GeeSet* _tmp7_;
		GeeIterator* _tmp8_;
		GeeIterator* _tmp9_;
		_tmp4_ = self->priv->typing_since;
		_tmp5_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_iterable_iterator ((GeeIterable*) _tmp7_);
		_tmp9_ = _tmp8_;
		_g_object_unref0 (_tmp7_);
		_conversation_it = _tmp9_;
		while (TRUE) {
			GeeIterator* _tmp10_;
			DinoEntitiesConversation* conversation = NULL;
			GeeIterator* _tmp11_;
			gpointer _tmp12_;
			GeeArrayList* to_remove = NULL;
			GeeArrayList* _tmp13_;
			_tmp10_ = _conversation_it;
			if (!gee_iterator_next (_tmp10_)) {
				break;
			}
			_tmp11_ = _conversation_it;
			_tmp12_ = gee_iterator_get (_tmp11_);
			conversation = (DinoEntitiesConversation*) _tmp12_;
			_tmp13_ = gee_array_list_new (XMPP_TYPE_JID, (GBoxedCopyFunc) xmpp_jid_ref, (GDestroyNotify) xmpp_jid_unref, NULL, NULL, NULL);
			to_remove = _tmp13_;
			{
				GeeIterator* _jid_it = NULL;
				GeeHashMap* _tmp14_;
				DinoEntitiesConversation* _tmp15_;
				gpointer _tmp16_;
				GeeHashMap* _tmp17_;
				GeeSet* _tmp18_;
				GeeSet* _tmp19_;
				GeeSet* _tmp20_;
				GeeIterator* _tmp21_;
				GeeIterator* _tmp22_;
				_tmp14_ = self->priv->typing_since;
				_tmp15_ = conversation;
				_tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp14_, _tmp15_);
				_tmp17_ = (GeeHashMap*) _tmp16_;
				_tmp18_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp17_);
				_tmp19_ = _tmp18_;
				_tmp20_ = _tmp19_;
				_tmp21_ = gee_iterable_iterator ((GeeIterable*) _tmp20_);
				_tmp22_ = _tmp21_;
				_g_object_unref0 (_tmp20_);
				_g_object_unref0 (_tmp17_);
				_jid_it = _tmp22_;
				while (TRUE) {
					GeeIterator* _tmp23_;
					XmppJid* jid = NULL;
					GeeIterator* _tmp24_;
					gpointer _tmp25_;
					GeeHashMap* _tmp26_;
					DinoEntitiesConversation* _tmp27_;
					gpointer _tmp28_;
					GeeHashMap* _tmp29_;
					XmppJid* _tmp30_;
					gpointer _tmp31_;
					GDateTime* _tmp32_;
					GDateTime* _tmp33_;
					gboolean _tmp34_;
					_tmp23_ = _jid_it;
					if (!gee_iterator_next (_tmp23_)) {
						break;
					}
					_tmp24_ = _jid_it;
					_tmp25_ = gee_iterator_get (_tmp24_);
					jid = (XmppJid*) _tmp25_;
					_tmp26_ = self->priv->typing_since;
					_tmp27_ = conversation;
					_tmp28_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp26_, _tmp27_);
					_tmp29_ = (GeeHashMap*) _tmp28_;
					_tmp30_ = jid;
					_tmp31_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp29_, _tmp30_);
					_tmp32_ = (GDateTime*) _tmp31_;
					_tmp33_ = one_min_ago;
					_tmp34_ = g_date_time_compare (_tmp32_, _tmp33_) < 0;
					_g_date_time_unref0 (_tmp32_);
					_g_object_unref0 (_tmp29_);
					if (_tmp34_) {
						GeeArrayList* _tmp35_;
						XmppJid* _tmp36_;
						_tmp35_ = to_remove;
						_tmp36_ = jid;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp35_, _tmp36_);
					}
					_xmpp_jid_unref0 (jid);
				}
				_g_object_unref0 (_jid_it);
			}
			{
				GeeArrayList* _jid_list = NULL;
				GeeArrayList* _tmp37_;
				gint _jid_size = 0;
				GeeArrayList* _tmp38_;
				gint _tmp39_;
				gint _tmp40_;
				gint _jid_index = 0;
				_tmp37_ = to_remove;
				_jid_list = _tmp37_;
				_tmp38_ = _jid_list;
				_tmp39_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp38_);
				_tmp40_ = _tmp39_;
				_jid_size = _tmp40_;
				_jid_index = -1;
				while (TRUE) {
					gint _tmp41_;
					gint _tmp42_;
					XmppJid* jid = NULL;
					GeeArrayList* _tmp43_;
					gpointer _tmp44_;
					DinoEntitiesConversation* _tmp45_;
					XmppJid* _tmp46_;
					_jid_index = _jid_index + 1;
					_tmp41_ = _jid_index;
					_tmp42_ = _jid_size;
					if (!(_tmp41_ < _tmp42_)) {
						break;
					}
					_tmp43_ = _jid_list;
					_tmp44_ = gee_abstract_list_get ((GeeAbstractList*) _tmp43_, _jid_index);
					jid = (XmppJid*) _tmp44_;
					_tmp45_ = conversation;
					_tmp46_ = jid;
					dino_counterpart_interaction_manager_clear_chat_state (self, _tmp45_, _tmp46_);
					_xmpp_jid_unref0 (jid);
				}
			}
			_g_object_unref0 (to_remove);
			_g_object_unref0 (conversation);
		}
		_g_object_unref0 (_conversation_it);
	}
	result = TRUE;
	_g_date_time_unref0 (one_min_ago);
	return result;
}

static gboolean
___lambda109__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda109_ ((DinoCounterpartInteractionManager*) self);
	return result;
}

static DinoCounterpartInteractionManager*
dino_counterpart_interaction_manager_construct (GType object_type,
                                                DinoStreamInteractor* stream_interactor)
{
	DinoCounterpartInteractionManager * self = NULL;
	Block11Data* _data11_;
	DinoStreamInteractor* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoModuleIdentity* _tmp2_;
	gpointer _tmp3_;
	DinoMessageProcessor* _tmp4_;
	DinoModuleIdentity* _tmp5_;
	gpointer _tmp6_;
	DinoMessageProcessor* _tmp7_;
	DinoModuleIdentity* _tmp8_;
	gpointer _tmp9_;
	DinoPresenceManager* _tmp10_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	_data11_ = g_slice_new0 (Block11Data);
	_data11_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (_data11_->stream_interactor);
	_data11_->stream_interactor = _tmp0_;
	self = (DinoCounterpartInteractionManager*) g_object_new (object_type, NULL);
	_data11_->self = g_object_ref (self);
	_tmp1_ = _g_object_ref0 (_data11_->stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp1_;
	g_signal_connect_object (_data11_->stream_interactor, "account-added", (GCallback) _dino_counterpart_interaction_manager_on_account_added_dino_stream_interactor_account_added, self, 0);
	_tmp2_ = dino_message_processor_IDENTITY;
	_tmp3_ = dino_stream_interactor_get_module (_data11_->stream_interactor, DINO_TYPE_MESSAGE_PROCESSOR, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp2_);
	_tmp4_ = (DinoMessageProcessor*) _tmp3_;
	g_signal_connect_object (_tmp4_, "message-received", (GCallback) ___lambda106__dino_message_processor_message_received, self, 0);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = dino_message_processor_IDENTITY;
	_tmp6_ = dino_stream_interactor_get_module (_data11_->stream_interactor, DINO_TYPE_MESSAGE_PROCESSOR, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp5_);
	_tmp7_ = (DinoMessageProcessor*) _tmp6_;
	g_signal_connect_object (_tmp7_, "message-sent-or-received", (GCallback) _dino_counterpart_interaction_manager_check_if_got_marker_dino_message_processor_message_sent_or_received, self, 0);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = dino_presence_manager_IDENTITY;
	_tmp9_ = dino_stream_interactor_get_module (_data11_->stream_interactor, DINO_TYPE_PRESENCE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp8_);
	_tmp10_ = (DinoPresenceManager*) _tmp9_;
	g_signal_connect_data (_tmp10_, "received-offline-presence", (GCallback) ___lambda107__dino_presence_manager_received_offline_presence, block11_data_ref (_data11_), (GClosureNotify) block11_data_unref, 0);
	_g_object_unref0 (_tmp10_);
	g_signal_connect_object (_data11_->stream_interactor, "stream-negotiated", (GCallback) ___lambda108__dino_stream_interactor_stream_negotiated, self, 0);
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 60, ___lambda109__gsource_func, g_object_ref (self), g_object_unref);
	block11_data_unref (_data11_);
	_data11_ = NULL;
	return self;
}

static DinoCounterpartInteractionManager*
dino_counterpart_interaction_manager_new (DinoStreamInteractor* stream_interactor)
{
	return dino_counterpart_interaction_manager_construct (DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, stream_interactor);
}

GeeList*
dino_counterpart_interaction_manager_get_typing_jids (DinoCounterpartInteractionManager* self,
                                                      DinoEntitiesConversation* conversation)
{
	DinoStreamInteractor* _tmp0_;
	DinoConnectionManager* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	DinoEntitiesAccount* _tmp3_;
	gboolean _tmp4_ = FALSE;
	GeeHashMap* _tmp5_;
	GeeArrayList* jids = NULL;
	GeeArrayList* _tmp11_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (conversation != NULL, NULL);
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = _tmp0_->connection_manager;
	_tmp2_ = dino_entities_conversation_get_account (conversation);
	_tmp3_ = _tmp2_;
	if (dino_connection_manager_get_state (_tmp1_, _tmp3_) != DINO_CONNECTION_MANAGER_CONNECTION_STATE_CONNECTED) {
		result = NULL;
		return result;
	}
	_tmp5_ = self->priv->typing_since;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp5_, conversation)) {
		_tmp4_ = TRUE;
	} else {
		GeeHashMap* _tmp6_;
		gpointer _tmp7_;
		GeeHashMap* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp6_ = self->priv->typing_since;
		_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp6_, conversation);
		_tmp8_ = (GeeHashMap*) _tmp7_;
		_tmp9_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp4_ = _tmp10_ == 0;
		_g_object_unref0 (_tmp8_);
	}
	if (_tmp4_) {
		result = NULL;
		return result;
	}
	_tmp11_ = gee_array_list_new (XMPP_TYPE_JID, (GBoxedCopyFunc) xmpp_jid_ref, (GDestroyNotify) xmpp_jid_unref, NULL, NULL, NULL);
	jids = _tmp11_;
	{
		GeeIterator* _jid_it = NULL;
		GeeHashMap* _tmp12_;
		gpointer _tmp13_;
		GeeHashMap* _tmp14_;
		GeeSet* _tmp15_;
		GeeSet* _tmp16_;
		GeeSet* _tmp17_;
		GeeIterator* _tmp18_;
		GeeIterator* _tmp19_;
		_tmp12_ = self->priv->typing_since;
		_tmp13_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp12_, conversation);
		_tmp14_ = (GeeHashMap*) _tmp13_;
		_tmp15_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = _tmp16_;
		_tmp18_ = gee_iterable_iterator ((GeeIterable*) _tmp17_);
		_tmp19_ = _tmp18_;
		_g_object_unref0 (_tmp17_);
		_g_object_unref0 (_tmp14_);
		_jid_it = _tmp19_;
		while (TRUE) {
			GeeIterator* _tmp20_;
			XmppJid* jid = NULL;
			GeeIterator* _tmp21_;
			gpointer _tmp22_;
			GeeArrayList* _tmp23_;
			XmppJid* _tmp24_;
			_tmp20_ = _jid_it;
			if (!gee_iterator_next (_tmp20_)) {
				break;
			}
			_tmp21_ = _jid_it;
			_tmp22_ = gee_iterator_get (_tmp21_);
			jid = (XmppJid*) _tmp22_;
			_tmp23_ = jids;
			_tmp24_ = jid;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp23_, _tmp24_);
			_xmpp_jid_unref0 (jid);
		}
		_g_object_unref0 (_jid_it);
	}
	result = (GeeList*) jids;
	return result;
}

static Block12Data*
block12_data_ref (Block12Data* _data12_)
{
	g_atomic_int_inc (&_data12_->_ref_count_);
	return _data12_;
}

static void
block12_data_unref (void * _userdata_)
{
	Block12Data* _data12_;
	_data12_ = (Block12Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data12_->_ref_count_)) {
		DinoCounterpartInteractionManager* self;
		self = _data12_->self;
		_g_object_unref0 (_data12_->account);
		_g_object_unref0 (self);
		g_slice_free (Block12Data, _data12_);
	}
}

static void
__lambda103_ (Block12Data* _data12_,
              XmppXmppStream* stream,
              XmppJid* jid,
              const gchar* marker,
              const gchar* id,
              XmppMessageStanza* message_stanza)
{
	DinoCounterpartInteractionManager* self;
	self = _data12_->self;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (marker != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (message_stanza != NULL);
	dino_counterpart_interaction_manager_on_chat_marker_received (self, _data12_->account, jid, marker, id, message_stanza, NULL, NULL);
}

static void
___lambda103__xmpp_xep_chat_markers_module_marker_received (XmppXepChatMarkersModule* _sender,
                                                            XmppXmppStream* stream,
                                                            XmppJid* jid,
                                                            const gchar* marker,
                                                            const gchar* id,
                                                            XmppMessageStanza* message,
                                                            gpointer self)
{
	__lambda103_ (self, stream, jid, marker, id, message);
}

static void
__lambda104_ (Block12Data* _data12_,
              XmppXmppStream* stream,
              XmppJid* jid,
              const gchar* id,
              XmppMessageStanza* stanza)
{
	DinoCounterpartInteractionManager* self;
	self = _data12_->self;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (stanza != NULL);
	dino_counterpart_interaction_manager_on_receipt_received (self, _data12_->account, jid, id, stanza);
}

static void
___lambda104__xmpp_xep_message_delivery_receipts_module_receipt_received (XmppXepMessageDeliveryReceiptsModule* _sender,
                                                                          XmppXmppStream* stream,
                                                                          XmppJid* jid,
                                                                          const gchar* id,
                                                                          XmppMessageStanza* stanza,
                                                                          gpointer self)
{
	__lambda104_ (self, stream, jid, id, stanza);
}

static void
__lambda105_ (Block12Data* _data12_,
              XmppXmppStream* stream,
              XmppJid* jid,
              const gchar* state,
              XmppMessageStanza* stanza)
{
	DinoCounterpartInteractionManager* self;
	self = _data12_->self;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (state != NULL);
	g_return_if_fail (stanza != NULL);
	dino_counterpart_interaction_manager_on_chat_state_received (self, _data12_->account, jid, state, stanza, NULL, NULL);
}

static void
___lambda105__xmpp_xep_chat_state_notifications_module_chat_state_received (XmppXepChatStateNotificationsModule* _sender,
                                                                            XmppXmppStream* stream,
                                                                            XmppJid* jid,
                                                                            const gchar* state,
                                                                            XmppMessageStanza* stanza,
                                                                            gpointer self)
{
	__lambda105_ (self, stream, jid, state, stanza);
}

static void
dino_counterpart_interaction_manager_on_account_added (DinoCounterpartInteractionManager* self,
                                                       DinoEntitiesAccount* account)
{
	Block12Data* _data12_;
	DinoEntitiesAccount* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoModuleManager* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppXepChatMarkersModule* _tmp5_;
	DinoStreamInteractor* _tmp6_;
	DinoModuleManager* _tmp7_;
	XmppModuleIdentity* _tmp8_;
	gpointer _tmp9_;
	XmppXepMessageDeliveryReceiptsModule* _tmp10_;
	DinoStreamInteractor* _tmp11_;
	DinoModuleManager* _tmp12_;
	XmppModuleIdentity* _tmp13_;
	gpointer _tmp14_;
	XmppXepChatStateNotificationsModule* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	_data12_ = g_slice_new0 (Block12Data);
	_data12_->_ref_count_ = 1;
	_data12_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (account);
	_g_object_unref0 (_data12_->account);
	_data12_->account = _tmp0_;
	_tmp1_ = self->priv->stream_interactor;
	_tmp2_ = _tmp1_->module_manager;
	_tmp3_ = xmpp_xep_chat_markers_module_IDENTITY;
	_tmp4_ = dino_module_manager_get_module (_tmp2_, XMPP_XEP_CHAT_MARKERS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data12_->account, _tmp3_);
	_tmp5_ = (XmppXepChatMarkersModule*) _tmp4_;
	g_signal_connect_data (_tmp5_, "marker-received", (GCallback) ___lambda103__xmpp_xep_chat_markers_module_marker_received, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->priv->stream_interactor;
	_tmp7_ = _tmp6_->module_manager;
	_tmp8_ = xmpp_xep_message_delivery_receipts_module_IDENTITY;
	_tmp9_ = dino_module_manager_get_module (_tmp7_, XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data12_->account, _tmp8_);
	_tmp10_ = (XmppXepMessageDeliveryReceiptsModule*) _tmp9_;
	g_signal_connect_data (_tmp10_, "receipt-received", (GCallback) ___lambda104__xmpp_xep_message_delivery_receipts_module_receipt_received, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = self->priv->stream_interactor;
	_tmp12_ = _tmp11_->module_manager;
	_tmp13_ = xmpp_xep_chat_state_notifications_module_IDENTITY;
	_tmp14_ = dino_module_manager_get_module (_tmp12_, XMPP_XEP_CHAT_STATE_NOTIFICATIONS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data12_->account, _tmp13_);
	_tmp15_ = (XmppXepChatStateNotificationsModule*) _tmp14_;
	g_signal_connect_data (_tmp15_, "chat-state-received", (GCallback) ___lambda105__xmpp_xep_chat_state_notifications_module_chat_state_received, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0);
	_g_object_unref0 (_tmp15_);
	block12_data_unref (_data12_);
	_data12_ = NULL;
}

static void
dino_counterpart_interaction_manager_clear_chat_state (DinoCounterpartInteractionManager* self,
                                                       DinoEntitiesConversation* conversation,
                                                       XmppJid* jid)
{
	gboolean _tmp0_ = FALSE;
	GeeHashMap* _tmp1_;
	GeeHashMap* _tmp5_;
	gpointer _tmp6_;
	GeeHashMap* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (jid != NULL);
	_tmp1_ = self->priv->typing_since;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, conversation)) {
		GeeHashMap* _tmp2_;
		gpointer _tmp3_;
		GeeHashMap* _tmp4_;
		_tmp2_ = self->priv->typing_since;
		_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, conversation);
		_tmp4_ = (GeeHashMap*) _tmp3_;
		_tmp0_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp4_, jid);
		_g_object_unref0 (_tmp4_);
	} else {
		_tmp0_ = FALSE;
	}
	if (!_tmp0_) {
		return;
	}
	_tmp5_ = self->priv->typing_since;
	_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, conversation);
	_tmp7_ = (GeeHashMap*) _tmp6_;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp7_, jid, NULL);
	_g_object_unref0 (_tmp7_);
	g_signal_emit (self, dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_STATE_SIGNAL], 0, conversation, XMPP_XEP_CHAT_STATE_NOTIFICATIONS_STATE_ACTIVE);
}

static void
dino_counterpart_interaction_manager_clear_all_chat_states (DinoCounterpartInteractionManager* self,
                                                            DinoEntitiesAccount* account)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	{
		GeeIterator* _conversation_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->typing_since;
		_tmp1_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_conversation_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			DinoEntitiesConversation* conversation = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			DinoEntitiesConversation* _tmp9_;
			DinoEntitiesAccount* _tmp10_;
			DinoEntitiesAccount* _tmp11_;
			_tmp6_ = _conversation_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _conversation_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			conversation = (DinoEntitiesConversation*) _tmp8_;
			_tmp9_ = conversation;
			_tmp10_ = dino_entities_conversation_get_account (_tmp9_);
			_tmp11_ = _tmp10_;
			if (dino_entities_account_equals (_tmp11_, account)) {
				DinoEntitiesConversation* _tmp12_;
				GeeHashMap* _tmp13_;
				DinoEntitiesConversation* _tmp14_;
				gpointer _tmp15_;
				GeeHashMap* _tmp16_;
				_tmp12_ = conversation;
				g_signal_emit (self, dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_STATE_SIGNAL], 0, _tmp12_, XMPP_XEP_CHAT_STATE_NOTIFICATIONS_STATE_ACTIVE);
				_tmp13_ = self->priv->typing_since;
				_tmp14_ = conversation;
				_tmp15_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp13_, _tmp14_);
				_tmp16_ = (GeeHashMap*) _tmp15_;
				gee_abstract_map_clear ((GeeAbstractMap*) _tmp16_);
				_g_object_unref0 (_tmp16_);
			}
			_g_object_unref0 (conversation);
		}
		_g_object_unref0 (_conversation_it);
	}
}

static void
dino_counterpart_interaction_manager_on_chat_state_received_data_free (gpointer _data)
{
	DinoCounterpartInteractionManagerOnChatStateReceivedData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->account);
	_xmpp_jid_unref0 (_data_->jid);
	_g_free0 (_data_->state);
	_g_object_unref0 (_data_->stanza);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoCounterpartInteractionManagerOnChatStateReceivedData, _data_);
}

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

static void
dino_counterpart_interaction_manager_on_chat_state_received (DinoCounterpartInteractionManager* self,
                                                             DinoEntitiesAccount* account,
                                                             XmppJid* jid,
                                                             const gchar* state,
                                                             XmppMessageStanza* stanza,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_)
{
	DinoCounterpartInteractionManagerOnChatStateReceivedData* _data_;
	DinoCounterpartInteractionManager* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	XmppJid* _tmp2_;
	gchar* _tmp3_;
	XmppMessageStanza* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (state != NULL);
	g_return_if_fail (stanza != NULL);
	_data_ = g_slice_new0 (DinoCounterpartInteractionManagerOnChatStateReceivedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_counterpart_interaction_manager_on_chat_state_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 (jid);
	_xmpp_jid_unref0 (_data_->jid);
	_data_->jid = _tmp2_;
	_tmp3_ = g_strdup (state);
	_g_free0 (_data_->state);
	_data_->state = _tmp3_;
	_tmp4_ = _g_object_ref0 (stanza);
	_g_object_unref0 (_data_->stanza);
	_data_->stanza = _tmp4_;
	dino_counterpart_interaction_manager_on_chat_state_received_co (_data_);
}

static void
dino_counterpart_interaction_manager_on_chat_state_received_finish (DinoCounterpartInteractionManager* self,
                                                                    GAsyncResult* _res_)
{
	DinoCounterpartInteractionManagerOnChatStateReceivedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static guint
_xmpp_jid_hash_func_gee_hash_data_func (gconstpointer v,
                                        gpointer self)
{
	guint result;
	result = xmpp_jid_hash_func ((XmppJid*) v);
	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;
}

static gboolean
dino_counterpart_interaction_manager_on_chat_state_received_co (DinoCounterpartInteractionManagerOnChatStateReceivedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dino_entities_account_get_bare_jid (_data_->account);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = xmpp_jid_equals_bare (_data_->jid, _data_->_tmp2_);
	_xmpp_jid_unref0 (_data_->_tmp2_);
	if (_data_->_tmp3_) {
		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_->_tmp4_ = _data_->self->priv->stream_interactor;
	_data_->_tmp5_ = dino_conversation_manager_IDENTITY;
	_data_->_tmp6_ = dino_stream_interactor_get_module (_data_->_tmp4_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp5_);
	_data_->_tmp7_ = (DinoConversationManager*) _data_->_tmp6_;
	_data_->_tmp8_ = xmpp_stanza_get_from ((XmppStanza*) _data_->stanza);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = xmpp_stanza_get_to ((XmppStanza*) _data_->stanza);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = _data_->_tmp12_;
	_data_->_tmp14_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->stanza);
	_data_->_tmp15_ = _data_->_tmp14_;
	_data_->_tmp16_ = dino_conversation_manager_approx_conversation_for_stanza (_data_->_tmp7_, _data_->_tmp10_, _data_->_tmp13_, _data_->account, _data_->_tmp15_);
	_data_->_tmp17_ = _data_->_tmp16_;
	_xmpp_jid_unref0 (_data_->_tmp13_);
	_xmpp_jid_unref0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->_tmp7_);
	_data_->conversation = _data_->_tmp17_;
	_data_->_tmp18_ = _data_->conversation;
	if (_data_->_tmp18_ == NULL) {
		_g_object_unref0 (_data_->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;
	}
	_data_->_tmp19_ = _data_->conversation;
	_data_->_tmp20_ = dino_entities_conversation_get_type_ (_data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	if (_data_->_tmp21_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT) {
		_data_->_tmp22_ = _data_->self->priv->stream_interactor;
		_data_->_tmp23_ = dino_muc_manager_IDENTITY;
		_data_->_tmp24_ = dino_stream_interactor_get_module (_data_->_tmp22_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp23_);
		_data_->_tmp25_ = (DinoMucManager*) _data_->_tmp24_;
		_data_->_tmp26_ = xmpp_jid_get_bare_jid (_data_->jid);
		_data_->_tmp27_ = _data_->_tmp26_;
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_tmp29_ = dino_muc_manager_get_own_jid (_data_->_tmp25_, _data_->_tmp28_, _data_->account);
		_data_->_tmp30_ = _data_->_tmp29_;
		_xmpp_jid_unref0 (_data_->_tmp28_);
		_g_object_unref0 (_data_->_tmp25_);
		_data_->own_muc_jid = _data_->_tmp30_;
		_data_->_tmp32_ = _data_->own_muc_jid;
		if (_data_->_tmp32_ != NULL) {
			_data_->_tmp33_ = _data_->own_muc_jid;
			_data_->_tmp31_ = xmpp_jid_equals (_data_->_tmp33_, _data_->jid);
		} else {
			_data_->_tmp31_ = FALSE;
		}
		if (_data_->_tmp31_) {
			_xmpp_jid_unref0 (_data_->own_muc_jid);
			_g_object_unref0 (_data_->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;
		}
		_xmpp_jid_unref0 (_data_->own_muc_jid);
	}
	_data_->_tmp34_ = _data_->self->priv->typing_since;
	_data_->_tmp35_ = _data_->conversation;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp34_, _data_->_tmp35_)) {
		_data_->_tmp36_ = _data_->self->priv->typing_since;
		_data_->_tmp37_ = _data_->conversation;
		_data_->_tmp38_ = gee_hash_map_new (XMPP_TYPE_JID, (GBoxedCopyFunc) xmpp_jid_ref, (GDestroyNotify) xmpp_jid_unref, G_TYPE_DATE_TIME, (GBoxedCopyFunc) g_date_time_ref, (GDestroyNotify) g_date_time_unref, _xmpp_jid_hash_func_gee_hash_data_func, NULL, NULL, _xmpp_jid_equals_func_gee_equal_data_func, NULL, NULL, NULL, NULL, NULL);
		_data_->_tmp39_ = _data_->_tmp38_;
		gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp36_, _data_->_tmp37_, _data_->_tmp39_);
		_g_object_unref0 (_data_->_tmp39_);
	}
	if (g_strcmp0 (_data_->state, XMPP_XEP_CHAT_STATE_NOTIFICATIONS_STATE_COMPOSING) == 0) {
		_data_->_tmp40_ = _data_->self->priv->typing_since;
		_data_->_tmp41_ = _data_->conversation;
		_data_->_tmp42_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp40_, _data_->_tmp41_);
		_data_->_tmp43_ = (GeeHashMap*) _data_->_tmp42_;
		_data_->_tmp44_ = g_date_time_new_now_utc ();
		_data_->_tmp45_ = _data_->_tmp44_;
		gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp43_, _data_->jid, _data_->_tmp45_);
		_g_date_time_unref0 (_data_->_tmp45_);
		_g_object_unref0 (_data_->_tmp43_);
		_data_->_tmp46_ = _data_->conversation;
		g_signal_emit (_data_->self, dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_STATE_SIGNAL], 0, _data_->_tmp46_, _data_->state);
	} else {
		_data_->_tmp47_ = _data_->conversation;
		dino_counterpart_interaction_manager_clear_chat_state (_data_->self, _data_->_tmp47_, _data_->jid);
	}
	_g_object_unref0 (_data_->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;
}

static void
dino_counterpart_interaction_manager_on_chat_marker_received_data_free (gpointer _data)
{
	DinoCounterpartInteractionManagerOnChatMarkerReceivedData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->account);
	_xmpp_jid_unref0 (_data_->jid);
	_g_free0 (_data_->marker);
	_g_free0 (_data_->stanza_id);
	_g_object_unref0 (_data_->message_stanza);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoCounterpartInteractionManagerOnChatMarkerReceivedData, _data_);
}

static void
dino_counterpart_interaction_manager_on_chat_marker_received (DinoCounterpartInteractionManager* self,
                                                              DinoEntitiesAccount* account,
                                                              XmppJid* jid,
                                                              const gchar* marker,
                                                              const gchar* stanza_id,
                                                              XmppMessageStanza* message_stanza,
                                                              GAsyncReadyCallback _callback_,
                                                              gpointer _user_data_)
{
	DinoCounterpartInteractionManagerOnChatMarkerReceivedData* _data_;
	DinoCounterpartInteractionManager* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	XmppJid* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	XmppMessageStanza* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (marker != NULL);
	g_return_if_fail (stanza_id != NULL);
	g_return_if_fail (message_stanza != NULL);
	_data_ = g_slice_new0 (DinoCounterpartInteractionManagerOnChatMarkerReceivedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_counterpart_interaction_manager_on_chat_marker_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 (jid);
	_xmpp_jid_unref0 (_data_->jid);
	_data_->jid = _tmp2_;
	_tmp3_ = g_strdup (marker);
	_g_free0 (_data_->marker);
	_data_->marker = _tmp3_;
	_tmp4_ = g_strdup (stanza_id);
	_g_free0 (_data_->stanza_id);
	_data_->stanza_id = _tmp4_;
	_tmp5_ = _g_object_ref0 (message_stanza);
	_g_object_unref0 (_data_->message_stanza);
	_data_->message_stanza = _tmp5_;
	dino_counterpart_interaction_manager_on_chat_marker_received_co (_data_);
}

static void
dino_counterpart_interaction_manager_on_chat_marker_received_finish (DinoCounterpartInteractionManager* self,
                                                                     GAsyncResult* _res_)
{
	DinoCounterpartInteractionManagerOnChatMarkerReceivedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gboolean
dino_counterpart_interaction_manager_on_chat_marker_received_co (DinoCounterpartInteractionManagerOnChatMarkerReceivedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->stream_interactor;
	_data_->_tmp1_ = dino_conversation_manager_IDENTITY;
	_data_->_tmp2_ = dino_stream_interactor_get_module (_data_->_tmp0_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp1_);
	_data_->_tmp3_ = (DinoConversationManager*) _data_->_tmp2_;
	_data_->_tmp4_ = xmpp_stanza_get_from ((XmppStanza*) _data_->message_stanza);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = xmpp_stanza_get_to ((XmppStanza*) _data_->message_stanza);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->message_stanza);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = dino_conversation_manager_approx_conversation_for_stanza (_data_->_tmp3_, _data_->_tmp6_, _data_->_tmp9_, _data_->account, _data_->_tmp11_);
	_data_->_tmp13_ = _data_->_tmp12_;
	_xmpp_jid_unref0 (_data_->_tmp9_);
	_xmpp_jid_unref0 (_data_->_tmp6_);
	_g_object_unref0 (_data_->_tmp3_);
	_data_->conversation = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->conversation;
	if (_data_->_tmp14_ == NULL) {
		_g_object_unref0 (_data_->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;
	}
	_data_->_tmp15_ = _data_->conversation;
	dino_counterpart_interaction_manager_handle_chat_marker (_data_->self, _data_->_tmp15_, _data_->jid, _data_->marker, _data_->stanza_id);
	_g_object_unref0 (_data_->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;
}

static void
dino_counterpart_interaction_manager_handle_chat_marker (DinoCounterpartInteractionManager* self,
                                                         DinoEntitiesConversation* conversation,
                                                         XmppJid* jid,
                                                         const gchar* marker,
                                                         const gchar* stanza_id)
{
	gboolean own_marker = FALSE;
	DinoEntitiesConversationType _tmp0_;
	DinoEntitiesConversationType _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (marker != NULL);
	g_return_if_fail (stanza_id != NULL);
	own_marker = FALSE;
	_tmp0_ = dino_entities_conversation_get_type_ (conversation);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
		DinoEntitiesAccount* _tmp2_;
		DinoEntitiesAccount* _tmp3_;
		XmppJid* _tmp4_;
		XmppJid* _tmp5_;
		XmppJid* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		XmppJid* _tmp9_;
		XmppJid* _tmp10_;
		XmppJid* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp2_ = dino_entities_conversation_get_account (conversation);
		_tmp3_ = _tmp2_;
		_tmp4_ = dino_entities_account_get_bare_jid (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = xmpp_jid_to_string (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = xmpp_jid_get_bare_jid (jid);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_;
		_tmp12_ = xmpp_jid_to_string (_tmp11_);
		_tmp13_ = _tmp12_;
		own_marker = g_strcmp0 (_tmp8_, _tmp13_) == 0;
		_g_free0 (_tmp13_);
		_xmpp_jid_unref0 (_tmp11_);
		_g_free0 (_tmp8_);
		_xmpp_jid_unref0 (_tmp6_);
	} else {
		XmppJid* own_muc_jid = NULL;
		DinoStreamInteractor* _tmp14_;
		DinoModuleIdentity* _tmp15_;
		gpointer _tmp16_;
		DinoMucManager* _tmp17_;
		XmppJid* _tmp18_;
		XmppJid* _tmp19_;
		XmppJid* _tmp20_;
		DinoEntitiesAccount* _tmp21_;
		DinoEntitiesAccount* _tmp22_;
		XmppJid* _tmp23_;
		XmppJid* _tmp24_;
		gboolean _tmp25_ = FALSE;
		XmppJid* _tmp26_;
		_tmp14_ = self->priv->stream_interactor;
		_tmp15_ = dino_muc_manager_IDENTITY;
		_tmp16_ = dino_stream_interactor_get_module (_tmp14_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp15_);
		_tmp17_ = (DinoMucManager*) _tmp16_;
		_tmp18_ = xmpp_jid_get_bare_jid (jid);
		_tmp19_ = _tmp18_;
		_tmp20_ = _tmp19_;
		_tmp21_ = dino_entities_conversation_get_account (conversation);
		_tmp22_ = _tmp21_;
		_tmp23_ = dino_muc_manager_get_own_jid (_tmp17_, _tmp20_, _tmp22_);
		_tmp24_ = _tmp23_;
		_xmpp_jid_unref0 (_tmp20_);
		_g_object_unref0 (_tmp17_);
		own_muc_jid = _tmp24_;
		_tmp26_ = own_muc_jid;
		if (_tmp26_ != NULL) {
			XmppJid* _tmp27_;
			_tmp27_ = own_muc_jid;
			_tmp25_ = xmpp_jid_equals (_tmp27_, jid);
		} else {
			_tmp25_ = FALSE;
		}
		if (_tmp25_) {
			own_marker = TRUE;
		}
		_xmpp_jid_unref0 (own_muc_jid);
	}
	if (own_marker) {
		gboolean _tmp28_ = FALSE;
		DinoEntitiesMessage* message = NULL;
		gboolean _tmp29_ = FALSE;
		DinoEntitiesConversationType _tmp30_;
		DinoEntitiesConversationType _tmp31_;
		DinoEntitiesMessage* _tmp50_;
		gboolean _tmp51_ = FALSE;
		DinoEntitiesMessage* _tmp52_;
		DinoEntitiesMessage* _tmp53_;
		DinoEntitiesMessage* _tmp61_;
		DinoContentItem* content_item = NULL;
		DinoStreamInteractor* _tmp62_;
		DinoModuleIdentity* _tmp63_;
		gpointer _tmp64_;
		DinoContentItemStore* _tmp65_;
		DinoEntitiesMessage* _tmp66_;
		gint _tmp67_;
		gint _tmp68_;
		DinoContentItem* _tmp69_;
		DinoContentItem* _tmp70_;
		DinoContentItem* _tmp71_;
		DinoContentItem* read_up_to_item = NULL;
		DinoStreamInteractor* _tmp72_;
		DinoModuleIdentity* _tmp73_;
		gpointer _tmp74_;
		DinoContentItemStore* _tmp75_;
		gint _tmp76_;
		gint _tmp77_;
		DinoContentItem* _tmp78_;
		DinoContentItem* _tmp79_;
		gboolean _tmp80_ = FALSE;
		DinoContentItem* _tmp81_;
		DinoContentItem* _tmp84_;
		gint _tmp85_;
		gint _tmp86_;
		if (g_strcmp0 (marker, XMPP_XEP_CHAT_MARKERS_MARKER_DISPLAYED) != 0) {
			_tmp28_ = g_strcmp0 (marker, XMPP_XEP_CHAT_MARKERS_MARKER_ACKNOWLEDGED) != 0;
		} else {
			_tmp28_ = FALSE;
		}
		if (_tmp28_) {
			return;
		}
		message = NULL;
		_tmp30_ = dino_entities_conversation_get_type_ (conversation);
		_tmp31_ = _tmp30_;
		if (_tmp31_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT) {
			_tmp29_ = TRUE;
		} else {
			DinoEntitiesConversationType _tmp32_;
			DinoEntitiesConversationType _tmp33_;
			_tmp32_ = dino_entities_conversation_get_type_ (conversation);
			_tmp33_ = _tmp32_;
			_tmp29_ = _tmp33_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT_PM;
		}
		if (_tmp29_) {
			DinoStreamInteractor* _tmp34_;
			DinoModuleIdentity* _tmp35_;
			gpointer _tmp36_;
			DinoMessageStorage* _tmp37_;
			DinoEntitiesMessage* _tmp38_;
			DinoEntitiesMessage* _tmp39_;
			_tmp34_ = self->priv->stream_interactor;
			_tmp35_ = dino_message_storage_IDENTITY;
			_tmp36_ = dino_stream_interactor_get_module (_tmp34_, DINO_TYPE_MESSAGE_STORAGE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp35_);
			_tmp37_ = (DinoMessageStorage*) _tmp36_;
			_tmp38_ = dino_message_storage_get_message_by_server_id (_tmp37_, stanza_id, conversation);
			_g_object_unref0 (message);
			message = _tmp38_;
			_g_object_unref0 (_tmp37_);
			_tmp39_ = message;
			if (_tmp39_ == NULL) {
				DinoStreamInteractor* _tmp40_;
				DinoModuleIdentity* _tmp41_;
				gpointer _tmp42_;
				DinoMessageStorage* _tmp43_;
				DinoEntitiesMessage* _tmp44_;
				_tmp40_ = self->priv->stream_interactor;
				_tmp41_ = dino_message_storage_IDENTITY;
				_tmp42_ = dino_stream_interactor_get_module (_tmp40_, DINO_TYPE_MESSAGE_STORAGE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp41_);
				_tmp43_ = (DinoMessageStorage*) _tmp42_;
				_tmp44_ = dino_message_storage_get_message_by_stanza_id (_tmp43_, stanza_id, conversation);
				_g_object_unref0 (message);
				message = _tmp44_;
				_g_object_unref0 (_tmp43_);
			}
		} else {
			DinoStreamInteractor* _tmp45_;
			DinoModuleIdentity* _tmp46_;
			gpointer _tmp47_;
			DinoMessageStorage* _tmp48_;
			DinoEntitiesMessage* _tmp49_;
			_tmp45_ = self->priv->stream_interactor;
			_tmp46_ = dino_message_storage_IDENTITY;
			_tmp47_ = dino_stream_interactor_get_module (_tmp45_, DINO_TYPE_MESSAGE_STORAGE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp46_);
			_tmp48_ = (DinoMessageStorage*) _tmp47_;
			_tmp49_ = dino_message_storage_get_message_by_stanza_id (_tmp48_, stanza_id, conversation);
			_g_object_unref0 (message);
			message = _tmp49_;
			_g_object_unref0 (_tmp48_);
		}
		_tmp50_ = message;
		if (_tmp50_ == NULL) {
			_g_object_unref0 (message);
			return;
		}
		_tmp52_ = dino_entities_conversation_get_read_up_to (conversation);
		_tmp53_ = _tmp52_;
		if (_tmp53_ != NULL) {
			DinoEntitiesMessage* _tmp54_;
			DinoEntitiesMessage* _tmp55_;
			GDateTime* _tmp56_;
			GDateTime* _tmp57_;
			DinoEntitiesMessage* _tmp58_;
			GDateTime* _tmp59_;
			GDateTime* _tmp60_;
			_tmp54_ = dino_entities_conversation_get_read_up_to (conversation);
			_tmp55_ = _tmp54_;
			_tmp56_ = dino_entities_message_get_local_time (_tmp55_);
			_tmp57_ = _tmp56_;
			_tmp58_ = message;
			_tmp59_ = dino_entities_message_get_local_time (_tmp58_);
			_tmp60_ = _tmp59_;
			_tmp51_ = g_date_time_compare (_tmp57_, _tmp60_) > 0;
		} else {
			_tmp51_ = FALSE;
		}
		if (_tmp51_) {
			_g_object_unref0 (message);
			return;
		}
		_tmp61_ = message;
		dino_entities_conversation_set_read_up_to (conversation, _tmp61_);
		_tmp62_ = self->priv->stream_interactor;
		_tmp63_ = dino_content_item_store_IDENTITY;
		_tmp64_ = dino_stream_interactor_get_module (_tmp62_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp63_);
		_tmp65_ = (DinoContentItemStore*) _tmp64_;
		_tmp66_ = message;
		_tmp67_ = dino_entities_message_get_id (_tmp66_);
		_tmp68_ = _tmp67_;
		_tmp69_ = dino_content_item_store_get_item_by_foreign (_tmp65_, conversation, 1, _tmp68_);
		_tmp70_ = _tmp69_;
		_g_object_unref0 (_tmp65_);
		content_item = _tmp70_;
		_tmp71_ = content_item;
		if (_tmp71_ == NULL) {
			_g_object_unref0 (content_item);
			_g_object_unref0 (message);
			return;
		}
		_tmp72_ = self->priv->stream_interactor;
		_tmp73_ = dino_content_item_store_IDENTITY;
		_tmp74_ = dino_stream_interactor_get_module (_tmp72_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp73_);
		_tmp75_ = (DinoContentItemStore*) _tmp74_;
		_tmp76_ = dino_entities_conversation_get_read_up_to_item (conversation);
		_tmp77_ = _tmp76_;
		_tmp78_ = dino_content_item_store_get_item_by_id (_tmp75_, conversation, _tmp77_);
		_tmp79_ = _tmp78_;
		_g_object_unref0 (_tmp75_);
		read_up_to_item = _tmp79_;
		_tmp81_ = read_up_to_item;
		if (_tmp81_ != NULL) {
			DinoContentItem* _tmp82_;
			DinoContentItem* _tmp83_;
			_tmp82_ = read_up_to_item;
			_tmp83_ = content_item;
			_tmp80_ = dino_content_item_compare (_tmp82_, _tmp83_) > 0;
		} else {
			_tmp80_ = FALSE;
		}
		if (_tmp80_) {
			_g_object_unref0 (read_up_to_item);
			_g_object_unref0 (content_item);
			_g_object_unref0 (message);
			return;
		}
		_tmp84_ = content_item;
		_tmp85_ = dino_content_item_get_id (_tmp84_);
		_tmp86_ = _tmp85_;
		dino_entities_conversation_set_read_up_to_item (conversation, _tmp86_);
		_g_object_unref0 (read_up_to_item);
		_g_object_unref0 (content_item);
		_g_object_unref0 (message);
	} else {
		DinoEntitiesConversationType _tmp87_;
		DinoEntitiesConversationType _tmp88_;
		DinoEntitiesMessage* message = NULL;
		DinoStreamInteractor* _tmp89_;
		DinoModuleIdentity* _tmp90_;
		gpointer _tmp91_;
		DinoMessageStorage* _tmp92_;
		DinoEntitiesMessage* _tmp93_;
		DinoEntitiesMessage* _tmp94_;
		DinoEntitiesMessage* _tmp95_;
		_tmp87_ = dino_entities_conversation_get_type_ (conversation);
		_tmp88_ = _tmp87_;
		if (_tmp88_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT) {
			return;
		}
		_tmp89_ = self->priv->stream_interactor;
		_tmp90_ = dino_message_storage_IDENTITY;
		_tmp91_ = dino_stream_interactor_get_module (_tmp89_, DINO_TYPE_MESSAGE_STORAGE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp90_);
		_tmp92_ = (DinoMessageStorage*) _tmp91_;
		_tmp93_ = dino_message_storage_get_message_by_stanza_id (_tmp92_, stanza_id, conversation);
		_tmp94_ = _tmp93_;
		_g_object_unref0 (_tmp92_);
		message = _tmp94_;
		_tmp95_ = message;
		if (_tmp95_ != NULL) {
			const gchar* _tmp96_;
			GQuark _tmp98_ = 0U;
			static GQuark _tmp97_label0 = 0;
			static GQuark _tmp97_label1 = 0;
			_tmp96_ = marker;
			_tmp98_ = (NULL == _tmp96_) ? 0 : g_quark_from_string (_tmp96_);
			if (_tmp98_ == ((0 != _tmp97_label0) ? _tmp97_label0 : (_tmp97_label0 = g_quark_from_static_string (XMPP_XEP_CHAT_MARKERS_MARKER_RECEIVED)))) {
				switch (0) {
					default:
					{
						DinoEntitiesAccount* _tmp99_;
						DinoEntitiesAccount* _tmp100_;
						DinoEntitiesMessage* _tmp101_;
						DinoEntitiesMessage* _tmp102_;
						_tmp99_ = dino_entities_conversation_get_account (conversation);
						_tmp100_ = _tmp99_;
						_tmp101_ = message;
						g_signal_emit (self, dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MESSAGE_RECEIVED_SIGNAL], 0, _tmp100_, jid, _tmp101_);
						_tmp102_ = message;
						dino_entities_message_set_marked (_tmp102_, DINO_ENTITIES_MESSAGE_MARKED_RECEIVED);
						break;
					}
				}
			} else if (_tmp98_ == ((0 != _tmp97_label1) ? _tmp97_label1 : (_tmp97_label1 = g_quark_from_static_string (XMPP_XEP_CHAT_MARKERS_MARKER_DISPLAYED)))) {
				switch (0) {
					default:
					{
						DinoEntitiesAccount* _tmp103_;
						DinoEntitiesAccount* _tmp104_;
						DinoEntitiesMessage* _tmp105_;
						GeeList* messages = NULL;
						DinoStreamInteractor* _tmp106_;
						DinoModuleIdentity* _tmp107_;
						gpointer _tmp108_;
						DinoMessageStorage* _tmp109_;
						GeeList* _tmp110_;
						GeeList* _tmp111_;
						DinoEntitiesMessage* _tmp126_;
						_tmp103_ = dino_entities_conversation_get_account (conversation);
						_tmp104_ = _tmp103_;
						_tmp105_ = message;
						g_signal_emit (self, dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MESSAGE_DISPLAYED_SIGNAL], 0, _tmp104_, jid, _tmp105_);
						_tmp106_ = self->priv->stream_interactor;
						_tmp107_ = dino_message_storage_IDENTITY;
						_tmp108_ = dino_stream_interactor_get_module (_tmp106_, DINO_TYPE_MESSAGE_STORAGE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp107_);
						_tmp109_ = (DinoMessageStorage*) _tmp108_;
						_tmp110_ = dino_message_storage_get_messages (_tmp109_, conversation, 50);
						_tmp111_ = _tmp110_;
						_g_object_unref0 (_tmp109_);
						messages = _tmp111_;
						{
							GeeList* _m_list = NULL;
							GeeList* _tmp112_;
							gint _m_size = 0;
							GeeList* _tmp113_;
							gint _tmp114_;
							gint _tmp115_;
							gint _m_index = 0;
							_tmp112_ = messages;
							_m_list = _tmp112_;
							_tmp113_ = _m_list;
							_tmp114_ = gee_collection_get_size ((GeeCollection*) _tmp113_);
							_tmp115_ = _tmp114_;
							_m_size = _tmp115_;
							_m_index = -1;
							while (TRUE) {
								gint _tmp116_;
								gint _tmp117_;
								DinoEntitiesMessage* m = NULL;
								GeeList* _tmp118_;
								gpointer _tmp119_;
								DinoEntitiesMessage* _tmp120_;
								DinoEntitiesMessage* _tmp121_;
								DinoEntitiesMessage* _tmp122_;
								DinoEntitiesMessageMarked _tmp123_;
								DinoEntitiesMessageMarked _tmp124_;
								_m_index = _m_index + 1;
								_tmp116_ = _m_index;
								_tmp117_ = _m_size;
								if (!(_tmp116_ < _tmp117_)) {
									break;
								}
								_tmp118_ = _m_list;
								_tmp119_ = gee_list_get (_tmp118_, _m_index);
								m = (DinoEntitiesMessage*) _tmp119_;
								_tmp120_ = m;
								_tmp121_ = message;
								if (dino_entities_message_equals (_tmp120_, _tmp121_)) {
									_g_object_unref0 (m);
									break;
								}
								_tmp122_ = m;
								_tmp123_ = dino_entities_message_get_marked (_tmp122_);
								_tmp124_ = _tmp123_;
								if (_tmp124_ == DINO_ENTITIES_MESSAGE_MARKED_RECEIVED) {
									DinoEntitiesMessage* _tmp125_;
									_tmp125_ = m;
									dino_entities_message_set_marked (_tmp125_, DINO_ENTITIES_MESSAGE_MARKED_READ);
								}
								_g_object_unref0 (m);
							}
						}
						_tmp126_ = message;
						dino_entities_message_set_marked (_tmp126_, DINO_ENTITIES_MESSAGE_MARKED_READ);
						_g_object_unref0 (messages);
						break;
					}
				}
			}
		} else {
			gboolean _tmp127_ = FALSE;
			gboolean _tmp128_ = FALSE;
			GeeHashMap* _tmp129_;
			GeeHashMap* _tmp133_;
			_tmp129_ = self->priv->marker_wo_message;
			if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp129_, stanza_id)) {
				GeeHashMap* _tmp130_;
				gpointer _tmp131_;
				gchar* _tmp132_;
				_tmp130_ = self->priv->marker_wo_message;
				_tmp131_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp130_, stanza_id);
				_tmp132_ = (gchar*) _tmp131_;
				_tmp128_ = g_strcmp0 (_tmp132_, XMPP_XEP_CHAT_MARKERS_MARKER_DISPLAYED) == 0;
				_g_free0 (_tmp132_);
			} else {
				_tmp128_ = FALSE;
			}
			if (_tmp128_) {
				_tmp127_ = g_strcmp0 (marker, XMPP_XEP_CHAT_MARKERS_MARKER_RECEIVED) == 0;
			} else {
				_tmp127_ = FALSE;
			}
			if (_tmp127_) {
				_g_object_unref0 (message);
				return;
			}
			_tmp133_ = self->priv->marker_wo_message;
			gee_abstract_map_set ((GeeAbstractMap*) _tmp133_, stanza_id, marker);
		}
		_g_object_unref0 (message);
	}
}

static void
dino_counterpart_interaction_manager_check_if_got_marker (DinoCounterpartInteractionManager* self,
                                                          DinoEntitiesMessage* message,
                                                          DinoEntitiesConversation* conversation)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	g_return_if_fail (conversation != NULL);
	_tmp0_ = self->priv->marker_wo_message;
	_tmp1_ = dino_entities_message_get_stanza_id (message);
	_tmp2_ = _tmp1_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		XmppJid* _tmp3_;
		XmppJid* _tmp4_;
		GeeHashMap* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gpointer _tmp8_;
		gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		GeeHashMap* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		_tmp3_ = dino_entities_conversation_get_counterpart (conversation);
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->marker_wo_message;
		_tmp6_ = dino_entities_message_get_stanza_id (message);
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, _tmp7_);
		_tmp9_ = (gchar*) _tmp8_;
		_tmp10_ = dino_entities_message_get_stanza_id (message);
		_tmp11_ = _tmp10_;
		dino_counterpart_interaction_manager_handle_chat_marker (self, conversation, _tmp4_, _tmp9_, _tmp11_);
		_g_free0 (_tmp9_);
		_tmp12_ = self->priv->marker_wo_message;
		_tmp13_ = dino_entities_message_get_stanza_id (message);
		_tmp14_ = _tmp13_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp12_, _tmp14_, NULL);
	}
}

static void
dino_counterpart_interaction_manager_on_receipt_received (DinoCounterpartInteractionManager* self,
                                                          DinoEntitiesAccount* account,
                                                          XmppJid* jid,
                                                          const gchar* id,
                                                          XmppMessageStanza* stanza)
{
	DinoEntitiesConversation* conversation = NULL;
	DinoStreamInteractor* _tmp0_;
	DinoModuleIdentity* _tmp1_;
	gpointer _tmp2_;
	DinoConversationManager* _tmp3_;
	XmppJid* _tmp4_;
	XmppJid* _tmp5_;
	XmppJid* _tmp6_;
	XmppJid* _tmp7_;
	XmppJid* _tmp8_;
	XmppJid* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	DinoEntitiesConversation* _tmp12_;
	DinoEntitiesConversation* _tmp13_;
	DinoEntitiesConversation* _tmp14_;
	DinoEntitiesConversation* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (stanza != NULL);
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = dino_conversation_manager_IDENTITY;
	_tmp2_ = dino_stream_interactor_get_module (_tmp0_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_);
	_tmp3_ = (DinoConversationManager*) _tmp2_;
	_tmp4_ = xmpp_stanza_get_from ((XmppStanza*) stanza);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = xmpp_stanza_get_to ((XmppStanza*) stanza);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp10_ = xmpp_stanza_get_type_ ((XmppStanza*) stanza);
	_tmp11_ = _tmp10_;
	_tmp12_ = dino_conversation_manager_approx_conversation_for_stanza (_tmp3_, _tmp6_, _tmp9_, account, _tmp11_);
	_tmp13_ = _tmp12_;
	_xmpp_jid_unref0 (_tmp9_);
	_xmpp_jid_unref0 (_tmp6_);
	_g_object_unref0 (_tmp3_);
	conversation = _tmp13_;
	_tmp14_ = conversation;
	if (_tmp14_ == NULL) {
		_g_object_unref0 (conversation);
		return;
	}
	_tmp15_ = conversation;
	dino_counterpart_interaction_manager_handle_chat_marker (self, _tmp15_, jid, XMPP_XEP_CHAT_MARKERS_MARKER_RECEIVED, id);
	_g_object_unref0 (conversation);
}

static const gchar*
dino_counterpart_interaction_manager_real_get_id (DinoStreamInteractionModule* base)
{
	const gchar* result;
	DinoCounterpartInteractionManager* self;
	DinoModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	self = (DinoCounterpartInteractionManager*) base;
	_tmp0_ = dino_counterpart_interaction_manager_IDENTITY;
	_tmp1_ = dino_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
g_cclosure_user_marshal_VOID__OBJECT_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_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	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_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_string (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_OBJECT_ENUM (GClosure * closure,
                                                           GValue * return_value,
                                                           guint n_param_values,
                                                           const GValue * param_values,
                                                           gpointer invocation_hint,
                                                           gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_XMPP_JID_OBJECT_ENUM) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer arg_3, gint arg_4, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_XMPP_JID_OBJECT_ENUM 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_XMPP_JID_OBJECT_ENUM) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), xmpp_value_get_jid (param_values + 2), g_value_get_object (param_values + 3), g_value_get_enum (param_values + 4), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_OBJECT (GClosure * closure,
                                                      GValue * return_value,
                                                      guint n_param_values,
                                                      const GValue * param_values,
                                                      gpointer invocation_hint,
                                                      gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_XMPP_JID_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer arg_3, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_XMPP_JID_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	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_XMPP_JID_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), xmpp_value_get_jid (param_values + 2), g_value_get_object (param_values + 3), data2);
}

static void
dino_counterpart_interaction_manager_class_init (DinoCounterpartInteractionManagerClass * klass,
                                                 gpointer klass_data)
{
	DinoModuleIdentity* _tmp0_;
	dino_counterpart_interaction_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoCounterpartInteractionManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_counterpart_interaction_manager_get_property;
	G_OBJECT_CLASS (klass)->finalize = dino_counterpart_interaction_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_COUNTERPART_INTERACTION_MANAGER_ID_PROPERTY, dino_counterpart_interaction_manager_properties[DINO_COUNTERPART_INTERACTION_MANAGER_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_STATE_SIGNAL] = g_signal_new ("received-state", DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, DINO_ENTITIES_TYPE_CONVERSATION, G_TYPE_STRING);
	dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MARKER_SIGNAL] = g_signal_new ("received-marker", DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_OBJECT_ENUM, G_TYPE_NONE, 4, DINO_ENTITIES_TYPE_ACCOUNT, XMPP_TYPE_JID, DINO_ENTITIES_TYPE_MESSAGE, DINO_ENTITIES_MESSAGE_TYPE_MARKED);
	dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MESSAGE_RECEIVED_SIGNAL] = g_signal_new ("received-message-received", DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_OBJECT, G_TYPE_NONE, 3, DINO_ENTITIES_TYPE_ACCOUNT, XMPP_TYPE_JID, DINO_ENTITIES_TYPE_MESSAGE);
	dino_counterpart_interaction_manager_signals[DINO_COUNTERPART_INTERACTION_MANAGER_RECEIVED_MESSAGE_DISPLAYED_SIGNAL] = g_signal_new ("received-message-displayed", DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_OBJECT, G_TYPE_NONE, 3, DINO_ENTITIES_TYPE_ACCOUNT, XMPP_TYPE_JID, DINO_ENTITIES_TYPE_MESSAGE);
	_tmp0_ = dino_module_identity_new (DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, "counterpart_interaction_manager");
	dino_counterpart_interaction_manager_IDENTITY = _tmp0_;
}

static void
dino_counterpart_interaction_manager_dino_stream_interaction_module_interface_init (DinoStreamInteractionModuleIface * iface,
                                                                                    gpointer iface_data)
{
	dino_counterpart_interaction_manager_dino_stream_interaction_module_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_id = dino_counterpart_interaction_manager_real_get_id;
}

static void
dino_counterpart_interaction_manager_instance_init (DinoCounterpartInteractionManager * self,
                                                    gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	self->priv = dino_counterpart_interaction_manager_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (DINO_ENTITIES_TYPE_CONVERSATION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, GEE_TYPE_HASH_MAP, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _dino_entities_conversation_hash_func_gee_hash_data_func, NULL, NULL, _dino_entities_conversation_equals_func_gee_equal_data_func, NULL, NULL, NULL, NULL, NULL);
	self->priv->typing_since = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->marker_wo_message = _tmp1_;
}

static void
dino_counterpart_interaction_manager_finalize (GObject * obj)
{
	DinoCounterpartInteractionManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, DinoCounterpartInteractionManager);
	_g_object_unref0 (self->priv->stream_interactor);
	_g_object_unref0 (self->priv->typing_since);
	_g_object_unref0 (self->priv->marker_wo_message);
	G_OBJECT_CLASS (dino_counterpart_interaction_manager_parent_class)->finalize (obj);
}

static GType
dino_counterpart_interaction_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoCounterpartInteractionManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_counterpart_interaction_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoCounterpartInteractionManager), 0, (GInstanceInitFunc) dino_counterpart_interaction_manager_instance_init, NULL };
	static const GInterfaceInfo dino_stream_interaction_module_info = { (GInterfaceInitFunc) dino_counterpart_interaction_manager_dino_stream_interaction_module_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_counterpart_interaction_manager_type_id;
	dino_counterpart_interaction_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoCounterpartInteractionManager", &g_define_type_info, 0);
	g_type_add_interface_static (dino_counterpart_interaction_manager_type_id, DINO_TYPE_STREAM_INTERACTION_MODULE, &dino_stream_interaction_module_info);
	DinoCounterpartInteractionManager_private_offset = g_type_add_instance_private (dino_counterpart_interaction_manager_type_id, sizeof (DinoCounterpartInteractionManagerPrivate));
	return dino_counterpart_interaction_manager_type_id;
}

GType
dino_counterpart_interaction_manager_get_type (void)
{
	static volatile gsize dino_counterpart_interaction_manager_type_id__once = 0;
	if (g_once_init_enter (&dino_counterpart_interaction_manager_type_id__once)) {
		GType dino_counterpart_interaction_manager_type_id;
		dino_counterpart_interaction_manager_type_id = dino_counterpart_interaction_manager_get_type_once ();
		g_once_init_leave (&dino_counterpart_interaction_manager_type_id__once, dino_counterpart_interaction_manager_type_id);
	}
	return dino_counterpart_interaction_manager_type_id__once;
}

static void
_vala_dino_counterpart_interaction_manager_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	DinoCounterpartInteractionManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_TYPE_COUNTERPART_INTERACTION_MANAGER, DinoCounterpartInteractionManager);
	switch (property_id) {
		case DINO_COUNTERPART_INTERACTION_MANAGER_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
_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;
}

