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

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <adwaita.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <float.h>
#include <math.h>
#include <graphene-gobject.h>
#include <gdk/gdk.h>
#include <glib/gstdio.h>

#define DC_CONVERSATION_VIEW_TEXT_PREVIEW_MAX_BYTES ((gsize) (1024 * 1024))
#define DC_CONVERSATION_VIEW_IMAGE_LIST_CHUNK 50
#define DC_COMPOSE_BAR_VOICE_FILE_NAME "voice-message.m4a"
#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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define DC_TYPE_PENDING_SEND (dc_pending_send_get_type ())
#define DC_PENDING_SEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_PENDING_SEND, DcPendingSend))
#define DC_PENDING_SEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_PENDING_SEND, DcPendingSendClass))
#define DC_IS_PENDING_SEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_PENDING_SEND))
#define DC_IS_PENDING_SEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_PENDING_SEND))
#define DC_PENDING_SEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_PENDING_SEND, DcPendingSendClass))

typedef struct _DcPendingSend DcPendingSend;
typedef struct _DcPendingSendClass DcPendingSendClass;
typedef struct _DcPendingSendPrivate DcPendingSendPrivate;
enum  {
	DC_PENDING_SEND_0_PROPERTY,
	DC_PENDING_SEND_NUM_PROPERTIES
};
static GParamSpec* dc_pending_send_properties[DC_PENDING_SEND_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define DC_TYPE_CONVERSATION_SIGNAL_HANDLER (dc_conversation_signal_handler_get_type ())
#define DC_CONVERSATION_SIGNAL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONVERSATION_SIGNAL_HANDLER, DcConversationSignalHandler))
#define DC_CONVERSATION_SIGNAL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONVERSATION_SIGNAL_HANDLER, DcConversationSignalHandlerClass))
#define DC_IS_CONVERSATION_SIGNAL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONVERSATION_SIGNAL_HANDLER))
#define DC_IS_CONVERSATION_SIGNAL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONVERSATION_SIGNAL_HANDLER))
#define DC_CONVERSATION_SIGNAL_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONVERSATION_SIGNAL_HANDLER, DcConversationSignalHandlerClass))

typedef struct _DcConversationSignalHandler DcConversationSignalHandler;
typedef struct _DcConversationSignalHandlerClass DcConversationSignalHandlerClass;
typedef struct _DcConversationSignalHandlerPrivate DcConversationSignalHandlerPrivate;
enum  {
	DC_CONVERSATION_SIGNAL_HANDLER_0_PROPERTY,
	DC_CONVERSATION_SIGNAL_HANDLER_NUM_PROPERTIES
};
static GParamSpec* dc_conversation_signal_handler_properties[DC_CONVERSATION_SIGNAL_HANDLER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define DC_TYPE_CONVERSATION_VIEW (dc_conversation_view_get_type ())
#define DC_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONVERSATION_VIEW, DcConversationView))
#define DC_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONVERSATION_VIEW, DcConversationViewClass))
#define DC_IS_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONVERSATION_VIEW))
#define DC_IS_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONVERSATION_VIEW))
#define DC_CONVERSATION_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONVERSATION_VIEW, DcConversationViewClass))

typedef struct _DcConversationView DcConversationView;
typedef struct _DcConversationViewClass DcConversationViewClass;
typedef struct _DcConversationViewPrivate DcConversationViewPrivate;

#define DC_TYPE_WINDOW (dc_window_get_type ())
#define DC_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_WINDOW, DcWindow))
#define DC_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_WINDOW, DcWindowClass))
#define DC_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_WINDOW))
#define DC_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_WINDOW))
#define DC_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_WINDOW, DcWindowClass))

typedef struct _DcWindow DcWindow;
typedef struct _DcWindowClass DcWindowClass;

#define DC_TYPE_RPC_CLIENT (dc_rpc_client_get_type ())
#define DC_RPC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_RPC_CLIENT, DcRpcClient))
#define DC_RPC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_RPC_CLIENT, DcRpcClientClass))
#define DC_IS_RPC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_RPC_CLIENT))
#define DC_IS_RPC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_RPC_CLIENT))
#define DC_RPC_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_RPC_CLIENT, DcRpcClientClass))

typedef struct _DcRpcClient DcRpcClient;
typedef struct _DcRpcClientClass DcRpcClientClass;

#define DC_TYPE_SETTINGS_MANAGER (dc_settings_manager_get_type ())
#define DC_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_SETTINGS_MANAGER, DcSettingsManager))
#define DC_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_SETTINGS_MANAGER, DcSettingsManagerClass))
#define DC_IS_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_SETTINGS_MANAGER))
#define DC_IS_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_SETTINGS_MANAGER))
#define DC_SETTINGS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_SETTINGS_MANAGER, DcSettingsManagerClass))

typedef struct _DcSettingsManager DcSettingsManager;
typedef struct _DcSettingsManagerClass DcSettingsManagerClass;

#define DC_TYPE_LINK_PREVIEW_FETCHER (dc_link_preview_fetcher_get_type ())
#define DC_LINK_PREVIEW_FETCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_LINK_PREVIEW_FETCHER, DcLinkPreviewFetcher))
#define DC_LINK_PREVIEW_FETCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_LINK_PREVIEW_FETCHER, DcLinkPreviewFetcherClass))
#define DC_IS_LINK_PREVIEW_FETCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_LINK_PREVIEW_FETCHER))
#define DC_IS_LINK_PREVIEW_FETCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_LINK_PREVIEW_FETCHER))
#define DC_LINK_PREVIEW_FETCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_LINK_PREVIEW_FETCHER, DcLinkPreviewFetcherClass))

typedef struct _DcLinkPreviewFetcher DcLinkPreviewFetcher;
typedef struct _DcLinkPreviewFetcherClass DcLinkPreviewFetcherClass;
typedef enum  {
	DC_CHAT_KIND_UNKNOWN = 0,
	DC_CHAT_KIND_DIRECT = 1,
	DC_CHAT_KIND_GROUP = 2
} DcChatKind;

#define DC_TYPE_CHAT_KIND (dc_chat_kind_get_type ())

#define DC_TYPE_COMPOSE_BAR (dc_compose_bar_get_type ())
#define DC_COMPOSE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_COMPOSE_BAR, DcComposeBar))
#define DC_COMPOSE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_COMPOSE_BAR, DcComposeBarClass))
#define DC_IS_COMPOSE_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_COMPOSE_BAR))
#define DC_IS_COMPOSE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_COMPOSE_BAR))
#define DC_COMPOSE_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_COMPOSE_BAR, DcComposeBarClass))

typedef struct _DcComposeBar DcComposeBar;
typedef struct _DcComposeBarClass DcComposeBarClass;

#define DC_TYPE_FILE_DROP_TARGET (dc_file_drop_target_get_type ())
#define DC_FILE_DROP_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_FILE_DROP_TARGET, DcFileDropTarget))
#define DC_FILE_DROP_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_FILE_DROP_TARGET, DcFileDropTargetClass))
#define DC_IS_FILE_DROP_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_FILE_DROP_TARGET))
#define DC_IS_FILE_DROP_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_FILE_DROP_TARGET))
#define DC_FILE_DROP_TARGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_FILE_DROP_TARGET, DcFileDropTargetClass))

typedef struct _DcFileDropTarget DcFileDropTarget;
typedef struct _DcFileDropTargetClass DcFileDropTargetClass;

#define DC_TYPE_CONVERSATION_MEDIA_BAR (dc_conversation_media_bar_get_type ())
#define DC_CONVERSATION_MEDIA_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBar))
#define DC_CONVERSATION_MEDIA_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBarClass))
#define DC_IS_CONVERSATION_MEDIA_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONVERSATION_MEDIA_BAR))
#define DC_IS_CONVERSATION_MEDIA_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONVERSATION_MEDIA_BAR))
#define DC_CONVERSATION_MEDIA_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONVERSATION_MEDIA_BAR, DcConversationMediaBarClass))

typedef struct _DcConversationMediaBar DcConversationMediaBar;
typedef struct _DcConversationMediaBarClass DcConversationMediaBarClass;
typedef enum  {
	DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE,
	DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM,
	DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR
} DcConversationViewViewportGoal;

#define DC_CONVERSATION_VIEW_TYPE_VIEWPORT_GOAL (dc_conversation_view_viewport_goal_get_type ())

#define DC_TYPE_PINNED_MESSAGES_MANAGER (dc_pinned_messages_manager_get_type ())
#define DC_PINNED_MESSAGES_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_PINNED_MESSAGES_MANAGER, DcPinnedMessagesManager))
#define DC_PINNED_MESSAGES_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_PINNED_MESSAGES_MANAGER, DcPinnedMessagesManagerClass))
#define DC_IS_PINNED_MESSAGES_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_PINNED_MESSAGES_MANAGER))
#define DC_IS_PINNED_MESSAGES_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_PINNED_MESSAGES_MANAGER))
#define DC_PINNED_MESSAGES_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_PINNED_MESSAGES_MANAGER, DcPinnedMessagesManagerClass))

typedef struct _DcPinnedMessagesManager DcPinnedMessagesManager;
typedef struct _DcPinnedMessagesManagerClass DcPinnedMessagesManagerClass;

#define DC_TYPE_WEBXDC_APPS_BAR (dc_webxdc_apps_bar_get_type ())
#define DC_WEBXDC_APPS_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_WEBXDC_APPS_BAR, DcWebxdcAppsBar))
#define DC_WEBXDC_APPS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_WEBXDC_APPS_BAR, DcWebxdcAppsBarClass))
#define DC_IS_WEBXDC_APPS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_WEBXDC_APPS_BAR))
#define DC_IS_WEBXDC_APPS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_WEBXDC_APPS_BAR))
#define DC_WEBXDC_APPS_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_WEBXDC_APPS_BAR, DcWebxdcAppsBarClass))

typedef struct _DcWebxdcAppsBar DcWebxdcAppsBar;
typedef struct _DcWebxdcAppsBarClass DcWebxdcAppsBarClass;

#define DC_TYPE_MESSAGE_ACTIONS (dc_message_actions_get_type ())
#define DC_MESSAGE_ACTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE_ACTIONS, DcMessageActions))
#define DC_MESSAGE_ACTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE_ACTIONS, DcMessageActionsClass))
#define DC_IS_MESSAGE_ACTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE_ACTIONS))
#define DC_IS_MESSAGE_ACTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE_ACTIONS))
#define DC_MESSAGE_ACTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE_ACTIONS, DcMessageActionsClass))

typedef struct _DcMessageActions DcMessageActions;
typedef struct _DcMessageActionsClass DcMessageActionsClass;

#define DC_TYPE_MENTION_ROSTER (dc_mention_roster_get_type ())
#define DC_MENTION_ROSTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MENTION_ROSTER, DcMentionRoster))
#define DC_MENTION_ROSTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MENTION_ROSTER, DcMentionRosterClass))
#define DC_IS_MENTION_ROSTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MENTION_ROSTER))
#define DC_IS_MENTION_ROSTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MENTION_ROSTER))
#define DC_MENTION_ROSTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MENTION_ROSTER, DcMentionRosterClass))

typedef struct _DcMentionRoster DcMentionRoster;
typedef struct _DcMentionRosterClass DcMentionRosterClass;
enum  {
	DC_CONVERSATION_VIEW_0_PROPERTY,
	DC_CONVERSATION_VIEW_CHAT_ID_PROPERTY,
	DC_CONVERSATION_VIEW_NUM_PROPERTIES
};
static GParamSpec* dc_conversation_view_properties[DC_CONVERSATION_VIEW_NUM_PROPERTIES];
typedef enum  {
	DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_UNAVAILABLE,
	DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_FAILED,
	DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_SAVED
} DcConversationViewDraftSaveResult;

#define DC_CONVERSATION_VIEW_TYPE_DRAFT_SAVE_RESULT (dc_conversation_view_draft_save_result_get_type ())
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
typedef struct _Block35Data Block35Data;

#define DC_TYPE_MESSAGE (dc_message_get_type ())
#define DC_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE, DcMessage))
#define DC_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE, DcMessageClass))
#define DC_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE))
#define DC_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE))
#define DC_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE, DcMessageClass))

typedef struct _DcMessage DcMessage;
typedef struct _DcMessageClass DcMessageClass;

#define DC_TYPE_AUDIO_PLAYBACK (dc_audio_playback_get_type ())
#define DC_AUDIO_PLAYBACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlayback))
#define DC_AUDIO_PLAYBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlaybackClass))
#define DC_IS_AUDIO_PLAYBACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_PLAYBACK))
#define DC_IS_AUDIO_PLAYBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_PLAYBACK))
#define DC_AUDIO_PLAYBACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlaybackClass))

typedef struct _DcAudioPlayback DcAudioPlayback;
typedef struct _DcAudioPlaybackClass DcAudioPlaybackClass;
typedef struct _Block36Data Block36Data;
typedef struct _Block37Data Block37Data;

#define DC_TYPE_AUDIO_PLAYBACK_ITEM (dc_audio_playback_item_get_type ())
#define DC_AUDIO_PLAYBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItem))
#define DC_AUDIO_PLAYBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItemClass))
#define DC_IS_AUDIO_PLAYBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM))
#define DC_IS_AUDIO_PLAYBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_PLAYBACK_ITEM))
#define DC_AUDIO_PLAYBACK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItemClass))

typedef struct _DcAudioPlaybackItem DcAudioPlaybackItem;
typedef struct _DcAudioPlaybackItemClass DcAudioPlaybackItemClass;
typedef struct _Block38Data Block38Data;

#define DC_TYPE_MESSAGE_ROW (dc_message_row_get_type ())
#define DC_MESSAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE_ROW, DcMessageRow))
#define DC_MESSAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE_ROW, DcMessageRowClass))
#define DC_IS_MESSAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE_ROW))
#define DC_IS_MESSAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE_ROW))
#define DC_MESSAGE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE_ROW, DcMessageRowClass))

typedef struct _DcMessageRow DcMessageRow;
typedef struct _DcMessageRowClass DcMessageRowClass;
typedef enum  {
	DC_BUBBLE_AVATAR_DISPLAY_NONE = 0,
	DC_BUBBLE_AVATAR_DISPLAY_OTHER = 1,
	DC_BUBBLE_AVATAR_DISPLAY_BOTH = 2
} DcBubbleAvatarDisplay;

#define DC_TYPE_BUBBLE_AVATAR_DISPLAY (dc_bubble_avatar_display_get_type ())
typedef enum  {
	DC_MESSAGE_STYLE_BUBBLES = 0,
	DC_MESSAGE_STYLE_IRC = 1,
	DC_MESSAGE_STYLE_WORKSPACE = 2
} DcMessageStyle;

#define DC_TYPE_MESSAGE_STYLE (dc_message_style_get_type ())
typedef struct _Block39Data Block39Data;
typedef struct _Block40Data Block40Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DcConversationViewPlayAdjacentVoiceMessageData DcConversationViewPlayAdjacentVoiceMessageData;
typedef enum  {
	DC_DELETE_CHOICE_CANCEL,
	DC_DELETE_CHOICE_FOR_ME,
	DC_DELETE_CHOICE_FOR_EVERYONE
} DcDeleteChoice;

#define DC_TYPE_DELETE_CHOICE (dc_delete_choice_get_type ())
typedef struct _DcConversationViewDeleteSelectedMessagesData DcConversationViewDeleteSelectedMessagesData;
typedef struct _DcConversationViewDeleteSelectedMessagesConfirmedData DcConversationViewDeleteSelectedMessagesConfirmedData;
typedef struct _DcConversationViewAcceptRequestData DcConversationViewAcceptRequestData;
typedef struct _DcConversationViewBlockRequestData DcConversationViewBlockRequestData;
typedef struct _DcConversationViewReloadMessagesData DcConversationViewReloadMessagesData;
typedef struct _DcConversationViewHandleIncomingMsgData DcConversationViewHandleIncomingMsgData;
typedef struct _Block41Data Block41Data;
typedef struct _Block42Data Block42Data;
typedef struct _DcConversationViewToggleFullMessageData DcConversationViewToggleFullMessageData;
typedef struct _DcConversationViewViewFullMessageData DcConversationViewViewFullMessageData;
typedef struct _DcConversationViewFetchFullMessageTextData DcConversationViewFetchFullMessageTextData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define DC_TYPE_FULL_MESSAGE_DIALOG (dc_full_message_dialog_get_type ())
#define DC_FULL_MESSAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_FULL_MESSAGE_DIALOG, DcFullMessageDialog))
#define DC_FULL_MESSAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_FULL_MESSAGE_DIALOG, DcFullMessageDialogClass))
#define DC_IS_FULL_MESSAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_FULL_MESSAGE_DIALOG))
#define DC_IS_FULL_MESSAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_FULL_MESSAGE_DIALOG))
#define DC_FULL_MESSAGE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_FULL_MESSAGE_DIALOG, DcFullMessageDialogClass))

typedef struct _DcFullMessageDialog DcFullMessageDialog;
typedef struct _DcFullMessageDialogClass DcFullMessageDialogClass;
typedef struct _Block43Data Block43Data;
typedef struct _Block44Data Block44Data;
typedef struct _Block45Data Block45Data;
typedef struct _Block46Data Block46Data;
typedef struct _DcConversationViewLoadMessagesData DcConversationViewLoadMessagesData;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))

#define DC_TYPE_CONTACT (dc_contact_get_type ())
#define DC_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONTACT, DcContact))
#define DC_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONTACT, DcContactClass))
#define DC_IS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONTACT))
#define DC_IS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONTACT))
#define DC_CONTACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONTACT, DcContactClass))

typedef struct _DcContact DcContact;
typedef struct _DcContactClass DcContactClass;

#define DC_TYPE_MENTION_MEMBER (dc_mention_member_get_type ())
#define DC_MENTION_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MENTION_MEMBER, DcMentionMember))
#define DC_MENTION_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MENTION_MEMBER, DcMentionMemberClass))
#define DC_IS_MENTION_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MENTION_MEMBER))
#define DC_IS_MENTION_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MENTION_MEMBER))
#define DC_MENTION_MEMBER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MENTION_MEMBER, DcMentionMemberClass))

typedef struct _DcMentionMember DcMentionMember;
typedef struct _DcMentionMemberClass DcMentionMemberClass;
typedef struct _DcConversationViewEnsureMentionRosterData DcConversationViewEnsureMentionRosterData;
typedef struct _DcConversationViewLoadChatKindIfNeededData DcConversationViewLoadChatKindIfNeededData;
typedef enum  {
	DC_MESSAGE_STATE_UNDEFINED = 0,
	DC_MESSAGE_STATE_IN_FRESH = 10,
	DC_MESSAGE_STATE_IN_NOTICED = 13,
	DC_MESSAGE_STATE_IN_SEEN = 16,
	DC_MESSAGE_STATE_OUT_PREPARING = 18,
	DC_MESSAGE_STATE_OUT_DRAFT = 19,
	DC_MESSAGE_STATE_OUT_PENDING = 20,
	DC_MESSAGE_STATE_OUT_FAILED = 24,
	DC_MESSAGE_STATE_OUT_DELIVERED = 26,
	DC_MESSAGE_STATE_OUT_MDN_RCVD = 28
} DcMessageState;

#define DC_TYPE_MESSAGE_STATE (dc_message_state_get_type ())
typedef struct _DcConversationViewFetchMessagesBatchData DcConversationViewFetchMessagesBatchData;
typedef struct _DcConversationViewLoadEarlierMessagesData DcConversationViewLoadEarlierMessagesData;
typedef struct _DcConversationViewLoadUntilPendingMessageData DcConversationViewLoadUntilPendingMessageData;
typedef struct _DcConversationViewSaveWebxdcFromBarData DcConversationViewSaveWebxdcFromBarData;
typedef struct _Block47Data Block47Data;

#define DC_LINK_PREVIEW_FETCHER_TYPE_RESULT (dc_link_preview_fetcher_result_get_type ())
#define DC_LINK_PREVIEW_FETCHER_RESULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_LINK_PREVIEW_FETCHER_TYPE_RESULT, DcLinkPreviewFetcherResult))
#define DC_LINK_PREVIEW_FETCHER_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_LINK_PREVIEW_FETCHER_TYPE_RESULT, DcLinkPreviewFetcherResultClass))
#define DC_LINK_PREVIEW_FETCHER_IS_RESULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_LINK_PREVIEW_FETCHER_TYPE_RESULT))
#define DC_LINK_PREVIEW_FETCHER_IS_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_LINK_PREVIEW_FETCHER_TYPE_RESULT))
#define DC_LINK_PREVIEW_FETCHER_RESULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_LINK_PREVIEW_FETCHER_TYPE_RESULT, DcLinkPreviewFetcherResultClass))

typedef struct _DcLinkPreviewFetcherResult DcLinkPreviewFetcherResult;
typedef struct _DcLinkPreviewFetcherResultClass DcLinkPreviewFetcherResultClass;
#define _dc_link_preview_fetcher_result_unref0(var) ((var == NULL) ? NULL : (var = (dc_link_preview_fetcher_result_unref (var), NULL)))
typedef struct _DcLinkPreviewFetcherResultPrivate DcLinkPreviewFetcherResultPrivate;
typedef struct _DcConversationViewProcessSendQueueData DcConversationViewProcessSendQueueData;
typedef struct _DcConversationViewDoSendData DcConversationViewDoSendData;
typedef struct _DcConversationViewLoadDraftData DcConversationViewLoadDraftData;
typedef struct _Block48Data Block48Data;
typedef struct _DcConversationViewSaveDraftSnapshotData DcConversationViewSaveDraftSnapshotData;
typedef struct _DcConversationViewRemoveDraftData DcConversationViewRemoveDraftData;

#define DC_TYPE_AUDIO_PLAYER (dc_audio_player_get_type ())
#define DC_AUDIO_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_PLAYER, DcAudioPlayer))
#define DC_AUDIO_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_PLAYER, DcAudioPlayerClass))
#define DC_IS_AUDIO_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_PLAYER))
#define DC_IS_AUDIO_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_PLAYER))
#define DC_AUDIO_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_PLAYER, DcAudioPlayerClass))

typedef struct _DcAudioPlayer DcAudioPlayer;
typedef struct _DcAudioPlayerClass DcAudioPlayerClass;
typedef struct _DcConversationViewExtendImageListData DcConversationViewExtendImageListData;

struct _DcPendingSend {
	GObject parent_instance;
	DcPendingSendPrivate * priv;
	gchar* text;
	gchar* file_path;
	gchar* file_name;
	gint quote_msg_id;
	gboolean voice;
	gboolean owns_file;
};

struct _DcPendingSendClass {
	GObjectClass parent_class;
};

struct _DcConversationSignalHandler {
	GObject parent_instance;
	DcConversationSignalHandlerPrivate * priv;
};

struct _DcConversationSignalHandlerClass {
	GObjectClass parent_class;
};

struct _DcConversationSignalHandlerPrivate {
	GObject* source;
	gulong handler_id;
};

struct _DcConversationView {
	GtkBox parent_instance;
	DcConversationViewPrivate * priv;
};

struct _DcConversationViewClass {
	GtkBoxClass parent_class;
};

struct _DcConversationViewPrivate {
	gint _chat_id;
	DcWindow* window;
	DcRpcClient* rpc;
	DcSettingsManager* settings;
	DcLinkPreviewFetcher* link_preview_fetcher;
	DcChatKind chat_kind;
	gboolean chat_kind_loaded;
	GtkListView* message_listview;
	GtkScrolledWindow* message_scroll;
	GListStore* message_store;
	GtkFilterListModel* filtered_message_store;
	GtkCustomFilter* message_filter;
	DcComposeBar* compose_bar;
	GtkBox* selection_bar;
	GtkButton* selection_delete_btn;
	GtkButton* selection_forward_btn;
	GtkBox* request_bar;
	gboolean is_contact_request;
	gboolean selection_mode;
	GtkButton* scroll_down_btn;
	GtkLabel* loading_pill_label;
	GtkRevealer* loading_more_revealer;
	GtkSpinner* loading_more_spinner;
	GtkRevealer* message_search_revealer;
	GtkSearchEntry* message_search_entry;
	gboolean search_toggling;
	DcFileDropTarget* file_drop_target;
	DcConversationMediaBar* media_bar;
	gulong playback_message_handler;
	gulong playback_finished_handler;
	GPtrArray* signal_handlers;
	guint* tick_callback_ids;
	gint tick_callback_ids_length1;
	gint _tick_callback_ids_size_;
	gboolean closed;
	DcConversationViewViewportGoal goal;
	guint goal_generation;
	gint* pending_seen_ids;
	gint pending_seen_ids_length1;
	gint _pending_seen_ids_size_;
	JsonArray* all_msg_ids;
	guint loaded_start_index;
	gboolean loading_more;
	gint pending_scroll_message_id;
	gint pending_voice_direction;
	gboolean loading_chat;
	gboolean messages_loaded;
	gboolean messages_stale;
	gboolean draft_loaded;
	gboolean draft_rpc_available;
	guint draft_save_timer;
	gboolean draft_save_pending;
	gchar* pending_draft_text;
	gchar* pending_draft_file_path;
	gchar* pending_draft_file_name;
	gint pending_draft_quote_msg_id;
	gboolean pending_draft_voice;
	gint64 scroll_freeze_until_us;
	GQueue* send_queue;
	gboolean sending_queue;
	DcPinnedMessagesManager* pinned;
	DcWebxdcAppsBar* webxdc_bar;
	DcMessageActions* msg_actions;
	DcMentionRoster* mention_roster;
	DcMentionRoster* reaction_roster;
	gboolean roster_loaded;
};

struct _Block35Data {
	int _ref_count_;
	DcConversationView* self;
	DcWindow* window;
};

struct _Block36Data {
	int _ref_count_;
	GWeakRef view_ref;
};

struct _Block37Data {
	int _ref_count_;
	GWeakRef view_ref;
};

struct _Block38Data {
	int _ref_count_;
	DcConversationView* self;
	GtkGestureClick* dc;
	gint dc_last_id;
	gint64 dc_last_time;
};

struct _Block39Data {
	int _ref_count_;
	GWeakRef view_ref;
};

struct _Block40Data {
	int _ref_count_;
	DcConversationView* self;
	DcAudioPlayback* playback;
	DcAudioPlaybackItem* current_item;
	DcMessage* next;
};

struct _DcConversationViewPlayAdjacentVoiceMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint direction;
	DcAudioPlayback* playback;
	DcAudioPlayback* _tmp0_;
	DcAudioPlaybackItem* current_item;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	DcAudioPlaybackItem* _tmp7_;
	DcAudioPlaybackItem* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	DcRpcClient* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	DcAudioPlaybackItem* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	DcMessage* msg;
	DcAudioPlaybackItem* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	DcMessage* _tmp21_;
	DcMessage* _tmp22_;
	DcAudioPlayback* _tmp23_;
	DcMessage* _tmp24_;
	DcRpcClient* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	gboolean _tmp28_;
	gboolean _tmp29_;
	gboolean _tmp30_;
	JsonArray* _tmp31_;
	gint current_id;
	DcAudioPlaybackItem* _tmp32_;
	gint _tmp33_;
	gint _tmp34_;
	gdouble anchor_top;
	DcMessageRow* anchor;
	GtkListView* _tmp35_;
	gdouble _tmp36_;
	DcMessageRow* _tmp37_;
	gint _tmp38_;
	DcMessageRow* _tmp39_;
	DcMessageRow* _tmp40_;
	gint _tmp41_;
	gint _tmp42_;
	gint anchor_id;
	gboolean _tmp43_;
	DcAudioPlayback* _tmp44_;
	DcAudioPlaybackItem* _tmp45_;
	DcAudioPlaybackItem* _tmp46_;
	DcAudioPlaybackItem* _tmp47_;
	guint _tmp48_;
	guint new_start;
	GPtrArray* messages;
	GPtrArray* _tmp49_;
	GListStore* _tmp50_;
	GPtrArray* _tmp51_;
	gint _tmp52_;
	GObject** _tmp53_;
	GObject** _tmp54_;
	gint _tmp54__length1;
	DcMessage* _tmp55_;
	DcMessage* _tmp56_;
	gboolean _tmp57_;
	DcMessage* _tmp58_;
	DcAudioPlayback* _tmp59_;
	DcAudioPlaybackItem* _tmp60_;
	DcAudioPlaybackItem* _tmp61_;
	DcAudioPlaybackItem* _tmp62_;
	DcAudioPlayback* _tmp63_;
	DcMessage* _tmp64_;
	DcRpcClient* _tmp65_;
	gint _tmp66_;
	gint _tmp67_;
	gint _tmp68_;
	GtkFilterListModel* _tmp69_;
	gint anchor_pos;
	GError* e;
	DcWindow* _tmp70_;
	GError* _tmp71_;
	const gchar* _tmp72_;
	gchar* _tmp73_;
	gchar* _tmp74_;
	GError* _inner_error0_;
};

struct _DcConversationViewDeleteSelectedMessagesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint* ids;
	gint _tmp0_;
	gint* _tmp1_;
	gint ids_length1;
	gint _ids_size_;
	gint* _tmp2_;
	gint _tmp2__length1;
	const gchar* _tmp3_;
	gint* _tmp4_;
	gint _tmp4__length1;
	gchar* title;
	gchar* _tmp5_;
	gboolean all_outgoing;
	gchar* body;
	gchar* _tmp6_;
	gint* _tmp7_;
	gint _tmp7__length1;
	gchar* _tmp8_;
	gint* _tmp9_;
	gint _tmp9__length1;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gint* _tmp13_;
	gint _tmp13__length1;
	gchar* _tmp14_;
	gint* _tmp15_;
	gint _tmp15__length1;
	gchar* _tmp16_;
	gchar* _tmp17_;
	DcDeleteChoice choice;
	DcWindow* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gint* _tmp21_;
	gint _tmp21__length1;
	gint* _tmp22_;
	gint _tmp22__length1;
};

struct _DcConversationViewDeleteSelectedMessagesConfirmedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint* ids;
	gint ids_length1;
	gboolean for_all;
	DcRpcClient* _tmp0_;
	DcRpcClient* _tmp1_;
	DcAudioPlayback* playback;
	DcAudioPlayback* _tmp2_;
	DcAudioPlayback* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	DcAudioPlayback* _tmp6_;
	gint i;
	gboolean _tmp7_;
	gint _tmp8_;
	gint idx;
	GListStore* _tmp9_;
	gint _tmp10_;
	GListStore* _tmp11_;
	GError* e;
	DcWindow* _tmp12_;
	GError* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GError* _inner_error0_;
};

struct _DcConversationViewAcceptRequestData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	DcComposeBar* _tmp2_;
	DcWindow* _tmp3_;
	GError* e;
	DcWindow* _tmp4_;
	GError* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GError* _inner_error0_;
};

struct _DcConversationViewBlockRequestData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	DcWindow* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	DcWindow* _tmp6_;
	DcWindow* _tmp7_;
	GError* e;
	DcWindow* _tmp8_;
	GError* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _DcConversationViewReloadMessagesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
};

struct _DcConversationViewHandleIncomingMsgData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint msg_id;
	gboolean result;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	gboolean _tmp3_;
	DcWindow* _tmp4_;
	gint _tmp5_;
	DcRpcClient* _tmp6_;
	gint* _tmp7_;
	gint* _tmp8_;
	gint _tmp8__length1;
	DcWindow* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	DcMessage* msg;
	DcRpcClient* _tmp13_;
	DcMessage* _tmp14_;
	DcMessage* _tmp15_;
	gboolean is_current;
	DcWindow* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	DcMessage* _tmp20_;
	DcMessage* _tmp21_;
	DcMessage* _tmp22_;
	gboolean _tmp23_;
	DcWindow* _tmp24_;
	gint _tmp25_;
	DcMessage* _tmp26_;
	DcRpcClient* _tmp27_;
	gint* _tmp28_;
	gint* _tmp29_;
	gint _tmp29__length1;
	gboolean _tmp30_;
	DcMessage* _tmp31_;
	GError* e;
	GError* _tmp32_;
	const gchar* _tmp33_;
	GError* _inner_error0_;
};

struct _Block41Data {
	int _ref_count_;
	DcConversationView* self;
	gboolean was_active;
};

struct _Block42Data {
	int _ref_count_;
	DcConversationView* self;
	gdouble saved_value;
	gboolean was_at_bottom;
	gboolean was_loading;
	guint tick_id;
};

struct _DcConversationViewToggleFullMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint msg_id;
	DcMessage* msg;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	DcMessage* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	DcMessage* _tmp6_;
	DcMessage* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	DcRpcClient* _tmp10_;
	gchar* full_text;
	DcMessage* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	DcMessage* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	DcMessage* current;
	GListStore* _tmp20_;
	DcMessage* _tmp21_;
	DcMessage* _tmp22_;
	DcMessage* _tmp23_;
	gboolean _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	DcMessage* _tmp29_;
	const gchar* _tmp30_;
	DcMessage* _tmp31_;
	DcWindow* _tmp32_;
	GError* e;
	DcWindow* _tmp33_;
	GError* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	GError* _inner_error0_;
};

struct _DcConversationViewViewFullMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint msg_id;
	DcMessage* msg;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	gchar* full_text;
	DcMessage* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	DcMessage* current;
	GListStore* _tmp11_;
	DcMessage* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	DcMessage* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	DcMessage* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	DcWindow* _tmp23_;
	GError* e;
	DcWindow* _tmp24_;
	GError* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	GError* _inner_error0_;
};

struct _DcConversationViewFetchFullMessageTextData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint msg_id;
	gchar* result;
	DcMessage* msg;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	gboolean _tmp2_;
	DcMessage* _tmp3_;
	DcMessage* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gchar* html;
	DcRpcClient* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gboolean _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GError* _inner_error0_;
};

struct _Block43Data {
	int _ref_count_;
	DcConversationView* self;
	guint tick_id;
	gdouble v;
};

struct _Block44Data {
	int _ref_count_;
	DcConversationView* self;
	gint msg_id;
};

struct _Block45Data {
	int _ref_count_;
	DcConversationView* self;
	guint generation;
	gdouble want;
	guint stable_frames;
	guint elapsed_frames;
	guint tick_id;
	gint msg_id;
	guint position;
	guint min_frames;
};

struct _Block46Data {
	int _ref_count_;
	DcConversationView* self;
	gdouble previous_scroll_value;
};

struct _DcConversationViewLoadMessagesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gboolean preserve_scroll;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	Block46Data* _data46_;
	gboolean was_near_bottom;
	GtkScrolledWindow* _tmp3_;
	GtkAdjustment* _tmp4_;
	GtkAdjustment* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	JsonArray* _tmp8_;
	DcRpcClient* _tmp9_;
	DcRpcClient* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	JsonArray* _tmp14_;
	JsonArray* _tmp15_;
	JsonArray* _tmp16_;
	guint _tmp17_;
	JsonArray* _tmp18_;
	JsonArray* _tmp19_;
	GPtrArray* messages;
	JsonArray* _tmp20_;
	GPtrArray* _tmp21_;
	DcPinnedMessagesManager* _tmp22_;
	gint _tmp23_;
	DcWebxdcAppsBar* _tmp24_;
	gint _tmp25_;
	guint _tmp26_;
	DcConversationViewViewportGoal _tmp27_;
	gboolean _tmp28_;
	GListStore* _tmp29_;
	GListStore* _tmp30_;
	GPtrArray* _tmp31_;
	gint _tmp32_;
	GObject** _tmp33_;
	GObject** _tmp34_;
	gint _tmp34__length1;
	GPtrArray* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	gboolean _tmp38_;
	DcPinnedMessagesManager* _tmp39_;
	GError* e;
	DcWindow* _tmp40_;
	GError* _tmp41_;
	const gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	GError* _inner_error0_;
};

struct _DcConversationViewEnsureMentionRosterData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	DcMentionRoster* roster;
	DcMentionRoster* _tmp0_;
	DcWindow* _tmp1_;
	gint _tmp2_;
	gchar** _tmp3_;
	gchar** key_collection;
	gint key_collection_length1;
	gint _key_collection_size_;
	gint key_it;
	gchar* _tmp4_;
	gchar* key;
	DcMentionRoster* _tmp5_;
	const gchar* _tmp6_;
	JsonObject* chat;
	DcRpcClient* _tmp7_;
	DcRpcClient* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	JsonObject* _tmp12_;
	gboolean _tmp13_;
	JsonObject* _tmp14_;
	JsonObject* _tmp15_;
	JsonArray* ids;
	JsonObject* _tmp16_;
	JsonArray* _tmp17_;
	JsonArray* _tmp18_;
	guint i;
	gboolean _tmp19_;
	guint _tmp20_;
	JsonArray* _tmp21_;
	gint cid;
	JsonArray* _tmp22_;
	JsonObject* cobj;
	DcRpcClient* _tmp23_;
	DcRpcClient* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	JsonObject* _tmp27_;
	JsonObject* _tmp28_;
	DcContact* c;
	JsonObject* _tmp29_;
	DcContact* _tmp30_;
	gchar* _tmp31_;
	gboolean _tmp32_;
	gboolean _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	gint _tmp38_;
	gint _tmp39_;
	const gchar* _tmp40_;
	gchar* _tmp41_;
	DcContact* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* name;
	gchar* _tmp46_;
	DcMentionRoster* _tmp47_;
	const gchar* _tmp48_;
	DcContact* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	DcContact* _tmp52_;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	DcMentionMember* _tmp55_;
	DcMentionMember* _tmp56_;
	DcMentionRoster* _tmp57_;
	DcMentionRoster* _tmp58_;
	DcMessageActions* _tmp59_;
	DcMessageActions* _tmp60_;
	DcMentionRoster* _tmp61_;
	DcMentionRoster* _tmp62_;
	DcMentionRoster* _tmp63_;
	DcMentionRoster* _tmp64_;
	DcMentionRoster* _tmp65_;
	DcComposeBar* _tmp66_;
	DcMessageActions* _tmp67_;
	DcMessageActions* _tmp68_;
	DcComposeBar* _tmp69_;
	GError* _inner_error0_;
};

struct _DcConversationViewLoadChatKindIfNeededData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gboolean _tmp0_;
	JsonObject* chat;
	DcRpcClient* _tmp1_;
	DcRpcClient* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	JsonObject* _tmp6_;
	JsonObject* _tmp7_;
	JsonObject* _tmp8_;
	GError* _inner_error0_;
};

struct _DcConversationViewFetchMessagesBatchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	guint start;
	guint end;
	GPtrArray* result;
	guint count;
	gint* ids;
	gint* _tmp0_;
	gint ids_length1;
	gint _ids_size_;
	guint i;
	gboolean _tmp1_;
	guint _tmp2_;
	gint* _tmp3_;
	gint _tmp3__length1;
	JsonArray* _tmp4_;
	JsonObject* map;
	DcRpcClient* _tmp5_;
	DcRpcClient* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gint* _tmp9_;
	gint _tmp9__length1;
	JsonObject* _tmp10_;
	GPtrArray* _result_;
	GPtrArray* _tmp11_;
	gint* _tmp12_;
	gint _tmp12__length1;
	gint* mid_collection;
	gint mid_collection_length1;
	gint _mid_collection_size_;
	gint mid_it;
	gint mid;
	gchar* k;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	DcMessage* msg;
	const gchar* _tmp15_;
	JsonObject* _tmp16_;
	DcRpcClient* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	DcMessage* _tmp20_;
	DcMessage* _tmp21_;
	gint _tmp22_;
	gint _tmp23_;
	GPtrArray* _tmp24_;
	DcMessage* _tmp25_;
	DcMessage* _tmp26_;
	GError* _inner_error0_;
};

struct _DcConversationViewLoadEarlierMessagesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	JsonArray* _tmp2_;
	guint _tmp3_;
	guint new_start;
	GPtrArray* messages;
	GPtrArray* _tmp4_;
	gdouble anchor_top;
	DcMessageRow* anchor;
	GtkListView* _tmp5_;
	gdouble _tmp6_;
	DcMessageRow* _tmp7_;
	gint _tmp8_;
	DcMessageRow* _tmp9_;
	DcMessageRow* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gint anchor_id;
	GListStore* _tmp13_;
	GPtrArray* _tmp14_;
	gint _tmp15_;
	GObject** _tmp16_;
	GObject** _tmp17_;
	gint _tmp17__length1;
	gint _tmp18_;
	GtkFilterListModel* _tmp19_;
	gint anchor_pos;
	GError* e;
	DcWindow* _tmp20_;
	GError* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	GError* _inner_error0_;
};

struct _DcConversationViewLoadUntilPendingMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	JsonArray* _tmp2_;
	gboolean unavailable;
	gint target_id;
	GListStore* _tmp3_;
	DcMessage* _tmp4_;
	DcMessage* _tmp5_;
	gboolean _tmp6_;
	gint target_index;
	JsonArray* _tmp7_;
	gboolean _tmp8_;
	guint new_start;
	GPtrArray* messages;
	GPtrArray* _tmp9_;
	gdouble anchor_top;
	DcMessageRow* anchor_row;
	GtkListView* _tmp10_;
	gdouble _tmp11_;
	DcMessageRow* _tmp12_;
	GListStore* _tmp13_;
	GPtrArray* _tmp14_;
	gint _tmp15_;
	GObject** _tmp16_;
	GObject** _tmp17_;
	gint _tmp17__length1;
	DcMessageRow* _tmp18_;
	gint anchor_pos;
	GtkFilterListModel* _tmp19_;
	DcMessageRow* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	DcMessageRow* _tmp23_;
	gint _tmp24_;
	gint _tmp25_;
	GError* e;
	DcWindow* _tmp26_;
	GError* _tmp27_;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	DcWindow* _tmp31_;
	GError* _inner_error0_;
};

struct _DcConversationViewSaveWebxdcFromBarData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gint msg_id;
	DcMessage* msg;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	DcMessage* _tmp3_;
	DcRpcClient* _tmp4_;
	DcMessage* _tmp5_;
	DcMessage* _tmp6_;
	GError* e;
	DcWindow* _tmp7_;
	GError* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	DcMessage* _tmp14_;
	DcMessage* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	DcMessage* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	DcWindow* _tmp23_;
	DcWindow* _tmp24_;
	DcMessage* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	DcMessage* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GError* _inner_error0_;
};

struct _Block47Data {
	int _ref_count_;
	DcConversationView* self;
	guint generation;
};

struct _DcLinkPreviewFetcherResult {
	GTypeInstance parent_instance;
	volatile int ref_count;
	DcLinkPreviewFetcherResultPrivate * priv;
	gchar* url;
	gchar* image_path;
	gchar* file_name;
	gchar* title;
	gchar* description;
};

struct _DcLinkPreviewFetcherResultClass {
	GTypeClass parent_class;
	void (*finalize) (DcLinkPreviewFetcherResult *self);
};

struct _DcConversationViewProcessSendQueueData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	GQueue* _tmp0_;
	GQueue* _tmp1_;
	gpointer _tmp2_;
	DcPendingSend* _tmp3_;
};

struct _DcConversationViewDoSendData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	DcPendingSend* job;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	const gchar* _tmp4_;
	gchar* send_text;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* view_type;
	gchar* _tmp11_;
	gint msg_id;
	DcRpcClient* _tmp12_;
	gint _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	DcMessage* msg;
	DcRpcClient* _tmp18_;
	DcMessage* _tmp19_;
	DcMessage* _tmp20_;
	DcMessage* _tmp21_;
	DcMessage* _tmp22_;
	GError* e;
	DcWindow* _tmp23_;
	GError* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GError* _inner_error1_;
	gboolean _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GError* _inner_error0_;
};

struct _DcConversationViewLoadDraftData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gboolean _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	DcMessage* draft;
	DcRpcClient* _tmp4_;
	gint _tmp5_;
	DcMessage* _tmp6_;
	gboolean _tmp7_;
	DcMessage* _tmp8_;
	DcComposeBar* _tmp9_;
	DcComposeBar* _tmp10_;
	DcMessage* _tmp11_;
	GError* e;
	GError* _tmp12_;
	GError* _tmp13_;
	const gchar* _tmp14_;
	GError* _inner_error0_;
};

struct _Block48Data {
	int _ref_count_;
	GWeakRef view_ref;
};

struct _DcConversationViewSaveDraftSnapshotData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcRpcClient* rpc;
	gint chat_id;
	gchar* text;
	gchar* file_path;
	gchar* file_name;
	gint quote_msg_id;
	gboolean voice;
	DcConversationViewDraftSaveResult result;
	gint _tmp0_;
	gint _tmp1_;
	gboolean has_text;
	gint _tmp2_;
	gint _tmp3_;
	gboolean _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gboolean has_file;
	gboolean has_quote;
	gboolean _tmp7_;
	gboolean _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GError* e;
	gboolean available;
	GError* _tmp17_;
	GError* _tmp18_;
	const gchar* _tmp19_;
	DcConversationViewDraftSaveResult _tmp20_;
	GError* _inner_error0_;
};

struct _DcConversationViewRemoveDraftData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gboolean _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	DcRpcClient* _tmp4_;
	gint _tmp5_;
	DcWindow* _tmp6_;
	GError* e;
	GError* _tmp7_;
	GError* _tmp8_;
	const gchar* _tmp9_;
	GError* _inner_error0_;
};

struct _DcConversationViewExtendImageListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcConversationView* self;
	gchar* current_path;
	DcMessage** all;
	DcMessage** _tmp0_;
	gint all_length1;
	gint _all_size_;
	gint* ids;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint* _tmp4_;
	gint ids_length1;
	gint _ids_size_;
	gboolean _tmp5_;
	DcWindow* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gint off;
	gboolean _tmp9_;
	gint* _tmp10_;
	gint _tmp10__length1;
	gint len;
	gint* _tmp11_;
	gint _tmp11__length1;
	DcMessage** msgs;
	DcRpcClient* _tmp12_;
	gint* _tmp13_;
	gint _tmp13__length1;
	gint _tmp14_;
	DcMessage** _tmp15_;
	gint msgs_length1;
	gint _msgs_size_;
	gboolean _tmp16_;
	DcWindow* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	DcMessage** _tmp20_;
	gint _tmp20__length1;
	DcMessage** m_collection;
	gint m_collection_length1;
	gint _m_collection_size_;
	gint m_it;
	DcMessage* _tmp21_;
	DcMessage* m;
	DcMessage* _tmp22_;
	DcMessage* _tmp23_;
	GError* e;
	GError* _tmp24_;
	const gchar* _tmp25_;
	GPtrArray* list;
	GPtrArray* _tmp26_;
	DcMessage** _tmp27_;
	gint _tmp27__length1;
	DcMessage** _vala1_m_collection;
	gint _vala1_m_collection_length1;
	gint __vala1_m_collection_size_;
	gint _vala1_m_it;
	DcMessage* _tmp28_;
	DcMessage* _vala1_m;
	gboolean _tmp29_;
	DcMessage* _tmp30_;
	gboolean _tmp31_;
	gboolean _tmp32_;
	DcMessage* _tmp33_;
	GPtrArray* _tmp34_;
	DcMessage* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	gchar* _tmp38_;
	GPtrArray* _tmp39_;
	gint _tmp40_;
	gint _tmp41_;
	DcWindow* _tmp42_;
	GPtrArray* _tmp43_;
	gsize _tmp44_;
	gpointer* _tmp45_;
	gchar** _tmp46_;
	gint _tmp46__length1;
	GError* _inner_error0_;
};

static gpointer dc_pending_send_parent_class = NULL;
static gint DcConversationSignalHandler_private_offset;
static gpointer dc_conversation_signal_handler_parent_class = NULL;
static gint DcConversationView_private_offset;
static gpointer dc_conversation_view_parent_class = NULL;
VALA_EXTERN gchar* dc_message_row_self_display_name;

VALA_EXTERN GType dc_pending_send_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcPendingSend, g_object_unref)
VALA_EXTERN DcPendingSend* dc_pending_send_new (const gchar* text,
                                    const gchar* file_path,
                                    const gchar* file_name,
                                    gint quote_msg_id,
                                    gboolean voice,
                                    gboolean owns_file);
VALA_EXTERN DcPendingSend* dc_pending_send_construct (GType object_type,
                                          const gchar* text,
                                          const gchar* file_path,
                                          const gchar* file_name,
                                          gint quote_msg_id,
                                          gboolean voice,
                                          gboolean owns_file);
static void dc_pending_send_finalize (GObject * obj);
static GType dc_pending_send_get_type_once (void);
VALA_EXTERN GType dc_conversation_signal_handler_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcConversationSignalHandler, g_object_unref)
VALA_EXTERN DcConversationSignalHandler* dc_conversation_signal_handler_new (GObject* source,
                                                                 gulong handler_id);
VALA_EXTERN DcConversationSignalHandler* dc_conversation_signal_handler_construct (GType object_type,
                                                                       GObject* source,
                                                                       gulong handler_id);
VALA_EXTERN void dc_conversation_signal_handler_disconnect_handler (DcConversationSignalHandler* self);
static void dc_conversation_signal_handler_finalize (GObject * obj);
static GType dc_conversation_signal_handler_get_type_once (void);
VALA_EXTERN GType dc_conversation_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcConversationView, g_object_unref)
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
VALA_EXTERN GType dc_rpc_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcClient, g_object_unref)
VALA_EXTERN GType dc_settings_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsManager, g_object_unref)
VALA_EXTERN GType dc_link_preview_fetcher_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcLinkPreviewFetcher, g_object_unref)
VALA_EXTERN GType dc_chat_kind_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_compose_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcComposeBar, g_object_unref)
VALA_EXTERN GType dc_file_drop_target_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcFileDropTarget, g_object_unref)
VALA_EXTERN GType dc_conversation_media_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcConversationMediaBar, g_object_unref)
static GType dc_conversation_view_viewport_goal_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
VALA_EXTERN GType dc_pinned_messages_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcPinnedMessagesManager, g_object_unref)
VALA_EXTERN GType dc_webxdc_apps_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWebxdcAppsBar, g_object_unref)
VALA_EXTERN GType dc_message_actions_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageActions, g_object_unref)
VALA_EXTERN GType dc_mention_roster_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMentionRoster, g_object_unref)
static GType dc_conversation_view_draft_save_result_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void _g_object_unref0_ (gpointer var);
static inline void _g_queue_free__g_object_unref0_ (GQueue* self);
VALA_EXTERN DcConversationView* dc_conversation_view_new (gint chat_id,
                                              DcWindow* window,
                                              DcRpcClient* rpc,
                                              DcSettingsManager* settings,
                                              DcChatKind chat_kind);
VALA_EXTERN DcConversationView* dc_conversation_view_construct (GType object_type,
                                                    gint chat_id,
                                                    DcWindow* window,
                                                    DcRpcClient* rpc,
                                                    DcSettingsManager* settings,
                                                    DcChatKind chat_kind);
static Block35Data* block35_data_ref (Block35Data* _data35_);
static void block35_data_unref (void * _userdata_);
VALA_EXTERN GType dc_message_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessage, g_object_unref)
VALA_EXTERN DcPinnedMessagesManager* dc_pinned_messages_manager_new (GListStore* message_store,
                                                         DcSettingsManager* settings);
VALA_EXTERN DcPinnedMessagesManager* dc_pinned_messages_manager_construct (GType object_type,
                                                               GListStore* message_store,
                                                               DcSettingsManager* settings);
VALA_EXTERN void dc_pinned_messages_manager_set_rpc (DcPinnedMessagesManager* self,
                                         DcRpcClient* r);
static void dc_conversation_view_track_signal (DcConversationView* self,
                                        GObject* source,
                                        gulong handler_id);
static void __lambda120_ (DcConversationView* self,
                   gint mid);
VALA_EXTERN void dc_conversation_view_scroll_to_message (DcConversationView* self,
                                             gint msg_id);
static void ___lambda120__dc_pinned_messages_manager_scroll_requested (DcPinnedMessagesManager* _sender,
                                                                gint msg_id,
                                                                gpointer self);
static void __lambda122_ (Block35Data* _data35_,
                   const gchar* message);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
static void ___lambda122__dc_pinned_messages_manager_operation_failed (DcPinnedMessagesManager* _sender,
                                                                const gchar* message,
                                                                gpointer self);
VALA_EXTERN DcWebxdcAppsBar* dc_webxdc_apps_bar_new (void);
VALA_EXTERN DcWebxdcAppsBar* dc_webxdc_apps_bar_construct (GType object_type);
VALA_EXTERN void dc_webxdc_apps_bar_set_rpc (DcWebxdcAppsBar* self,
                                 DcRpcClient* r);
VALA_EXTERN void dc_webxdc_apps_bar_set_pinned (DcWebxdcAppsBar* self,
                                    DcPinnedMessagesManager* p);
static void __lambda123_ (DcConversationView* self,
                   gint mid);
static void ___lambda123__dc_webxdc_apps_bar_scroll_requested (DcWebxdcAppsBar* _sender,
                                                        gint msg_id,
                                                        gpointer self);
static void __lambda124_ (DcConversationView* self,
                   gint mid);
VALA_EXTERN void dc_message_actions_start_forwarding (DcMessageActions* self,
                                          gint msg_id);
static void ___lambda124__dc_webxdc_apps_bar_forward_requested (DcWebxdcAppsBar* _sender,
                                                         gint msg_id,
                                                         gpointer self);
static void __lambda125_ (DcConversationView* self,
                   gint mid);
static void dc_conversation_view_save_webxdc_from_bar (DcConversationView* self,
                                                gint msg_id,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_conversation_view_save_webxdc_from_bar_finish (DcConversationView* self,
                                                       GAsyncResult* _res_);
static void ___lambda125__dc_webxdc_apps_bar_save_requested (DcWebxdcAppsBar* _sender,
                                                      gint msg_id,
                                                      gpointer self);
VALA_EXTERN DcConversationMediaBar* dc_conversation_media_bar_new (void);
VALA_EXTERN DcConversationMediaBar* dc_conversation_media_bar_construct (GType object_type);
static void __lambda126_ (Block35Data* _data35_);
VALA_EXTERN void dc_window_navigate_voice_playback (DcWindow* self,
                                        gint direction);
static void ___lambda126__dc_conversation_media_bar_previous_requested (DcConversationMediaBar* _sender,
                                                                 gpointer self);
static void __lambda159_ (Block35Data* _data35_);
static void ___lambda159__dc_conversation_media_bar_next_requested (DcConversationMediaBar* _sender,
                                                             gpointer self);
static void __lambda160_ (Block35Data* _data35_,
                   gint acct_id,
                   gint origin_chat_id,
                   gint mid);
VALA_EXTERN void dc_window_open_media_message (DcWindow* self,
                                   gint acct_id,
                                   gint chat_id,
                                   gint msg_id,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void dc_window_open_media_message_finish (DcWindow* self,
                                          GAsyncResult* _res_);
static void ___lambda160__dc_conversation_media_bar_message_requested (DcConversationMediaBar* _sender,
                                                                gint account_id,
                                                                gint chat_id,
                                                                gint message_id,
                                                                gpointer self);
VALA_EXTERN GType dc_audio_playback_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlayback, g_object_unref)
VALA_EXTERN DcAudioPlayback* dc_audio_playback_shared (void);
static gulong dc_conversation_view_connect_playback_updates (DcAudioPlayback* playback,
                                                      DcConversationView* target);
static gulong dc_conversation_view_connect_playback_finished (DcAudioPlayback* playback,
                                                       DcConversationView* target);
static void dc_conversation_view_build_ui (DcConversationView* self);
VALA_EXTERN DcMessageActions* dc_message_actions_new (DcWindow* window,
                                          DcRpcClient* rpc,
                                          GListStore* message_store,
                                          DcPinnedMessagesManager* pinned,
                                          DcComposeBar* compose_bar,
                                          DcSettingsManager* settings);
VALA_EXTERN DcMessageActions* dc_message_actions_construct (GType object_type,
                                                DcWindow* window,
                                                DcRpcClient* rpc,
                                                GListStore* message_store,
                                                DcPinnedMessagesManager* pinned,
                                                DcComposeBar* compose_bar,
                                                DcSettingsManager* settings);
VALA_EXTERN void dc_message_actions_set_reaction_roster (DcMessageActions* self,
                                             DcMentionRoster* roster);
static void __lambda195_ (DcConversationView* self,
                   gint mid);
static void dc_conversation_view_begin_selection_mode (DcConversationView* self,
                                                gint initial_msg_id);
static void ___lambda195__dc_message_actions_select_requested (DcMessageActions* _sender,
                                                        gint msg_id,
                                                        gpointer self);
static void dc_conversation_view_track_tick_callback (DcConversationView* self,
                                               guint callback_id);
static void _vala_array_add33 (guint* * array,
                        gint* length,
                        gint* size,
                        guint value);
static gboolean dc_conversation_view_end_tick_callback (DcConversationView* self,
                                                 guint callback_id);
static void dc_conversation_view_forget_tick_callback (DcConversationView* self,
                                                guint callback_id);
static void _vala_array_add34 (guint* * array,
                        gint* length,
                        gint* size,
                        guint value);
static guint* _vala_array_dup14 (guint* self,
                          gssize length);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static void __lambda161_ (Block36Data* _data36_);
static void dc_conversation_view_update_conversation_media_bar (DcConversationView* self);
static void ___lambda161__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
static void __lambda162_ (Block37Data* _data37_,
                   gint mid);
VALA_EXTERN GType dc_audio_playback_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlaybackItem, g_object_unref)
VALA_EXTERN DcAudioPlaybackItem* dc_audio_playback_get_current_item (DcAudioPlayback* self);
VALA_EXTERN gint dc_audio_playback_item_get_account_id (DcAudioPlaybackItem* self);
VALA_EXTERN gint dc_rpc_client_get_account_id (DcRpcClient* self);
VALA_EXTERN gint dc_audio_playback_item_get_chat_id (DcAudioPlaybackItem* self);
VALA_EXTERN gint dc_conversation_view_get_chat_id (DcConversationView* self);
VALA_EXTERN gint dc_audio_playback_item_get_message_id (DcAudioPlaybackItem* self);
static void dc_conversation_view_queue_next_voice_message (DcConversationView* self,
                                                    gint current_msg_id);
static void ___lambda162__dc_audio_playback_finished (DcAudioPlayback* _sender,
                                               gint message_id,
                                               gpointer self);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
static void dc_conversation_view_on_scroll_bounds_changed (DcConversationView* self);
static void _dc_conversation_view_on_scroll_bounds_changed_g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self);
static void __lambda164_ (DcConversationView* self);
static void dc_conversation_view_update_date_pill (DcConversationView* self);
static gboolean dc_conversation_view_is_near_bottom (DcConversationView* self);
static gboolean dc_conversation_view_is_near_top (DcConversationView* self);
static void dc_conversation_view_load_earlier_messages (DcConversationView* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static void dc_conversation_view_load_earlier_messages_finish (DcConversationView* self,
                                                        GAsyncResult* _res_);
static void ___lambda164__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static gboolean __lambda165_ (DcConversationView* self,
                       gdouble dx,
                       gdouble dy);
static void dc_conversation_view_on_user_scroll_input (DcConversationView* self);
static gboolean ___lambda165__gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                           gdouble dx,
                                                           gdouble dy,
                                                           gpointer self);
static void __lambda166_ (DcConversationView* self,
                   gint n,
                   gdouble x,
                   gdouble y);
static void ___lambda166__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static GtkCustomFilter* dc_conversation_view_create_message_filter (DcConversationView* target);
static void __lambda168_ (DcConversationView* self,
                   GObject* obj);
static GPtrArray* dc_conversation_view_collect_trailing_irc_images (DcConversationView* self,
                                                             DcMessage* msg,
                                                             DcMessage* prev,
                                                             guint pos,
                                                             gboolean* is_continuation);
VALA_EXTERN gboolean dc_message_row_same_day (gint64 ts1,
                                  gint64 ts2);
VALA_EXTERN gint64 dc_message_get_timestamp (DcMessage* self);
VALA_EXTERN GtkWidget* dc_message_row_build_date_separator (gint64 ts);
static gboolean dc_conversation_view_search_filter_active (DcConversationView* self);
VALA_EXTERN GType dc_message_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageRow, g_object_unref)
VALA_EXTERN GType dc_bubble_avatar_display_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcBubbleAvatarDisplay dc_settings_manager_get_bubble_avatar_display (DcSettingsManager* self);
static gboolean dc_conversation_view_bubble_avatars_apply_to_this_chat (DcConversationView* self);
VALA_EXTERN DcMessageRow* dc_message_row_new (DcMessage* msg,
                                  DcMessage* prev,
                                  GPtrArray* trailing_images,
                                  gboolean is_image_continuation,
                                  DcBubbleAvatarDisplay avatar_display,
                                  gboolean avatar_scope_enabled,
                                  gboolean show_sender_name,
                                  DcMentionRoster* mention_roster,
                                  DcMentionRoster* reaction_roster,
                                  gint account_id);
VALA_EXTERN DcMessageRow* dc_message_row_construct (GType object_type,
                                        DcMessage* msg,
                                        DcMessage* prev,
                                        GPtrArray* trailing_images,
                                        gboolean is_image_continuation,
                                        DcBubbleAvatarDisplay avatar_display,
                                        gboolean avatar_scope_enabled,
                                        gboolean show_sender_name,
                                        DcMentionRoster* mention_roster,
                                        DcMentionRoster* reaction_roster,
                                        gint account_id);
static void dc_conversation_view_on_row_selection_toggled (DcMessageRow* row,
                                                    gint msg_id,
                                                    gboolean active,
                                                    DcConversationView* view);
static void dc_conversation_view_on_row_quote_clicked (DcMessageRow* row,
                                                gint quote_id,
                                                DcConversationView* view);
static void dc_conversation_view_on_message_row_action_requested (DcMessageRow* row,
                                                           const gchar* action,
                                                           GtkWidget* anchor,
                                                           DcConversationView* view);
static void dc_conversation_view_on_row_full_message_requested (DcMessageRow* row,
                                                         gint msg_id,
                                                         DcConversationView* view);
static void dc_conversation_view_on_row_full_message_view_requested (DcMessageRow* row,
                                                              gint msg_id,
                                                              DcConversationView* view);
static void dc_conversation_view_on_row_checkbox_toggle_requested (DcMessageRow* row,
                                                            gint msg_id,
                                                            const gchar* new_text,
                                                            DcConversationView* view);
VALA_EXTERN gboolean dc_message_get_highlighted (DcMessage* self);
VALA_EXTERN void dc_message_set_highlighted (DcMessage* self,
                                 gboolean value);
VALA_EXTERN void dc_message_row_highlight (DcMessageRow* self);
static void ___lambda168__gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                      GObject* object,
                                                      gpointer self);
static void dc_conversation_view_unbind_message_list_item (GObject* obj);
static void _dc_conversation_view_unbind_message_list_item_gtk_signal_list_item_factory_unbind (GtkSignalListItemFactory* _sender,
                                                                                         GObject* object,
                                                                                         gpointer self);
VALA_EXTERN GType dc_message_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcMessageStyle dc_settings_manager_get_message_style (DcSettingsManager* self);
static void __lambda173_ (DcConversationView* self,
                   gint n,
                   gdouble x,
                   gdouble y);
static DcMessageRow* dc_conversation_view_pick_message_row (DcConversationView* self,
                                                     gdouble x,
                                                     gdouble y);
VALA_EXTERN void dc_message_actions_show_context_menu (DcMessageActions* self,
                                           gint msg_id,
                                           gboolean is_outgoing,
                                           gdouble x,
                                           gdouble y,
                                           GtkWidget* parent);
VALA_EXTERN gint dc_message_row_get_message_id (DcMessageRow* self);
VALA_EXTERN gboolean dc_message_row_get_is_outgoing (DcMessageRow* self);
static void ___lambda173__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static void __lambda174_ (Block38Data* _data38_,
                   gint n,
                   gdouble x,
                   gdouble y);
static gboolean dc_conversation_view_pointer_on_css (DcConversationView* self,
                                              gdouble x,
                                              gdouble y,
                                              gchar** classes,
                                              gint classes_length1);
static gboolean dc_conversation_view_pointer_on_selectable_text (DcConversationView* self,
                                                          gdouble x,
                                                          gdouble y);
VALA_EXTERN gboolean dc_message_row_has_selectable_text (DcMessageRow* self);
static gboolean dc_conversation_view_pointer_on_message_bubble (DcConversationView* self,
                                                         gdouble x,
                                                         gdouble y);
VALA_EXTERN gboolean dc_message_row_select_all_text (DcMessageRow* self);
static gboolean dc_conversation_view_pointer_on_audio (DcConversationView* self,
                                                gdouble x,
                                                gdouble y);
static void dc_conversation_view_hold_scroll_on_focus_shift (DcConversationView* self);
VALA_EXTERN void dc_message_actions_handle_double_click (DcMessageActions* self,
                                             gint msg_id,
                                             gboolean is_outgoing,
                                             gdouble x,
                                             gdouble y,
                                             GtkWidget* parent);
VALA_EXTERN DcMessage* dc_find_message (GListModel* store,
                            gint msg_id);
static gboolean dc_conversation_view_should_activate_message_at_pointer (DcConversationView* self,
                                                                  DcMessage* msg,
                                                                  gboolean pointer_on_media);
static void dc_conversation_view_on_message_activated (DcConversationView* self,
                                                DcMessage* msg);
static void ___lambda174__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static void __lambda183_ (DcConversationView* self);
static void ___lambda183__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                    gpointer self);
VALA_EXTERN GtkRevealer* dc_pinned_messages_manager_get_revealer (DcPinnedMessagesManager* self);
VALA_EXTERN GtkRevealer* dc_webxdc_apps_bar_get_revealer (DcWebxdcAppsBar* self);
static void __lambda184_ (DcConversationView* self);
VALA_EXTERN void dc_conversation_view_scroll_to_bottom (DcConversationView* self);
static void ___lambda184__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN DcComposeBar* dc_compose_bar_new (void);
VALA_EXTERN DcComposeBar* dc_compose_bar_construct (GType object_type);
static void dc_conversation_view_on_link_previews_requested (DcConversationView* self,
                                                      gchar** urls,
                                                      gint urls_length1,
                                                      guint generation);
static void _dc_conversation_view_on_link_previews_requested_dc_compose_bar_link_previews_requested (DcComposeBar* _sender,
                                                                                              gchar** urls,
                                                                                              gint urls_length1,
                                                                                              guint generation,
                                                                                              gpointer self);
static void dc_conversation_view_on_send_message (DcConversationView* self,
                                           const gchar* text,
                                           const gchar* file_path,
                                           const gchar* file_name,
                                           gint quote_msg_id);
static void _dc_conversation_view_on_send_message_dc_compose_bar_send_message (DcComposeBar* _sender,
                                                                        const gchar* text,
                                                                        const gchar* file_path,
                                                                        const gchar* file_name,
                                                                        gint quote_msg_id,
                                                                        gpointer self);
static void dc_conversation_view_on_send_voice_message (DcConversationView* self,
                                                 const gchar* file_path,
                                                 const gchar* text,
                                                 gint quote_msg_id,
                                                 gboolean temporary);
static void _dc_conversation_view_on_send_voice_message_dc_compose_bar_send_voice_message (DcComposeBar* _sender,
                                                                                    const gchar* file_path,
                                                                                    const gchar* text,
                                                                                    gint quote_msg_id,
                                                                                    gboolean temporary,
                                                                                    gpointer self);
static void dc_conversation_view_on_draft_changed (DcConversationView* self,
                                            const gchar* text,
                                            const gchar* file_path,
                                            const gchar* file_name,
                                            gint quote_msg_id,
                                            gboolean voice);
static void _dc_conversation_view_on_draft_changed_dc_compose_bar_draft_changed (DcComposeBar* _sender,
                                                                          const gchar* text,
                                                                          const gchar* file_path,
                                                                          const gchar* file_name,
                                                                          gint quote_msg_id,
                                                                          gboolean voice,
                                                                          gpointer self);
static void __lambda187_ (DcConversationView* self,
                   gint msg_id,
                   const gchar* new_text);
VALA_EXTERN void dc_message_actions_edit_message (DcMessageActions* self,
                                      gint msg_id,
                                      const gchar* new_text,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN void dc_message_actions_edit_message_finish (DcMessageActions* self,
                                             GAsyncResult* _res_);
static void ___lambda187__dc_compose_bar_edit_message (DcComposeBar* _sender,
                                                gint msg_id,
                                                const gchar* new_text,
                                                gpointer self);
static void __lambda188_ (DcConversationView* self);
VALA_EXTERN void dc_message_actions_start_editing_last (DcMessageActions* self);
static void ___lambda188__dc_compose_bar_edit_last_requested (DcComposeBar* _sender,
                                                       gpointer self);
static GtkBox* dc_conversation_view_build_selection_bar (DcConversationView* self);
static GtkBox* dc_conversation_view_build_request_bar (DcConversationView* self);
static void dc_conversation_view_install_file_drop_target (DcConversationView* self);
static void dc_conversation_view_on_row_action (DcConversationView* self,
                                         gint msg_id,
                                         gboolean is_outgoing,
                                         const gchar* action,
                                         GtkWidget* anchor);
static void dc_conversation_view_update_selection_actions (DcConversationView* self);
static void dc_conversation_view_toggle_full_message (DcConversationView* self,
                                               gint msg_id,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static void dc_conversation_view_toggle_full_message_finish (DcConversationView* self,
                                                      GAsyncResult* _res_);
static void dc_conversation_view_view_full_message (DcConversationView* self,
                                             gint msg_id,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void dc_conversation_view_view_full_message_finish (DcConversationView* self,
                                                    GAsyncResult* _res_);
static Block39Data* block39_data_ref (Block39Data* _data39_);
static void block39_data_unref (void * _userdata_);
static gboolean __lambda167_ (Block39Data* _data39_,
                       GObject* item);
static gboolean dc_conversation_view_filter_message (DcConversationView* self,
                                              GObject* item);
static gboolean ___lambda167__gtk_custom_filter_func (GObject* item,
                                               gpointer self);
VALA_EXTERN const gchar* dc_message_get_text (DcMessage* self);
static Block40Data* block40_data_ref (Block40Data* _data40_);
static void block40_data_unref (void * _userdata_);
static DcMessage* dc_conversation_view_find_adjacent_voice_message (DcConversationView* self,
                                                             gint current_msg_id,
                                                             gint direction);
static gboolean __lambda163_ (Block40Data* _data40_);
VALA_EXTERN gboolean dc_audio_playback_get_playing (DcAudioPlayback* self);
VALA_EXTERN void dc_audio_playback_play_message (DcAudioPlayback* self,
                                     DcMessage* msg,
                                     gint account_id);
static gboolean ___lambda163__gsource_func (gpointer self);
VALA_EXTERN gint dc_find_message_index (GListModel* store,
                            gint msg_id);
VALA_EXTERN gboolean dc_message_get_has_local_file (DcMessage* self);
VALA_EXTERN gboolean dc_message_is_audio_file (DcMessage* self);
static void dc_conversation_view_play_adjacent_voice_message_data_free (gpointer _data);
VALA_EXTERN void dc_conversation_view_play_adjacent_voice_message (DcConversationView* self,
                                                       gint direction,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
VALA_EXTERN void dc_conversation_view_play_adjacent_voice_message_finish (DcConversationView* self,
                                                              GAsyncResult* _res_);
static gboolean dc_conversation_view_play_adjacent_voice_message_co (DcConversationViewPlayAdjacentVoiceMessageData* _data_);
static DcMessageRow* dc_conversation_view_find_message_row (DcConversationView* self,
                                                     GtkWidget* widget,
                                                     gint message_id,
                                                     gdouble* top);
static void dc_conversation_view_set_loading_more_visible (DcConversationView* self,
                                                    gboolean visible);
static void dc_conversation_view_fetch_messages_batch (DcConversationView* self,
                                                guint start,
                                                guint end,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static GPtrArray* dc_conversation_view_fetch_messages_batch_finish (DcConversationView* self,
                                                             GAsyncResult* _res_,
                                                             GError** error);
static void dc_conversation_view_play_adjacent_voice_message_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
static GObject** dc_conversation_view_pinned_message_batch (DcConversationView* self,
                                                     GPtrArray* messages,
                                                     gint* result_length1);
VALA_EXTERN void dc_conversation_view_flush_pending_seen (DcConversationView* self);
static void dc_conversation_view_anchor_message (DcConversationView* self,
                                          gint msg_id,
                                          guint position,
                                          gdouble wanted_top,
                                          guint min_frames);
static void dc_conversation_view_finish_loading_earlier (DcConversationView* self,
                                                  gboolean resume_pending);
VALA_EXTERN void dc_audio_playback_set_navigation (DcAudioPlayback* self,
                                       gboolean previous,
                                       gboolean next);
VALA_EXTERN void dc_message_actions_show_reaction_menu (DcMessageActions* self,
                                            gint msg_id,
                                            GtkWidget* parent,
                                            gdouble x,
                                            gdouble y);
VALA_EXTERN void dc_message_actions_start_replying (DcMessageActions* self,
                                        gint msg_id);
VALA_EXTERN void dc_pinned_messages_manager_toggle_pin (DcPinnedMessagesManager* self,
                                            gint msg_id,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN void dc_pinned_messages_manager_toggle_pin_finish (DcPinnedMessagesManager* self,
                                                   GAsyncResult* _res_);
VALA_EXTERN void dc_window_prompt_webxdc_app (DcWindow* self,
                                  GtkWidget* parent,
                                  DcRpcClient* app_rpc,
                                  DcMessage* msg,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN void dc_window_prompt_webxdc_app_finish (DcWindow* self,
                                         GAsyncResult* _res_);
static void dc_conversation_view_maybe_autoscroll (DcConversationView* self);
VALA_EXTERN gboolean dc_message_get_is_image_only (DcMessage* self);
VALA_EXTERN gboolean dc_message_row_same_sender (DcMessage* a,
                                     DcMessage* b);
static void __lambda189_ (DcConversationView* self);
static void dc_conversation_view_delete_selected_messages (DcConversationView* self,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static void dc_conversation_view_delete_selected_messages_finish (DcConversationView* self,
                                                           GAsyncResult* _res_);
static void ___lambda189__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda190_ (DcConversationView* self);
static void dc_conversation_view_forward_selected_messages (DcConversationView* self);
static void ___lambda190__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda191_ (DcConversationView* self);
static void dc_conversation_view_end_selection_mode (DcConversationView* self);
static void ___lambda191__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda192_ (DcConversationView* self);
static void dc_conversation_view_block_request (DcConversationView* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dc_conversation_view_block_request_finish (DcConversationView* self,
                                                GAsyncResult* _res_);
static void ___lambda192__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda193_ (DcConversationView* self);
static void dc_conversation_view_accept_request (DcConversationView* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_conversation_view_accept_request_finish (DcConversationView* self,
                                                 GAsyncResult* _res_);
static void ___lambda193__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN void dc_conversation_view_set_contact_request (DcConversationView* self,
                                               gboolean is_request);
static void dc_conversation_view_sync_bottom_bars (DcConversationView* self);
VALA_EXTERN void dc_message_set_selection_visible (DcMessage* self,
                                       gboolean value);
VALA_EXTERN gint dc_message_get_id (DcMessage* self);
VALA_EXTERN void dc_message_set_selected (DcMessage* self,
                              gboolean value);
static gint dc_conversation_view_selected_message_count (DcConversationView* self);
VALA_EXTERN gboolean dc_message_get_selected (DcMessage* self);
static gint* dc_conversation_view_selected_message_ids (DcConversationView* self,
                                                 gint* result_length1);
static void _vala_array_add35 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
static gboolean dc_conversation_view_selected_messages_all_outgoing (DcConversationView* self);
VALA_EXTERN gboolean dc_message_get_is_outgoing (DcMessage* self);
VALA_EXTERN void dc_message_actions_start_forwarding_many (DcMessageActions* self,
                                               gint* msg_ids,
                                               gint msg_ids_length1);
static void dc_conversation_view_delete_selected_messages_data_free (gpointer _data);
static gboolean dc_conversation_view_delete_selected_messages_co (DcConversationViewDeleteSelectedMessagesData* _data_);
VALA_EXTERN GType dc_delete_choice_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void dc_confirm_delete_options (GtkWidget* parent,
                                const gchar* title,
                                const gchar* body,
                                gboolean allow_delete_for_everyone,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN DcDeleteChoice dc_confirm_delete_options_finish (GAsyncResult* _res_);
static void dc_conversation_view_delete_selected_messages_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
static void dc_conversation_view_delete_selected_messages_confirmed (DcConversationView* self,
                                                              gint* ids,
                                                              gint ids_length1,
                                                              gboolean for_all,
                                                              GAsyncReadyCallback _callback_,
                                                              gpointer _user_data_);
static void dc_conversation_view_delete_selected_messages_confirmed_finish (DcConversationView* self,
                                                                     GAsyncResult* _res_);
static void dc_conversation_view_delete_selected_messages_confirmed_data_free (gpointer _data);
static gboolean dc_conversation_view_delete_selected_messages_confirmed_co (DcConversationViewDeleteSelectedMessagesConfirmedData* _data_);
VALA_EXTERN void dc_rpc_client_delete_messages_for_all (DcRpcClient* self,
                                            gint* msg_ids,
                                            gint msg_ids_length1,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages_for_all_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static void dc_conversation_view_delete_selected_messages_confirmed_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages (DcRpcClient* self,
                                    gint* msg_ids,
                                    gint msg_ids_length1,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static gboolean dc_conversation_view_int_array_contains (gint* ids,
                                                  gint ids_length1,
                                                  gint needle);
VALA_EXTERN gint dc_audio_playback_get_current_message_id (DcAudioPlayback* self);
VALA_EXTERN void dc_audio_playback_stop (DcAudioPlayback* self);
VALA_EXTERN void dc_conversation_view_set_chat_kind (DcConversationView* self,
                                         DcChatKind kind);
static void dc_conversation_view_accept_request_data_free (gpointer _data);
static gboolean dc_conversation_view_accept_request_co (DcConversationViewAcceptRequestData* _data_);
VALA_EXTERN void dc_rpc_client_accept_chat (DcRpcClient* self,
                                gint chat_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_accept_chat_finish (DcRpcClient* self,
                                       GAsyncResult* _res_,
                                       GError** error);
static void dc_conversation_view_accept_request_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
VALA_EXTERN void dc_compose_bar_grab_entry_focus (DcComposeBar* self);
VALA_EXTERN void dc_window_request_reload_chats (DcWindow* self);
static void dc_conversation_view_block_request_data_free (gpointer _data);
static gboolean dc_conversation_view_block_request_co (DcConversationViewBlockRequestData* _data_);
VALA_EXTERN void dc_rpc_client_block_chat (DcRpcClient* self,
                               gint chat_id,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_block_chat_finish (DcRpcClient* self,
                                      GAsyncResult* _res_,
                                      GError** error);
static void dc_conversation_view_block_request_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
VALA_EXTERN gint dc_window_get_current_chat_id (DcWindow* self);
VALA_EXTERN void dc_window_clear_chat_view (DcWindow* self);
VALA_EXTERN void dc_conversation_view_on_activated (DcConversationView* self,
                                        gboolean focus_compose);
static void dc_conversation_view_load_messages (DcConversationView* self,
                                         gboolean preserve_scroll,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dc_conversation_view_load_messages_finish (DcConversationView* self,
                                                GAsyncResult* _res_);
VALA_EXTERN void dc_conversation_view_reload_messages (DcConversationView* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN void dc_conversation_view_reload_messages_finish (DcConversationView* self,
                                                  GAsyncResult* _res_);
static void dc_conversation_view_load_draft (DcConversationView* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static void dc_conversation_view_load_draft_finish (DcConversationView* self,
                                             GAsyncResult* _res_);
VALA_EXTERN void dc_conversation_view_on_reselected (DcConversationView* self,
                                         gboolean focus_compose);
VALA_EXTERN void dc_conversation_view_attach_dropped_file_path (DcConversationView* self,
                                                    const gchar* path);
static void dc_conversation_view_attach_local_file (DcConversationView* self,
                                             const gchar* path,
                                             const gchar* name);
VALA_EXTERN void dc_conversation_view_attach_dropped_file (DcConversationView* self,
                                               const gchar* path,
                                               const gchar* name);
VALA_EXTERN gboolean dc_conversation_view_can_accept_dropped_file (DcConversationView* self);
static gboolean dc_conversation_view_can_accept_file_attachment (DcConversationView* self);
VALA_EXTERN void dc_conversation_view_focus_entry (DcConversationView* self);
VALA_EXTERN gboolean dc_conversation_view_has_active_compose_mode (DcConversationView* self);
VALA_EXTERN gboolean dc_compose_bar_has_active_mode (DcComposeBar* self);
VALA_EXTERN gboolean dc_conversation_view_compose_entry_has_focus (DcConversationView* self);
VALA_EXTERN gboolean dc_compose_bar_entry_has_focus (DcComposeBar* self);
VALA_EXTERN void dc_conversation_view_cancel_active_compose_mode (DcConversationView* self);
VALA_EXTERN void dc_compose_bar_cancel_active_mode (DcComposeBar* self);
VALA_EXTERN void dc_conversation_view_type_into_entry (DcConversationView* self,
                                           const gchar* text);
VALA_EXTERN void dc_compose_bar_type_text (DcComposeBar* self,
                               const gchar* text);
static void dc_conversation_view_reload_messages_data_free (gpointer _data);
static gboolean dc_conversation_view_reload_messages_co (DcConversationViewReloadMessagesData* _data_);
static void dc_conversation_view_reload_messages_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN void dc_conversation_view_mark_messages_stale (DcConversationView* self);
static void dc_conversation_view_handle_incoming_msg_data_free (gpointer _data);
VALA_EXTERN void dc_conversation_view_handle_incoming_msg (DcConversationView* self,
                                               gint msg_id,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
VALA_EXTERN gboolean dc_conversation_view_handle_incoming_msg_finish (DcConversationView* self,
                                                          GAsyncResult* _res_);
static gboolean dc_conversation_view_handle_incoming_msg_co (DcConversationViewHandleIncomingMsgData* _data_);
VALA_EXTERN gboolean dc_window_is_chat_visible (DcWindow* self,
                                    gint chat_id);
VALA_EXTERN void dc_rpc_client_mark_seen_msgs (DcRpcClient* self,
                                   gint* msg_ids,
                                   gint msg_ids_length1,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_mark_seen_msgs_finish (DcRpcClient* self,
                                          GAsyncResult* _res_,
                                          GError** error);
static void dc_conversation_view_handle_incoming_msg_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
static void dc_conversation_view_queue_pending_seen (DcConversationView* self,
                                              gint msg_id);
VALA_EXTERN void dc_rpc_client_fetch_message (DcRpcClient* self,
                                  gint msg_id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_client_fetch_message_finish (DcRpcClient* self,
                                               GAsyncResult* _res_,
                                               GError** error);
static void dc_conversation_view_insert_message_sorted (DcConversationView* self,
                                                 DcMessage* msg);
static gboolean dc_conversation_view_should_mark_message_seen (DcMessage* msg);
static gint* dc_conversation_view_loaded_incoming_message_ids (DcConversationView* self,
                                                        gint* result_length1);
static void _vala_array_add36 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
static void dc_conversation_view_send_seen_ids (DcConversationView* self,
                                         gint* ids,
                                         gint ids_length1);
static void _vala_array_add37 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
VALA_EXTERN gboolean dc_message_get_is_info (DcMessage* self);
static void _vala_array_add38 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
static void __lambda83_ (DcConversationView* self,
                  GObject* o,
                  GAsyncResult* res);
static void ___lambda83__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
VALA_EXTERN void dc_conversation_view_toggle_search (DcConversationView* self);
static Block41Data* block41_data_ref (Block41Data* _data41_);
static void block41_data_unref (void * _userdata_);
static gboolean __lambda196_ (Block41Data* _data41_);
static gboolean ___lambda196__gsource_func (gpointer self);
VALA_EXTERN void dc_conversation_view_replace_message (DcConversationView* self,
                                           gint msg_id,
                                           DcMessage* new_msg);
static Block42Data* block42_data_ref (Block42Data* _data42_);
static void block42_data_unref (void * _userdata_);
VALA_EXTERN gboolean dc_message_get_selection_visible (DcMessage* self);
static void dc_conversation_view_preserve_full_message_state (DcMessage* old_msg,
                                                       DcMessage* new_msg);
VALA_EXTERN void dc_conversation_view_freeze_scroll_handler (DcConversationView* self,
                                                 guint ms);
static gboolean __lambda76_ (Block42Data* _data42_,
                      GtkWidget* w,
                      GdkFrameClock* clock);
static gdouble dc_conversation_view_max_scroll_value (DcConversationView* self);
VALA_EXTERN void dc_conversation_view_restore_scroll_value (DcConversationView* self,
                                                gdouble v);
static gboolean ___lambda76__gtk_tick_callback (GtkWidget* widget,
                                         GdkFrameClock* frame_clock,
                                         gpointer self);
static void dc_conversation_view_refresh_message_row (DcConversationView* self,
                                               gint msg_id);
VALA_EXTERN DcMessage* dc_message_dup (DcMessage* self);
static void dc_conversation_view_toggle_full_message_data_free (gpointer _data);
static gboolean dc_conversation_view_toggle_full_message_co (DcConversationViewToggleFullMessageData* _data_);
VALA_EXTERN gboolean dc_message_get_full_message_expanded (DcMessage* self);
VALA_EXTERN void dc_message_set_full_message_expanded (DcMessage* self,
                                           gboolean value);
VALA_EXTERN gboolean dc_message_get_can_download_full_message (DcMessage* self);
VALA_EXTERN void dc_rpc_client_download_full_message (DcRpcClient* self,
                                          gint msg_id,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_download_full_message_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void dc_conversation_view_toggle_full_message_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
VALA_EXTERN const gchar* dc_message_get_full_message_text (DcMessage* self);
static void dc_conversation_view_set_full_message_loading (DcConversationView* self,
                                                    DcMessage* msg,
                                                    gboolean loading);
static void dc_conversation_view_fetch_full_message_text (DcConversationView* self,
                                                   gint msg_id,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static gchar* dc_conversation_view_fetch_full_message_text_finish (DcConversationView* self,
                                                            GAsyncResult* _res_,
                                                            GError** error);
VALA_EXTERN void dc_message_set_full_message_loading (DcMessage* self,
                                          gboolean value);
VALA_EXTERN void dc_message_set_full_message_text (DcMessage* self,
                                       const gchar* value);
static void dc_conversation_view_clear_full_message_loading (DcConversationView* self,
                                                      gint msg_id);
static void dc_conversation_view_view_full_message_data_free (gpointer _data);
static gboolean dc_conversation_view_view_full_message_co (DcConversationViewViewFullMessageData* _data_);
static void dc_conversation_view_view_full_message_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static void dc_conversation_view_show_full_message_text (DcConversationView* self,
                                                  gint msg_id,
                                                  const gchar* full_text);
static void dc_conversation_view_fetch_full_message_text_data_free (gpointer _data);
static gboolean dc_conversation_view_fetch_full_message_text_co (DcConversationViewFetchFullMessageTextData* _data_);
VALA_EXTERN gboolean dc_message_get_has_html (DcMessage* self);
VALA_EXTERN void dc_rpc_client_get_message_html (DcRpcClient* self,
                                     gint msg_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_client_get_message_html_finish (DcRpcClient* self,
                                              GAsyncResult* _res_,
                                              GError** error);
static void dc_conversation_view_fetch_full_message_text_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_);
static gchar* dc_conversation_view_html_to_text (const gchar* html);
VALA_EXTERN gboolean dc_message_get_full_message_loading (DcMessage* self);
static gchar* dc_conversation_view_decode_basic_html_entities (const gchar* text);
VALA_EXTERN GType dc_full_message_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcFullMessageDialog, g_object_unref)
VALA_EXTERN gint dc_settings_manager_effective_font_size (DcSettingsManager* self);
VALA_EXTERN DcFullMessageDialog* dc_full_message_dialog_new (DcWindow* window,
                                                 DcRpcClient* rpc,
                                                 DcMessageActions* actions,
                                                 DcMessage* msg,
                                                 const gchar* full_text,
                                                 gint initial_font_size);
VALA_EXTERN DcFullMessageDialog* dc_full_message_dialog_construct (GType object_type,
                                                       DcWindow* window,
                                                       DcRpcClient* rpc,
                                                       DcMessageActions* actions,
                                                       DcMessage* msg,
                                                       const gchar* full_text,
                                                       gint initial_font_size);
VALA_EXTERN gdouble dc_conversation_view_get_scroll_value (DcConversationView* self);
VALA_EXTERN void dc_conversation_view_restore_scroll_value_deferred (DcConversationView* self,
                                                         gdouble v);
static Block43Data* block43_data_ref (Block43Data* _data43_);
static void block43_data_unref (void * _userdata_);
static gboolean __lambda78_ (Block43Data* _data43_,
                      GtkWidget* w,
                      GdkFrameClock* clock);
static gboolean ___lambda78__gtk_tick_callback (GtkWidget* widget,
                                         GdkFrameClock* frame_clock,
                                         gpointer self);
VALA_EXTERN gboolean dc_conversation_view_close_search_if_active (DcConversationView* self);
static Block44Data* block44_data_ref (Block44Data* _data44_);
static void block44_data_unref (void * _userdata_);
static gboolean ___lambda121_ (Block44Data* _data44_);
static gboolean ____lambda121__gsource_func (gpointer self);
static gboolean dc_conversation_view_scroll_to_loaded_message (DcConversationView* self,
                                                        gint msg_id);
static void dc_conversation_view_resume_pending_voice_navigation (DcConversationView* self);
static void dc_conversation_view_load_until_pending_message (DcConversationView* self,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static void dc_conversation_view_load_until_pending_message_finish (DcConversationView* self,
                                                             GAsyncResult* _res_);
VALA_EXTERN void dc_conversation_view_request_voice_navigation (DcConversationView* self,
                                                    gint direction);
static Block45Data* block45_data_ref (Block45Data* _data45_);
static void block45_data_unref (void * _userdata_);
static gboolean __lambda85_ (Block45Data* _data45_,
                      GtkWidget* w,
                      GdkFrameClock* clock);
static gboolean ___lambda85__gtk_tick_callback (GtkWidget* widget,
                                         GdkFrameClock* frame_clock,
                                         gpointer self);
static void dc_conversation_view_load_messages_data_free (gpointer _data);
static gboolean dc_conversation_view_load_messages_co (DcConversationViewLoadMessagesData* _data_);
static Block46Data* block46_data_ref (Block46Data* _data46_);
static void block46_data_unref (void * _userdata_);
static void dc_conversation_view_load_chat_kind_if_needed (DcConversationView* self,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static void dc_conversation_view_load_chat_kind_if_needed_finish (DcConversationView* self,
                                                           GAsyncResult* _res_);
static void dc_conversation_view_load_messages_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void dc_conversation_view_ensure_mention_roster (DcConversationView* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static void dc_conversation_view_ensure_mention_roster_finish (DcConversationView* self,
                                                        GAsyncResult* _res_);
VALA_EXTERN void dc_rpc_client_get_message_ids_for (DcRpcClient* self,
                                        gint acct_id,
                                        gint chat_id,
                                        gboolean info_only,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN JsonArray* dc_rpc_client_get_message_ids_for_finish (DcRpcClient* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
VALA_EXTERN void dc_pinned_messages_manager_load_for_chat (DcPinnedMessagesManager* self,
                                               gint chat_id,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
VALA_EXTERN void dc_pinned_messages_manager_load_for_chat_finish (DcPinnedMessagesManager* self,
                                                      GAsyncResult* _res_);
VALA_EXTERN void dc_webxdc_apps_bar_load_for_chat (DcWebxdcAppsBar* self,
                                       gint chat_id,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
VALA_EXTERN void dc_webxdc_apps_bar_load_for_chat_finish (DcWebxdcAppsBar* self,
                                              GAsyncResult* _res_);
static gboolean _____lambda84_ (Block46Data* _data46_);
static gboolean ______lambda84__gsource_func (gpointer self);
VALA_EXTERN void dc_pinned_messages_manager_update_bar (DcPinnedMessagesManager* self,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN void dc_pinned_messages_manager_update_bar_finish (DcPinnedMessagesManager* self,
                                                   GAsyncResult* _res_);
static void dc_conversation_view_resume_pending_message_scroll (DcConversationView* self);
static void dc_conversation_view_ensure_mention_roster_data_free (gpointer _data);
static gboolean dc_conversation_view_ensure_mention_roster_co (DcConversationViewEnsureMentionRosterData* _data_);
VALA_EXTERN DcMentionRoster* dc_mention_roster_new (void);
VALA_EXTERN DcMentionRoster* dc_mention_roster_construct (GType object_type);
VALA_EXTERN gchar** dc_window_self_mention_keys (DcWindow* self,
                                     gint* result_length1);
VALA_EXTERN void dc_mention_roster_add_self_key (DcMentionRoster* self,
                                     const gchar* key);
VALA_EXTERN void dc_rpc_client_get_full_chat_by_id_for (DcRpcClient* self,
                                            gint acct_id,
                                            gint chat_id,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_full_chat_by_id_for_finish (DcRpcClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error);
static void dc_conversation_view_ensure_mention_roster_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_get_contact_for (DcRpcClient* self,
                                    gint acct_id,
                                    gint contact_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_contact_for_finish (DcRpcClient* self,
                                                  GAsyncResult* _res_,
                                                  GError** error);
VALA_EXTERN GType dc_contact_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcContact, g_object_unref)
VALA_EXTERN DcContact* dc_rpc_parsers_parse_contact (gint contact_id,
                                         JsonObject* obj);
VALA_EXTERN const gchar* dc_contact_get_display_name (DcContact* self);
VALA_EXTERN GType dc_mention_member_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMentionMember, g_object_unref)
VALA_EXTERN void dc_mention_roster_add_member (DcMentionRoster* self,
                                   DcMentionMember* m);
VALA_EXTERN const gchar* dc_contact_get_address (DcContact* self);
VALA_EXTERN const gchar* dc_contact_get_profile_image (DcContact* self);
VALA_EXTERN DcMentionMember* dc_mention_member_new (gint contact_id,
                                        const gchar* display_name,
                                        const gchar* address,
                                        gboolean is_self,
                                        const gchar* avatar_path);
VALA_EXTERN DcMentionMember* dc_mention_member_construct (GType object_type,
                                              gint contact_id,
                                              const gchar* display_name,
                                              const gchar* address,
                                              gboolean is_self,
                                              const gchar* avatar_path);
VALA_EXTERN void dc_compose_bar_set_mention_roster (DcComposeBar* self,
                                        DcMentionRoster* roster);
VALA_EXTERN void dc_conversation_view_invalidate_mention_roster (DcConversationView* self);
static void dc_conversation_view_load_chat_kind_if_needed_data_free (gpointer _data);
static gboolean dc_conversation_view_load_chat_kind_if_needed_co (DcConversationViewLoadChatKindIfNeededData* _data_);
static void dc_conversation_view_load_chat_kind_if_needed_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
VALA_EXTERN DcChatKind dc_rpc_parsers_parse_chat_kind (JsonObject* obj);
VALA_EXTERN gboolean dc_settings_manager_get_bubble_avatars_in_direct_chats (DcSettingsManager* self);
static void dc_conversation_view_fetch_messages_batch_data_free (gpointer _data);
static gboolean dc_conversation_view_fetch_messages_batch_co (DcConversationViewFetchMessagesBatchData* _data_);
VALA_EXTERN void dc_rpc_client_get_messages_for (DcRpcClient* self,
                                     gint acct_id,
                                     gint* msg_ids,
                                     gint msg_ids_length1,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_messages_for_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static void dc_conversation_view_fetch_messages_batch_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_parsers_parse_message (JsonObject* obj,
                                         const gchar* self_email);
VALA_EXTERN const gchar* dc_rpc_client_get_self_email (DcRpcClient* self);
VALA_EXTERN gint dc_message_get_state (DcMessage* self);
VALA_EXTERN GType dc_message_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean dc_pinned_messages_manager_is_pinned (DcPinnedMessagesManager* self,
                                               gint msg_id);
VALA_EXTERN void dc_message_set_is_pinned (DcMessage* self,
                               gboolean value);
static void dc_conversation_view_load_earlier_messages_data_free (gpointer _data);
static gboolean dc_conversation_view_load_earlier_messages_co (DcConversationViewLoadEarlierMessagesData* _data_);
static void dc_conversation_view_load_earlier_messages_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
static void dc_conversation_view_load_until_pending_message_data_free (gpointer _data);
static gboolean dc_conversation_view_load_until_pending_message_co (DcConversationViewLoadUntilPendingMessageData* _data_);
VALA_EXTERN gint dc_message_history_find_id (JsonArray* ids,
                                 gint message_id);
VALA_EXTERN guint dc_message_history_earlier_batch_start (guint loaded_start,
                                              guint target_index,
                                              guint batch_size);
static void dc_conversation_view_load_until_pending_message_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
VALA_EXTERN gchar* dc_message_row_format_date_label (gint64 ts);
static void dc_conversation_view_save_webxdc_from_bar_data_free (gpointer _data);
static gboolean dc_conversation_view_save_webxdc_from_bar_co (DcConversationViewSaveWebxdcFromBarData* _data_);
static void dc_conversation_view_save_webxdc_from_bar_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
VALA_EXTERN void dc_window_save_attachment (DcWindow* self,
                                const gchar* src_path,
                                const gchar* name,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void dc_window_save_attachment_finish (DcWindow* self,
                                       GAsyncResult* _res_);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
static Block47Data* block47_data_ref (Block47Data* _data47_);
static void block47_data_unref (void * _userdata_);
VALA_EXTERN DcLinkPreviewFetcher* dc_link_preview_fetcher_new (DcRpcClient* rpc);
VALA_EXTERN DcLinkPreviewFetcher* dc_link_preview_fetcher_construct (GType object_type,
                                                         DcRpcClient* rpc);
VALA_EXTERN void dc_link_preview_fetcher_fetch (DcLinkPreviewFetcher* self,
                                    const gchar* url,
                                    gboolean clean_image_urls,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN gpointer dc_link_preview_fetcher_result_ref (gpointer instance);
VALA_EXTERN void dc_link_preview_fetcher_result_unref (gpointer instance);
VALA_EXTERN GParamSpec* dc_link_preview_fetcher_param_spec_result (const gchar* name,
                                                       const gchar* nick,
                                                       const gchar* blurb,
                                                       GType object_type,
                                                       GParamFlags flags);
VALA_EXTERN void dc_link_preview_fetcher_value_set_result (GValue* value,
                                               gpointer v_object);
VALA_EXTERN void dc_link_preview_fetcher_value_take_result (GValue* value,
                                                gpointer v_object);
VALA_EXTERN gpointer dc_link_preview_fetcher_value_get_result (const GValue* value);
VALA_EXTERN GType dc_link_preview_fetcher_result_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcLinkPreviewFetcherResult, dc_link_preview_fetcher_result_unref)
VALA_EXTERN DcLinkPreviewFetcherResult* dc_link_preview_fetcher_fetch_finish (DcLinkPreviewFetcher* self,
                                                                  GAsyncResult* _res_);
VALA_EXTERN gboolean dc_settings_manager_get_clean_pasted_links (DcSettingsManager* self);
static void ____lambda185_ (Block47Data* _data47_,
                     GObject* obj,
                     GAsyncResult* res);
VALA_EXTERN gboolean dc_compose_bar_add_link_preview (DcComposeBar* self,
                                          guint generation,
                                          const gchar* image_path,
                                          const gchar* file_name,
                                          const gchar* title,
                                          const gchar* description);
static void _____lambda185__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static void dc_conversation_view_queue_send (DcConversationView* self,
                                      DcPendingSend* job);
static void dc_conversation_view_discard_pending_draft_save (DcConversationView* self);
static void dc_conversation_view_remove_draft (DcConversationView* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static void dc_conversation_view_remove_draft_finish (DcConversationView* self,
                                               GAsyncResult* _res_);
static void dc_conversation_view_process_send_queue (DcConversationView* self,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static void dc_conversation_view_process_send_queue_finish (DcConversationView* self,
                                                     GAsyncResult* _res_);
static void dc_conversation_view_process_send_queue_data_free (gpointer _data);
static gboolean dc_conversation_view_process_send_queue_co (DcConversationViewProcessSendQueueData* _data_);
static void dc_conversation_view_do_send (DcConversationView* self,
                                   DcPendingSend* job,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
static void dc_conversation_view_do_send_finish (DcConversationView* self,
                                          GAsyncResult* _res_);
static void dc_conversation_view_process_send_queue_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void dc_conversation_view_do_send_data_free (gpointer _data);
static gboolean dc_conversation_view_do_send_co (DcConversationViewDoSendData* _data_);
VALA_EXTERN gchar* dc_attachment_types_infer_outgoing_view_type (const gchar* file_path,
                                                     const gchar* file_name);
VALA_EXTERN void dc_rpc_client_send_msg (DcRpcClient* self,
                             gint chat_id,
                             const gchar* text,
                             const gchar* file_path,
                             const gchar* file_name,
                             gint quoted_msg_id,
                             const gchar* view_type,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_send_msg_finish (DcRpcClient* self,
                                    GAsyncResult* _res_,
                                    GError** error);
static void dc_conversation_view_do_send_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
static void dc_conversation_view_cancel_pending_draft_timer (DcConversationView* self);
static gboolean __lambda186_ (DcConversationView* self);
static void dc_conversation_view_flush_pending_draft_save (DcConversationView* self);
static gboolean ___lambda186__gsource_func (gpointer self);
static void dc_conversation_view_clear_pending_draft_snapshot (DcConversationView* self);
static void dc_conversation_view_start_detached_draft_save (DcConversationView* target,
                                                     const gchar* text,
                                                     const gchar* file_path,
                                                     const gchar* file_name,
                                                     gint quote_msg_id,
                                                     gboolean voice);
static void dc_conversation_view_load_draft_data_free (gpointer _data);
static gboolean dc_conversation_view_load_draft_co (DcConversationViewLoadDraftData* _data_);
VALA_EXTERN void dc_rpc_client_get_draft (DcRpcClient* self,
                              gint chat_id,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_client_get_draft_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static void dc_conversation_view_load_draft_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
VALA_EXTERN gboolean dc_compose_bar_has_unsent_content (DcComposeBar* self);
VALA_EXTERN void dc_compose_bar_restore_draft (DcComposeBar* self,
                                   DcMessage* draft);
static gboolean dc_conversation_view_is_missing_draft_rpc (GError* e);
static Block48Data* block48_data_ref (Block48Data* _data48_);
static void block48_data_unref (void * _userdata_);
static void dc_conversation_view_save_draft_snapshot (DcRpcClient* rpc,
                                               gint chat_id,
                                               const gchar* text,
                                               const gchar* file_path,
                                               const gchar* file_name,
                                               gint quote_msg_id,
                                               gboolean voice,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static DcConversationViewDraftSaveResult dc_conversation_view_save_draft_snapshot_finish (GAsyncResult* _res_);
static void __lambda95_ (Block48Data* _data48_,
                  GObject* obj,
                  GAsyncResult* _result_);
static void ___lambda95__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void dc_conversation_view_save_draft_snapshot_data_free (gpointer _data);
static gboolean dc_conversation_view_save_draft_snapshot_co (DcConversationViewSaveDraftSnapshotData* _data_);
VALA_EXTERN void dc_rpc_client_remove_draft (DcRpcClient* self,
                                 gint chat_id,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_remove_draft_finish (DcRpcClient* self,
                                        GAsyncResult* _res_,
                                        GError** error);
static void dc_conversation_view_save_draft_snapshot_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_set_draft (DcRpcClient* self,
                              gint chat_id,
                              const gchar* text,
                              const gchar* file_path,
                              const gchar* file_name,
                              gint quoted_msg_id,
                              const gchar* view_type,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_set_draft_finish (DcRpcClient* self,
                                     GAsyncResult* _res_,
                                     GError** error);
static void dc_conversation_view_remove_draft_data_free (gpointer _data);
static gboolean dc_conversation_view_remove_draft_co (DcConversationViewRemoveDraftData* _data_);
static void dc_conversation_view_remove_draft_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN gboolean dc_compose_bar_can_accept_attachment (DcComposeBar* self);
VALA_EXTERN void dc_compose_bar_set_pending_attachment (DcComposeBar* self,
                                            const gchar* file_path,
                                            const gchar* file_name,
                                            gboolean is_temp,
                                            const gchar* caption);
VALA_EXTERN DcFileDropTarget* dc_file_drop_target_new (GtkWidget* widget,
                                           const gchar* active_css_class);
VALA_EXTERN DcFileDropTarget* dc_file_drop_target_construct (GType object_type,
                                                 GtkWidget* widget,
                                                 const gchar* active_css_class);
static gboolean _dc_conversation_view_can_accept_file_attachment_dc_file_drop_target_accept (DcFileDropTarget* _sender,
                                                                                      gpointer self);
static void _dc_conversation_view_attach_local_file_dc_file_drop_target_dropped (DcFileDropTarget* _sender,
                                                                          const gchar* path,
                                                                          const gchar* name,
                                                                          gpointer self);
static void __lambda194_ (DcConversationView* self,
                   const gchar* message);
static void ___lambda194__dc_file_drop_target_failed (DcFileDropTarget* _sender,
                                               const gchar* message,
                                               gpointer self);
VALA_EXTERN GType dc_audio_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlayer, g_object_unref)
VALA_EXTERN gboolean dc_message_is_image_file (DcMessage* self);
VALA_EXTERN gboolean dc_message_is_video_file (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_has_file (DcMessage* self);
VALA_EXTERN gboolean dc_message_is_webxdc (DcMessage* self);
VALA_EXTERN gboolean dc_message_is_video_sticker_file (DcMessage* self);
VALA_EXTERN void dc_window_show_video (DcWindow* self,
                           const gchar* path,
                           const gchar* name);
static void dc_conversation_view_collect_image_paths (DcConversationView* self,
                                               const gchar* current_path,
                                               gchar*** paths,
                                               gint* paths_length1,
                                               gint* start_index);
VALA_EXTERN void dc_window_show_image_list (DcWindow* self,
                                gchar** paths,
                                gint paths_length1,
                                gint start_index);
static void dc_conversation_view_extend_image_list (DcConversationView* self,
                                             const gchar* current_path,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void dc_conversation_view_extend_image_list_finish (DcConversationView* self,
                                                    GAsyncResult* _res_);
VALA_EXTERN gboolean dc_message_is_text_preview_file (DcMessage* self);
static void dc_conversation_view_preview_text_attachment (DcConversationView* self,
                                                   DcMessage* msg);
VALA_EXTERN gboolean dc_message_is_html_file (DcMessage* self);
VALA_EXTERN gchar* dc_message_display_file_name (DcMessage* self,
                                     const gchar* fallback);
VALA_EXTERN gboolean dc_message_is_markdown_file (DcMessage* self);
VALA_EXTERN DcFullMessageDialog* dc_full_message_dialog_new_for_file (DcWindow* window,
                                                          const gchar* file_title,
                                                          const gchar* content,
                                                          gint initial_font_size,
                                                          gboolean markdown_default);
VALA_EXTERN DcFullMessageDialog* dc_full_message_dialog_construct_for_file (GType object_type,
                                                                DcWindow* window,
                                                                const gchar* file_title,
                                                                const gchar* content,
                                                                gint initial_font_size,
                                                                gboolean markdown_default);
static void _g_free0_ (gpointer var);
static void dc_conversation_view_extend_image_list_data_free (gpointer _data);
static gboolean dc_conversation_view_extend_image_list_co (DcConversationViewExtendImageListData* _data_);
VALA_EXTERN void dc_rpc_client_get_chat_media (DcRpcClient* self,
                                   gint chat_id,
                                   gchar** types,
                                   gint types_length1,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN gint* dc_rpc_client_get_chat_media_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           gint* result_length1,
                                           GError** error);
static void dc_conversation_view_extend_image_list_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
VALA_EXTERN gchar* dc_window_image_viewer_path (DcWindow* self);
VALA_EXTERN void dc_rpc_client_get_parsed_messages (DcRpcClient* self,
                                        gint* msg_ids,
                                        gint msg_ids_length1,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN DcMessage** dc_rpc_client_get_parsed_messages_finish (DcRpcClient* self,
                                                      GAsyncResult* _res_,
                                                      gint* result_length1,
                                                      GError** error);
static void _vala_array_add39 (DcMessage** * array,
                        gint* length,
                        gint* size,
                        DcMessage* value);
VALA_EXTERN void dc_window_replace_image_list (DcWindow* self,
                                   gchar** paths,
                                   gint paths_length1,
                                   const gchar* expected_path);
VALA_EXTERN void dc_conversation_view_close (DcConversationView* self);
static guint* _vala_array_dup15 (guint* self,
                          gssize length);
VALA_EXTERN void dc_webxdc_apps_bar_close (DcWebxdcAppsBar* self);
VALA_EXTERN void dc_compose_bar_close (DcComposeBar* self);
static void dc_conversation_view_real_dispose (GObject* base);
static void dc_conversation_view_set_chat_id (DcConversationView* self,
                                       gint value);
static void dc_conversation_view_finalize (GObject * obj);
static GType dc_conversation_view_get_type_once (void);
static void _vala_dc_conversation_view_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_dc_conversation_view_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);
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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const gchar* DC_CONVERSATION_VIEW_CHAT_IMAGE_TYPES[3] = {"Sticker", "Gif", "Image"};

DcPendingSend*
dc_pending_send_construct (GType object_type,
                           const gchar* text,
                           const gchar* file_path,
                           const gchar* file_name,
                           gint quote_msg_id,
                           gboolean voice,
                           gboolean owns_file)
{
	DcPendingSend * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_val_if_fail (text != NULL, NULL);
	self = (DcPendingSend*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (text);
	_g_free0 (self->text);
	self->text = _tmp0_;
	_tmp1_ = g_strdup (file_path);
	_g_free0 (self->file_path);
	self->file_path = _tmp1_;
	_tmp2_ = g_strdup (file_name);
	_g_free0 (self->file_name);
	self->file_name = _tmp2_;
	self->quote_msg_id = quote_msg_id;
	self->voice = voice;
	self->owns_file = owns_file;
	return self;
}

DcPendingSend*
dc_pending_send_new (const gchar* text,
                     const gchar* file_path,
                     const gchar* file_name,
                     gint quote_msg_id,
                     gboolean voice,
                     gboolean owns_file)
{
	return dc_pending_send_construct (DC_TYPE_PENDING_SEND, text, file_path, file_name, quote_msg_id, voice, owns_file);
}

static void
dc_pending_send_class_init (DcPendingSendClass * klass,
                            gpointer klass_data)
{
	dc_pending_send_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = dc_pending_send_finalize;
}

static void
dc_pending_send_instance_init (DcPendingSend * self,
                               gpointer klass)
{
}

static void
dc_pending_send_finalize (GObject * obj)
{
	DcPendingSend * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_PENDING_SEND, DcPendingSend);
	_g_free0 (self->text);
	_g_free0 (self->file_path);
	_g_free0 (self->file_name);
	G_OBJECT_CLASS (dc_pending_send_parent_class)->finalize (obj);
}

static GType
dc_pending_send_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcPendingSendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_pending_send_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcPendingSend), 0, (GInstanceInitFunc) dc_pending_send_instance_init, NULL };
	GType dc_pending_send_type_id;
	dc_pending_send_type_id = g_type_register_static (G_TYPE_OBJECT, "DcPendingSend", &g_define_type_info, 0);
	return dc_pending_send_type_id;
}

GType
dc_pending_send_get_type (void)
{
	static volatile gsize dc_pending_send_type_id__once = 0;
	if (g_once_init_enter (&dc_pending_send_type_id__once)) {
		GType dc_pending_send_type_id;
		dc_pending_send_type_id = dc_pending_send_get_type_once ();
		g_once_init_leave (&dc_pending_send_type_id__once, dc_pending_send_type_id);
	}
	return dc_pending_send_type_id__once;
}

static inline gpointer
dc_conversation_signal_handler_get_instance_private (DcConversationSignalHandler* self)
{
	return G_STRUCT_MEMBER_P (self, DcConversationSignalHandler_private_offset);
}

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

DcConversationSignalHandler*
dc_conversation_signal_handler_construct (GType object_type,
                                          GObject* source,
                                          gulong handler_id)
{
	DcConversationSignalHandler * self = NULL;
	GObject* _tmp0_;
	g_return_val_if_fail (source != NULL, NULL);
	self = (DcConversationSignalHandler*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (source);
	_g_object_unref0 (self->priv->source);
	self->priv->source = _tmp0_;
	self->priv->handler_id = handler_id;
	return self;
}

DcConversationSignalHandler*
dc_conversation_signal_handler_new (GObject* source,
                                    gulong handler_id)
{
	return dc_conversation_signal_handler_construct (DC_TYPE_CONVERSATION_SIGNAL_HANDLER, source, handler_id);
}

void
dc_conversation_signal_handler_disconnect_handler (DcConversationSignalHandler* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GObject* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp2_ = self->priv->source;
	if (_tmp2_ != NULL) {
		_tmp1_ = self->priv->handler_id != ((gulong) 0);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GObject* _tmp3_;
		_tmp3_ = self->priv->source;
		_tmp0_ = g_signal_handler_is_connected (_tmp3_, self->priv->handler_id);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GObject* _tmp4_;
		_tmp4_ = self->priv->source;
		g_signal_handler_disconnect (_tmp4_, self->priv->handler_id);
	}
	self->priv->handler_id = (gulong) 0;
	_g_object_unref0 (self->priv->source);
	self->priv->source = NULL;
}

static void
dc_conversation_signal_handler_class_init (DcConversationSignalHandlerClass * klass,
                                           gpointer klass_data)
{
	dc_conversation_signal_handler_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcConversationSignalHandler_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dc_conversation_signal_handler_finalize;
}

static void
dc_conversation_signal_handler_instance_init (DcConversationSignalHandler * self,
                                              gpointer klass)
{
	self->priv = dc_conversation_signal_handler_get_instance_private (self);
}

static void
dc_conversation_signal_handler_finalize (GObject * obj)
{
	DcConversationSignalHandler * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_CONVERSATION_SIGNAL_HANDLER, DcConversationSignalHandler);
	_g_object_unref0 (self->priv->source);
	G_OBJECT_CLASS (dc_conversation_signal_handler_parent_class)->finalize (obj);
}

static GType
dc_conversation_signal_handler_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcConversationSignalHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_conversation_signal_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcConversationSignalHandler), 0, (GInstanceInitFunc) dc_conversation_signal_handler_instance_init, NULL };
	GType dc_conversation_signal_handler_type_id;
	dc_conversation_signal_handler_type_id = g_type_register_static (G_TYPE_OBJECT, "DcConversationSignalHandler", &g_define_type_info, 0);
	DcConversationSignalHandler_private_offset = g_type_add_instance_private (dc_conversation_signal_handler_type_id, sizeof (DcConversationSignalHandlerPrivate));
	return dc_conversation_signal_handler_type_id;
}

GType
dc_conversation_signal_handler_get_type (void)
{
	static volatile gsize dc_conversation_signal_handler_type_id__once = 0;
	if (g_once_init_enter (&dc_conversation_signal_handler_type_id__once)) {
		GType dc_conversation_signal_handler_type_id;
		dc_conversation_signal_handler_type_id = dc_conversation_signal_handler_get_type_once ();
		g_once_init_leave (&dc_conversation_signal_handler_type_id__once, dc_conversation_signal_handler_type_id);
	}
	return dc_conversation_signal_handler_type_id__once;
}

static inline gpointer
dc_conversation_view_get_instance_private (DcConversationView* self)
{
	return G_STRUCT_MEMBER_P (self, DcConversationView_private_offset);
}

static GType
dc_conversation_view_viewport_goal_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE, "DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE", "free"}, {DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM, "DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM", "bottom"}, {DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR, "DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR", "anchor"}, {0, NULL, NULL}};
	GType dc_conversation_view_viewport_goal_type_id;
	dc_conversation_view_viewport_goal_type_id = g_enum_register_static ("DcConversationViewViewportGoal", values);
	return dc_conversation_view_viewport_goal_type_id;
}

static GType
dc_conversation_view_viewport_goal_get_type (void)
{
	static volatile gsize dc_conversation_view_viewport_goal_type_id__once = 0;
	if (g_once_init_enter (&dc_conversation_view_viewport_goal_type_id__once)) {
		GType dc_conversation_view_viewport_goal_type_id;
		dc_conversation_view_viewport_goal_type_id = dc_conversation_view_viewport_goal_get_type_once ();
		g_once_init_leave (&dc_conversation_view_viewport_goal_type_id__once, dc_conversation_view_viewport_goal_type_id);
	}
	return dc_conversation_view_viewport_goal_type_id__once;
}

static GType
dc_conversation_view_draft_save_result_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_UNAVAILABLE, "DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_UNAVAILABLE", "unavailable"}, {DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_FAILED, "DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_FAILED", "failed"}, {DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_SAVED, "DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_SAVED", "saved"}, {0, NULL, NULL}};
	GType dc_conversation_view_draft_save_result_type_id;
	dc_conversation_view_draft_save_result_type_id = g_enum_register_static ("DcConversationViewDraftSaveResult", values);
	return dc_conversation_view_draft_save_result_type_id;
}

static GType
dc_conversation_view_draft_save_result_get_type (void)
{
	static volatile gsize dc_conversation_view_draft_save_result_type_id__once = 0;
	if (g_once_init_enter (&dc_conversation_view_draft_save_result_type_id__once)) {
		GType dc_conversation_view_draft_save_result_type_id;
		dc_conversation_view_draft_save_result_type_id = dc_conversation_view_draft_save_result_get_type_once ();
		g_once_init_leave (&dc_conversation_view_draft_save_result_type_id__once, dc_conversation_view_draft_save_result_type_id);
	}
	return dc_conversation_view_draft_save_result_type_id__once;
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_queue_free__g_object_unref0_ (GQueue* self)
{
	g_queue_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

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_)) {
		DcConversationView* self;
		self = _data35_->self;
		_g_object_unref0 (_data35_->window);
		_g_object_unref0 (self);
		g_slice_free (Block35Data, _data35_);
	}
}

static void
__lambda120_ (DcConversationView* self,
              gint mid)
{
	dc_conversation_view_scroll_to_message (self, mid);
}

static void
___lambda120__dc_pinned_messages_manager_scroll_requested (DcPinnedMessagesManager* _sender,
                                                           gint msg_id,
                                                           gpointer self)
{
	__lambda120_ ((DcConversationView*) self, msg_id);
}

static void
__lambda122_ (Block35Data* _data35_,
              const gchar* message)
{
	DcConversationView* self;
	self = _data35_->self;
	g_return_if_fail (message != NULL);
	dc_window_show_toast (_data35_->window, message);
}

static void
___lambda122__dc_pinned_messages_manager_operation_failed (DcPinnedMessagesManager* _sender,
                                                           const gchar* message,
                                                           gpointer self)
{
	__lambda122_ (self, message);
}

static void
__lambda123_ (DcConversationView* self,
              gint mid)
{
	dc_conversation_view_scroll_to_message (self, mid);
}

static void
___lambda123__dc_webxdc_apps_bar_scroll_requested (DcWebxdcAppsBar* _sender,
                                                   gint msg_id,
                                                   gpointer self)
{
	__lambda123_ ((DcConversationView*) self, msg_id);
}

static void
__lambda124_ (DcConversationView* self,
              gint mid)
{
	DcMessageActions* _tmp0_;
	_tmp0_ = self->priv->msg_actions;
	dc_message_actions_start_forwarding (_tmp0_, mid);
}

static void
___lambda124__dc_webxdc_apps_bar_forward_requested (DcWebxdcAppsBar* _sender,
                                                    gint msg_id,
                                                    gpointer self)
{
	__lambda124_ ((DcConversationView*) self, msg_id);
}

static void
__lambda125_ (DcConversationView* self,
              gint mid)
{
	dc_conversation_view_save_webxdc_from_bar (self, mid, NULL, NULL);
}

static void
___lambda125__dc_webxdc_apps_bar_save_requested (DcWebxdcAppsBar* _sender,
                                                 gint msg_id,
                                                 gpointer self)
{
	__lambda125_ ((DcConversationView*) self, msg_id);
}

static void
__lambda126_ (Block35Data* _data35_)
{
	DcConversationView* self;
	self = _data35_->self;
	dc_window_navigate_voice_playback (_data35_->window, -1);
}

static void
___lambda126__dc_conversation_media_bar_previous_requested (DcConversationMediaBar* _sender,
                                                            gpointer self)
{
	__lambda126_ (self);
}

static void
__lambda159_ (Block35Data* _data35_)
{
	DcConversationView* self;
	self = _data35_->self;
	dc_window_navigate_voice_playback (_data35_->window, 1);
}

static void
___lambda159__dc_conversation_media_bar_next_requested (DcConversationMediaBar* _sender,
                                                        gpointer self)
{
	__lambda159_ (self);
}

static void
__lambda160_ (Block35Data* _data35_,
              gint acct_id,
              gint origin_chat_id,
              gint mid)
{
	DcConversationView* self;
	self = _data35_->self;
	dc_window_open_media_message (_data35_->window, acct_id, origin_chat_id, mid, NULL, NULL);
}

static void
___lambda160__dc_conversation_media_bar_message_requested (DcConversationMediaBar* _sender,
                                                           gint account_id,
                                                           gint chat_id,
                                                           gint message_id,
                                                           gpointer self)
{
	__lambda160_ (self, account_id, chat_id, message_id);
}

static void
__lambda195_ (DcConversationView* self,
              gint mid)
{
	dc_conversation_view_begin_selection_mode (self, mid);
}

static void
___lambda195__dc_message_actions_select_requested (DcMessageActions* _sender,
                                                   gint msg_id,
                                                   gpointer self)
{
	__lambda195_ ((DcConversationView*) self, msg_id);
}

DcConversationView*
dc_conversation_view_construct (GType object_type,
                                gint chat_id,
                                DcWindow* window,
                                DcRpcClient* rpc,
                                DcSettingsManager* settings,
                                DcChatKind chat_kind)
{
	DcConversationView * self = NULL;
	Block35Data* _data35_;
	DcWindow* _tmp0_;
	GListStore* _tmp1_;
	GListStore* _tmp2_;
	DcPinnedMessagesManager* _tmp3_;
	DcPinnedMessagesManager* _tmp4_;
	DcPinnedMessagesManager* _tmp5_;
	DcPinnedMessagesManager* _tmp6_;
	gulong _tmp7_;
	DcPinnedMessagesManager* _tmp8_;
	DcPinnedMessagesManager* _tmp9_;
	gulong _tmp10_;
	DcWebxdcAppsBar* _tmp11_;
	DcWebxdcAppsBar* _tmp12_;
	DcWebxdcAppsBar* _tmp13_;
	DcPinnedMessagesManager* _tmp14_;
	DcWebxdcAppsBar* _tmp15_;
	DcWebxdcAppsBar* _tmp16_;
	gulong _tmp17_;
	DcWebxdcAppsBar* _tmp18_;
	DcWebxdcAppsBar* _tmp19_;
	gulong _tmp20_;
	DcWebxdcAppsBar* _tmp21_;
	DcWebxdcAppsBar* _tmp22_;
	gulong _tmp23_;
	DcConversationMediaBar* _tmp24_;
	DcConversationMediaBar* _tmp25_;
	DcConversationMediaBar* _tmp26_;
	gulong _tmp27_;
	DcConversationMediaBar* _tmp28_;
	DcConversationMediaBar* _tmp29_;
	gulong _tmp30_;
	DcConversationMediaBar* _tmp31_;
	DcConversationMediaBar* _tmp32_;
	gulong _tmp33_;
	DcAudioPlayback* playback = NULL;
	DcAudioPlayback* _tmp34_;
	GListStore* _tmp35_;
	DcPinnedMessagesManager* _tmp36_;
	DcComposeBar* _tmp37_;
	DcMessageActions* _tmp38_;
	DcMessageActions* _tmp39_;
	DcMentionRoster* _tmp40_;
	DcMessageActions* _tmp41_;
	DcMessageActions* _tmp42_;
	gulong _tmp43_;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	_data35_ = g_slice_new0 (Block35Data);
	_data35_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (_data35_->window);
	_data35_->window = _tmp0_;
	self = (DcConversationView*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 0, "chat-id", chat_id, NULL);
	_data35_->self = g_object_ref (self);
	self->priv->window = _data35_->window;
	self->priv->rpc = rpc;
	self->priv->settings = settings;
	self->priv->chat_kind = chat_kind;
	self->priv->chat_kind_loaded = chat_kind != DC_CHAT_KIND_UNKNOWN;
	gtk_widget_set_hexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) self, GTK_ALIGN_FILL);
	gtk_widget_add_css_class ((GtkWidget*) self, "conversation-view");
	_tmp1_ = g_list_store_new (DC_TYPE_MESSAGE);
	_g_object_unref0 (self->priv->message_store);
	self->priv->message_store = _tmp1_;
	_tmp2_ = self->priv->message_store;
	_tmp3_ = dc_pinned_messages_manager_new (_tmp2_, settings);
	_g_object_unref0 (self->priv->pinned);
	self->priv->pinned = _tmp3_;
	_tmp4_ = self->priv->pinned;
	dc_pinned_messages_manager_set_rpc (_tmp4_, rpc);
	_tmp5_ = self->priv->pinned;
	_tmp6_ = self->priv->pinned;
	_tmp7_ = g_signal_connect_object (_tmp6_, "scroll-requested", (GCallback) ___lambda120__dc_pinned_messages_manager_scroll_requested, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp5_, _tmp7_);
	_tmp8_ = self->priv->pinned;
	_tmp9_ = self->priv->pinned;
	_tmp10_ = g_signal_connect_data (_tmp9_, "operation-failed", (GCallback) ___lambda122__dc_pinned_messages_manager_operation_failed, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp8_, _tmp10_);
	_tmp11_ = dc_webxdc_apps_bar_new ();
	_g_object_unref0 (self->priv->webxdc_bar);
	self->priv->webxdc_bar = _tmp11_;
	_tmp12_ = self->priv->webxdc_bar;
	dc_webxdc_apps_bar_set_rpc (_tmp12_, rpc);
	_tmp13_ = self->priv->webxdc_bar;
	_tmp14_ = self->priv->pinned;
	dc_webxdc_apps_bar_set_pinned (_tmp13_, _tmp14_);
	_tmp15_ = self->priv->webxdc_bar;
	_tmp16_ = self->priv->webxdc_bar;
	_tmp17_ = g_signal_connect_object (_tmp16_, "scroll-requested", (GCallback) ___lambda123__dc_webxdc_apps_bar_scroll_requested, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp15_, _tmp17_);
	_tmp18_ = self->priv->webxdc_bar;
	_tmp19_ = self->priv->webxdc_bar;
	_tmp20_ = g_signal_connect_object (_tmp19_, "forward-requested", (GCallback) ___lambda124__dc_webxdc_apps_bar_forward_requested, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp18_, _tmp20_);
	_tmp21_ = self->priv->webxdc_bar;
	_tmp22_ = self->priv->webxdc_bar;
	_tmp23_ = g_signal_connect_object (_tmp22_, "save-requested", (GCallback) ___lambda125__dc_webxdc_apps_bar_save_requested, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp21_, _tmp23_);
	_tmp24_ = dc_conversation_media_bar_new ();
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->media_bar);
	self->priv->media_bar = _tmp24_;
	_tmp25_ = self->priv->media_bar;
	_tmp26_ = self->priv->media_bar;
	_tmp27_ = g_signal_connect_data (_tmp26_, "previous-requested", (GCallback) ___lambda126__dc_conversation_media_bar_previous_requested, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp25_, _tmp27_);
	_tmp28_ = self->priv->media_bar;
	_tmp29_ = self->priv->media_bar;
	_tmp30_ = g_signal_connect_data (_tmp29_, "next-requested", (GCallback) ___lambda159__dc_conversation_media_bar_next_requested, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp28_, _tmp30_);
	_tmp31_ = self->priv->media_bar;
	_tmp32_ = self->priv->media_bar;
	_tmp33_ = g_signal_connect_data (_tmp32_, "message-requested", (GCallback) ___lambda160__dc_conversation_media_bar_message_requested, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp31_, _tmp33_);
	_tmp34_ = dc_audio_playback_shared ();
	playback = _tmp34_;
	self->priv->playback_message_handler = dc_conversation_view_connect_playback_updates (playback, self);
	self->priv->playback_finished_handler = dc_conversation_view_connect_playback_finished (playback, self);
	dc_conversation_view_build_ui (self);
	_tmp35_ = self->priv->message_store;
	_tmp36_ = self->priv->pinned;
	_tmp37_ = self->priv->compose_bar;
	_tmp38_ = dc_message_actions_new (_data35_->window, rpc, _tmp35_, _tmp36_, _tmp37_, settings);
	_g_object_unref0 (self->priv->msg_actions);
	self->priv->msg_actions = _tmp38_;
	_tmp39_ = self->priv->msg_actions;
	_tmp40_ = self->priv->reaction_roster;
	dc_message_actions_set_reaction_roster (_tmp39_, _tmp40_);
	_tmp41_ = self->priv->msg_actions;
	_tmp42_ = self->priv->msg_actions;
	_tmp43_ = g_signal_connect_object (_tmp42_, "select-requested", (GCallback) ___lambda195__dc_message_actions_select_requested, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp41_, _tmp43_);
	_g_object_unref0 (playback);
	block35_data_unref (_data35_);
	_data35_ = NULL;
	return self;
}

DcConversationView*
dc_conversation_view_new (gint chat_id,
                          DcWindow* window,
                          DcRpcClient* rpc,
                          DcSettingsManager* settings,
                          DcChatKind chat_kind)
{
	return dc_conversation_view_construct (DC_TYPE_CONVERSATION_VIEW, chat_id, window, rpc, settings, chat_kind);
}

static void
dc_conversation_view_track_signal (DcConversationView* self,
                                   GObject* source,
                                   gulong handler_id)
{
	GPtrArray* _tmp0_;
	DcConversationSignalHandler* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_tmp0_ = self->priv->signal_handlers;
	_tmp1_ = dc_conversation_signal_handler_new (source, handler_id);
	g_ptr_array_add (_tmp0_, _tmp1_);
}

static void
_vala_array_add33 (guint* * array,
                   gint* length,
                   gint* size,
                   guint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (guint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static void
dc_conversation_view_track_tick_callback (DcConversationView* self,
                                          guint callback_id)
{
	g_return_if_fail (self != NULL);
	_vala_array_add33 (&self->priv->tick_callback_ids, &self->priv->tick_callback_ids_length1, &self->priv->_tick_callback_ids_size_, callback_id);
}

static gboolean
dc_conversation_view_end_tick_callback (DcConversationView* self,
                                        guint callback_id)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	dc_conversation_view_forget_tick_callback (self, callback_id);
	result = G_SOURCE_REMOVE;
	return result;
}

static void
_vala_array_add34 (guint* * array,
                   gint* length,
                   gint* size,
                   guint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (guint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static guint*
_vala_array_dup14 (guint* self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint));
	}
	return NULL;
}

static void
dc_conversation_view_forget_tick_callback (DcConversationView* self,
                                           guint callback_id)
{
	guint* remaining = NULL;
	guint* _tmp0_;
	gint remaining_length1;
	gint _remaining_size_;
	guint* _tmp1_;
	gint _tmp1__length1;
	guint* _tmp2_;
	gint _tmp2__length1;
	guint* _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (guint, 0);
	remaining = _tmp0_;
	remaining_length1 = 0;
	_remaining_size_ = remaining_length1;
	_tmp1_ = self->priv->tick_callback_ids;
	_tmp1__length1 = self->priv->tick_callback_ids_length1;
	{
		guint* id_collection = NULL;
		gint id_collection_length1 = 0;
		gint _id_collection_size_ = 0;
		gint id_it = 0;
		id_collection = _tmp1_;
		id_collection_length1 = _tmp1__length1;
		for (id_it = 0; id_it < id_collection_length1; id_it = id_it + 1) {
			guint id = 0U;
			id = id_collection[id_it];
			{
				if (id != callback_id) {
					_vala_array_add34 (&remaining, &remaining_length1, &_remaining_size_, id);
				}
			}
		}
	}
	_tmp2_ = remaining;
	_tmp2__length1 = remaining_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup14 (_tmp2_, _tmp2__length1) : _tmp2_;
	_tmp3__length1 = _tmp2__length1;
	self->priv->tick_callback_ids = (g_free (self->priv->tick_callback_ids), NULL);
	self->priv->tick_callback_ids = _tmp3_;
	self->priv->tick_callback_ids_length1 = _tmp3__length1;
	self->priv->_tick_callback_ids_size_ = self->priv->tick_callback_ids_length1;
	remaining = (g_free (remaining), NULL);
}

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_)) {
		g_weak_ref_clear (&_data36_->view_ref);
		g_slice_free (Block36Data, _data36_);
	}
}

static void
__lambda161_ (Block36Data* _data36_)
{
	DcConversationView* view = NULL;
	GObject* _tmp0_;
	DcConversationView* _tmp1_;
	gboolean _tmp2_ = FALSE;
	DcConversationView* _tmp3_;
	_tmp0_ = g_weak_ref_get (&_data36_->view_ref);
	_tmp1_ = DC_IS_CONVERSATION_VIEW (_tmp0_) ? ((DcConversationView*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	view = _tmp1_;
	_tmp3_ = view;
	if (_tmp3_ != NULL) {
		DcConversationView* _tmp4_;
		_tmp4_ = view;
		_tmp2_ = !_tmp4_->priv->closed;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		DcConversationView* _tmp5_;
		_tmp5_ = view;
		dc_conversation_view_update_conversation_media_bar (_tmp5_);
	}
	_g_object_unref0 (view);
}

static void
___lambda161__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda161_ (self);
}

static gulong
dc_conversation_view_connect_playback_updates (DcAudioPlayback* playback,
                                               DcConversationView* target)
{
	Block36Data* _data36_;
	gulong _tmp0_;
	gulong result;
	g_return_val_if_fail (playback != NULL, 0UL);
	g_return_val_if_fail (target != NULL, 0UL);
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	g_weak_ref_init (&_data36_->view_ref, (GObject*) target);
	_tmp0_ = g_signal_connect_data ((GObject*) playback, "notify::current-item", (GCallback) ___lambda161__g_object_notify, block36_data_ref (_data36_), (GClosureNotify) block36_data_unref, 0);
	result = _tmp0_;
	block36_data_unref (_data36_);
	_data36_ = NULL;
	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_)) {
		g_weak_ref_clear (&_data37_->view_ref);
		g_slice_free (Block37Data, _data37_);
	}
}

static void
__lambda162_ (Block37Data* _data37_,
              gint mid)
{
	DcConversationView* view = NULL;
	GObject* _tmp0_;
	DcConversationView* _tmp1_;
	gboolean _tmp2_ = FALSE;
	DcConversationView* _tmp3_;
	DcAudioPlaybackItem* item = NULL;
	DcAudioPlayback* _tmp5_;
	DcAudioPlayback* _tmp6_;
	DcAudioPlaybackItem* _tmp7_;
	DcAudioPlaybackItem* _tmp8_;
	DcAudioPlaybackItem* _tmp9_;
	DcAudioPlaybackItem* _tmp10_;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	DcAudioPlaybackItem* _tmp14_;
	_tmp0_ = g_weak_ref_get (&_data37_->view_ref);
	_tmp1_ = DC_IS_CONVERSATION_VIEW (_tmp0_) ? ((DcConversationView*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	view = _tmp1_;
	_tmp3_ = view;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		DcConversationView* _tmp4_;
		_tmp4_ = view;
		_tmp2_ = _tmp4_->priv->closed;
	}
	if (_tmp2_) {
		_g_object_unref0 (view);
		return;
	}
	_tmp5_ = dc_audio_playback_shared ();
	_tmp6_ = _tmp5_;
	_tmp7_ = dc_audio_playback_get_current_item (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	_tmp10_ = _tmp9_;
	_g_object_unref0 (_tmp6_);
	item = _tmp10_;
	_tmp14_ = item;
	if (_tmp14_ != NULL) {
		DcAudioPlaybackItem* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		DcConversationView* _tmp18_;
		DcRpcClient* _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		_tmp15_ = item;
		_tmp16_ = dc_audio_playback_item_get_account_id (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = view;
		_tmp19_ = _tmp18_->priv->rpc;
		_tmp20_ = dc_rpc_client_get_account_id (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp13_ = _tmp17_ == _tmp21_;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		DcAudioPlaybackItem* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		DcConversationView* _tmp25_;
		gint _tmp26_;
		_tmp22_ = item;
		_tmp23_ = dc_audio_playback_item_get_chat_id (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = view;
		_tmp26_ = _tmp25_->priv->_chat_id;
		_tmp12_ = _tmp24_ == _tmp26_;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		DcAudioPlaybackItem* _tmp27_;
		gint _tmp28_;
		gint _tmp29_;
		_tmp27_ = item;
		_tmp28_ = dc_audio_playback_item_get_message_id (_tmp27_);
		_tmp29_ = _tmp28_;
		_tmp11_ = _tmp29_ == mid;
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		DcConversationView* _tmp30_;
		_tmp30_ = view;
		dc_conversation_view_queue_next_voice_message (_tmp30_, mid);
	}
	_g_object_unref0 (item);
	_g_object_unref0 (view);
}

static void
___lambda162__dc_audio_playback_finished (DcAudioPlayback* _sender,
                                          gint message_id,
                                          gpointer self)
{
	__lambda162_ (self, message_id);
}

static gulong
dc_conversation_view_connect_playback_finished (DcAudioPlayback* playback,
                                                DcConversationView* target)
{
	Block37Data* _data37_;
	gulong _tmp0_;
	gulong result;
	g_return_val_if_fail (playback != NULL, 0UL);
	g_return_val_if_fail (target != NULL, 0UL);
	_data37_ = g_slice_new0 (Block37Data);
	_data37_->_ref_count_ = 1;
	g_weak_ref_init (&_data37_->view_ref, (GObject*) target);
	_tmp0_ = g_signal_connect_data (playback, "finished", (GCallback) ___lambda162__dc_audio_playback_finished, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	result = _tmp0_;
	block37_data_unref (_data37_);
	_data37_ = NULL;
	return result;
}

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_)) {
		DcConversationView* self;
		self = _data38_->self;
		_g_object_unref0 (_data38_->dc);
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}

static void
_dc_conversation_view_on_scroll_bounds_changed_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self)
{
	dc_conversation_view_on_scroll_bounds_changed ((DcConversationView*) self);
}

static void
__lambda164_ (DcConversationView* self)
{
	DcConversationViewViewportGoal _tmp0_ = 0;
	GtkButton* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	if (self->priv->loading_chat) {
		return;
	}
	if (g_get_monotonic_time () < self->priv->scroll_freeze_until_us) {
		return;
	}
	if (self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR) {
		dc_conversation_view_update_date_pill (self);
		return;
	}
	if (dc_conversation_view_is_near_bottom (self)) {
		_tmp0_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
	} else {
		_tmp0_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
	}
	self->priv->goal = _tmp0_;
	_tmp1_ = self->priv->scroll_down_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, self->priv->goal != DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM);
	dc_conversation_view_update_date_pill (self);
	if (dc_conversation_view_is_near_top (self)) {
		_tmp3_ = !self->priv->loading_more;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = self->priv->loaded_start_index > ((guint) 0);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		dc_conversation_view_load_earlier_messages (self, NULL, NULL);
	}
}

static void
___lambda164__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda164_ ((DcConversationView*) self);
}

static gboolean
__lambda165_ (DcConversationView* self,
              gdouble dx,
              gdouble dy)
{
	gboolean result;
	dc_conversation_view_on_user_scroll_input (self);
	result = FALSE;
	return result;
}

static gboolean
___lambda165__gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                  gdouble dx,
                                                  gdouble dy,
                                                  gpointer self)
{
	gboolean result;
	result = __lambda165_ ((DcConversationView*) self, dx, dy);
	return result;
}

static void
__lambda166_ (DcConversationView* self,
              gint n,
              gdouble x,
              gdouble y)
{
	dc_conversation_view_on_user_scroll_input (self);
}

static void
___lambda166__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda166_ ((DcConversationView*) self, n_press, x, y);
}

static void
__lambda168_ (DcConversationView* self,
              GObject* obj)
{
	GtkListItem* li = NULL;
	GtkListItem* _tmp0_;
	DcMessage* msg = NULL;
	GtkListItem* _tmp1_;
	GObject* _tmp2_;
	GObject* _tmp3_;
	DcMessage* _tmp4_;
	DcMessage* prev = NULL;
	guint pos = 0U;
	GtkListItem* _tmp5_;
	guint _tmp6_;
	guint _tmp7_;
	gboolean is_img_continuation = FALSE;
	GPtrArray* trailing = NULL;
	DcMessage* _tmp10_;
	DcMessage* _tmp11_;
	gboolean _tmp12_ = FALSE;
	GPtrArray* _tmp13_;
	GtkBox* container = NULL;
	GtkBox* _tmp14_;
	gboolean _tmp15_ = FALSE;
	DcMessage* _tmp16_;
	DcMessage* _tmp29_ = NULL;
	DcMessageRow* row = NULL;
	DcMessage* _tmp31_;
	GPtrArray* _tmp32_;
	DcSettingsManager* _tmp33_;
	DcBubbleAvatarDisplay _tmp34_;
	DcBubbleAvatarDisplay _tmp35_;
	DcMentionRoster* _tmp36_;
	DcMentionRoster* _tmp37_;
	DcRpcClient* _tmp38_;
	gint _tmp39_;
	gint _tmp40_;
	DcMessageRow* _tmp41_;
	DcMessageRow* _tmp42_;
	DcMessageRow* _tmp43_;
	DcMessageRow* _tmp44_;
	DcMessageRow* _tmp45_;
	DcMessageRow* _tmp46_;
	DcMessageRow* _tmp47_;
	DcMessage* _tmp48_;
	gboolean _tmp49_;
	gboolean _tmp50_;
	GtkBox* _tmp53_;
	DcMessageRow* _tmp54_;
	GtkListItem* _tmp55_;
	GtkBox* _tmp56_;
	GtkListItem* _tmp57_;
	GtkListItem* _tmp58_;
	GtkListItem* _tmp59_;
	g_return_if_fail (obj != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_list_item_get_type (), GtkListItem));
	li = _tmp0_;
	_tmp1_ = li;
	_tmp2_ = gtk_list_item_get_item (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, DC_TYPE_MESSAGE, DcMessage));
	msg = _tmp4_;
	prev = NULL;
	_tmp5_ = li;
	_tmp6_ = gtk_list_item_get_position (_tmp5_);
	_tmp7_ = _tmp6_;
	pos = _tmp7_;
	if (pos > ((guint) 0)) {
		GtkFilterListModel* _tmp8_;
		GObject* _tmp9_;
		_tmp8_ = self->priv->filtered_message_store;
		_tmp9_ = g_list_model_get_item ((GListModel*) _tmp8_, pos - 1);
		_g_object_unref0 (prev);
		prev = G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, DC_TYPE_MESSAGE, DcMessage);
	}
	_tmp10_ = msg;
	_tmp11_ = prev;
	_tmp13_ = dc_conversation_view_collect_trailing_irc_images (self, _tmp10_, _tmp11_, pos, &_tmp12_);
	is_img_continuation = _tmp12_;
	trailing = _tmp13_;
	_tmp14_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp14_);
	container = _tmp14_;
	_tmp16_ = prev;
	if (_tmp16_ == NULL) {
		_tmp15_ = TRUE;
	} else {
		DcMessage* _tmp17_;
		gint64 _tmp18_;
		gint64 _tmp19_;
		DcMessage* _tmp20_;
		gint64 _tmp21_;
		gint64 _tmp22_;
		_tmp17_ = msg;
		_tmp18_ = dc_message_get_timestamp (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = prev;
		_tmp21_ = dc_message_get_timestamp (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp15_ = !dc_message_row_same_day (_tmp19_, _tmp22_);
	}
	if (_tmp15_) {
		GtkBox* _tmp23_;
		DcMessage* _tmp24_;
		gint64 _tmp25_;
		gint64 _tmp26_;
		GtkWidget* _tmp27_;
		GtkWidget* _tmp28_;
		_tmp23_ = container;
		_tmp24_ = msg;
		_tmp25_ = dc_message_get_timestamp (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = dc_message_row_build_date_separator (_tmp26_);
		_tmp28_ = _tmp27_;
		gtk_box_append (_tmp23_, _tmp28_);
		_g_object_unref0 (_tmp28_);
	}
	if (dc_conversation_view_search_filter_active (self)) {
		_tmp29_ = NULL;
	} else {
		DcMessage* _tmp30_;
		_tmp30_ = prev;
		_tmp29_ = _tmp30_;
	}
	_tmp31_ = msg;
	_tmp32_ = trailing;
	_tmp33_ = self->priv->settings;
	_tmp34_ = dc_settings_manager_get_bubble_avatar_display (_tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = self->priv->mention_roster;
	_tmp37_ = self->priv->reaction_roster;
	_tmp38_ = self->priv->rpc;
	_tmp39_ = dc_rpc_client_get_account_id (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = dc_message_row_new (_tmp31_, _tmp29_, _tmp32_, is_img_continuation, _tmp35_, dc_conversation_view_bubble_avatars_apply_to_this_chat (self), self->priv->chat_kind != DC_CHAT_KIND_DIRECT, _tmp36_, _tmp37_, _tmp40_);
	g_object_ref_sink (_tmp41_);
	row = _tmp41_;
	_tmp42_ = row;
	g_signal_connect_object (_tmp42_, "selection-toggled", (GCallback) dc_conversation_view_on_row_selection_toggled, (GObject*) self, (GConnectFlags) 0);
	_tmp43_ = row;
	g_signal_connect_object (_tmp43_, "quote-clicked", (GCallback) dc_conversation_view_on_row_quote_clicked, (GObject*) self, (GConnectFlags) 0);
	_tmp44_ = row;
	g_signal_connect_object (_tmp44_, "action-requested", (GCallback) dc_conversation_view_on_message_row_action_requested, (GObject*) self, (GConnectFlags) 0);
	_tmp45_ = row;
	g_signal_connect_object (_tmp45_, "full-message-requested", (GCallback) dc_conversation_view_on_row_full_message_requested, (GObject*) self, (GConnectFlags) 0);
	_tmp46_ = row;
	g_signal_connect_object (_tmp46_, "full-message-view-requested", (GCallback) dc_conversation_view_on_row_full_message_view_requested, (GObject*) self, (GConnectFlags) 0);
	_tmp47_ = row;
	g_signal_connect_object (_tmp47_, "checkbox-toggle-requested", (GCallback) dc_conversation_view_on_row_checkbox_toggle_requested, (GObject*) self, (GConnectFlags) 0);
	_tmp48_ = msg;
	_tmp49_ = dc_message_get_highlighted (_tmp48_);
	_tmp50_ = _tmp49_;
	if (_tmp50_) {
		DcMessage* _tmp51_;
		DcMessageRow* _tmp52_;
		_tmp51_ = msg;
		dc_message_set_highlighted (_tmp51_, FALSE);
		_tmp52_ = row;
		dc_message_row_highlight (_tmp52_);
	}
	_tmp53_ = container;
	_tmp54_ = row;
	gtk_box_append (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = li;
	_tmp56_ = container;
	gtk_list_item_set_child (_tmp55_, (GtkWidget*) _tmp56_);
	_tmp57_ = li;
	gtk_list_item_set_selectable (_tmp57_, FALSE);
	_tmp58_ = li;
	gtk_list_item_set_activatable (_tmp58_, FALSE);
	_tmp59_ = li;
	gtk_list_item_set_focusable (_tmp59_, FALSE);
	_g_object_unref0 (row);
	_g_object_unref0 (container);
	_g_ptr_array_unref0 (trailing);
	_g_object_unref0 (prev);
	_g_object_unref0 (msg);
	_g_object_unref0 (li);
}

static void
___lambda168__gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                 GObject* object,
                                                 gpointer self)
{
	__lambda168_ ((DcConversationView*) self, object);
}

static void
_dc_conversation_view_unbind_message_list_item_gtk_signal_list_item_factory_unbind (GtkSignalListItemFactory* _sender,
                                                                                    GObject* object,
                                                                                    gpointer self)
{
	dc_conversation_view_unbind_message_list_item (object);
}

static void
__lambda173_ (DcConversationView* self,
              gint n,
              gdouble x,
              gdouble y)
{
	DcMessageRow* row = NULL;
	DcMessageRow* _tmp0_;
	DcMessageRow* _tmp1_;
	_tmp0_ = dc_conversation_view_pick_message_row (self, x, y);
	row = _tmp0_;
	_tmp1_ = row;
	if (_tmp1_ != NULL) {
		DcMessageActions* _tmp2_;
		DcMessageRow* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		DcMessageRow* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		GtkListView* _tmp9_;
		_tmp2_ = self->priv->msg_actions;
		_tmp3_ = row;
		_tmp4_ = dc_message_row_get_message_id (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = row;
		_tmp7_ = dc_message_row_get_is_outgoing (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = self->priv->message_listview;
		dc_message_actions_show_context_menu (_tmp2_, _tmp5_, _tmp8_, x, y, (GtkWidget*) _tmp9_);
	}
	_g_object_unref0 (row);
}

static void
___lambda173__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda173_ ((DcConversationView*) self, n_press, x, y);
}

static void
__lambda174_ (Block38Data* _data38_,
              gint n,
              gdouble x,
              gdouble y)
{
	DcConversationView* self;
	DcMessageRow* row = NULL;
	DcMessageRow* _tmp0_;
	DcMessageRow* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gboolean _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar** _tmp10_;
	gchar** _tmp11_;
	gint _tmp11__length1;
	gboolean _tmp12_;
	gboolean _tmp13_ = FALSE;
	gboolean text_selection_area = FALSE;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_ = FALSE;
	gboolean _tmp19_ = FALSE;
	gint64 now = 0LL;
	gint dct = 0;
	GtkSettings* gs = NULL;
	GtkSettings* _tmp20_;
	GtkSettings* _tmp21_;
	GtkSettings* _tmp22_;
	gboolean _tmp26_ = FALSE;
	DcMessageRow* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	self = _data38_->self;
	_tmp0_ = dc_conversation_view_pick_message_row (self, x, y);
	row = _tmp0_;
	_tmp1_ = row;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (row);
		return;
	}
	if (self->priv->selection_mode) {
		_data38_->dc_last_id = -1;
		_data38_->dc_last_time = (gint64) 0;
		_g_object_unref0 (row);
		return;
	}
	_tmp2_ = g_strdup ("message-full-text-button");
	_tmp3_ = g_strdup ("webxdc-card");
	_tmp4_ = g_new0 (gchar*, 2 + 1);
	_tmp4_[0] = _tmp2_;
	_tmp4_[1] = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp5__length1 = 2;
	_tmp6_ = dc_conversation_view_pointer_on_css (self, x, y, _tmp5_, (gint) 2);
	_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
	if (_tmp6_) {
		gtk_gesture_set_state ((GtkGesture*) _data38_->dc, GTK_EVENT_SEQUENCE_DENIED);
		_data38_->dc_last_id = -1;
		_data38_->dc_last_time = (gint64) 0;
		_g_object_unref0 (row);
		return;
	}
	_tmp7_ = g_strdup ("reaction-badge");
	_tmp8_ = g_strdup ("markdown-task-toggle");
	_tmp9_ = g_strdup ("message-actions-bar");
	_tmp10_ = g_new0 (gchar*, 3 + 1);
	_tmp10_[0] = _tmp7_;
	_tmp10_[1] = _tmp8_;
	_tmp10_[2] = _tmp9_;
	_tmp11_ = _tmp10_;
	_tmp11__length1 = 3;
	_tmp12_ = dc_conversation_view_pointer_on_css (self, x, y, _tmp11_, (gint) 3);
	_tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_free), NULL);
	if (_tmp12_) {
		_data38_->dc_last_id = -1;
		_data38_->dc_last_time = (gint64) 0;
		_g_object_unref0 (row);
		return;
	}
	if (dc_conversation_view_pointer_on_selectable_text (self, x, y)) {
		_tmp13_ = TRUE;
	} else {
		gboolean _tmp14_ = FALSE;
		DcMessageRow* _tmp15_;
		_tmp15_ = row;
		if (dc_message_row_has_selectable_text (_tmp15_)) {
			_tmp14_ = dc_conversation_view_pointer_on_message_bubble (self, x, y);
		} else {
			_tmp14_ = FALSE;
		}
		_tmp13_ = _tmp14_;
	}
	text_selection_area = _tmp13_;
	if (n >= 3) {
		_tmp17_ = text_selection_area;
	} else {
		_tmp17_ = FALSE;
	}
	if (_tmp17_) {
		DcMessageRow* _tmp18_;
		_tmp18_ = row;
		_tmp16_ = dc_message_row_select_all_text (_tmp18_);
	} else {
		_tmp16_ = FALSE;
	}
	if (_tmp16_) {
		gtk_gesture_set_state ((GtkGesture*) _data38_->dc, GTK_EVENT_SEQUENCE_CLAIMED);
		_data38_->dc_last_id = -1;
		_data38_->dc_last_time = (gint64) 0;
		_g_object_unref0 (row);
		return;
	}
	if (text_selection_area) {
		_tmp19_ = TRUE;
	} else {
		_tmp19_ = dc_conversation_view_pointer_on_audio (self, x, y);
	}
	if (_tmp19_) {
		_data38_->dc_last_id = -1;
		_data38_->dc_last_time = (gint64) 0;
		_g_object_unref0 (row);
		return;
	}
	dc_conversation_view_hold_scroll_on_focus_shift (self);
	now = g_get_monotonic_time () / 1000;
	dct = 400;
	_tmp20_ = gtk_settings_get_default ();
	_tmp21_ = _g_object_ref0 (_tmp20_);
	gs = _tmp21_;
	_tmp22_ = gs;
	if (_tmp22_ != NULL) {
		GtkSettings* _tmp23_;
		gint _tmp24_;
		gint _tmp25_;
		_tmp23_ = gs;
		g_object_get (_tmp23_, "gtk-double-click-time", &_tmp24_, NULL);
		_tmp25_ = _tmp24_;
		dct = _tmp25_;
	}
	_tmp27_ = row;
	_tmp28_ = dc_message_row_get_message_id (_tmp27_);
	_tmp29_ = _tmp28_;
	if (_tmp29_ == _data38_->dc_last_id) {
		_tmp26_ = (now - _data38_->dc_last_time) <= ((gint64) dct);
	} else {
		_tmp26_ = FALSE;
	}
	if (_tmp26_) {
		DcMessageActions* _tmp30_;
		DcMessageRow* _tmp31_;
		gint _tmp32_;
		gint _tmp33_;
		DcMessageRow* _tmp34_;
		gboolean _tmp35_;
		gboolean _tmp36_;
		GtkListView* _tmp37_;
		_data38_->dc_last_id = -1;
		_data38_->dc_last_time = (gint64) 0;
		_tmp30_ = self->priv->msg_actions;
		_tmp31_ = row;
		_tmp32_ = dc_message_row_get_message_id (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = row;
		_tmp35_ = dc_message_row_get_is_outgoing (_tmp34_);
		_tmp36_ = _tmp35_;
		_tmp37_ = self->priv->message_listview;
		dc_message_actions_handle_double_click (_tmp30_, _tmp33_, _tmp36_, x, y, (GtkWidget*) _tmp37_);
	} else {
		DcMessageRow* _tmp38_;
		gint _tmp39_;
		gint _tmp40_;
		DcMessage* msg = NULL;
		GListStore* _tmp41_;
		DcMessageRow* _tmp42_;
		gint _tmp43_;
		gint _tmp44_;
		DcMessage* _tmp45_;
		gboolean _tmp46_ = FALSE;
		DcMessage* _tmp47_;
		_tmp38_ = row;
		_tmp39_ = dc_message_row_get_message_id (_tmp38_);
		_tmp40_ = _tmp39_;
		_data38_->dc_last_id = _tmp40_;
		_data38_->dc_last_time = now;
		_tmp41_ = self->priv->message_store;
		_tmp42_ = row;
		_tmp43_ = dc_message_row_get_message_id (_tmp42_);
		_tmp44_ = _tmp43_;
		_tmp45_ = dc_find_message ((GListModel*) _tmp41_, _tmp44_);
		msg = _tmp45_;
		_tmp47_ = msg;
		if (_tmp47_ != NULL) {
			DcMessage* _tmp48_;
			gchar* _tmp49_;
			gchar* _tmp50_;
			gchar** _tmp51_;
			gchar** _tmp52_;
			gint _tmp52__length1;
			_tmp48_ = msg;
			_tmp49_ = g_strdup ("message-image");
			_tmp50_ = g_strdup ("message-video-frame");
			_tmp51_ = g_new0 (gchar*, 2 + 1);
			_tmp51_[0] = _tmp49_;
			_tmp51_[1] = _tmp50_;
			_tmp52_ = _tmp51_;
			_tmp52__length1 = 2;
			_tmp46_ = dc_conversation_view_should_activate_message_at_pointer (self, _tmp48_, dc_conversation_view_pointer_on_css (self, x, y, _tmp52_, (gint) 2));
			_tmp52_ = (_vala_array_free (_tmp52_, _tmp52__length1, (GDestroyNotify) g_free), NULL);
		} else {
			_tmp46_ = FALSE;
		}
		if (_tmp46_) {
			DcMessage* _tmp53_;
			_tmp53_ = msg;
			dc_conversation_view_on_message_activated (self, _tmp53_);
		}
		_g_object_unref0 (msg);
	}
	_g_object_unref0 (gs);
	_g_object_unref0 (row);
}

static void
___lambda174__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda174_ (self, n_press, x, y);
}

static void
__lambda183_ (DcConversationView* self)
{
	GtkCustomFilter* _tmp0_;
	_tmp0_ = self->priv->message_filter;
	gtk_filter_changed ((GtkFilter*) _tmp0_, GTK_FILTER_CHANGE_DIFFERENT);
}

static void
___lambda183__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                               gpointer self)
{
	__lambda183_ ((DcConversationView*) self);
}

static void
__lambda184_ (DcConversationView* self)
{
	dc_conversation_view_scroll_to_bottom (self);
}

static void
___lambda184__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda184_ ((DcConversationView*) self);
}

static void
_dc_conversation_view_on_link_previews_requested_dc_compose_bar_link_previews_requested (DcComposeBar* _sender,
                                                                                         gchar** urls,
                                                                                         gint urls_length1,
                                                                                         guint generation,
                                                                                         gpointer self)
{
	dc_conversation_view_on_link_previews_requested ((DcConversationView*) self, urls, urls_length1, generation);
}

static void
_dc_conversation_view_on_send_message_dc_compose_bar_send_message (DcComposeBar* _sender,
                                                                   const gchar* text,
                                                                   const gchar* file_path,
                                                                   const gchar* file_name,
                                                                   gint quote_msg_id,
                                                                   gpointer self)
{
	dc_conversation_view_on_send_message ((DcConversationView*) self, text, file_path, file_name, quote_msg_id);
}

static void
_dc_conversation_view_on_send_voice_message_dc_compose_bar_send_voice_message (DcComposeBar* _sender,
                                                                               const gchar* file_path,
                                                                               const gchar* text,
                                                                               gint quote_msg_id,
                                                                               gboolean temporary,
                                                                               gpointer self)
{
	dc_conversation_view_on_send_voice_message ((DcConversationView*) self, file_path, text, quote_msg_id, temporary);
}

static void
_dc_conversation_view_on_draft_changed_dc_compose_bar_draft_changed (DcComposeBar* _sender,
                                                                     const gchar* text,
                                                                     const gchar* file_path,
                                                                     const gchar* file_name,
                                                                     gint quote_msg_id,
                                                                     gboolean voice,
                                                                     gpointer self)
{
	dc_conversation_view_on_draft_changed ((DcConversationView*) self, text, file_path, file_name, quote_msg_id, voice);
}

static void
__lambda187_ (DcConversationView* self,
              gint msg_id,
              const gchar* new_text)
{
	DcMessageActions* _tmp0_;
	g_return_if_fail (new_text != NULL);
	_tmp0_ = self->priv->msg_actions;
	dc_message_actions_edit_message (_tmp0_, msg_id, new_text, NULL, NULL);
}

static void
___lambda187__dc_compose_bar_edit_message (DcComposeBar* _sender,
                                           gint msg_id,
                                           const gchar* new_text,
                                           gpointer self)
{
	__lambda187_ ((DcConversationView*) self, msg_id, new_text);
}

static void
__lambda188_ (DcConversationView* self)
{
	DcMessageActions* _tmp0_;
	_tmp0_ = self->priv->msg_actions;
	dc_message_actions_start_editing_last (_tmp0_);
}

static void
___lambda188__dc_compose_bar_edit_last_requested (DcComposeBar* _sender,
                                                  gpointer self)
{
	__lambda188_ ((DcConversationView*) self);
}

static void
dc_conversation_view_build_ui (DcConversationView* self)
{
	Block38Data* _data38_;
	GtkScrolledWindow* _tmp0_;
	GtkScrolledWindow* _tmp1_;
	GtkScrolledWindow* _tmp2_;
	GtkScrolledWindow* _tmp3_;
	GtkScrolledWindow* _tmp4_;
	GtkScrolledWindow* _tmp5_;
	GtkAdjustment* adjustment = NULL;
	GtkScrolledWindow* _tmp6_;
	GtkAdjustment* _tmp7_;
	GtkAdjustment* _tmp8_;
	GtkAdjustment* _tmp9_;
	GtkAdjustment* _tmp10_;
	GtkAdjustment* _tmp11_;
	gulong _tmp12_;
	GtkAdjustment* _tmp13_;
	GtkAdjustment* _tmp14_;
	gulong _tmp15_;
	GtkAdjustment* _tmp16_;
	GtkAdjustment* _tmp17_;
	gulong _tmp18_;
	GtkEventControllerScroll* wheel = NULL;
	GtkEventControllerScroll* _tmp19_;
	GtkEventControllerScroll* _tmp20_;
	GtkEventControllerScroll* _tmp21_;
	GtkEventControllerScroll* _tmp22_;
	gulong _tmp23_;
	GtkScrolledWindow* _tmp24_;
	GtkEventControllerScroll* _tmp25_;
	GtkEventController* _tmp26_;
	GtkGestureClick* scrollbar_press = NULL;
	GtkGestureClick* _tmp27_;
	GtkGestureClick* _tmp28_;
	GtkGestureClick* _tmp29_;
	GtkGestureClick* _tmp30_;
	gulong _tmp31_;
	GtkScrolledWindow* _tmp32_;
	GtkWidget* _tmp33_;
	GtkGestureClick* _tmp34_;
	GtkEventController* _tmp35_;
	GtkCustomFilter* _tmp36_;
	GListStore* _tmp37_;
	GListModel* _tmp38_;
	GtkCustomFilter* _tmp39_;
	GtkFilter* _tmp40_;
	GtkFilterListModel* _tmp41_;
	GtkSignalListItemFactory* factory = NULL;
	GtkSignalListItemFactory* _tmp42_;
	GtkSignalListItemFactory* _tmp43_;
	GtkSignalListItemFactory* _tmp44_;
	gulong _tmp45_;
	GtkSignalListItemFactory* _tmp46_;
	GtkNoSelection* selection = NULL;
	GtkFilterListModel* _tmp47_;
	GListModel* _tmp48_;
	GtkNoSelection* _tmp49_;
	GtkNoSelection* _tmp50_;
	GtkSelectionModel* _tmp51_;
	GtkSignalListItemFactory* _tmp52_;
	GtkListItemFactory* _tmp53_;
	GtkListView* _tmp54_;
	GtkListView* _tmp55_;
	GtkListView* _tmp56_;
	GtkListView* _tmp57_;
	GtkListView* _tmp58_;
	GtkListView* _tmp59_;
	DcSettingsManager* _tmp60_;
	DcMessageStyle _tmp61_;
	DcMessageStyle _tmp62_;
	GtkGestureClick* rc = NULL;
	GtkGestureClick* _tmp64_;
	gulong _tmp65_;
	GtkListView* _tmp66_;
	GtkEventController* _tmp67_;
	GtkGestureClick* _tmp68_;
	gulong _tmp69_;
	GtkListView* _tmp70_;
	GtkEventController* _tmp71_;
	GtkScrolledWindow* _tmp72_;
	GtkListView* _tmp73_;
	GtkSearchEntry* _tmp74_;
	GtkSearchEntry* _tmp75_;
	GtkSearchEntry* _tmp76_;
	GtkSearchEntry* _tmp77_;
	GtkSearchEntry* _tmp78_;
	GtkSearchEntry* _tmp79_;
	GtkSearchEntry* _tmp80_;
	GtkSearchEntry* _tmp81_;
	GtkSearchEntry* _tmp82_;
	gulong _tmp83_;
	GtkRevealer* _tmp84_;
	GtkRevealer* _tmp85_;
	GtkSearchEntry* _tmp86_;
	GtkRevealer* _tmp87_;
	GtkRevealer* _tmp88_;
	GtkRevealer* _tmp89_;
	DcConversationMediaBar* _tmp90_;
	DcPinnedMessagesManager* _tmp91_;
	GtkRevealer* _tmp92_;
	GtkRevealer* _tmp93_;
	DcWebxdcAppsBar* _tmp94_;
	GtkRevealer* _tmp95_;
	GtkRevealer* _tmp96_;
	GtkButton* _tmp97_;
	GtkButton* _tmp98_;
	GtkButton* _tmp99_;
	GtkButton* _tmp100_;
	GtkButton* _tmp101_;
	GtkButton* _tmp102_;
	GtkButton* _tmp103_;
	GtkButton* _tmp104_;
	GtkButton* _tmp105_;
	GtkButton* _tmp106_;
	GtkButton* _tmp107_;
	gulong _tmp108_;
	GtkBox* loading_pill = NULL;
	GtkBox* _tmp109_;
	GtkSpinner* _tmp110_;
	GtkSpinner* _tmp111_;
	GtkLabel* _tmp112_;
	GtkLabel* _tmp113_;
	GtkRevealer* _tmp114_;
	GtkRevealer* _tmp115_;
	GtkRevealer* _tmp116_;
	GtkRevealer* _tmp117_;
	GtkRevealer* _tmp118_;
	GtkRevealer* _tmp119_;
	GtkRevealer* _tmp120_;
	GtkRevealer* _tmp121_;
	GtkOverlay* scroll_overlay = NULL;
	GtkOverlay* _tmp122_;
	GtkScrolledWindow* _tmp123_;
	GtkButton* _tmp124_;
	GtkRevealer* _tmp125_;
	DcComposeBar* _tmp126_;
	DcComposeBar* _tmp127_;
	DcComposeBar* _tmp128_;
	DcSettingsManager* _tmp129_;
	DcComposeBar* _tmp130_;
	DcSettingsManager* _tmp131_;
	DcComposeBar* _tmp132_;
	DcSettingsManager* _tmp133_;
	DcComposeBar* _tmp134_;
	DcComposeBar* _tmp135_;
	DcComposeBar* _tmp136_;
	gulong _tmp137_;
	DcComposeBar* _tmp138_;
	DcComposeBar* _tmp139_;
	gulong _tmp140_;
	DcComposeBar* _tmp141_;
	DcComposeBar* _tmp142_;
	gulong _tmp143_;
	DcComposeBar* _tmp144_;
	DcComposeBar* _tmp145_;
	gulong _tmp146_;
	DcComposeBar* _tmp147_;
	DcComposeBar* _tmp148_;
	gulong _tmp149_;
	DcComposeBar* _tmp150_;
	DcComposeBar* _tmp151_;
	gulong _tmp152_;
	DcComposeBar* _tmp153_;
	GtkBox* _tmp154_;
	GtkBox* _tmp155_;
	GtkBox* _tmp156_;
	GtkBox* _tmp157_;
	g_return_if_fail (self != NULL);
	_data38_ = g_slice_new0 (Block38Data);
	_data38_->_ref_count_ = 1;
	_data38_->self = g_object_ref (self);
	_tmp0_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->message_scroll);
	self->priv->message_scroll = _tmp0_;
	_tmp1_ = self->priv->message_scroll;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	_tmp2_ = self->priv->message_scroll;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp2_, TRUE);
	_tmp3_ = self->priv->message_scroll;
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_FILL);
	_tmp4_ = self->priv->message_scroll;
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_FILL);
	_tmp5_ = self->priv->message_scroll;
	g_object_set (_tmp5_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp6_ = self->priv->message_scroll;
	_tmp7_ = gtk_scrolled_window_get_vadjustment (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	adjustment = _tmp9_;
	_tmp10_ = adjustment;
	_tmp11_ = adjustment;
	_tmp12_ = g_signal_connect_object ((GObject*) _tmp11_, "notify::upper", (GCallback) _dc_conversation_view_on_scroll_bounds_changed_g_object_notify, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp10_, _tmp12_);
	_tmp13_ = adjustment;
	_tmp14_ = adjustment;
	_tmp15_ = g_signal_connect_object ((GObject*) _tmp14_, "notify::page-size", (GCallback) _dc_conversation_view_on_scroll_bounds_changed_g_object_notify, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp13_, _tmp15_);
	_tmp16_ = adjustment;
	_tmp17_ = adjustment;
	_tmp18_ = g_signal_connect_object ((GObject*) _tmp17_, "notify::value", (GCallback) ___lambda164__g_object_notify, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp16_, _tmp18_);
	_tmp19_ = (GtkEventControllerScroll*) gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);
	wheel = _tmp19_;
	_tmp20_ = wheel;
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp20_, GTK_PHASE_CAPTURE);
	_tmp21_ = wheel;
	_tmp22_ = wheel;
	_tmp23_ = g_signal_connect_object (_tmp22_, "scroll", (GCallback) ___lambda165__gtk_event_controller_scroll_scroll, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp21_, _tmp23_);
	_tmp24_ = self->priv->message_scroll;
	_tmp25_ = wheel;
	_tmp26_ = _g_object_ref0 ((GtkEventController*) _tmp25_);
	gtk_widget_add_controller ((GtkWidget*) _tmp24_, _tmp26_);
	_tmp27_ = (GtkGestureClick*) gtk_gesture_click_new ();
	scrollbar_press = _tmp27_;
	_tmp28_ = scrollbar_press;
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp28_, GTK_PHASE_CAPTURE);
	_tmp29_ = scrollbar_press;
	_tmp30_ = scrollbar_press;
	_tmp31_ = g_signal_connect_object (_tmp30_, "pressed", (GCallback) ___lambda166__gtk_gesture_click_pressed, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp29_, _tmp31_);
	_tmp32_ = self->priv->message_scroll;
	_tmp33_ = gtk_scrolled_window_get_vscrollbar (_tmp32_);
	_tmp34_ = scrollbar_press;
	_tmp35_ = _g_object_ref0 ((GtkEventController*) _tmp34_);
	gtk_widget_add_controller (_tmp33_, _tmp35_);
	_tmp36_ = dc_conversation_view_create_message_filter (self);
	_g_object_unref0 (self->priv->message_filter);
	self->priv->message_filter = _tmp36_;
	_tmp37_ = self->priv->message_store;
	_tmp38_ = _g_object_ref0 ((GListModel*) _tmp37_);
	_tmp39_ = self->priv->message_filter;
	_tmp40_ = _g_object_ref0 ((GtkFilter*) _tmp39_);
	_tmp41_ = gtk_filter_list_model_new (_tmp38_, _tmp40_);
	_g_object_unref0 (self->priv->filtered_message_store);
	self->priv->filtered_message_store = _tmp41_;
	_tmp42_ = (GtkSignalListItemFactory*) gtk_signal_list_item_factory_new ();
	factory = _tmp42_;
	_tmp43_ = factory;
	_tmp44_ = factory;
	_tmp45_ = g_signal_connect_object (_tmp44_, "bind", (GCallback) ___lambda168__gtk_signal_list_item_factory_bind, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp43_, _tmp45_);
	_tmp46_ = factory;
	g_signal_connect (_tmp46_, "unbind", (GCallback) _dc_conversation_view_unbind_message_list_item_gtk_signal_list_item_factory_unbind, NULL);
	_tmp47_ = self->priv->filtered_message_store;
	_tmp48_ = _g_object_ref0 ((GListModel*) _tmp47_);
	_tmp49_ = gtk_no_selection_new (_tmp48_);
	selection = _tmp49_;
	_tmp50_ = selection;
	_tmp51_ = _g_object_ref0 ((GtkSelectionModel*) _tmp50_);
	_tmp52_ = factory;
	_tmp53_ = _g_object_ref0 ((GtkListItemFactory*) _tmp52_);
	_tmp54_ = (GtkListView*) gtk_list_view_new (_tmp51_, _tmp53_);
	g_object_ref_sink (_tmp54_);
	_g_object_unref0 (self->priv->message_listview);
	self->priv->message_listview = _tmp54_;
	_tmp55_ = self->priv->message_listview;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp55_, TRUE);
	_tmp56_ = self->priv->message_listview;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp56_, TRUE);
	_tmp57_ = self->priv->message_listview;
	gtk_widget_set_halign ((GtkWidget*) _tmp57_, GTK_ALIGN_FILL);
	_tmp58_ = self->priv->message_listview;
	gtk_widget_set_valign ((GtkWidget*) _tmp58_, GTK_ALIGN_FILL);
	_tmp59_ = self->priv->message_listview;
	gtk_widget_add_css_class ((GtkWidget*) _tmp59_, "boxed-list-separate");
	_tmp60_ = self->priv->settings;
	_tmp61_ = dc_settings_manager_get_message_style (_tmp60_);
	_tmp62_ = _tmp61_;
	if (_tmp62_ == DC_MESSAGE_STYLE_WORKSPACE) {
		GtkListView* _tmp63_;
		_tmp63_ = self->priv->message_listview;
		gtk_widget_set_margin_bottom ((GtkWidget*) _tmp63_, 10);
	}
	_tmp64_ = (GtkGestureClick*) gtk_gesture_click_new ();
	rc = _tmp64_;
	gtk_gesture_single_set_button ((GtkGestureSingle*) rc, (guint) 3);
	_tmp65_ = g_signal_connect_object (rc, "pressed", (GCallback) ___lambda173__gtk_gesture_click_pressed, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) rc, _tmp65_);
	_tmp66_ = self->priv->message_listview;
	_tmp67_ = _g_object_ref0 ((GtkEventController*) rc);
	gtk_widget_add_controller ((GtkWidget*) _tmp66_, _tmp67_);
	_tmp68_ = (GtkGestureClick*) gtk_gesture_click_new ();
	_data38_->dc = _tmp68_;
	gtk_gesture_single_set_button ((GtkGestureSingle*) _data38_->dc, (guint) 1);
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _data38_->dc, GTK_PHASE_CAPTURE);
	_data38_->dc_last_id = -1;
	_data38_->dc_last_time = (gint64) 0;
	_tmp69_ = g_signal_connect_data (_data38_->dc, "pressed", (GCallback) ___lambda174__gtk_gesture_click_pressed, block38_data_ref (_data38_), (GClosureNotify) block38_data_unref, 0);
	dc_conversation_view_track_signal (self, (GObject*) _data38_->dc, _tmp69_);
	_tmp70_ = self->priv->message_listview;
	_tmp71_ = _g_object_ref0 ((GtkEventController*) _data38_->dc);
	gtk_widget_add_controller ((GtkWidget*) _tmp70_, _tmp71_);
	_tmp72_ = self->priv->message_scroll;
	_tmp73_ = self->priv->message_listview;
	gtk_scrolled_window_set_child (_tmp72_, (GtkWidget*) _tmp73_);
	_tmp74_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp74_);
	_g_object_unref0 (self->priv->message_search_entry);
	self->priv->message_search_entry = _tmp74_;
	_tmp75_ = self->priv->message_search_entry;
	g_object_set (_tmp75_, "placeholder-text", "Search in conversation\u2026", NULL);
	_tmp76_ = self->priv->message_search_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp76_, TRUE);
	_tmp77_ = self->priv->message_search_entry;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp77_, 8);
	_tmp78_ = self->priv->message_search_entry;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp78_, 8);
	_tmp79_ = self->priv->message_search_entry;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp79_, 4);
	_tmp80_ = self->priv->message_search_entry;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp80_, 4);
	_tmp81_ = self->priv->message_search_entry;
	_tmp82_ = self->priv->message_search_entry;
	_tmp83_ = g_signal_connect_object (_tmp82_, "search-changed", (GCallback) ___lambda183__gtk_search_entry_search_changed, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp81_, _tmp83_);
	_tmp84_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp84_);
	_g_object_unref0 (self->priv->message_search_revealer);
	self->priv->message_search_revealer = _tmp84_;
	_tmp85_ = self->priv->message_search_revealer;
	_tmp86_ = self->priv->message_search_entry;
	gtk_revealer_set_child (_tmp85_, (GtkWidget*) _tmp86_);
	_tmp87_ = self->priv->message_search_revealer;
	gtk_revealer_set_reveal_child (_tmp87_, FALSE);
	_tmp88_ = self->priv->message_search_revealer;
	gtk_revealer_set_transition_type (_tmp88_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	_tmp89_ = self->priv->message_search_revealer;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp89_);
	_tmp90_ = self->priv->media_bar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp90_);
	_tmp91_ = self->priv->pinned;
	_tmp92_ = dc_pinned_messages_manager_get_revealer (_tmp91_);
	_tmp93_ = _tmp92_;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp93_);
	_tmp94_ = self->priv->webxdc_bar;
	_tmp95_ = dc_webxdc_apps_bar_get_revealer (_tmp94_);
	_tmp96_ = _tmp95_;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp96_);
	_tmp97_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp97_);
	_g_object_unref0 (self->priv->scroll_down_btn);
	self->priv->scroll_down_btn = _tmp97_;
	_tmp98_ = self->priv->scroll_down_btn;
	gtk_button_set_icon_name (_tmp98_, "go-down-symbolic");
	_tmp99_ = self->priv->scroll_down_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp99_, "circular");
	_tmp100_ = self->priv->scroll_down_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp100_, "osd");
	_tmp101_ = self->priv->scroll_down_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp101_, "scroll-down-btn");
	_tmp102_ = self->priv->scroll_down_btn;
	gtk_widget_set_halign ((GtkWidget*) _tmp102_, GTK_ALIGN_CENTER);
	_tmp103_ = self->priv->scroll_down_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp103_, GTK_ALIGN_END);
	_tmp104_ = self->priv->scroll_down_btn;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp104_, 12);
	_tmp105_ = self->priv->scroll_down_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp105_, FALSE);
	_tmp106_ = self->priv->scroll_down_btn;
	_tmp107_ = self->priv->scroll_down_btn;
	_tmp108_ = g_signal_connect_object (_tmp107_, "clicked", (GCallback) ___lambda184__gtk_button_clicked, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp106_, _tmp108_);
	_tmp109_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp109_);
	loading_pill = _tmp109_;
	gtk_widget_add_css_class ((GtkWidget*) loading_pill, "osd");
	gtk_widget_add_css_class ((GtkWidget*) loading_pill, "loading-pill");
	_tmp110_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_tmp110_);
	_g_object_unref0 (self->priv->loading_more_spinner);
	self->priv->loading_more_spinner = _tmp110_;
	_tmp111_ = self->priv->loading_more_spinner;
	gtk_box_append (loading_pill, (GtkWidget*) _tmp111_);
	_tmp112_ = (GtkLabel*) gtk_label_new ("Loading…");
	g_object_ref_sink (_tmp112_);
	_g_object_unref0 (self->priv->loading_pill_label);
	self->priv->loading_pill_label = _tmp112_;
	_tmp113_ = self->priv->loading_pill_label;
	gtk_box_append (loading_pill, (GtkWidget*) _tmp113_);
	_tmp114_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp114_);
	_g_object_unref0 (self->priv->loading_more_revealer);
	self->priv->loading_more_revealer = _tmp114_;
	_tmp115_ = self->priv->loading_more_revealer;
	gtk_revealer_set_child (_tmp115_, (GtkWidget*) loading_pill);
	_tmp116_ = self->priv->loading_more_revealer;
	gtk_revealer_set_reveal_child (_tmp116_, FALSE);
	_tmp117_ = self->priv->loading_more_revealer;
	gtk_revealer_set_transition_type (_tmp117_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	_tmp118_ = self->priv->loading_more_revealer;
	gtk_widget_set_halign ((GtkWidget*) _tmp118_, GTK_ALIGN_CENTER);
	_tmp119_ = self->priv->loading_more_revealer;
	gtk_widget_set_valign ((GtkWidget*) _tmp119_, GTK_ALIGN_START);
	_tmp120_ = self->priv->loading_more_revealer;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp120_, 12);
	_tmp121_ = self->priv->loading_more_revealer;
	gtk_widget_set_can_target ((GtkWidget*) _tmp121_, FALSE);
	_tmp122_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp122_);
	scroll_overlay = _tmp122_;
	_tmp123_ = self->priv->message_scroll;
	gtk_overlay_set_child (scroll_overlay, (GtkWidget*) _tmp123_);
	gtk_widget_set_hexpand ((GtkWidget*) scroll_overlay, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) scroll_overlay, TRUE);
	gtk_widget_set_halign ((GtkWidget*) scroll_overlay, GTK_ALIGN_FILL);
	gtk_widget_set_valign ((GtkWidget*) scroll_overlay, GTK_ALIGN_FILL);
	_tmp124_ = self->priv->scroll_down_btn;
	gtk_overlay_add_overlay (scroll_overlay, (GtkWidget*) _tmp124_);
	_tmp125_ = self->priv->loading_more_revealer;
	gtk_overlay_add_overlay (scroll_overlay, (GtkWidget*) _tmp125_);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) scroll_overlay);
	_tmp126_ = dc_compose_bar_new ();
	g_object_ref_sink (_tmp126_);
	_g_object_unref0 (self->priv->compose_bar);
	self->priv->compose_bar = _tmp126_;
	_tmp127_ = self->priv->compose_bar;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp127_, TRUE);
	_tmp128_ = self->priv->compose_bar;
	gtk_widget_set_halign ((GtkWidget*) _tmp128_, GTK_ALIGN_FILL);
	_tmp129_ = self->priv->settings;
	_tmp130_ = self->priv->compose_bar;
	g_object_bind_property_with_closures ((GObject*) _tmp129_, "shift-enter-sends", (GObject*) _tmp130_, "shift-enter-sends", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp131_ = self->priv->settings;
	_tmp132_ = self->priv->compose_bar;
	g_object_bind_property_with_closures ((GObject*) _tmp131_, "clean-pasted-links", (GObject*) _tmp132_, "clean-pasted-links", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp133_ = self->priv->settings;
	_tmp134_ = self->priv->compose_bar;
	g_object_bind_property_with_closures ((GObject*) _tmp133_, "link-previews", (GObject*) _tmp134_, "link-previews", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp135_ = self->priv->compose_bar;
	_tmp136_ = self->priv->compose_bar;
	_tmp137_ = g_signal_connect_object (_tmp136_, "link-previews-requested", (GCallback) _dc_conversation_view_on_link_previews_requested_dc_compose_bar_link_previews_requested, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp135_, _tmp137_);
	_tmp138_ = self->priv->compose_bar;
	_tmp139_ = self->priv->compose_bar;
	_tmp140_ = g_signal_connect_object (_tmp139_, "send-message", (GCallback) _dc_conversation_view_on_send_message_dc_compose_bar_send_message, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp138_, _tmp140_);
	_tmp141_ = self->priv->compose_bar;
	_tmp142_ = self->priv->compose_bar;
	_tmp143_ = g_signal_connect_object (_tmp142_, "send-voice-message", (GCallback) _dc_conversation_view_on_send_voice_message_dc_compose_bar_send_voice_message, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp141_, _tmp143_);
	_tmp144_ = self->priv->compose_bar;
	_tmp145_ = self->priv->compose_bar;
	_tmp146_ = g_signal_connect_object (_tmp145_, "draft-changed", (GCallback) _dc_conversation_view_on_draft_changed_dc_compose_bar_draft_changed, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp144_, _tmp146_);
	_tmp147_ = self->priv->compose_bar;
	_tmp148_ = self->priv->compose_bar;
	_tmp149_ = g_signal_connect_object (_tmp148_, "edit-message", (GCallback) ___lambda187__dc_compose_bar_edit_message, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp147_, _tmp149_);
	_tmp150_ = self->priv->compose_bar;
	_tmp151_ = self->priv->compose_bar;
	_tmp152_ = g_signal_connect_object (_tmp151_, "edit-last-requested", (GCallback) ___lambda188__dc_compose_bar_edit_last_requested, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp150_, _tmp152_);
	_tmp153_ = self->priv->compose_bar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp153_);
	_tmp154_ = dc_conversation_view_build_selection_bar (self);
	_g_object_unref0 (self->priv->selection_bar);
	self->priv->selection_bar = _tmp154_;
	_tmp155_ = self->priv->selection_bar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp155_);
	_tmp156_ = dc_conversation_view_build_request_bar (self);
	_g_object_unref0 (self->priv->request_bar);
	self->priv->request_bar = _tmp156_;
	_tmp157_ = self->priv->request_bar;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp157_);
	dc_conversation_view_install_file_drop_target (self);
	_g_object_unref0 (scroll_overlay);
	_g_object_unref0 (loading_pill);
	_g_object_unref0 (rc);
	_g_object_unref0 (selection);
	_g_object_unref0 (factory);
	_g_object_unref0 (scrollbar_press);
	_g_object_unref0 (wheel);
	_g_object_unref0 (adjustment);
	block38_data_unref (_data38_);
	_data38_ = NULL;
}

static void
dc_conversation_view_on_message_row_action_requested (DcMessageRow* row,
                                                      const gchar* action,
                                                      GtkWidget* anchor,
                                                      DcConversationView* view)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (row != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (anchor != NULL);
	g_return_if_fail (view != NULL);
	if (view->priv->closed) {
		return;
	}
	_tmp0_ = dc_message_row_get_message_id (row);
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_message_row_get_is_outgoing (row);
	_tmp3_ = _tmp2_;
	dc_conversation_view_on_row_action (view, _tmp1_, _tmp3_, action, anchor);
}

static void
dc_conversation_view_on_row_selection_toggled (DcMessageRow* row,
                                               gint msg_id,
                                               gboolean active,
                                               DcConversationView* view)
{
	g_return_if_fail (row != NULL);
	g_return_if_fail (view != NULL);
	if (!view->priv->closed) {
		dc_conversation_view_update_selection_actions (view);
	}
}

static void
dc_conversation_view_on_row_quote_clicked (DcMessageRow* row,
                                           gint quote_id,
                                           DcConversationView* view)
{
	g_return_if_fail (row != NULL);
	g_return_if_fail (view != NULL);
	if (!view->priv->closed) {
		dc_conversation_view_scroll_to_message (view, quote_id);
	}
}

static void
dc_conversation_view_on_row_full_message_requested (DcMessageRow* row,
                                                    gint msg_id,
                                                    DcConversationView* view)
{
	g_return_if_fail (row != NULL);
	g_return_if_fail (view != NULL);
	if (!view->priv->closed) {
		dc_conversation_view_toggle_full_message (view, msg_id, NULL, NULL);
	}
}

static void
dc_conversation_view_on_row_full_message_view_requested (DcMessageRow* row,
                                                         gint msg_id,
                                                         DcConversationView* view)
{
	g_return_if_fail (row != NULL);
	g_return_if_fail (view != NULL);
	if (!view->priv->closed) {
		dc_conversation_view_view_full_message (view, msg_id, NULL, NULL);
	}
}

static void
dc_conversation_view_on_row_checkbox_toggle_requested (DcMessageRow* row,
                                                       gint msg_id,
                                                       const gchar* new_text,
                                                       DcConversationView* view)
{
	g_return_if_fail (row != NULL);
	g_return_if_fail (new_text != NULL);
	g_return_if_fail (view != NULL);
	if (!view->priv->closed) {
		DcMessageActions* _tmp0_;
		_tmp0_ = view->priv->msg_actions;
		dc_message_actions_edit_message (_tmp0_, msg_id, new_text, NULL, NULL);
	}
}

static Block39Data*
block39_data_ref (Block39Data* _data39_)
{
	g_atomic_int_inc (&_data39_->_ref_count_);
	return _data39_;
}

static void
block39_data_unref (void * _userdata_)
{
	Block39Data* _data39_;
	_data39_ = (Block39Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data39_->_ref_count_)) {
		g_weak_ref_clear (&_data39_->view_ref);
		g_slice_free (Block39Data, _data39_);
	}
}

static gboolean
__lambda167_ (Block39Data* _data39_,
              GObject* item)
{
	DcConversationView* view = NULL;
	GObject* _tmp0_;
	DcConversationView* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	DcConversationView* _tmp4_;
	gboolean result;
	g_return_val_if_fail (item != NULL, FALSE);
	_tmp0_ = g_weak_ref_get (&_data39_->view_ref);
	_tmp1_ = DC_IS_CONVERSATION_VIEW (_tmp0_) ? ((DcConversationView*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	view = _tmp1_;
	_tmp4_ = view;
	if (_tmp4_ == NULL) {
		_tmp3_ = TRUE;
	} else {
		DcConversationView* _tmp5_;
		_tmp5_ = view;
		_tmp3_ = _tmp5_->priv->closed;
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		DcConversationView* _tmp6_;
		_tmp6_ = view;
		_tmp2_ = dc_conversation_view_filter_message (_tmp6_, item);
	}
	result = _tmp2_;
	_g_object_unref0 (view);
	return result;
}

static gboolean
___lambda167__gtk_custom_filter_func (GObject* item,
                                      gpointer self)
{
	gboolean result;
	result = __lambda167_ (self, item);
	return result;
}

static GtkCustomFilter*
dc_conversation_view_create_message_filter (DcConversationView* target)
{
	Block39Data* _data39_;
	GtkCustomFilter* _tmp0_;
	GtkCustomFilter* result;
	g_return_val_if_fail (target != NULL, NULL);
	_data39_ = g_slice_new0 (Block39Data);
	_data39_->_ref_count_ = 1;
	g_weak_ref_init (&_data39_->view_ref, (GObject*) target);
	_tmp0_ = gtk_custom_filter_new (___lambda167__gtk_custom_filter_func, block39_data_ref (_data39_), block39_data_unref);
	result = _tmp0_;
	block39_data_unref (_data39_);
	_data39_ = NULL;
	return result;
}

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

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
dc_conversation_view_filter_message (DcConversationView* self,
                                     GObject* item)
{
	GtkRevealer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gchar* query = NULL;
	GtkSearchEntry* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	DcMessage* msg = NULL;
	DcMessage* _tmp13_;
	gboolean _tmp14_ = FALSE;
	DcMessage* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (item != NULL, FALSE);
	_tmp0_ = self->priv->message_search_revealer;
	_tmp1_ = gtk_revealer_get_reveal_child (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		result = TRUE;
		return result;
	}
	_tmp3_ = self->priv->message_search_entry;
	_tmp4_ = gtk_editable_get_text ((GtkEditable*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = string_strip (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_utf8_strdown (_tmp7_, (gssize) -1);
	_tmp9_ = _tmp8_;
	_g_free0 (_tmp7_);
	query = _tmp9_;
	_tmp10_ = query;
	_tmp11_ = strlen (_tmp10_);
	_tmp12_ = _tmp11_;
	if (_tmp12_ == 0) {
		result = TRUE;
		_g_free0 (query);
		return result;
	}
	_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (item, DC_TYPE_MESSAGE, DcMessage));
	msg = _tmp13_;
	_tmp15_ = msg;
	_tmp16_ = dc_message_get_text (_tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_ != NULL) {
		DcMessage* _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		const gchar* _tmp23_;
		_tmp18_ = msg;
		_tmp19_ = dc_message_get_text (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = g_utf8_strdown (_tmp20_, (gssize) -1);
		_tmp22_ = _tmp21_;
		_tmp23_ = query;
		_tmp14_ = string_contains (_tmp22_, _tmp23_);
		_g_free0 (_tmp22_);
	} else {
		_tmp14_ = FALSE;
	}
	result = _tmp14_;
	_g_object_unref0 (msg);
	_g_free0 (query);
	return result;
}

static void
dc_conversation_view_unbind_message_list_item (GObject* obj)
{
	GtkListItem* item = NULL;
	GtkListItem* _tmp0_;
	g_return_if_fail (obj != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_list_item_get_type (), GtkListItem));
	item = _tmp0_;
	gtk_list_item_set_child (item, NULL);
	_g_object_unref0 (item);
}

static Block40Data*
block40_data_ref (Block40Data* _data40_)
{
	g_atomic_int_inc (&_data40_->_ref_count_);
	return _data40_;
}

static void
block40_data_unref (void * _userdata_)
{
	Block40Data* _data40_;
	_data40_ = (Block40Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data40_->_ref_count_)) {
		DcConversationView* self;
		self = _data40_->self;
		_g_object_unref0 (_data40_->next);
		_g_object_unref0 (_data40_->current_item);
		_g_object_unref0 (_data40_->playback);
		_g_object_unref0 (self);
		g_slice_free (Block40Data, _data40_);
	}
}

static gboolean
__lambda163_ (Block40Data* _data40_)
{
	DcConversationView* self;
	gboolean _tmp0_ = FALSE;
	DcAudioPlayback* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	self = _data40_->self;
	_tmp1_ = _data40_->playback;
	_tmp2_ = dc_audio_playback_get_playing (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		DcAudioPlayback* _tmp4_;
		DcAudioPlaybackItem* _tmp5_;
		DcAudioPlaybackItem* _tmp6_;
		DcAudioPlaybackItem* _tmp7_;
		_tmp4_ = _data40_->playback;
		_tmp5_ = dc_audio_playback_get_current_item (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _data40_->current_item;
		_tmp0_ = _tmp6_ == _tmp7_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		DcAudioPlayback* _tmp8_;
		DcMessage* _tmp9_;
		DcRpcClient* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		_tmp8_ = _data40_->playback;
		_tmp9_ = _data40_->next;
		_tmp10_ = self->priv->rpc;
		_tmp11_ = dc_rpc_client_get_account_id (_tmp10_);
		_tmp12_ = _tmp11_;
		dc_audio_playback_play_message (_tmp8_, _tmp9_, _tmp12_);
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda163__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda163_ (self);
	return result;
}

static void
dc_conversation_view_queue_next_voice_message (DcConversationView* self,
                                               gint current_msg_id)
{
	Block40Data* _data40_;
	DcAudioPlayback* _tmp0_;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	gboolean _tmp5_ = FALSE;
	DcAudioPlaybackItem* _tmp6_;
	DcMessage* _tmp10_;
	DcMessage* _tmp11_;
	g_return_if_fail (self != NULL);
	_data40_ = g_slice_new0 (Block40Data);
	_data40_->_ref_count_ = 1;
	_data40_->self = g_object_ref (self);
	_tmp0_ = dc_audio_playback_shared ();
	_data40_->playback = _tmp0_;
	_tmp1_ = _data40_->playback;
	_tmp2_ = dc_audio_playback_get_current_item (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_data40_->current_item = _tmp4_;
	_tmp6_ = _data40_->current_item;
	if (_tmp6_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		DcAudioPlaybackItem* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp7_ = _data40_->current_item;
		_tmp8_ = dc_audio_playback_item_get_message_id (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_ = _tmp9_ != current_msg_id;
	}
	if (_tmp5_) {
		block40_data_unref (_data40_);
		_data40_ = NULL;
		return;
	}
	_tmp10_ = dc_conversation_view_find_adjacent_voice_message (self, current_msg_id, 1);
	_data40_->next = _tmp10_;
	_tmp11_ = _data40_->next;
	if (_tmp11_ == NULL) {
		block40_data_unref (_data40_);
		_data40_ = NULL;
		return;
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda163__gsource_func, block40_data_ref (_data40_), block40_data_unref);
	block40_data_unref (_data40_);
	_data40_ = NULL;
}

static DcMessage*
dc_conversation_view_find_adjacent_voice_message (DcConversationView* self,
                                                  gint current_msg_id,
                                                  gint direction)
{
	gint current = 0;
	GListStore* _tmp0_;
	gint count = 0;
	GListStore* _tmp1_;
	gboolean _tmp2_ = FALSE;
	DcMessage* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->message_store;
	current = dc_find_message_index ((GListModel*) _tmp0_, current_msg_id);
	_tmp1_ = self->priv->message_store;
	count = (gint) g_list_model_get_n_items ((GListModel*) _tmp1_);
	if (current < 0) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = direction == 0;
	}
	if (_tmp2_) {
		result = NULL;
		return result;
	}
	{
		gint i = 0;
		i = current + direction;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gboolean _tmp4_ = FALSE;
				DcMessage* msg = NULL;
				GListStore* _tmp5_;
				GObject* _tmp6_;
				gboolean _tmp7_ = FALSE;
				DcMessage* _tmp8_;
				gboolean _tmp9_;
				gboolean _tmp10_;
				if (!_tmp3_) {
					i += direction;
				}
				_tmp3_ = FALSE;
				if (i >= 0) {
					_tmp4_ = i < count;
				} else {
					_tmp4_ = FALSE;
				}
				if (!_tmp4_) {
					break;
				}
				_tmp5_ = self->priv->message_store;
				_tmp6_ = g_list_model_get_item ((GListModel*) _tmp5_, (guint) i);
				msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, DC_TYPE_MESSAGE, DcMessage);
				_tmp8_ = msg;
				_tmp9_ = dc_message_get_has_local_file (_tmp8_);
				_tmp10_ = _tmp9_;
				if (_tmp10_) {
					DcMessage* _tmp11_;
					_tmp11_ = msg;
					_tmp7_ = dc_message_is_audio_file (_tmp11_);
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					result = msg;
					return result;
				}
				_g_object_unref0 (msg);
			}
		}
	}
	result = NULL;
	return result;
}

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

void
dc_conversation_view_play_adjacent_voice_message (DcConversationView* self,
                                                  gint direction,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	DcConversationViewPlayAdjacentVoiceMessageData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewPlayAdjacentVoiceMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_play_adjacent_voice_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->direction = direction;
	dc_conversation_view_play_adjacent_voice_message_co (_data_);
}

void
dc_conversation_view_play_adjacent_voice_message_finish (DcConversationView* self,
                                                         GAsyncResult* _res_)
{
	DcConversationViewPlayAdjacentVoiceMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_play_adjacent_voice_message_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	DcConversationViewPlayAdjacentVoiceMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_play_adjacent_voice_message_co (_data_);
}

static gboolean
dc_conversation_view_play_adjacent_voice_message_co (DcConversationViewPlayAdjacentVoiceMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dc_audio_playback_shared ();
	_data_->playback = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->playback;
	_data_->_tmp2_ = dc_audio_playback_get_current_item (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = _g_object_ref0 (_data_->_tmp3_);
	_data_->current_item = _data_->_tmp4_;
	_data_->_tmp7_ = _data_->current_item;
	if (_data_->_tmp7_ == NULL) {
		_data_->_tmp6_ = TRUE;
	} else {
		_data_->_tmp8_ = _data_->current_item;
		_data_->_tmp9_ = dc_audio_playback_item_get_account_id (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = _data_->self->priv->rpc;
		_data_->_tmp12_ = dc_rpc_client_get_account_id (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp6_ = _data_->_tmp10_ != _data_->_tmp13_;
	}
	if (_data_->_tmp6_) {
		_data_->_tmp5_ = TRUE;
	} else {
		_data_->_tmp14_ = _data_->current_item;
		_data_->_tmp15_ = dc_audio_playback_item_get_chat_id (_data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp17_ = _data_->self->priv->_chat_id;
		_data_->_tmp5_ = _data_->_tmp16_ != _data_->_tmp17_;
	}
	if (_data_->_tmp5_) {
		_g_object_unref0 (_data_->current_item);
		_g_object_unref0 (_data_->playback);
		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_->_tmp18_ = _data_->current_item;
	_data_->_tmp19_ = dc_audio_playback_item_get_message_id (_data_->_tmp18_);
	_data_->_tmp20_ = _data_->_tmp19_;
	_data_->_tmp21_ = dc_conversation_view_find_adjacent_voice_message (_data_->self, _data_->_tmp20_, _data_->direction);
	_data_->msg = _data_->_tmp21_;
	_data_->_tmp22_ = _data_->msg;
	if (_data_->_tmp22_ != NULL) {
		_data_->_tmp23_ = _data_->playback;
		_data_->_tmp24_ = _data_->msg;
		_data_->_tmp25_ = _data_->self->priv->rpc;
		_data_->_tmp26_ = dc_rpc_client_get_account_id (_data_->_tmp25_);
		_data_->_tmp27_ = _data_->_tmp26_;
		dc_audio_playback_play_message (_data_->_tmp23_, _data_->_tmp24_, _data_->_tmp27_);
		_g_object_unref0 (_data_->msg);
		_g_object_unref0 (_data_->current_item);
		_g_object_unref0 (_data_->playback);
		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;
	}
	if (_data_->direction >= 0) {
		_data_->_tmp30_ = TRUE;
	} else {
		_data_->_tmp30_ = _data_->self->priv->loading_more;
	}
	if (_data_->_tmp30_) {
		_data_->_tmp29_ = TRUE;
	} else {
		_data_->_tmp31_ = _data_->self->priv->all_msg_ids;
		_data_->_tmp29_ = _data_->_tmp31_ == NULL;
	}
	if (_data_->_tmp29_) {
		_data_->_tmp28_ = TRUE;
	} else {
		_data_->_tmp28_ = _data_->self->priv->loaded_start_index == ((guint) 0);
	}
	if (_data_->_tmp28_) {
		_g_object_unref0 (_data_->msg);
		_g_object_unref0 (_data_->current_item);
		_g_object_unref0 (_data_->playback);
		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_->_tmp32_ = _data_->current_item;
	_data_->_tmp33_ = dc_audio_playback_item_get_message_id (_data_->_tmp32_);
	_data_->_tmp34_ = _data_->_tmp33_;
	_data_->current_id = _data_->_tmp34_;
	_data_->_tmp35_ = _data_->self->priv->message_listview;
	_data_->_tmp36_ = 0.0;
	_data_->_tmp37_ = dc_conversation_view_find_message_row (_data_->self, (GtkWidget*) _data_->_tmp35_, 0, &_data_->_tmp36_);
	_data_->anchor_top = _data_->_tmp36_;
	_data_->anchor = _data_->_tmp37_;
	_data_->_tmp39_ = _data_->anchor;
	if (_data_->_tmp39_ != NULL) {
		_data_->_tmp40_ = _data_->anchor;
		_data_->_tmp41_ = dc_message_row_get_message_id (_data_->_tmp40_);
		_data_->_tmp42_ = _data_->_tmp41_;
		_data_->_tmp38_ = _data_->_tmp42_;
	} else {
		_data_->_tmp38_ = 0;
	}
	_data_->anchor_id = _data_->_tmp38_;
	_data_->self->priv->loading_more = TRUE;
	dc_conversation_view_set_loading_more_visible (_data_->self, TRUE);
	if (_data_->self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM) {
		_data_->self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
	}
	{
		while (TRUE) {
			if (_data_->self->priv->loaded_start_index > ((guint) 0)) {
				_data_->_tmp44_ = _data_->playback;
				_data_->_tmp45_ = dc_audio_playback_get_current_item (_data_->_tmp44_);
				_data_->_tmp46_ = _data_->_tmp45_;
				_data_->_tmp47_ = _data_->current_item;
				_data_->_tmp43_ = _data_->_tmp46_ == _data_->_tmp47_;
			} else {
				_data_->_tmp43_ = FALSE;
			}
			if (!_data_->_tmp43_) {
				break;
			}
			if (_data_->self->priv->loaded_start_index > ((guint) 100)) {
				_data_->_tmp48_ = _data_->self->priv->loaded_start_index - 100;
			} else {
				_data_->_tmp48_ = (guint) 0;
			}
			_data_->new_start = _data_->_tmp48_;
			_data_->_state_ = 1;
			dc_conversation_view_fetch_messages_batch (_data_->self, _data_->new_start, _data_->self->priv->loaded_start_index, dc_conversation_view_play_adjacent_voice_message_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp49_ = dc_conversation_view_fetch_messages_batch_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			_data_->messages = _data_->_tmp49_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp50_ = _data_->self->priv->message_store;
			_data_->_tmp51_ = _data_->messages;
			_data_->_tmp52_ = 0;
			_data_->_tmp53_ = dc_conversation_view_pinned_message_batch (_data_->self, _data_->_tmp51_, &_data_->_tmp52_);
			_data_->_tmp54_ = _data_->_tmp53_;
			_data_->_tmp54__length1 = _data_->_tmp52_;
			g_list_store_splice (_data_->_tmp50_, (guint) 0, (guint) 0, _data_->_tmp54_, (guint) _data_->_tmp52_);
			_data_->_tmp54_ = (_vala_array_free (_data_->_tmp54_, _data_->_tmp54__length1, (GDestroyNotify) g_object_unref), NULL);
			dc_conversation_view_flush_pending_seen (_data_->self);
			_data_->self->priv->loaded_start_index = _data_->new_start;
			dc_conversation_view_update_conversation_media_bar (_data_->self);
			_data_->_tmp55_ = dc_conversation_view_find_adjacent_voice_message (_data_->self, _data_->current_id, -1);
			_g_object_unref0 (_data_->msg);
			_data_->msg = _data_->_tmp55_;
			_data_->_tmp56_ = _data_->msg;
			if (_data_->_tmp56_ != NULL) {
				_g_ptr_array_unref0 (_data_->messages);
				break;
			}
			_g_ptr_array_unref0 (_data_->messages);
		}
		_data_->_tmp58_ = _data_->msg;
		if (_data_->_tmp58_ != NULL) {
			_data_->_tmp59_ = _data_->playback;
			_data_->_tmp60_ = dc_audio_playback_get_current_item (_data_->_tmp59_);
			_data_->_tmp61_ = _data_->_tmp60_;
			_data_->_tmp62_ = _data_->current_item;
			_data_->_tmp57_ = _data_->_tmp61_ == _data_->_tmp62_;
		} else {
			_data_->_tmp57_ = FALSE;
		}
		if (_data_->_tmp57_) {
			_data_->_tmp63_ = _data_->playback;
			_data_->_tmp64_ = _data_->msg;
			_data_->_tmp65_ = _data_->self->priv->rpc;
			_data_->_tmp66_ = dc_rpc_client_get_account_id (_data_->_tmp65_);
			_data_->_tmp67_ = _data_->_tmp66_;
			dc_audio_playback_play_message (_data_->_tmp63_, _data_->_tmp64_, _data_->_tmp67_);
		}
		if (_data_->anchor_id != 0) {
			_data_->_tmp69_ = _data_->self->priv->filtered_message_store;
			_data_->_tmp68_ = dc_find_message_index ((GListModel*) _data_->_tmp69_, _data_->anchor_id);
		} else {
			_data_->_tmp68_ = -1;
		}
		_data_->anchor_pos = _data_->_tmp68_;
		if (_data_->anchor_pos >= 0) {
			dc_conversation_view_anchor_message (_data_->self, _data_->anchor_id, (guint) _data_->anchor_pos, _data_->anchor_top, (guint) 0);
		}
		dc_conversation_view_finish_loading_earlier (_data_->self, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		dc_conversation_view_finish_loading_earlier (_data_->self, FALSE);
		_data_->_tmp70_ = _data_->self->priv->window;
		_data_->_tmp71_ = _data_->e;
		_data_->_tmp72_ = _data_->_tmp71_->message;
		_data_->_tmp73_ = g_strconcat ("Failed to load previous voice message: ", _data_->_tmp72_, NULL);
		_data_->_tmp74_ = _data_->_tmp73_;
		dc_window_show_toast (_data_->_tmp70_, _data_->_tmp74_);
		_g_free0 (_data_->_tmp74_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->anchor);
		_g_object_unref0 (_data_->msg);
		_g_object_unref0 (_data_->current_item);
		_g_object_unref0 (_data_->playback);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->anchor);
	_g_object_unref0 (_data_->msg);
	_g_object_unref0 (_data_->current_item);
	_g_object_unref0 (_data_->playback);
	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
dc_conversation_view_update_conversation_media_bar (DcConversationView* self)
{
	DcAudioPlayback* playback = NULL;
	DcAudioPlayback* _tmp0_;
	DcAudioPlaybackItem* item = NULL;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	DcAudioPlaybackItem* _tmp7_;
	gint current_id = 0;
	DcAudioPlaybackItem* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	DcMessage* msg = NULL;
	GListStore* _tmp21_;
	DcMessage* _tmp22_;
	DcMessage* _tmp23_;
	gboolean _tmp24_ = FALSE;
	DcMessage* _tmp25_;
	DcMessage* _tmp26_;
	gboolean _tmp27_;
	DcAudioPlayback* _tmp28_;
	DcMessage* _tmp29_;
	DcMessage* _tmp30_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_audio_playback_shared ();
	playback = _tmp0_;
	_tmp1_ = playback;
	_tmp2_ = dc_audio_playback_get_current_item (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	item = _tmp4_;
	_tmp7_ = item;
	if (_tmp7_ == NULL) {
		_tmp6_ = TRUE;
	} else {
		DcAudioPlaybackItem* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		DcRpcClient* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		_tmp8_ = item;
		_tmp9_ = dc_audio_playback_item_get_account_id (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = self->priv->rpc;
		_tmp12_ = dc_rpc_client_get_account_id (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp6_ = _tmp10_ != _tmp13_;
	}
	if (_tmp6_) {
		_tmp5_ = TRUE;
	} else {
		DcAudioPlaybackItem* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		_tmp14_ = item;
		_tmp15_ = dc_audio_playback_item_get_chat_id (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = self->priv->_chat_id;
		_tmp5_ = _tmp16_ != _tmp17_;
	}
	if (_tmp5_) {
		_g_object_unref0 (item);
		_g_object_unref0 (playback);
		return;
	}
	_tmp18_ = item;
	_tmp19_ = dc_audio_playback_item_get_message_id (_tmp18_);
	_tmp20_ = _tmp19_;
	current_id = _tmp20_;
	_tmp21_ = self->priv->message_store;
	_tmp22_ = dc_find_message ((GListModel*) _tmp21_, current_id);
	msg = _tmp22_;
	_tmp23_ = msg;
	if (_tmp23_ == NULL) {
		_g_object_unref0 (msg);
		_g_object_unref0 (item);
		_g_object_unref0 (playback);
		return;
	}
	_tmp25_ = dc_conversation_view_find_adjacent_voice_message (self, current_id, -1);
	_tmp26_ = _tmp25_;
	_tmp27_ = _tmp26_ != NULL;
	_g_object_unref0 (_tmp26_);
	if (_tmp27_) {
		_tmp24_ = TRUE;
	} else {
		_tmp24_ = self->priv->loaded_start_index > ((guint) 0);
	}
	_tmp28_ = playback;
	_tmp29_ = dc_conversation_view_find_adjacent_voice_message (self, current_id, 1);
	_tmp30_ = _tmp29_;
	dc_audio_playback_set_navigation (_tmp28_, _tmp24_, _tmp30_ != NULL);
	_g_object_unref0 (_tmp30_);
	_g_object_unref0 (msg);
	_g_object_unref0 (item);
	_g_object_unref0 (playback);
}

static void
dc_conversation_view_on_row_action (DcConversationView* self,
                                    gint msg_id,
                                    gboolean is_outgoing,
                                    const gchar* action,
                                    GtkWidget* anchor)
{
	gdouble ax = 0.0;
	gdouble ay = 0.0;
	graphene_rect_t bounds = {0};
	GtkListView* _tmp0_;
	graphene_rect_t _tmp1_ = {0};
	gboolean _tmp2_;
	const gchar* _tmp11_;
	GQuark _tmp13_ = 0U;
	static GQuark _tmp12_label0 = 0;
	static GQuark _tmp12_label1 = 0;
	static GQuark _tmp12_label2 = 0;
	static GQuark _tmp12_label3 = 0;
	static GQuark _tmp12_label4 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (anchor != NULL);
	if (self->priv->selection_mode) {
		return;
	}
	ax = (gdouble) 0;
	ay = (gdouble) 0;
	_tmp0_ = self->priv->message_listview;
	_tmp2_ = gtk_widget_compute_bounds (anchor, (GtkWidget*) _tmp0_, &_tmp1_);
	bounds = _tmp1_;
	if (_tmp2_) {
		graphene_rect_t _tmp3_;
		graphene_point_t _tmp4_;
		graphene_rect_t _tmp5_;
		graphene_size_t _tmp6_;
		graphene_rect_t _tmp7_;
		graphene_point_t _tmp8_;
		graphene_rect_t _tmp9_;
		graphene_size_t _tmp10_;
		_tmp3_ = bounds;
		_tmp4_ = _tmp3_.origin;
		_tmp5_ = bounds;
		_tmp6_ = _tmp5_.size;
		ax = (gdouble) (_tmp4_.x + (_tmp6_.width / 2));
		_tmp7_ = bounds;
		_tmp8_ = _tmp7_.origin;
		_tmp9_ = bounds;
		_tmp10_ = _tmp9_.size;
		ay = (gdouble) (_tmp8_.y + _tmp10_.height);
	}
	_tmp11_ = action;
	_tmp13_ = (NULL == _tmp11_) ? 0 : g_quark_from_string (_tmp11_);
	if (_tmp13_ == ((0 != _tmp12_label0) ? _tmp12_label0 : (_tmp12_label0 = g_quark_from_static_string ("react")))) {
		switch (0) {
			default:
			{
				DcMessageActions* _tmp14_;
				GtkListView* _tmp15_;
				_tmp14_ = self->priv->msg_actions;
				_tmp15_ = self->priv->message_listview;
				dc_message_actions_show_reaction_menu (_tmp14_, msg_id, (GtkWidget*) _tmp15_, ax, ay);
				break;
			}
		}
	} else if (_tmp13_ == ((0 != _tmp12_label1) ? _tmp12_label1 : (_tmp12_label1 = g_quark_from_static_string ("reply")))) {
		switch (0) {
			default:
			{
				DcMessageActions* _tmp16_;
				_tmp16_ = self->priv->msg_actions;
				dc_message_actions_start_replying (_tmp16_, msg_id);
				break;
			}
		}
	} else if (_tmp13_ == ((0 != _tmp12_label2) ? _tmp12_label2 : (_tmp12_label2 = g_quark_from_static_string ("forward")))) {
		switch (0) {
			default:
			{
				DcMessageActions* _tmp17_;
				_tmp17_ = self->priv->msg_actions;
				dc_message_actions_start_forwarding (_tmp17_, msg_id);
				break;
			}
		}
	} else if (_tmp13_ == ((0 != _tmp12_label3) ? _tmp12_label3 : (_tmp12_label3 = g_quark_from_static_string ("pin")))) {
		switch (0) {
			default:
			{
				DcPinnedMessagesManager* _tmp18_;
				_tmp18_ = self->priv->pinned;
				dc_pinned_messages_manager_toggle_pin (_tmp18_, msg_id, NULL, NULL);
				break;
			}
		}
	} else if (_tmp13_ == ((0 != _tmp12_label4) ? _tmp12_label4 : (_tmp12_label4 = g_quark_from_static_string ("webxdc")))) {
		switch (0) {
			default:
			{
				DcMessage* msg = NULL;
				GListStore* _tmp19_;
				DcMessage* _tmp20_;
				DcMessage* _tmp21_;
				_tmp19_ = self->priv->message_store;
				_tmp20_ = dc_find_message ((GListModel*) _tmp19_, msg_id);
				msg = _tmp20_;
				_tmp21_ = msg;
				if (_tmp21_ != NULL) {
					DcWindow* _tmp22_;
					DcWindow* _tmp23_;
					DcRpcClient* _tmp24_;
					DcMessage* _tmp25_;
					_tmp22_ = self->priv->window;
					_tmp23_ = self->priv->window;
					_tmp24_ = self->priv->rpc;
					_tmp25_ = msg;
					dc_window_prompt_webxdc_app (_tmp22_, (GtkWidget*) _tmp23_, _tmp24_, _tmp25_, NULL, NULL);
				}
				_g_object_unref0 (msg);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				DcMessageActions* _tmp26_;
				GtkListView* _tmp27_;
				_tmp26_ = self->priv->msg_actions;
				_tmp27_ = self->priv->message_listview;
				dc_message_actions_show_context_menu (_tmp26_, msg_id, is_outgoing, ax, ay, (GtkWidget*) _tmp27_);
				break;
			}
		}
	}
}

static void
dc_conversation_view_on_scroll_bounds_changed (DcConversationView* self)
{
	GtkButton* _tmp0_;
	g_return_if_fail (self != NULL);
	if (self->priv->loading_chat) {
		return;
	}
	dc_conversation_view_maybe_autoscroll (self);
	_tmp0_ = self->priv->scroll_down_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, !dc_conversation_view_is_near_bottom (self));
	dc_conversation_view_update_date_pill (self);
}

/** Wheel / scrollbar / touchpad input: the user owns the viewport
            now. Cancel an active anchor and a jump that is still loading
            history; load_until_pending_message notices the cleared ID and
            stops fetching. */
static void
dc_conversation_view_on_user_scroll_input (DcConversationView* self)
{
	g_return_if_fail (self != NULL);
	self->priv->pending_scroll_message_id = 0;
	self->priv->pending_voice_direction = 0;
	if (self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR) {
		guint _tmp0_;
		_tmp0_ = self->priv->goal_generation;
		self->priv->goal_generation = _tmp0_ + 1;
		self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
	}
}

static gint
vala_g_ptr_array_get_length (GPtrArray* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) self->len;
	return result;
}

static GPtrArray*
dc_conversation_view_collect_trailing_irc_images (DcConversationView* self,
                                                  DcMessage* msg,
                                                  DcMessage* prev,
                                                  guint pos,
                                                  gboolean* is_continuation)
{
	gboolean _vala_is_continuation = FALSE;
	gboolean _tmp0_ = FALSE;
	DcSettingsManager* _tmp1_;
	DcMessageStyle _tmp2_;
	DcMessageStyle _tmp3_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	GPtrArray* trailing = NULL;
	GPtrArray* _tmp10_;
	GPtrArray* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (msg != NULL, NULL);
	_vala_is_continuation = FALSE;
	_tmp1_ = self->priv->settings;
	_tmp2_ = dc_settings_manager_get_message_style (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != DC_MESSAGE_STYLE_IRC) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp4_ = dc_message_get_is_image_only (msg);
		_tmp5_ = _tmp4_;
		_tmp0_ = !_tmp5_;
	}
	if (_tmp0_) {
		result = NULL;
		if (is_continuation) {
			*is_continuation = _vala_is_continuation;
		}
		return result;
	}
	if (prev != NULL) {
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp8_ = dc_message_get_is_image_only (prev);
		_tmp9_ = _tmp8_;
		_tmp7_ = _tmp9_;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		_tmp6_ = dc_message_row_same_sender (prev, msg);
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		_vala_is_continuation = TRUE;
		result = NULL;
		if (is_continuation) {
			*is_continuation = _vala_is_continuation;
		}
		return result;
	}
	_tmp10_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	trailing = _tmp10_;
	{
		guint i = 0U;
		guint n = 0U;
		GtkFilterListModel* _tmp11_;
		i = pos + 1;
		_tmp11_ = self->priv->filtered_message_store;
		n = g_list_model_get_n_items ((GListModel*) _tmp11_);
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				gboolean _tmp14_ = FALSE;
				DcMessage* next = NULL;
				GtkFilterListModel* _tmp18_;
				GObject* _tmp19_;
				gboolean _tmp20_ = FALSE;
				gboolean _tmp21_ = FALSE;
				DcMessage* _tmp22_;
				GPtrArray* _tmp27_;
				DcMessage* _tmp28_;
				DcMessage* _tmp29_;
				if (!_tmp12_) {
					guint _tmp13_;
					_tmp13_ = i;
					i = _tmp13_ + 1;
				}
				_tmp12_ = FALSE;
				if (i < n) {
					GPtrArray* _tmp15_;
					gint _tmp16_;
					gint _tmp17_;
					_tmp15_ = trailing;
					_tmp16_ = vala_g_ptr_array_get_length (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp14_ = _tmp17_ < 5;
				} else {
					_tmp14_ = FALSE;
				}
				if (!_tmp14_) {
					break;
				}
				_tmp18_ = self->priv->filtered_message_store;
				_tmp19_ = g_list_model_get_item ((GListModel*) _tmp18_, i);
				next = G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, DC_TYPE_MESSAGE, DcMessage);
				_tmp22_ = next;
				if (_tmp22_ == NULL) {
					_tmp21_ = TRUE;
				} else {
					DcMessage* _tmp23_;
					gboolean _tmp24_;
					gboolean _tmp25_;
					_tmp23_ = next;
					_tmp24_ = dc_message_get_is_image_only (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp21_ = !_tmp25_;
				}
				if (_tmp21_) {
					_tmp20_ = TRUE;
				} else {
					DcMessage* _tmp26_;
					_tmp26_ = next;
					_tmp20_ = !dc_message_row_same_sender (msg, _tmp26_);
				}
				if (_tmp20_) {
					_g_object_unref0 (next);
					break;
				}
				_tmp27_ = trailing;
				_tmp28_ = next;
				_tmp29_ = _g_object_ref0 (_tmp28_);
				g_ptr_array_add (_tmp27_, _tmp29_);
				_g_object_unref0 (next);
			}
		}
	}
	result = trailing;
	if (is_continuation) {
		*is_continuation = _vala_is_continuation;
	}
	return result;
}

static void
__lambda189_ (DcConversationView* self)
{
	dc_conversation_view_delete_selected_messages (self, NULL, NULL);
}

static void
___lambda189__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda189_ ((DcConversationView*) self);
}

static void
__lambda190_ (DcConversationView* self)
{
	dc_conversation_view_forward_selected_messages (self);
}

static void
___lambda190__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda190_ ((DcConversationView*) self);
}

static void
__lambda191_ (DcConversationView* self)
{
	dc_conversation_view_end_selection_mode (self);
}

static void
___lambda191__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda191_ ((DcConversationView*) self);
}

static GtkBox*
dc_conversation_view_build_selection_bar (DcConversationView* self)
{
	GtkBox* bar = NULL;
	GtkBox* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	gulong _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkButton* _tmp9_;
	GtkButton* _tmp10_;
	GtkButton* _tmp11_;
	gulong _tmp12_;
	GtkButton* _tmp13_;
	GtkButton* cancel_btn = NULL;
	GtkButton* _tmp14_;
	gulong _tmp15_;
	GtkBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp0_);
	bar = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) bar, "selection-action-bar");
	gtk_widget_set_margin_start ((GtkWidget*) bar, 8);
	gtk_widget_set_margin_end ((GtkWidget*) bar, 8);
	gtk_widget_set_margin_top ((GtkWidget*) bar, 8);
	gtk_widget_set_margin_bottom ((GtkWidget*) bar, 8);
	gtk_widget_set_halign ((GtkWidget*) bar, GTK_ALIGN_FILL);
	gtk_widget_set_hexpand ((GtkWidget*) bar, TRUE);
	gtk_widget_set_visible ((GtkWidget*) bar, FALSE);
	_tmp1_ = (GtkButton*) gtk_button_new_with_label ("Delete");
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->selection_delete_btn);
	self->priv->selection_delete_btn = _tmp1_;
	_tmp2_ = self->priv->selection_delete_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "destructive-action");
	_tmp3_ = self->priv->selection_delete_btn;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = self->priv->selection_delete_btn;
	_tmp5_ = self->priv->selection_delete_btn;
	_tmp6_ = g_signal_connect_object (_tmp5_, "clicked", (GCallback) ___lambda189__gtk_button_clicked, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp4_, _tmp6_);
	_tmp7_ = self->priv->selection_delete_btn;
	gtk_box_append (bar, (GtkWidget*) _tmp7_);
	_tmp8_ = (GtkButton*) gtk_button_new_with_label ("Forward");
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->selection_forward_btn);
	self->priv->selection_forward_btn = _tmp8_;
	_tmp9_ = self->priv->selection_forward_btn;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp9_, TRUE);
	_tmp10_ = self->priv->selection_forward_btn;
	_tmp11_ = self->priv->selection_forward_btn;
	_tmp12_ = g_signal_connect_object (_tmp11_, "clicked", (GCallback) ___lambda190__gtk_button_clicked, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp10_, _tmp12_);
	_tmp13_ = self->priv->selection_forward_btn;
	gtk_box_append (bar, (GtkWidget*) _tmp13_);
	_tmp14_ = (GtkButton*) gtk_button_new_with_label ("Cancel");
	g_object_ref_sink (_tmp14_);
	cancel_btn = _tmp14_;
	gtk_widget_set_hexpand ((GtkWidget*) cancel_btn, TRUE);
	_tmp15_ = g_signal_connect_object (cancel_btn, "clicked", (GCallback) ___lambda191__gtk_button_clicked, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) cancel_btn, _tmp15_);
	gtk_box_append (bar, (GtkWidget*) cancel_btn);
	result = bar;
	_g_object_unref0 (cancel_btn);
	return result;
}

static void
__lambda192_ (DcConversationView* self)
{
	dc_conversation_view_block_request (self, NULL, NULL);
}

static void
___lambda192__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda192_ ((DcConversationView*) self);
}

static void
__lambda193_ (DcConversationView* self)
{
	dc_conversation_view_accept_request (self, NULL, NULL);
}

static void
___lambda193__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda193_ ((DcConversationView*) self);
}

static GtkBox*
dc_conversation_view_build_request_bar (DcConversationView* self)
{
	GtkBox* bar = NULL;
	GtkBox* _tmp0_;
	GtkLabel* notice = NULL;
	GtkLabel* _tmp1_;
	GtkBox* buttons = NULL;
	GtkBox* _tmp2_;
	GtkButton* block_btn = NULL;
	GtkButton* _tmp3_;
	gulong _tmp4_;
	GtkButton* accept_btn = NULL;
	GtkButton* _tmp5_;
	gulong _tmp6_;
	GtkBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp0_);
	bar = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) bar, "contact-request-bar");
	gtk_widget_set_margin_start ((GtkWidget*) bar, 8);
	gtk_widget_set_margin_end ((GtkWidget*) bar, 8);
	gtk_widget_set_margin_top ((GtkWidget*) bar, 8);
	gtk_widget_set_margin_bottom ((GtkWidget*) bar, 8);
	gtk_widget_set_visible ((GtkWidget*) bar, FALSE);
	_tmp1_ = (GtkLabel*) gtk_label_new ("This chat is a contact request. " "Accept it to reply, or block the sender.");
	g_object_ref_sink (_tmp1_);
	notice = _tmp1_;
	gtk_widget_add_css_class ((GtkWidget*) notice, "dim-label");
	gtk_label_set_wrap (notice, TRUE);
	gtk_label_set_justify (notice, GTK_JUSTIFY_CENTER);
	gtk_widget_set_halign ((GtkWidget*) notice, GTK_ALIGN_CENTER);
	gtk_box_append (bar, (GtkWidget*) notice);
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	g_object_ref_sink (_tmp2_);
	buttons = _tmp2_;
	gtk_widget_set_halign ((GtkWidget*) buttons, GTK_ALIGN_CENTER);
	_tmp3_ = (GtkButton*) gtk_button_new_with_label ("Block");
	g_object_ref_sink (_tmp3_);
	block_btn = _tmp3_;
	gtk_widget_add_css_class ((GtkWidget*) block_btn, "destructive-action");
	gtk_widget_add_css_class ((GtkWidget*) block_btn, "pill");
	_tmp4_ = g_signal_connect_object (block_btn, "clicked", (GCallback) ___lambda192__gtk_button_clicked, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) block_btn, _tmp4_);
	gtk_box_append (buttons, (GtkWidget*) block_btn);
	_tmp5_ = (GtkButton*) gtk_button_new_with_label ("Accept");
	g_object_ref_sink (_tmp5_);
	accept_btn = _tmp5_;
	gtk_widget_add_css_class ((GtkWidget*) accept_btn, "suggested-action");
	gtk_widget_add_css_class ((GtkWidget*) accept_btn, "pill");
	_tmp6_ = g_signal_connect_object (accept_btn, "clicked", (GCallback) ___lambda193__gtk_button_clicked, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) accept_btn, _tmp6_);
	gtk_box_append (buttons, (GtkWidget*) accept_btn);
	gtk_box_append (bar, (GtkWidget*) buttons);
	result = bar;
	_g_object_unref0 (accept_btn);
	_g_object_unref0 (block_btn);
	_g_object_unref0 (buttons);
	_g_object_unref0 (notice);
	return result;
}

void
dc_conversation_view_set_contact_request (DcConversationView* self,
                                          gboolean is_request)
{
	g_return_if_fail (self != NULL);
	self->priv->is_contact_request = is_request;
	dc_conversation_view_sync_bottom_bars (self);
}

static void
dc_conversation_view_sync_bottom_bars (DcConversationView* self)
{
	GtkBox* _tmp0_;
	gboolean _tmp1_ = FALSE;
	GtkBox* _tmp2_;
	gboolean _tmp3_ = FALSE;
	DcComposeBar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->selection_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, self->priv->selection_mode);
	if (!self->priv->selection_mode) {
		_tmp1_ = self->priv->is_contact_request;
	} else {
		_tmp1_ = FALSE;
	}
	_tmp2_ = self->priv->request_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, _tmp1_);
	if (!self->priv->selection_mode) {
		_tmp3_ = !self->priv->is_contact_request;
	} else {
		_tmp3_ = FALSE;
	}
	_tmp4_ = self->priv->compose_bar;
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, _tmp3_);
}

static void
dc_conversation_view_begin_selection_mode (DcConversationView* self,
                                           gint initial_msg_id)
{
	g_return_if_fail (self != NULL);
	self->priv->selection_mode = TRUE;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GListStore* _tmp2_;
				DcMessage* msg = NULL;
				GListStore* _tmp3_;
				GObject* _tmp4_;
				DcMessage* _tmp5_;
				DcMessage* _tmp6_;
				DcMessage* _tmp7_;
				gint _tmp8_;
				gint _tmp9_;
				if (!_tmp0_) {
					guint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->message_store;
				if (!(i < g_list_model_get_n_items ((GListModel*) _tmp2_))) {
					break;
				}
				_tmp3_ = self->priv->message_store;
				_tmp4_ = g_list_model_get_item ((GListModel*) _tmp3_, i);
				msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, DC_TYPE_MESSAGE, DcMessage);
				_tmp5_ = msg;
				dc_message_set_selection_visible (_tmp5_, TRUE);
				_tmp6_ = msg;
				g_object_notify ((GObject*) _tmp6_, "selection-visible");
				_tmp7_ = msg;
				_tmp8_ = dc_message_get_id (_tmp7_);
				_tmp9_ = _tmp8_;
				if (_tmp9_ == initial_msg_id) {
					DcMessage* _tmp10_;
					DcMessage* _tmp11_;
					_tmp10_ = msg;
					dc_message_set_selected (_tmp10_, TRUE);
					_tmp11_ = msg;
					g_object_notify ((GObject*) _tmp11_, "selected");
				}
				_g_object_unref0 (msg);
			}
		}
	}
	dc_conversation_view_sync_bottom_bars (self);
	dc_conversation_view_update_selection_actions (self);
}

static void
dc_conversation_view_end_selection_mode (DcConversationView* self)
{
	g_return_if_fail (self != NULL);
	self->priv->selection_mode = FALSE;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GListStore* _tmp2_;
				DcMessage* msg = NULL;
				GListStore* _tmp3_;
				GObject* _tmp4_;
				DcMessage* _tmp5_;
				DcMessage* _tmp6_;
				DcMessage* _tmp7_;
				DcMessage* _tmp8_;
				if (!_tmp0_) {
					guint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->message_store;
				if (!(i < g_list_model_get_n_items ((GListModel*) _tmp2_))) {
					break;
				}
				_tmp3_ = self->priv->message_store;
				_tmp4_ = g_list_model_get_item ((GListModel*) _tmp3_, i);
				msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, DC_TYPE_MESSAGE, DcMessage);
				_tmp5_ = msg;
				dc_message_set_selected (_tmp5_, FALSE);
				_tmp6_ = msg;
				dc_message_set_selection_visible (_tmp6_, FALSE);
				_tmp7_ = msg;
				g_object_notify ((GObject*) _tmp7_, "selected");
				_tmp8_ = msg;
				g_object_notify ((GObject*) _tmp8_, "selection-visible");
				_g_object_unref0 (msg);
			}
		}
	}
	dc_conversation_view_sync_bottom_bars (self);
	dc_conversation_view_update_selection_actions (self);
}

static gint
dc_conversation_view_selected_message_count (DcConversationView* self)
{
	gint count = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	count = 0;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GListStore* _tmp2_;
				DcMessage* msg = NULL;
				GListStore* _tmp3_;
				GObject* _tmp4_;
				DcMessage* _tmp5_;
				gboolean _tmp6_;
				gboolean _tmp7_;
				if (!_tmp0_) {
					guint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->message_store;
				if (!(i < g_list_model_get_n_items ((GListModel*) _tmp2_))) {
					break;
				}
				_tmp3_ = self->priv->message_store;
				_tmp4_ = g_list_model_get_item ((GListModel*) _tmp3_, i);
				msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, DC_TYPE_MESSAGE, DcMessage);
				_tmp5_ = msg;
				_tmp6_ = dc_message_get_selected (_tmp5_);
				_tmp7_ = _tmp6_;
				if (_tmp7_) {
					gint _tmp8_;
					_tmp8_ = count;
					count = _tmp8_ + 1;
				}
				_g_object_unref0 (msg);
			}
		}
	}
	result = count;
	return result;
}

static void
_vala_array_add35 (gint* * array,
                   gint* length,
                   gint* size,
                   gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static gint*
dc_conversation_view_selected_message_ids (DcConversationView* self,
                                           gint* result_length1)
{
	gint* ids = NULL;
	gint* _tmp0_;
	gint ids_length1;
	gint _ids_size_;
	gint* _tmp12_;
	gint _tmp12__length1;
	gint* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gint, 0);
	ids = _tmp0_;
	ids_length1 = 0;
	_ids_size_ = ids_length1;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GListStore* _tmp3_;
				DcMessage* msg = NULL;
				GListStore* _tmp4_;
				GObject* _tmp5_;
				DcMessage* _tmp6_;
				gboolean _tmp7_;
				gboolean _tmp8_;
				if (!_tmp1_) {
					guint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = self->priv->message_store;
				if (!(i < g_list_model_get_n_items ((GListModel*) _tmp3_))) {
					break;
				}
				_tmp4_ = self->priv->message_store;
				_tmp5_ = g_list_model_get_item ((GListModel*) _tmp4_, i);
				msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, DC_TYPE_MESSAGE, DcMessage);
				_tmp6_ = msg;
				_tmp7_ = dc_message_get_selected (_tmp6_);
				_tmp8_ = _tmp7_;
				if (_tmp8_) {
					DcMessage* _tmp9_;
					gint _tmp10_;
					gint _tmp11_;
					_tmp9_ = msg;
					_tmp10_ = dc_message_get_id (_tmp9_);
					_tmp11_ = _tmp10_;
					_vala_array_add35 (&ids, &ids_length1, &_ids_size_, _tmp11_);
				}
				_g_object_unref0 (msg);
			}
		}
	}
	_tmp12_ = ids;
	_tmp12__length1 = ids_length1;
	if (result_length1) {
		*result_length1 = _tmp12__length1;
	}
	result = _tmp12_;
	return result;
}

static gboolean
dc_conversation_view_selected_messages_all_outgoing (DcConversationView* self)
{
	gboolean found = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	found = FALSE;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GListStore* _tmp2_;
				DcMessage* msg = NULL;
				GListStore* _tmp3_;
				GObject* _tmp4_;
				DcMessage* _tmp5_;
				gboolean _tmp6_;
				gboolean _tmp7_;
				DcMessage* _tmp8_;
				gboolean _tmp9_;
				gboolean _tmp10_;
				if (!_tmp0_) {
					guint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->message_store;
				if (!(i < g_list_model_get_n_items ((GListModel*) _tmp2_))) {
					break;
				}
				_tmp3_ = self->priv->message_store;
				_tmp4_ = g_list_model_get_item ((GListModel*) _tmp3_, i);
				msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, DC_TYPE_MESSAGE, DcMessage);
				_tmp5_ = msg;
				_tmp6_ = dc_message_get_selected (_tmp5_);
				_tmp7_ = _tmp6_;
				if (!_tmp7_) {
					_g_object_unref0 (msg);
					continue;
				}
				found = TRUE;
				_tmp8_ = msg;
				_tmp9_ = dc_message_get_is_outgoing (_tmp8_);
				_tmp10_ = _tmp9_;
				if (!_tmp10_) {
					result = FALSE;
					_g_object_unref0 (msg);
					return result;
				}
				_g_object_unref0 (msg);
			}
		}
	}
	result = found;
	return result;
}

static void
dc_conversation_view_update_selection_actions (DcConversationView* self)
{
	gboolean _tmp0_ = FALSE;
	GtkButton* _tmp1_;
	gboolean has_selection = FALSE;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->selection_delete_btn;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		GtkButton* _tmp2_;
		_tmp2_ = self->priv->selection_forward_btn;
		_tmp0_ = _tmp2_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	has_selection = dc_conversation_view_selected_message_count (self) > 0;
	_tmp3_ = self->priv->selection_delete_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, has_selection);
	_tmp4_ = self->priv->selection_forward_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, has_selection);
}

static void
dc_conversation_view_forward_selected_messages (DcConversationView* self)
{
	gint* ids = NULL;
	gint _tmp0_ = 0;
	gint* _tmp1_;
	gint ids_length1;
	gint _ids_size_;
	gint* _tmp2_;
	gint _tmp2__length1;
	DcMessageActions* _tmp3_;
	gint* _tmp4_;
	gint _tmp4__length1;
	g_return_if_fail (self != NULL);
	_tmp1_ = dc_conversation_view_selected_message_ids (self, &_tmp0_);
	ids = _tmp1_;
	ids_length1 = _tmp0_;
	_ids_size_ = ids_length1;
	_tmp2_ = ids;
	_tmp2__length1 = ids_length1;
	if (_tmp2__length1 == 0) {
		ids = (g_free (ids), NULL);
		return;
	}
	_tmp3_ = self->priv->msg_actions;
	_tmp4_ = ids;
	_tmp4__length1 = ids_length1;
	dc_message_actions_start_forwarding_many (_tmp3_, _tmp4_, (gint) _tmp4__length1);
	dc_conversation_view_end_selection_mode (self);
	ids = (g_free (ids), NULL);
}

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

static void
dc_conversation_view_delete_selected_messages (DcConversationView* self,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	DcConversationViewDeleteSelectedMessagesData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewDeleteSelectedMessagesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_delete_selected_messages_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_delete_selected_messages_co (_data_);
}

static void
dc_conversation_view_delete_selected_messages_finish (DcConversationView* self,
                                                      GAsyncResult* _res_)
{
	DcConversationViewDeleteSelectedMessagesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_delete_selected_messages_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	DcConversationViewDeleteSelectedMessagesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_delete_selected_messages_co (_data_);
}

static gboolean
dc_conversation_view_delete_selected_messages_co (DcConversationViewDeleteSelectedMessagesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = 0;
	_data_->_tmp1_ = dc_conversation_view_selected_message_ids (_data_->self, &_data_->_tmp0_);
	_data_->ids = _data_->_tmp1_;
	_data_->ids_length1 = _data_->_tmp0_;
	_data_->_ids_size_ = _data_->ids_length1;
	_data_->_tmp2_ = _data_->ids;
	_data_->_tmp2__length1 = _data_->ids_length1;
	if (_data_->_tmp2__length1 == 0) {
		_data_->ids = (g_free (_data_->ids), NULL);
		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_->ids;
	_data_->_tmp4__length1 = _data_->ids_length1;
	if (_data_->_tmp4__length1 == 1) {
		_data_->_tmp3_ = "Delete Message?";
	} else {
		_data_->_tmp3_ = "Delete Messages?";
	}
	_data_->_tmp5_ = g_strdup (_data_->_tmp3_);
	_data_->title = _data_->_tmp5_;
	_data_->all_outgoing = dc_conversation_view_selected_messages_all_outgoing (_data_->self);
	if (_data_->all_outgoing) {
		_data_->_tmp7_ = _data_->ids;
		_data_->_tmp7__length1 = _data_->ids_length1;
		if (_data_->_tmp7__length1 == 1) {
			_data_->_tmp8_ = g_strdup ("Delete the selected message from your device only, or from all partici" \
"pants? This cannot be undone.");
			_g_free0 (_data_->_tmp6_);
			_data_->_tmp6_ = _data_->_tmp8_;
		} else {
			_data_->_tmp9_ = _data_->ids;
			_data_->_tmp9__length1 = _data_->ids_length1;
			_data_->_tmp10_ = g_strdup_printf ("Delete %d selected messages from your device only, or from all partici" \
"pants? This cannot be undone.", _data_->_tmp9__length1);
			_g_free0 (_data_->_tmp6_);
			_data_->_tmp6_ = _data_->_tmp10_;
		}
		_data_->_tmp11_ = _data_->_tmp6_;
		_data_->_tmp6_ = NULL;
		_g_free0 (_data_->body);
		_data_->body = _data_->_tmp11_;
		_g_free0 (_data_->_tmp6_);
	} else {
		_data_->_tmp13_ = _data_->ids;
		_data_->_tmp13__length1 = _data_->ids_length1;
		if (_data_->_tmp13__length1 == 1) {
			_data_->_tmp14_ = g_strdup ("Delete the selected message from your device? This cannot be undone.");
			_g_free0 (_data_->_tmp12_);
			_data_->_tmp12_ = _data_->_tmp14_;
		} else {
			_data_->_tmp15_ = _data_->ids;
			_data_->_tmp15__length1 = _data_->ids_length1;
			_data_->_tmp16_ = g_strdup_printf ("Delete %d selected messages from your device? This cannot be undone.", _data_->_tmp15__length1);
			_g_free0 (_data_->_tmp12_);
			_data_->_tmp12_ = _data_->_tmp16_;
		}
		_data_->_tmp17_ = _data_->_tmp12_;
		_data_->_tmp12_ = NULL;
		_g_free0 (_data_->body);
		_data_->body = _data_->_tmp17_;
		_g_free0 (_data_->_tmp12_);
	}
	_data_->_tmp18_ = _data_->self->priv->window;
	_data_->_tmp19_ = _data_->title;
	_data_->_tmp20_ = _data_->body;
	_data_->_state_ = 1;
	dc_confirm_delete_options ((GtkWidget*) _data_->_tmp18_, _data_->_tmp19_, _data_->_tmp20_, _data_->all_outgoing, dc_conversation_view_delete_selected_messages_ready, _data_);
	return FALSE;
	_state_1:
	_data_->choice = dc_confirm_delete_options_finish (_data_->_res_);
	if (_data_->choice == DC_DELETE_CHOICE_FOR_ME) {
		_data_->_tmp21_ = _data_->ids;
		_data_->_tmp21__length1 = _data_->ids_length1;
		dc_conversation_view_delete_selected_messages_confirmed (_data_->self, _data_->_tmp21_, (gint) _data_->_tmp21__length1, FALSE, NULL, NULL);
	} else {
		if (_data_->choice == DC_DELETE_CHOICE_FOR_EVERYONE) {
			_data_->_tmp22_ = _data_->ids;
			_data_->_tmp22__length1 = _data_->ids_length1;
			dc_conversation_view_delete_selected_messages_confirmed (_data_->self, _data_->_tmp22_, (gint) _data_->_tmp22__length1, TRUE, NULL, NULL);
		}
	}
	_g_free0 (_data_->body);
	_g_free0 (_data_->title);
	_data_->ids = (g_free (_data_->ids), NULL);
	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
dc_conversation_view_delete_selected_messages_confirmed_data_free (gpointer _data)
{
	DcConversationViewDeleteSelectedMessagesConfirmedData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewDeleteSelectedMessagesConfirmedData, _data_);
}

static void
dc_conversation_view_delete_selected_messages_confirmed (DcConversationView* self,
                                                         gint* ids,
                                                         gint ids_length1,
                                                         gboolean for_all,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_)
{
	DcConversationViewDeleteSelectedMessagesConfirmedData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewDeleteSelectedMessagesConfirmedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_delete_selected_messages_confirmed_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->ids = ids;
	_data_->ids_length1 = ids_length1;
	_data_->for_all = for_all;
	dc_conversation_view_delete_selected_messages_confirmed_co (_data_);
}

static void
dc_conversation_view_delete_selected_messages_confirmed_finish (DcConversationView* self,
                                                                GAsyncResult* _res_)
{
	DcConversationViewDeleteSelectedMessagesConfirmedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_delete_selected_messages_confirmed_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_)
{
	DcConversationViewDeleteSelectedMessagesConfirmedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_delete_selected_messages_confirmed_co (_data_);
}

static gboolean
dc_conversation_view_delete_selected_messages_confirmed_co (DcConversationViewDeleteSelectedMessagesConfirmedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		if (_data_->for_all) {
			_data_->_tmp0_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_delete_messages_for_all (_data_->_tmp0_, _data_->ids, (gint) _data_->ids_length1, dc_conversation_view_delete_selected_messages_confirmed_ready, _data_);
			return FALSE;
			_state_1:
			dc_rpc_client_delete_messages_for_all_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			_data_->_tmp1_ = _data_->self->priv->rpc;
			_data_->_state_ = 2;
			dc_rpc_client_delete_messages (_data_->_tmp1_, _data_->ids, (gint) _data_->ids_length1, dc_conversation_view_delete_selected_messages_confirmed_ready, _data_);
			return FALSE;
			_state_2:
			dc_rpc_client_delete_messages_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		_data_->_tmp2_ = dc_audio_playback_shared ();
		_data_->playback = _data_->_tmp2_;
		_data_->_tmp3_ = _data_->playback;
		_data_->_tmp4_ = dc_audio_playback_get_current_message_id (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		if (dc_conversation_view_int_array_contains (_data_->ids, (gint) _data_->ids_length1, _data_->_tmp5_)) {
			_data_->_tmp6_ = _data_->playback;
			dc_audio_playback_stop (_data_->_tmp6_);
		}
		{
			_data_->i = _data_->ids_length1 - 1;
			{
				_data_->_tmp7_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp7_) {
						_data_->_tmp8_ = _data_->i;
						_data_->i = _data_->_tmp8_ - 1;
					}
					_data_->_tmp7_ = FALSE;
					if (!(_data_->i >= 0)) {
						break;
					}
					_data_->_tmp9_ = _data_->self->priv->message_store;
					_data_->_tmp10_ = _data_->ids[_data_->i];
					_data_->idx = dc_find_message_index ((GListModel*) _data_->_tmp9_, _data_->_tmp10_);
					if (_data_->idx >= 0) {
						_data_->_tmp11_ = _data_->self->priv->message_store;
						g_list_store_remove (_data_->_tmp11_, (guint) _data_->idx);
					}
				}
			}
		}
		dc_conversation_view_update_conversation_media_bar (_data_->self);
		dc_conversation_view_end_selection_mode (_data_->self);
		_g_object_unref0 (_data_->playback);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp12_ = _data_->self->priv->window;
		_data_->_tmp13_ = _data_->e;
		_data_->_tmp14_ = _data_->_tmp13_->message;
		_data_->_tmp15_ = g_strconcat ("Delete failed: ", _data_->_tmp14_, NULL);
		_data_->_tmp16_ = _data_->_tmp15_;
		dc_window_show_toast (_data_->_tmp12_, _data_->_tmp16_);
		_g_free0 (_data_->_tmp16_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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;
}

void
dc_conversation_view_set_chat_kind (DcConversationView* self,
                                    DcChatKind kind)
{
	g_return_if_fail (self != NULL);
	if (kind == DC_CHAT_KIND_UNKNOWN) {
		return;
	}
	self->priv->chat_kind = kind;
	self->priv->chat_kind_loaded = TRUE;
}

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

static void
dc_conversation_view_accept_request (DcConversationView* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcConversationViewAcceptRequestData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewAcceptRequestData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_accept_request_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_accept_request_co (_data_);
}

static void
dc_conversation_view_accept_request_finish (DcConversationView* self,
                                            GAsyncResult* _res_)
{
	DcConversationViewAcceptRequestData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_accept_request_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcConversationViewAcceptRequestData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_accept_request_co (_data_);
}

static gboolean
dc_conversation_view_accept_request_co (DcConversationViewAcceptRequestData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_tmp1_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 1;
		dc_rpc_client_accept_chat (_data_->_tmp0_, _data_->_tmp1_, dc_conversation_view_accept_request_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_accept_chat_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		dc_conversation_view_set_contact_request (_data_->self, FALSE);
		_data_->_tmp2_ = _data_->self->priv->compose_bar;
		dc_compose_bar_grab_entry_focus (_data_->_tmp2_);
		_data_->_tmp3_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->self->priv->window;
		_data_->_tmp5_ = _data_->e;
		_data_->_tmp6_ = _data_->_tmp5_->message;
		_data_->_tmp7_ = g_strconcat ("Failed to accept request: ", _data_->_tmp6_, NULL);
		_data_->_tmp8_ = _data_->_tmp7_;
		dc_window_show_toast (_data_->_tmp4_, _data_->_tmp8_);
		_g_free0 (_data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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
dc_conversation_view_block_request_data_free (gpointer _data)
{
	DcConversationViewBlockRequestData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewBlockRequestData, _data_);
}

static void
dc_conversation_view_block_request (DcConversationView* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DcConversationViewBlockRequestData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewBlockRequestData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_block_request_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_block_request_co (_data_);
}

static void
dc_conversation_view_block_request_finish (DcConversationView* self,
                                           GAsyncResult* _res_)
{
	DcConversationViewBlockRequestData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_block_request_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DcConversationViewBlockRequestData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_block_request_co (_data_);
}

static gboolean
dc_conversation_view_block_request_co (DcConversationViewBlockRequestData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_tmp1_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 1;
		dc_rpc_client_block_chat (_data_->_tmp0_, _data_->_tmp1_, dc_conversation_view_block_request_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_block_chat_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->self->priv->window;
		_data_->_tmp3_ = dc_window_get_current_chat_id (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = _data_->self->priv->_chat_id;
		if (_data_->_tmp4_ == _data_->_tmp5_) {
			_data_->_tmp6_ = _data_->self->priv->window;
			dc_window_clear_chat_view (_data_->_tmp6_);
		}
		_data_->_tmp7_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp7_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp8_ = _data_->self->priv->window;
		_data_->_tmp9_ = _data_->e;
		_data_->_tmp10_ = _data_->_tmp9_->message;
		_data_->_tmp11_ = g_strconcat ("Failed to block request: ", _data_->_tmp10_, NULL);
		_data_->_tmp12_ = _data_->_tmp11_;
		dc_window_show_toast (_data_->_tmp8_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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;
}

void
dc_conversation_view_on_activated (DcConversationView* self,
                                   gboolean focus_compose)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	if (!self->priv->messages_loaded) {
		self->priv->messages_loaded = TRUE;
		dc_conversation_view_load_messages (self, FALSE, NULL, NULL);
	} else {
		if (self->priv->messages_stale) {
			dc_conversation_view_reload_messages (self, NULL, NULL);
		}
	}
	if (!self->priv->draft_loaded) {
		self->priv->draft_loaded = TRUE;
		dc_conversation_view_load_draft (self, NULL, NULL);
	}
	if (focus_compose) {
		_tmp1_ = !self->priv->is_contact_request;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = !self->priv->selection_mode;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		DcComposeBar* _tmp2_;
		_tmp2_ = self->priv->compose_bar;
		dc_compose_bar_grab_entry_focus (_tmp2_);
	}
}

void
dc_conversation_view_on_reselected (DcConversationView* self,
                                    gboolean focus_compose)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	dc_conversation_view_scroll_to_bottom (self);
	if (focus_compose) {
		_tmp0_ = !self->priv->selection_mode;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		DcComposeBar* _tmp1_;
		_tmp1_ = self->priv->compose_bar;
		dc_compose_bar_grab_entry_focus (_tmp1_);
	}
}

void
dc_conversation_view_attach_dropped_file_path (DcConversationView* self,
                                               const gchar* path)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_tmp0_ = g_path_get_basename (path);
	_tmp1_ = _tmp0_;
	dc_conversation_view_attach_local_file (self, path, _tmp1_);
	_g_free0 (_tmp1_);
}

void
dc_conversation_view_attach_dropped_file (DcConversationView* self,
                                          const gchar* path,
                                          const gchar* name)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	g_return_if_fail (name != NULL);
	dc_conversation_view_attach_local_file (self, path, name);
}

gboolean
dc_conversation_view_can_accept_dropped_file (DcConversationView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = dc_conversation_view_can_accept_file_attachment (self);
	return result;
}

void
dc_conversation_view_focus_entry (DcConversationView* self)
{
	DcComposeBar* _tmp0_;
	g_return_if_fail (self != NULL);
	if (self->priv->selection_mode) {
		return;
	}
	_tmp0_ = self->priv->compose_bar;
	dc_compose_bar_grab_entry_focus (_tmp0_);
}

gboolean
dc_conversation_view_has_active_compose_mode (DcConversationView* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->selection_mode) {
		_tmp0_ = TRUE;
	} else {
		DcComposeBar* _tmp1_;
		_tmp1_ = self->priv->compose_bar;
		_tmp0_ = dc_compose_bar_has_active_mode (_tmp1_);
	}
	result = _tmp0_;
	return result;
}

gboolean
dc_conversation_view_compose_entry_has_focus (DcConversationView* self)
{
	DcComposeBar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->selection_mode) {
		result = TRUE;
		return result;
	}
	_tmp0_ = self->priv->compose_bar;
	result = dc_compose_bar_entry_has_focus (_tmp0_);
	return result;
}

void
dc_conversation_view_cancel_active_compose_mode (DcConversationView* self)
{
	DcComposeBar* _tmp0_;
	g_return_if_fail (self != NULL);
	if (self->priv->selection_mode) {
		dc_conversation_view_end_selection_mode (self);
		return;
	}
	_tmp0_ = self->priv->compose_bar;
	dc_compose_bar_cancel_active_mode (_tmp0_);
}

void
dc_conversation_view_type_into_entry (DcConversationView* self,
                                      const gchar* text)
{
	DcComposeBar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	if (self->priv->selection_mode) {
		return;
	}
	_tmp0_ = self->priv->compose_bar;
	dc_compose_bar_type_text (_tmp0_, text);
}

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

void
dc_conversation_view_reload_messages (DcConversationView* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcConversationViewReloadMessagesData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewReloadMessagesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_reload_messages_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_reload_messages_co (_data_);
}

void
dc_conversation_view_reload_messages_finish (DcConversationView* self,
                                             GAsyncResult* _res_)
{
	DcConversationViewReloadMessagesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_reload_messages_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcConversationViewReloadMessagesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_reload_messages_co (_data_);
}

static gboolean
dc_conversation_view_reload_messages_co (DcConversationViewReloadMessagesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dc_conversation_view_load_messages (_data_->self, TRUE, dc_conversation_view_reload_messages_ready, _data_);
	return FALSE;
	_state_1:
	dc_conversation_view_load_messages_finish (_data_->self, _data_->_res_);
	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;
}

void
dc_conversation_view_mark_messages_stale (DcConversationView* self)
{
	g_return_if_fail (self != NULL);
	self->priv->messages_stale = TRUE;
}

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

void
dc_conversation_view_handle_incoming_msg (DcConversationView* self,
                                          gint msg_id,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	DcConversationViewHandleIncomingMsgData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewHandleIncomingMsgData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_handle_incoming_msg_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	dc_conversation_view_handle_incoming_msg_co (_data_);
}

gboolean
dc_conversation_view_handle_incoming_msg_finish (DcConversationView* self,
                                                 GAsyncResult* _res_)
{
	gboolean result;
	DcConversationViewHandleIncomingMsgData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dc_conversation_view_handle_incoming_msg_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	DcConversationViewHandleIncomingMsgData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_handle_incoming_msg_co (_data_);
}

static gboolean
dc_conversation_view_handle_incoming_msg_co (DcConversationViewHandleIncomingMsgData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->message_store;
		_data_->_tmp1_ = dc_find_message ((GListModel*) _data_->_tmp0_, _data_->msg_id);
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp3_ = _data_->_tmp2_ != NULL;
		_g_object_unref0 (_data_->_tmp2_);
		if (_data_->_tmp3_) {
			_data_->_tmp4_ = _data_->self->priv->window;
			_data_->_tmp5_ = _data_->self->priv->_chat_id;
			if (dc_window_is_chat_visible (_data_->_tmp4_, _data_->_tmp5_)) {
				_data_->_tmp6_ = _data_->self->priv->rpc;
				_data_->_tmp7_ = g_new0 (gint, 1);
				_data_->_tmp7_[0] = _data_->msg_id;
				_data_->_tmp8_ = _data_->_tmp7_;
				_data_->_tmp8__length1 = 1;
				_data_->_state_ = 1;
				dc_rpc_client_mark_seen_msgs (_data_->_tmp6_, _data_->_tmp8_, (gint) 1, dc_conversation_view_handle_incoming_msg_ready, _data_);
				return FALSE;
				_state_1:
				dc_rpc_client_mark_seen_msgs_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
				_data_->_tmp8_ = (g_free (_data_->_tmp8_), NULL);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
			} else {
				_data_->_tmp9_ = _data_->self->priv->window;
				_data_->_tmp10_ = dc_window_get_current_chat_id (_data_->_tmp9_);
				_data_->_tmp11_ = _data_->_tmp10_;
				_data_->_tmp12_ = _data_->self->priv->_chat_id;
				if (_data_->_tmp11_ == _data_->_tmp12_) {
					dc_conversation_view_queue_pending_seen (_data_->self, _data_->msg_id);
				}
			}
			_data_->result = TRUE;
			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_->_tmp13_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_fetch_message (_data_->_tmp13_, _data_->msg_id, dc_conversation_view_handle_incoming_msg_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp14_ = dc_rpc_client_fetch_message_finish (_data_->_tmp13_, _data_->_res_, &_data_->_inner_error0_);
		_data_->msg = _data_->_tmp14_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp15_ = _data_->msg;
		if (_data_->_tmp15_ == NULL) {
			dc_conversation_view_mark_messages_stale (_data_->self);
			_data_->result = FALSE;
			_g_object_unref0 (_data_->msg);
			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_->_tmp16_ = _data_->self->priv->window;
		_data_->_tmp17_ = dc_window_get_current_chat_id (_data_->_tmp16_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp19_ = _data_->self->priv->_chat_id;
		_data_->is_current = _data_->_tmp18_ == _data_->_tmp19_;
		if (_data_->is_current) {
			_data_->_tmp20_ = _data_->msg;
			dc_message_set_highlighted (_data_->_tmp20_, TRUE);
		}
		_data_->_tmp21_ = _data_->msg;
		dc_message_set_selection_visible (_data_->_tmp21_, _data_->self->priv->selection_mode);
		_data_->_tmp22_ = _data_->msg;
		dc_conversation_view_insert_message_sorted (_data_->self, _data_->_tmp22_);
		_data_->_tmp24_ = _data_->self->priv->window;
		_data_->_tmp25_ = _data_->self->priv->_chat_id;
		if (dc_window_is_chat_visible (_data_->_tmp24_, _data_->_tmp25_)) {
			_data_->_tmp26_ = _data_->msg;
			_data_->_tmp23_ = dc_conversation_view_should_mark_message_seen (_data_->_tmp26_);
		} else {
			_data_->_tmp23_ = FALSE;
		}
		if (_data_->_tmp23_) {
			_data_->_tmp27_ = _data_->self->priv->rpc;
			_data_->_tmp28_ = g_new0 (gint, 1);
			_data_->_tmp28_[0] = _data_->msg_id;
			_data_->_tmp29_ = _data_->_tmp28_;
			_data_->_tmp29__length1 = 1;
			_data_->_state_ = 3;
			dc_rpc_client_mark_seen_msgs (_data_->_tmp27_, _data_->_tmp29_, (gint) 1, dc_conversation_view_handle_incoming_msg_ready, _data_);
			return FALSE;
			_state_3:
			dc_rpc_client_mark_seen_msgs_finish (_data_->_tmp27_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp29_ = (g_free (_data_->_tmp29_), NULL);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->msg);
				goto __catch0_g_error;
			}
		} else {
			if (_data_->is_current) {
				_data_->_tmp31_ = _data_->msg;
				_data_->_tmp30_ = dc_conversation_view_should_mark_message_seen (_data_->_tmp31_);
			} else {
				_data_->_tmp30_ = FALSE;
			}
			if (_data_->_tmp30_) {
				dc_conversation_view_queue_pending_seen (_data_->self, _data_->msg_id);
			}
		}
		_data_->result = TRUE;
		_g_object_unref0 (_data_->msg);
		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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp32_ = _data_->e;
		_data_->_tmp33_ = _data_->_tmp32_->message;
		g_warning ("conversation_view.vala:1191: handle_incoming_msg: %s", _data_->_tmp33_);
		dc_conversation_view_mark_messages_stale (_data_->self);
		_data_->result = FALSE;
		_g_error_free0 (_data_->e);
		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;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
_vala_array_add36 (gint* * array,
                   gint* length,
                   gint* size,
                   gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

void
dc_conversation_view_flush_pending_seen (DcConversationView* self)
{
	DcWindow* _tmp0_;
	gint _tmp1_;
	gint* ids = NULL;
	gint _tmp2_ = 0;
	gint* _tmp3_;
	gint ids_length1;
	gint _ids_size_;
	gint* _tmp4_;
	gint _tmp4__length1;
	gint* _tmp6_;
	gint* _tmp7_;
	gint _tmp7__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	_tmp1_ = self->priv->_chat_id;
	if (!dc_window_is_chat_visible (_tmp0_, _tmp1_)) {
		return;
	}
	_tmp3_ = dc_conversation_view_loaded_incoming_message_ids (self, &_tmp2_);
	ids = _tmp3_;
	ids_length1 = _tmp2_;
	_ids_size_ = ids_length1;
	_tmp4_ = self->priv->pending_seen_ids;
	_tmp4__length1 = self->priv->pending_seen_ids_length1;
	{
		gint* msg_id_collection = NULL;
		gint msg_id_collection_length1 = 0;
		gint _msg_id_collection_size_ = 0;
		gint msg_id_it = 0;
		msg_id_collection = _tmp4_;
		msg_id_collection_length1 = _tmp4__length1;
		for (msg_id_it = 0; msg_id_it < msg_id_collection_length1; msg_id_it = msg_id_it + 1) {
			gint msg_id = 0;
			msg_id = msg_id_collection[msg_id_it];
			{
				gint* _tmp5_;
				gint _tmp5__length1;
				_tmp5_ = ids;
				_tmp5__length1 = ids_length1;
				if (!dc_conversation_view_int_array_contains (_tmp5_, (gint) _tmp5__length1, msg_id)) {
					_vala_array_add36 (&ids, &ids_length1, &_ids_size_, msg_id);
				}
			}
		}
	}
	_tmp6_ = g_new0 (gint, 0);
	self->priv->pending_seen_ids = (g_free (self->priv->pending_seen_ids), NULL);
	self->priv->pending_seen_ids = _tmp6_;
	self->priv->pending_seen_ids_length1 = 0;
	self->priv->_pending_seen_ids_size_ = self->priv->pending_seen_ids_length1;
	_tmp7_ = ids;
	_tmp7__length1 = ids_length1;
	dc_conversation_view_send_seen_ids (self, _tmp7_, (gint) _tmp7__length1);
	ids = (g_free (ids), NULL);
}

static void
_vala_array_add37 (gint* * array,
                   gint* length,
                   gint* size,
                   gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static gint*
dc_conversation_view_loaded_incoming_message_ids (DcConversationView* self,
                                                  gint* result_length1)
{
	gint* ids = NULL;
	gint* _tmp0_;
	gint ids_length1;
	gint _ids_size_;
	guint n = 0U;
	GListStore* _tmp1_;
	gint* _tmp14_;
	gint _tmp14__length1;
	gint* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gint, 0);
	ids = _tmp0_;
	ids_length1 = 0;
	_ids_size_ = ids_length1;
	_tmp1_ = self->priv->message_store;
	n = g_list_model_get_n_items ((GListModel*) _tmp1_);
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				DcMessage* msg = NULL;
				GListStore* _tmp4_;
				GObject* _tmp5_;
				DcMessage* _tmp6_;
				gint* _tmp7_;
				gint _tmp7__length1;
				DcMessage* _tmp8_;
				gint _tmp9_;
				gint _tmp10_;
				if (!_tmp2_) {
					guint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				if (!(i < n)) {
					break;
				}
				_tmp4_ = self->priv->message_store;
				_tmp5_ = g_list_model_get_item ((GListModel*) _tmp4_, i);
				msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, DC_TYPE_MESSAGE, DcMessage);
				_tmp6_ = msg;
				if (!dc_conversation_view_should_mark_message_seen (_tmp6_)) {
					_g_object_unref0 (msg);
					continue;
				}
				_tmp7_ = ids;
				_tmp7__length1 = ids_length1;
				_tmp8_ = msg;
				_tmp9_ = dc_message_get_id (_tmp8_);
				_tmp10_ = _tmp9_;
				if (!dc_conversation_view_int_array_contains (_tmp7_, (gint) _tmp7__length1, _tmp10_)) {
					DcMessage* _tmp11_;
					gint _tmp12_;
					gint _tmp13_;
					_tmp11_ = msg;
					_tmp12_ = dc_message_get_id (_tmp11_);
					_tmp13_ = _tmp12_;
					_vala_array_add37 (&ids, &ids_length1, &_ids_size_, _tmp13_);
				}
				_g_object_unref0 (msg);
			}
		}
	}
	_tmp14_ = ids;
	_tmp14__length1 = ids_length1;
	if (result_length1) {
		*result_length1 = _tmp14__length1;
	}
	result = _tmp14_;
	return result;
}

static gboolean
dc_conversation_view_should_mark_message_seen (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gint _tmp2_;
	gint _tmp3_;
	gboolean result;
	g_return_val_if_fail (msg != NULL, FALSE);
	_tmp2_ = dc_message_get_id (msg);
	_tmp3_ = _tmp2_;
	if (_tmp3_ > 0) {
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp4_ = dc_message_get_is_outgoing (msg);
		_tmp5_ = _tmp4_;
		_tmp1_ = !_tmp5_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gboolean _tmp6_;
		gboolean _tmp7_;
		_tmp6_ = dc_message_get_is_info (msg);
		_tmp7_ = _tmp6_;
		_tmp0_ = !_tmp7_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
_vala_array_add38 (gint* * array,
                   gint* length,
                   gint* size,
                   gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static void
dc_conversation_view_queue_pending_seen (DcConversationView* self,
                                         gint msg_id)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (msg_id <= 0) {
		_tmp0_ = TRUE;
	} else {
		gint* _tmp1_;
		gint _tmp1__length1;
		_tmp1_ = self->priv->pending_seen_ids;
		_tmp1__length1 = self->priv->pending_seen_ids_length1;
		_tmp0_ = dc_conversation_view_int_array_contains (_tmp1_, (gint) _tmp1__length1, msg_id);
	}
	if (_tmp0_) {
		return;
	}
	_vala_array_add38 (&self->priv->pending_seen_ids, &self->priv->pending_seen_ids_length1, &self->priv->_pending_seen_ids_size_, msg_id);
}

static gboolean
dc_conversation_view_int_array_contains (gint* ids,
                                         gint ids_length1,
                                         gint needle)
{
	gboolean result;
	{
		gint* id_collection = NULL;
		gint id_collection_length1 = 0;
		gint _id_collection_size_ = 0;
		gint id_it = 0;
		id_collection = ids;
		id_collection_length1 = ids_length1;
		for (id_it = 0; id_it < id_collection_length1; id_it = id_it + 1) {
			gint id = 0;
			id = id_collection[id_it];
			{
				if (id == needle) {
					result = TRUE;
					return result;
				}
			}
		}
	}
	result = FALSE;
	return result;
}

static void
__lambda83_ (DcConversationView* self,
             GObject* o,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		DcRpcClient* _tmp0_;
		_tmp0_ = self->priv->rpc;
		dc_rpc_client_mark_seen_msgs_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_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
___lambda83__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda83_ ((DcConversationView*) self, source_object, res);
	g_object_unref (self);
}

static void
dc_conversation_view_send_seen_ids (DcConversationView* self,
                                    gint* ids,
                                    gint ids_length1)
{
	DcRpcClient* _tmp0_;
	g_return_if_fail (self != NULL);
	if (ids_length1 == 0) {
		return;
	}
	_tmp0_ = self->priv->rpc;
	dc_rpc_client_mark_seen_msgs (_tmp0_, ids, (gint) ids_length1, ___lambda83__gasync_ready_callback, g_object_ref (self));
}

static Block41Data*
block41_data_ref (Block41Data* _data41_)
{
	g_atomic_int_inc (&_data41_->_ref_count_);
	return _data41_;
}

static void
block41_data_unref (void * _userdata_)
{
	Block41Data* _data41_;
	_data41_ = (Block41Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data41_->_ref_count_)) {
		DcConversationView* self;
		self = _data41_->self;
		_g_object_unref0 (self);
		g_slice_free (Block41Data, _data41_);
	}
}

static gboolean
__lambda196_ (Block41Data* _data41_)
{
	DcConversationView* self;
	gboolean result;
	self = _data41_->self;
	if (!_data41_->was_active) {
		GtkSearchEntry* _tmp0_;
		_tmp0_ = self->priv->message_search_entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
	}
	self->priv->search_toggling = FALSE;
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda196__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda196_ (self);
	return result;
}

void
dc_conversation_view_toggle_search (DcConversationView* self)
{
	Block41Data* _data41_;
	GtkRevealer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkRevealer* _tmp3_;
	g_return_if_fail (self != NULL);
	_data41_ = g_slice_new0 (Block41Data);
	_data41_->_ref_count_ = 1;
	_data41_->self = g_object_ref (self);
	if (self->priv->search_toggling) {
		block41_data_unref (_data41_);
		_data41_ = NULL;
		return;
	}
	self->priv->search_toggling = TRUE;
	_tmp0_ = self->priv->message_search_revealer;
	_tmp1_ = gtk_revealer_get_reveal_child (_tmp0_);
	_tmp2_ = _tmp1_;
	_data41_->was_active = _tmp2_;
	_tmp3_ = self->priv->message_search_revealer;
	gtk_revealer_set_reveal_child (_tmp3_, !_data41_->was_active);
	if (_data41_->was_active) {
		GtkSearchEntry* _tmp4_;
		_tmp4_ = self->priv->message_search_entry;
		gtk_editable_set_text ((GtkEditable*) _tmp4_, "");
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda196__gsource_func, block41_data_ref (_data41_), block41_data_unref);
	block41_data_unref (_data41_);
	_data41_ = NULL;
}

/**
         * Replace a single message in the store while keeping the visible
         * scroll position unchanged. Used by reaction/edit updates that
         * resize a row but should not jump the viewport.
         */
static Block42Data*
block42_data_ref (Block42Data* _data42_)
{
	g_atomic_int_inc (&_data42_->_ref_count_);
	return _data42_;
}

static void
block42_data_unref (void * _userdata_)
{
	Block42Data* _data42_;
	_data42_ = (Block42Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data42_->_ref_count_)) {
		DcConversationView* self;
		self = _data42_->self;
		_g_object_unref0 (self);
		g_slice_free (Block42Data, _data42_);
	}
}

static gboolean
__lambda76_ (Block42Data* _data42_,
             GtkWidget* w,
             GdkFrameClock* clock)
{
	DcConversationView* self;
	gdouble _tmp0_ = 0.0;
	GtkButton* _tmp2_;
	gboolean result;
	self = _data42_->self;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (clock != NULL, FALSE);
	if (self->priv->closed) {
		result = dc_conversation_view_end_tick_callback (self, _data42_->tick_id);
		return result;
	}
	if (_data42_->was_at_bottom) {
		_tmp0_ = dc_conversation_view_max_scroll_value (self);
	} else {
		_tmp0_ = _data42_->saved_value;
	}
	dc_conversation_view_restore_scroll_value (self, _tmp0_);
	self->priv->loading_chat = _data42_->was_loading;
	if (self->priv->goal != DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR) {
		DcConversationViewViewportGoal _tmp1_ = 0;
		if (_data42_->was_at_bottom) {
			_tmp1_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
		} else {
			_tmp1_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
		}
		self->priv->goal = _tmp1_;
	}
	_tmp2_ = self->priv->scroll_down_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, !dc_conversation_view_is_near_bottom (self));
	result = dc_conversation_view_end_tick_callback (self, _data42_->tick_id);
	return result;
}

static gboolean
___lambda76__gtk_tick_callback (GtkWidget* widget,
                                GdkFrameClock* frame_clock,
                                gpointer self)
{
	gboolean result;
	result = __lambda76_ (self, widget, frame_clock);
	return result;
}

void
dc_conversation_view_replace_message (DcConversationView* self,
                                      gint msg_id,
                                      DcMessage* new_msg)
{
	Block42Data* _data42_;
	gint idx = 0;
	GListStore* _tmp0_;
	DcMessage* old_msg = NULL;
	GListStore* _tmp1_;
	GObject* _tmp2_;
	DcMessage* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	DcMessage* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	DcMessage* _tmp9_;
	GtkAdjustment* adj = NULL;
	GtkScrolledWindow* _tmp10_;
	GtkAdjustment* _tmp11_;
	GtkAdjustment* _tmp12_;
	GtkAdjustment* _tmp13_;
	GtkAdjustment* _tmp14_;
	gdouble _tmp15_;
	gdouble _tmp16_;
	GObject** replacements = NULL;
	GObject* _tmp17_;
	GObject** _tmp18_;
	gint replacements_length1;
	gint _replacements_size_;
	GListStore* _tmp19_;
	GObject** _tmp20_;
	gint _tmp20__length1;
	GtkListView* _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_msg != NULL);
	_data42_ = g_slice_new0 (Block42Data);
	_data42_->_ref_count_ = 1;
	_data42_->self = g_object_ref (self);
	_tmp0_ = self->priv->message_store;
	idx = dc_find_message_index ((GListModel*) _tmp0_, msg_id);
	if (idx < 0) {
		block42_data_unref (_data42_);
		_data42_ = NULL;
		return;
	}
	_tmp1_ = self->priv->message_store;
	_tmp2_ = g_list_model_get_item ((GListModel*) _tmp1_, (guint) idx);
	old_msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, DC_TYPE_MESSAGE, DcMessage);
	_tmp3_ = old_msg;
	_tmp4_ = dc_message_get_selection_visible (_tmp3_);
	_tmp5_ = _tmp4_;
	dc_message_set_selection_visible (new_msg, _tmp5_);
	_tmp6_ = old_msg;
	_tmp7_ = dc_message_get_selected (_tmp6_);
	_tmp8_ = _tmp7_;
	dc_message_set_selected (new_msg, _tmp8_);
	_tmp9_ = old_msg;
	dc_conversation_view_preserve_full_message_state (_tmp9_, new_msg);
	_tmp10_ = self->priv->message_scroll;
	_tmp11_ = gtk_scrolled_window_get_vadjustment (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = _g_object_ref0 (_tmp12_);
	adj = _tmp13_;
	_tmp14_ = adj;
	_tmp15_ = gtk_adjustment_get_value (_tmp14_);
	_tmp16_ = _tmp15_;
	_data42_->saved_value = _tmp16_;
	_data42_->was_at_bottom = dc_conversation_view_is_near_bottom (self);
	_data42_->was_loading = self->priv->loading_chat;
	self->priv->loading_chat = TRUE;
	dc_conversation_view_freeze_scroll_handler (self, (guint) 700);
	_tmp17_ = _g_object_ref0 ((GObject*) new_msg);
	_tmp18_ = g_new0 (GObject*, 1 + 1);
	_tmp18_[0] = _tmp17_;
	replacements = _tmp18_;
	replacements_length1 = 1;
	_replacements_size_ = replacements_length1;
	_tmp19_ = self->priv->message_store;
	_tmp20_ = replacements;
	_tmp20__length1 = replacements_length1;
	g_list_store_splice (_tmp19_, (guint) idx, (guint) 1, _tmp20_, (guint) _tmp20__length1);
	dc_conversation_view_update_conversation_media_bar (self);
	_data42_->tick_id = (guint) 0;
	_tmp21_ = self->priv->message_listview;
	_data42_->tick_id = gtk_widget_add_tick_callback ((GtkWidget*) _tmp21_, ___lambda76__gtk_tick_callback, block42_data_ref (_data42_), block42_data_unref);
	dc_conversation_view_track_tick_callback (self, _data42_->tick_id);
	replacements = (_vala_array_free (replacements, replacements_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (adj);
	_g_object_unref0 (old_msg);
	block42_data_unref (_data42_);
	_data42_ = NULL;
}

/** Rebind a row after changing transient properties on its existing
         * Message object. Gtk.ListView keeps the old widget when the same
         * instance reappears at a position, so splice a fresh copy instead. */
static void
dc_conversation_view_refresh_message_row (DcConversationView* self,
                                          gint msg_id)
{
	DcMessage* msg = NULL;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->message_store;
	_tmp1_ = dc_find_message ((GListModel*) _tmp0_, msg_id);
	msg = _tmp1_;
	_tmp2_ = msg;
	if (_tmp2_ != NULL) {
		DcMessage* _tmp3_;
		DcMessage* _tmp4_;
		DcMessage* _tmp5_;
		_tmp3_ = msg;
		_tmp4_ = dc_message_dup (_tmp3_);
		_tmp5_ = _tmp4_;
		dc_conversation_view_replace_message (self, msg_id, _tmp5_);
		_g_object_unref0 (_tmp5_);
	}
	_g_object_unref0 (msg);
}

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

static void
dc_conversation_view_toggle_full_message (DcConversationView* self,
                                          gint msg_id,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	DcConversationViewToggleFullMessageData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewToggleFullMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_toggle_full_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	dc_conversation_view_toggle_full_message_co (_data_);
}

static void
dc_conversation_view_toggle_full_message_finish (DcConversationView* self,
                                                 GAsyncResult* _res_)
{
	DcConversationViewToggleFullMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_toggle_full_message_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	DcConversationViewToggleFullMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_toggle_full_message_co (_data_);
}

static gboolean
dc_conversation_view_toggle_full_message_co (DcConversationViewToggleFullMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->message_store;
	_data_->_tmp1_ = dc_find_message ((GListModel*) _data_->_tmp0_, _data_->msg_id);
	_data_->msg = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->msg;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->msg);
		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_->_tmp3_ = _data_->msg;
	_data_->_tmp4_ = dc_message_get_full_message_expanded (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	if (_data_->_tmp5_) {
		_data_->_tmp6_ = _data_->msg;
		dc_message_set_full_message_expanded (_data_->_tmp6_, FALSE);
		dc_conversation_view_refresh_message_row (_data_->self, _data_->msg_id);
		_g_object_unref0 (_data_->msg);
		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_->_tmp7_ = _data_->msg;
		_data_->_tmp8_ = dc_message_get_can_download_full_message (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		if (_data_->_tmp9_) {
			_data_->_tmp10_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_download_full_message (_data_->_tmp10_, _data_->msg_id, dc_conversation_view_toggle_full_message_ready, _data_);
			return FALSE;
			_state_1:
			dc_rpc_client_download_full_message_finish (_data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_state_ = 2;
			dc_conversation_view_load_messages (_data_->self, TRUE, dc_conversation_view_toggle_full_message_ready, _data_);
			return FALSE;
			_state_2:
			dc_conversation_view_load_messages_finish (_data_->self, _data_->_res_);
			_g_object_unref0 (_data_->msg);
			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_->_tmp11_ = _data_->msg;
		_data_->_tmp12_ = dc_message_get_full_message_text (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = g_strdup (_data_->_tmp13_);
		_data_->full_text = _data_->_tmp14_;
		_data_->_tmp15_ = _data_->full_text;
		if (_data_->_tmp15_ == NULL) {
			_data_->_tmp16_ = _data_->msg;
			dc_conversation_view_set_full_message_loading (_data_->self, _data_->_tmp16_, TRUE);
			_data_->_state_ = 3;
			dc_conversation_view_fetch_full_message_text (_data_->self, _data_->msg_id, dc_conversation_view_toggle_full_message_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp18_ = dc_conversation_view_fetch_full_message_text_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp17_ = _data_->_tmp18_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->full_text);
				goto __catch0_g_error;
			}
			_data_->_tmp19_ = _data_->_tmp17_;
			_data_->_tmp17_ = NULL;
			_g_free0 (_data_->full_text);
			_data_->full_text = _data_->_tmp19_;
			_g_free0 (_data_->_tmp17_);
		}
		_data_->_tmp20_ = _data_->self->priv->message_store;
		_data_->_tmp21_ = dc_find_message ((GListModel*) _data_->_tmp20_, _data_->msg_id);
		_data_->current = _data_->_tmp21_;
		_data_->_tmp22_ = _data_->current;
		if (_data_->_tmp22_ != NULL) {
			_data_->_tmp23_ = _data_->current;
			dc_message_set_full_message_loading (_data_->_tmp23_, FALSE);
			_data_->_tmp25_ = _data_->full_text;
			if (_data_->_tmp25_ != NULL) {
				_data_->_tmp26_ = _data_->full_text;
				_data_->_tmp27_ = strlen (_data_->_tmp26_);
				_data_->_tmp28_ = _data_->_tmp27_;
				_data_->_tmp24_ = _data_->_tmp28_ > 0;
			} else {
				_data_->_tmp24_ = FALSE;
			}
			if (_data_->_tmp24_) {
				_data_->_tmp29_ = _data_->current;
				_data_->_tmp30_ = _data_->full_text;
				dc_message_set_full_message_text (_data_->_tmp29_, _data_->_tmp30_);
				_data_->_tmp31_ = _data_->current;
				dc_message_set_full_message_expanded (_data_->_tmp31_, TRUE);
				dc_conversation_view_refresh_message_row (_data_->self, _data_->msg_id);
				_g_object_unref0 (_data_->current);
				_g_free0 (_data_->full_text);
				_g_object_unref0 (_data_->msg);
				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;
			}
		}
		dc_conversation_view_clear_full_message_loading (_data_->self, _data_->msg_id);
		_data_->_tmp32_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp32_, "Full message unavailable");
		_g_object_unref0 (_data_->current);
		_g_free0 (_data_->full_text);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		dc_conversation_view_clear_full_message_loading (_data_->self, _data_->msg_id);
		_data_->_tmp33_ = _data_->self->priv->window;
		_data_->_tmp34_ = _data_->e;
		_data_->_tmp35_ = _data_->_tmp34_->message;
		_data_->_tmp36_ = g_strconcat ("Full message failed: ", _data_->_tmp35_, NULL);
		_data_->_tmp37_ = _data_->_tmp36_;
		dc_window_show_toast (_data_->_tmp33_, _data_->_tmp37_);
		_g_free0 (_data_->_tmp37_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->msg);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->msg);
	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
dc_conversation_view_view_full_message_data_free (gpointer _data)
{
	DcConversationViewViewFullMessageData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewViewFullMessageData, _data_);
}

static void
dc_conversation_view_view_full_message (DcConversationView* self,
                                        gint msg_id,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	DcConversationViewViewFullMessageData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewViewFullMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_view_full_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	dc_conversation_view_view_full_message_co (_data_);
}

static void
dc_conversation_view_view_full_message_finish (DcConversationView* self,
                                               GAsyncResult* _res_)
{
	DcConversationViewViewFullMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_view_full_message_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	DcConversationViewViewFullMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_view_full_message_co (_data_);
}

static gboolean
dc_conversation_view_view_full_message_co (DcConversationViewViewFullMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->message_store;
	_data_->_tmp1_ = dc_find_message ((GListModel*) _data_->_tmp0_, _data_->msg_id);
	_data_->msg = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->msg;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->msg);
		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_->_tmp3_ = _data_->msg;
		_data_->_tmp4_ = dc_message_get_full_message_text (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = g_strdup (_data_->_tmp5_);
		_data_->full_text = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->full_text;
		if (_data_->_tmp7_ == NULL) {
			_data_->_state_ = 1;
			dc_conversation_view_fetch_full_message_text (_data_->self, _data_->msg_id, dc_conversation_view_view_full_message_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp9_ = dc_conversation_view_fetch_full_message_text_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp8_ = _data_->_tmp9_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->full_text);
				goto __catch0_g_error;
			}
			_data_->_tmp10_ = _data_->_tmp8_;
			_data_->_tmp8_ = NULL;
			_g_free0 (_data_->full_text);
			_data_->full_text = _data_->_tmp10_;
			_g_free0 (_data_->_tmp8_);
		}
		_data_->_tmp11_ = _data_->self->priv->message_store;
		_data_->_tmp12_ = dc_find_message ((GListModel*) _data_->_tmp11_, _data_->msg_id);
		_data_->current = _data_->_tmp12_;
		_data_->_tmp15_ = _data_->current;
		if (_data_->_tmp15_ != NULL) {
			_data_->_tmp16_ = _data_->full_text;
			_data_->_tmp14_ = _data_->_tmp16_ != NULL;
		} else {
			_data_->_tmp14_ = FALSE;
		}
		if (_data_->_tmp14_) {
			_data_->_tmp17_ = _data_->full_text;
			_data_->_tmp18_ = strlen (_data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp13_ = _data_->_tmp19_ > 0;
		} else {
			_data_->_tmp13_ = FALSE;
		}
		if (_data_->_tmp13_) {
			_data_->_tmp20_ = _data_->current;
			_data_->_tmp21_ = _data_->full_text;
			dc_message_set_full_message_text (_data_->_tmp20_, _data_->_tmp21_);
			_data_->_tmp22_ = _data_->full_text;
			dc_conversation_view_show_full_message_text (_data_->self, _data_->msg_id, _data_->_tmp22_);
			_g_object_unref0 (_data_->current);
			_g_free0 (_data_->full_text);
			_g_object_unref0 (_data_->msg);
			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_->_tmp23_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp23_, "Full message unavailable");
		_g_object_unref0 (_data_->current);
		_g_free0 (_data_->full_text);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp24_ = _data_->self->priv->window;
		_data_->_tmp25_ = _data_->e;
		_data_->_tmp26_ = _data_->_tmp25_->message;
		_data_->_tmp27_ = g_strconcat ("Full message failed: ", _data_->_tmp26_, NULL);
		_data_->_tmp28_ = _data_->_tmp27_;
		dc_window_show_toast (_data_->_tmp24_, _data_->_tmp28_);
		_g_free0 (_data_->_tmp28_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->msg);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->msg);
	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
dc_conversation_view_fetch_full_message_text_data_free (gpointer _data)
{
	DcConversationViewFetchFullMessageTextData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewFetchFullMessageTextData, _data_);
}

static void
dc_conversation_view_fetch_full_message_text (DcConversationView* self,
                                              gint msg_id,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	DcConversationViewFetchFullMessageTextData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewFetchFullMessageTextData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_fetch_full_message_text_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	dc_conversation_view_fetch_full_message_text_co (_data_);
}

static gchar*
dc_conversation_view_fetch_full_message_text_finish (DcConversationView* self,
                                                     GAsyncResult* _res_,
                                                     GError** error)
{
	gchar* result;
	DcConversationViewFetchFullMessageTextData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_conversation_view_fetch_full_message_text_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_)
{
	DcConversationViewFetchFullMessageTextData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_fetch_full_message_text_co (_data_);
}

static gboolean
dc_conversation_view_fetch_full_message_text_co (DcConversationViewFetchFullMessageTextData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->message_store;
	_data_->_tmp1_ = dc_find_message ((GListModel*) _data_->_tmp0_, _data_->msg_id);
	_data_->msg = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->msg;
	if (_data_->_tmp3_ == NULL) {
		_data_->_tmp2_ = TRUE;
	} else {
		_data_->_tmp4_ = _data_->msg;
		_data_->_tmp5_ = dc_message_get_has_html (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp2_ = !_data_->_tmp6_;
	}
	if (_data_->_tmp2_) {
		_data_->result = NULL;
		_g_object_unref0 (_data_->msg);
		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_->_tmp7_ = _data_->self->priv->rpc;
	_data_->_state_ = 1;
	dc_rpc_client_get_message_html (_data_->_tmp7_, _data_->msg_id, dc_conversation_view_fetch_full_message_text_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp8_ = dc_rpc_client_get_message_html_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error0_);
	_data_->html = _data_->_tmp8_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->msg);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = _data_->html;
	if (_data_->_tmp11_ != NULL) {
		_data_->_tmp12_ = _data_->html;
		_data_->_tmp13_ = strlen (_data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_tmp10_ = _data_->_tmp14_ > 0;
	} else {
		_data_->_tmp10_ = FALSE;
	}
	if (_data_->_tmp10_) {
		_data_->_tmp15_ = _data_->html;
		_data_->_tmp16_ = dc_conversation_view_html_to_text (_data_->_tmp15_);
		_g_free0 (_data_->_tmp9_);
		_data_->_tmp9_ = _data_->_tmp16_;
	} else {
		_g_free0 (_data_->_tmp9_);
		_data_->_tmp9_ = NULL;
	}
	_data_->_tmp17_ = _data_->_tmp9_;
	_data_->_tmp9_ = NULL;
	_data_->result = _data_->_tmp17_;
	_g_free0 (_data_->_tmp9_);
	_g_free0 (_data_->html);
	_g_object_unref0 (_data_->msg);
	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
dc_conversation_view_set_full_message_loading (DcConversationView* self,
                                               DcMessage* msg,
                                               gboolean loading)
{
	gint _tmp0_;
	gint _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (msg != NULL);
	dc_message_set_full_message_loading (msg, loading);
	_tmp0_ = dc_message_get_id (msg);
	_tmp1_ = _tmp0_;
	dc_conversation_view_refresh_message_row (self, _tmp1_);
}

static void
dc_conversation_view_clear_full_message_loading (DcConversationView* self,
                                                 gint msg_id)
{
	DcMessage* msg = NULL;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	DcMessage* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->message_store;
	_tmp1_ = dc_find_message ((GListModel*) _tmp0_, msg_id);
	msg = _tmp1_;
	_tmp2_ = msg;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (msg);
		return;
	}
	_tmp3_ = msg;
	dc_message_set_full_message_loading (_tmp3_, FALSE);
	dc_conversation_view_refresh_message_row (self, msg_id);
	_g_object_unref0 (msg);
}

static void
dc_conversation_view_preserve_full_message_state (DcMessage* old_msg,
                                                  DcMessage* new_msg)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	g_return_if_fail (old_msg != NULL);
	g_return_if_fail (new_msg != NULL);
	_tmp0_ = dc_message_get_text (old_msg);
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_message_get_text (new_msg);
	_tmp3_ = _tmp2_;
	if (g_strcmp0 (_tmp1_, _tmp3_) != 0) {
		return;
	}
	_tmp4_ = dc_message_get_full_message_text (old_msg);
	_tmp5_ = _tmp4_;
	dc_message_set_full_message_text (new_msg, _tmp5_);
	_tmp6_ = dc_message_get_full_message_expanded (old_msg);
	_tmp7_ = _tmp6_;
	dc_message_set_full_message_expanded (new_msg, _tmp7_);
	_tmp8_ = dc_message_get_full_message_loading (old_msg);
	_tmp9_ = _tmp8_;
	dc_message_set_full_message_loading (new_msg, _tmp9_);
}

static gchar*
dc_conversation_view_html_to_text (const gchar* html)
{
	gchar* text = NULL;
	gchar* _tmp0_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (html != NULL, NULL);
	_tmp0_ = g_strdup (html);
	text = _tmp0_;
	{
		GRegex* hidden = NULL;
		GRegex* _tmp1_;
		GRegex* breaks = NULL;
		GRegex* _tmp2_;
		GRegex* blocks = NULL;
		GRegex* _tmp3_;
		GRegex* tags = NULL;
		GRegex* _tmp4_;
		gchar* _tmp5_ = NULL;
		GRegex* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_ = NULL;
		GRegex* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_ = NULL;
		GRegex* _tmp16_;
		const gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_ = NULL;
		GRegex* _tmp21_;
		const gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		_tmp1_ = g_regex_new ("<(head|script|style)\\b[^>]*>.*?</\\1>", G_REGEX_CASELESS | G_REGEX_DOTALL, 0, &_inner_error0_);
		hidden = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp2_ = g_regex_new ("<br\\s*/?>", G_REGEX_CASELESS, 0, &_inner_error0_);
		breaks = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (hidden);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp3_ = g_regex_new ("</(p|div|section|article|li|tr|h[1-6])>", G_REGEX_CASELESS, 0, &_inner_error0_);
		blocks = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (breaks);
			_g_regex_unref0 (hidden);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp4_ = g_regex_new ("<[^>]+>", 0, 0, &_inner_error0_);
		tags = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (blocks);
			_g_regex_unref0 (breaks);
			_g_regex_unref0 (hidden);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp6_ = hidden;
		_tmp7_ = text;
		_tmp8_ = g_regex_replace (_tmp6_, _tmp7_, (gssize) -1, 0, "", 0, &_inner_error0_);
		_tmp5_ = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (tags);
			_g_regex_unref0 (blocks);
			_g_regex_unref0 (breaks);
			_g_regex_unref0 (hidden);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp9_ = _tmp5_;
		_tmp5_ = NULL;
		_g_free0 (text);
		text = _tmp9_;
		_tmp11_ = breaks;
		_tmp12_ = text;
		_tmp13_ = g_regex_replace (_tmp11_, _tmp12_, (gssize) -1, 0, "\n", 0, &_inner_error0_);
		_tmp10_ = _tmp13_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (_tmp5_);
			_g_regex_unref0 (tags);
			_g_regex_unref0 (blocks);
			_g_regex_unref0 (breaks);
			_g_regex_unref0 (hidden);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp14_ = _tmp10_;
		_tmp10_ = NULL;
		_g_free0 (text);
		text = _tmp14_;
		_tmp16_ = blocks;
		_tmp17_ = text;
		_tmp18_ = g_regex_replace (_tmp16_, _tmp17_, (gssize) -1, 0, "\n", 0, &_inner_error0_);
		_tmp15_ = _tmp18_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (_tmp10_);
			_g_free0 (_tmp5_);
			_g_regex_unref0 (tags);
			_g_regex_unref0 (blocks);
			_g_regex_unref0 (breaks);
			_g_regex_unref0 (hidden);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp19_ = _tmp15_;
		_tmp15_ = NULL;
		_g_free0 (text);
		text = _tmp19_;
		_tmp21_ = tags;
		_tmp22_ = text;
		_tmp23_ = g_regex_replace (_tmp21_, _tmp22_, (gssize) -1, 0, "", 0, &_inner_error0_);
		_tmp20_ = _tmp23_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (_tmp15_);
			_g_free0 (_tmp10_);
			_g_free0 (_tmp5_);
			_g_regex_unref0 (tags);
			_g_regex_unref0 (blocks);
			_g_regex_unref0 (breaks);
			_g_regex_unref0 (hidden);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (text);
			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 NULL;
		}
		_tmp24_ = _tmp20_;
		_tmp20_ = NULL;
		_g_free0 (text);
		text = _tmp24_;
		_g_free0 (_tmp20_);
		_g_free0 (_tmp15_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp5_);
		_g_regex_unref0 (tags);
		_g_regex_unref0 (blocks);
		_g_regex_unref0 (breaks);
		_g_regex_unref0 (hidden);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (text);
		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;
	}
	_tmp25_ = text;
	_tmp26_ = dc_conversation_view_decode_basic_html_entities (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = string_strip (_tmp27_);
	_tmp29_ = _tmp28_;
	_g_free0 (_tmp27_);
	result = _tmp29_;
	_g_free0 (text);
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_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 NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_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 NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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;
}

static gchar*
dc_conversation_view_decode_basic_html_entities (const gchar* text)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = string_replace (text, "&nbsp;", " ");
	_tmp1_ = _tmp0_;
	_tmp2_ = string_replace (_tmp1_, "&quot;", "\"");
	_tmp3_ = _tmp2_;
	_tmp4_ = string_replace (_tmp3_, "&apos;", "'");
	_tmp5_ = _tmp4_;
	_tmp6_ = string_replace (_tmp5_, "&lt;", "<");
	_tmp7_ = _tmp6_;
	_tmp8_ = string_replace (_tmp7_, "&gt;", ">");
	_tmp9_ = _tmp8_;
	_tmp10_ = string_replace (_tmp9_, "&amp;", "&");
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp11_;
	return result;
}

static void
dc_conversation_view_show_full_message_text (DcConversationView* self,
                                             gint msg_id,
                                             const gchar* full_text)
{
	DcMessage* msg = NULL;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	DcFullMessageDialog* dialog = NULL;
	DcWindow* _tmp3_;
	DcRpcClient* _tmp4_;
	DcMessageActions* _tmp5_;
	DcMessage* _tmp6_;
	DcSettingsManager* _tmp7_;
	DcFullMessageDialog* _tmp8_;
	DcFullMessageDialog* _tmp9_;
	DcWindow* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (full_text != NULL);
	_tmp0_ = self->priv->message_store;
	_tmp1_ = dc_find_message ((GListModel*) _tmp0_, msg_id);
	msg = _tmp1_;
	_tmp2_ = msg;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (msg);
		return;
	}
	_tmp3_ = self->priv->window;
	_tmp4_ = self->priv->rpc;
	_tmp5_ = self->priv->msg_actions;
	_tmp6_ = msg;
	_tmp7_ = self->priv->settings;
	_tmp8_ = dc_full_message_dialog_new (_tmp3_, _tmp4_, _tmp5_, _tmp6_, full_text, dc_settings_manager_effective_font_size (_tmp7_));
	g_object_ref_sink (_tmp8_);
	dialog = _tmp8_;
	_tmp9_ = dialog;
	_tmp10_ = self->priv->window;
	adw_dialog_present ((AdwDialog*) _tmp9_, (GtkWidget*) _tmp10_);
	_g_object_unref0 (dialog);
	_g_object_unref0 (msg);
}

/**
         * Suppress the value-notify handler's "near top / near bottom"
         * recalculation for `ms` milliseconds. Used to silence spurious
         * scroll movements triggered by popovers, focus shifts, or row
         * resizes after a reaction / edit.
         */
void
dc_conversation_view_freeze_scroll_handler (DcConversationView* self,
                                            guint ms)
{
	gint64 until = 0LL;
	g_return_if_fail (self != NULL);
	until = g_get_monotonic_time () + (((gint64) ms) * 1000);
	if (until > self->priv->scroll_freeze_until_us) {
		self->priv->scroll_freeze_until_us = until;
	}
}

gdouble
dc_conversation_view_get_scroll_value (DcConversationView* self)
{
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	_tmp0_ = self->priv->message_scroll;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_adjustment_get_value (_tmp2_);
	_tmp4_ = _tmp3_;
	result = _tmp4_;
	return result;
}

void
dc_conversation_view_restore_scroll_value (DcConversationView* self,
                                           gdouble v)
{
	GtkAdjustment* a = NULL;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkAdjustment* _tmp3_;
	GtkAdjustment* _tmp4_;
	gdouble _tmp5_;
	gdouble _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->message_scroll;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	a = _tmp3_;
	v = MIN (v, dc_conversation_view_max_scroll_value (self));
	_tmp4_ = a;
	_tmp5_ = gtk_adjustment_get_value (_tmp4_);
	_tmp6_ = _tmp5_;
	if (fabs (_tmp6_ - v) > 0.5) {
		GtkAdjustment* _tmp7_;
		_tmp7_ = a;
		gtk_adjustment_set_value (_tmp7_, v);
	}
	_g_object_unref0 (a);
}

static Block43Data*
block43_data_ref (Block43Data* _data43_)
{
	g_atomic_int_inc (&_data43_->_ref_count_);
	return _data43_;
}

static void
block43_data_unref (void * _userdata_)
{
	Block43Data* _data43_;
	_data43_ = (Block43Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data43_->_ref_count_)) {
		DcConversationView* self;
		self = _data43_->self;
		_g_object_unref0 (self);
		g_slice_free (Block43Data, _data43_);
	}
}

static gboolean
__lambda78_ (Block43Data* _data43_,
             GtkWidget* w,
             GdkFrameClock* clock)
{
	DcConversationView* self;
	gboolean result;
	self = _data43_->self;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (clock != NULL, FALSE);
	if (self->priv->closed) {
		result = dc_conversation_view_end_tick_callback (self, _data43_->tick_id);
		return result;
	}
	dc_conversation_view_restore_scroll_value (self, _data43_->v);
	result = dc_conversation_view_end_tick_callback (self, _data43_->tick_id);
	return result;
}

static gboolean
___lambda78__gtk_tick_callback (GtkWidget* widget,
                                GdkFrameClock* frame_clock,
                                gpointer self)
{
	gboolean result;
	result = __lambda78_ (self, widget, frame_clock);
	return result;
}

void
dc_conversation_view_restore_scroll_value_deferred (DcConversationView* self,
                                                    gdouble v)
{
	Block43Data* _data43_;
	GtkListView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data43_ = g_slice_new0 (Block43Data);
	_data43_->_ref_count_ = 1;
	_data43_->self = g_object_ref (self);
	_data43_->v = v;
	if (self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR) {
		block43_data_unref (_data43_);
		_data43_ = NULL;
		return;
	}
	dc_conversation_view_freeze_scroll_handler (self, (guint) 250);
	_data43_->tick_id = (guint) 0;
	_tmp0_ = self->priv->message_listview;
	_data43_->tick_id = gtk_widget_add_tick_callback ((GtkWidget*) _tmp0_, ___lambda78__gtk_tick_callback, block43_data_ref (_data43_), block43_data_unref);
	dc_conversation_view_track_tick_callback (self, _data43_->tick_id);
	block43_data_unref (_data43_);
	_data43_ = NULL;
}

static void
dc_conversation_view_hold_scroll_on_focus_shift (DcConversationView* self)
{
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	g_return_if_fail (self != NULL);
	if (self->priv->goal != DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE) {
		return;
	}
	_tmp0_ = self->priv->message_scroll;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_adjustment_get_value (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_conversation_view_restore_scroll_value_deferred (self, _tmp4_);
}

gboolean
dc_conversation_view_close_search_if_active (DcConversationView* self)
{
	GtkRevealer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkRevealer* _tmp3_;
	GtkSearchEntry* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->message_search_revealer;
	_tmp1_ = gtk_revealer_get_reveal_child (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		return result;
	}
	_tmp3_ = self->priv->message_search_revealer;
	gtk_revealer_set_reveal_child (_tmp3_, FALSE);
	_tmp4_ = self->priv->message_search_entry;
	gtk_editable_set_text ((GtkEditable*) _tmp4_, "");
	result = TRUE;
	return result;
}

static Block44Data*
block44_data_ref (Block44Data* _data44_)
{
	g_atomic_int_inc (&_data44_->_ref_count_);
	return _data44_;
}

static void
block44_data_unref (void * _userdata_)
{
	Block44Data* _data44_;
	_data44_ = (Block44Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data44_->_ref_count_)) {
		DcConversationView* self;
		self = _data44_->self;
		_g_object_unref0 (self);
		g_slice_free (Block44Data, _data44_);
	}
}

static gboolean
___lambda121_ (Block44Data* _data44_)
{
	DcConversationView* self;
	gboolean result;
	self = _data44_->self;
	dc_conversation_view_scroll_to_message (self, _data44_->msg_id);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
____lambda121__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda121_ (self);
	return result;
}

void
dc_conversation_view_scroll_to_message (DcConversationView* self,
                                        gint msg_id)
{
	Block44Data* _data44_;
	g_return_if_fail (self != NULL);
	_data44_ = g_slice_new0 (Block44Data);
	_data44_->_ref_count_ = 1;
	_data44_->self = g_object_ref (self);
	_data44_->msg_id = msg_id;
	if (_data44_->msg_id <= 0) {
		block44_data_unref (_data44_);
		_data44_ = NULL;
		return;
	}
	if (dc_conversation_view_close_search_if_active (self)) {
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ____lambda121__gsource_func, block44_data_ref (_data44_), block44_data_unref);
		block44_data_unref (_data44_);
		_data44_ = NULL;
		return;
	}
	if (dc_conversation_view_scroll_to_loaded_message (self, _data44_->msg_id)) {
		self->priv->pending_scroll_message_id = 0;
		dc_conversation_view_resume_pending_voice_navigation (self);
		block44_data_unref (_data44_);
		_data44_ = NULL;
		return;
	}
	self->priv->pending_scroll_message_id = _data44_->msg_id;
	if (self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM) {
		self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
	}
	if (!self->priv->loading_more) {
		dc_conversation_view_load_until_pending_message (self, NULL, NULL);
	}
	block44_data_unref (_data44_);
	_data44_ = NULL;
}

void
dc_conversation_view_request_voice_navigation (DcConversationView* self,
                                               gint direction)
{
	DcAudioPlaybackItem* item = NULL;
	DcAudioPlayback* _tmp0_;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	DcAudioPlaybackItem* _tmp5_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	DcAudioPlaybackItem* _tmp9_;
	GListStore* _tmp20_;
	DcAudioPlaybackItem* _tmp21_;
	gint _tmp22_;
	gint _tmp23_;
	DcMessage* _tmp24_;
	DcMessage* _tmp25_;
	gboolean _tmp26_;
	DcAudioPlaybackItem* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_audio_playback_shared ();
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_audio_playback_get_current_item (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp1_);
	item = _tmp5_;
	_tmp9_ = item;
	if (_tmp9_ == NULL) {
		_tmp8_ = TRUE;
	} else {
		_tmp8_ = direction == 0;
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		DcAudioPlaybackItem* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		DcRpcClient* _tmp13_;
		gint _tmp14_;
		gint _tmp15_;
		_tmp10_ = item;
		_tmp11_ = dc_audio_playback_item_get_account_id (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = self->priv->rpc;
		_tmp14_ = dc_rpc_client_get_account_id (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp7_ = _tmp12_ != _tmp15_;
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		DcAudioPlaybackItem* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		_tmp16_ = item;
		_tmp17_ = dc_audio_playback_item_get_chat_id (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = self->priv->_chat_id;
		_tmp6_ = _tmp18_ != _tmp19_;
	}
	if (_tmp6_) {
		_g_object_unref0 (item);
		return;
	}
	_tmp20_ = self->priv->message_store;
	_tmp21_ = item;
	_tmp22_ = dc_audio_playback_item_get_message_id (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = dc_find_message ((GListModel*) _tmp20_, _tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = _tmp25_ != NULL;
	_g_object_unref0 (_tmp25_);
	if (_tmp26_) {
		dc_conversation_view_play_adjacent_voice_message (self, direction, NULL, NULL);
		_g_object_unref0 (item);
		return;
	}
	self->priv->pending_voice_direction = direction;
	_tmp27_ = item;
	_tmp28_ = dc_audio_playback_item_get_message_id (_tmp27_);
	_tmp29_ = _tmp28_;
	dc_conversation_view_scroll_to_message (self, _tmp29_);
	_g_object_unref0 (item);
}

static gboolean
dc_conversation_view_scroll_to_loaded_message (DcConversationView* self,
                                               gint msg_id)
{
	gint pos = 0;
	GtkFilterListModel* _tmp0_;
	DcMessage* msg = NULL;
	GtkFilterListModel* _tmp1_;
	GObject* _tmp2_;
	DcMessage* _tmp3_;
	GtkListView* _tmp4_;
	GtkFilterListModel* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->filtered_message_store;
	pos = dc_find_message_index ((GListModel*) _tmp0_, msg_id);
	if (pos < 0) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->filtered_message_store;
	_tmp2_ = g_list_model_get_item ((GListModel*) _tmp1_, (guint) pos);
	msg = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, DC_TYPE_MESSAGE, DcMessage);
	_tmp3_ = msg;
	dc_message_set_highlighted (_tmp3_, TRUE);
	_tmp4_ = self->priv->message_listview;
	gtk_list_view_scroll_to (_tmp4_, (guint) pos, GTK_LIST_SCROLL_FOCUS, NULL);
	_tmp5_ = self->priv->filtered_message_store;
	if ((((guint) pos) + 1) == g_list_model_get_n_items ((GListModel*) _tmp5_)) {
		guint _tmp6_;
		GtkButton* _tmp7_;
		_tmp6_ = self->priv->goal_generation;
		self->priv->goal_generation = _tmp6_ + 1;
		self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
		_tmp7_ = self->priv->scroll_down_btn;
		gtk_widget_set_visible ((GtkWidget*) _tmp7_, FALSE);
	} else {
		GtkButton* _tmp8_;
		dc_conversation_view_anchor_message (self, msg_id, (guint) pos, DBL_MAX, (guint) 45);
		_tmp8_ = self->priv->scroll_down_btn;
		gtk_widget_set_visible ((GtkWidget*) _tmp8_, TRUE);
	}
	result = TRUE;
	_g_object_unref0 (msg);
	return result;
}

/** Pin msg_id where it currently sits (or at wanted_top when the
            caller measured one before a splice) until the layout has held
            still for a few frames, then hand the viewport back. scroll_to
            only guarantees visibility for the layout of that one frame:
            images and stickers in freshly realized rows finish decoding
            later, resize, and would push the target away. min_frames keeps
            the anchor enforcing for at least that many frames even when
            the layout is instantly stable — an explicit jump must outlive
            the closing dialog's focus restore, which scrolls the list a
            few hundred ms later. Starting a new anchor, scroll_to_bottom
            or user input cancels this one instantly via goal_generation. */
static Block45Data*
block45_data_ref (Block45Data* _data45_)
{
	g_atomic_int_inc (&_data45_->_ref_count_);
	return _data45_;
}

static void
block45_data_unref (void * _userdata_)
{
	Block45Data* _data45_;
	_data45_ = (Block45Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data45_->_ref_count_)) {
		DcConversationView* self;
		self = _data45_->self;
		_g_object_unref0 (self);
		g_slice_free (Block45Data, _data45_);
	}
}

static gboolean
__lambda85_ (Block45Data* _data45_,
             GtkWidget* w,
             GdkFrameClock* clock)
{
	DcConversationView* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gdouble current_top = 0.0;
	DcMessageRow* row = NULL;
	GtkListView* _tmp2_;
	gdouble _tmp3_ = 0.0;
	DcMessageRow* _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	DcMessageRow* _tmp7_;
	gboolean in_viewport = FALSE;
	DcMessageRow* _tmp10_;
	guint _tmp19_;
	gboolean _tmp20_ = FALSE;
	gboolean settled = FALSE;
	gboolean _tmp21_ = FALSE;
	DcConversationViewViewportGoal _tmp22_ = 0;
	GtkButton* _tmp23_;
	gboolean result;
	self = _data45_->self;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (clock != NULL, FALSE);
	if (self->priv->closed) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = _data45_->generation != self->priv->goal_generation;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->goal != DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR;
	}
	if (_tmp0_) {
		result = dc_conversation_view_end_tick_callback (self, _data45_->tick_id);
		return result;
	}
	_tmp2_ = self->priv->message_listview;
	_tmp4_ = dc_conversation_view_find_message_row (self, (GtkWidget*) _tmp2_, _data45_->msg_id, &_tmp3_);
	current_top = _tmp3_;
	row = _tmp4_;
	_tmp7_ = row;
	if (_tmp7_ != NULL) {
		DcMessageRow* _tmp8_;
		_tmp8_ = row;
		_tmp6_ = (current_top + gtk_widget_get_height ((GtkWidget*) _tmp8_)) > ((gdouble) 0);
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		GtkScrolledWindow* _tmp9_;
		_tmp9_ = self->priv->message_scroll;
		_tmp5_ = current_top < ((gdouble) gtk_widget_get_height ((GtkWidget*) _tmp9_));
	} else {
		_tmp5_ = FALSE;
	}
	in_viewport = _tmp5_;
	_tmp10_ = row;
	if (_tmp10_ == NULL) {
		GtkListView* _tmp11_;
		_tmp11_ = self->priv->message_listview;
		gtk_list_view_scroll_to (_tmp11_, _data45_->position, GTK_LIST_SCROLL_NONE, NULL);
		_data45_->stable_frames = (guint) 0;
	} else {
		if (_data45_->want == DBL_MAX) {
			if (in_viewport) {
				_data45_->want = current_top;
			} else {
				GtkListView* _tmp12_;
				_tmp12_ = self->priv->message_listview;
				gtk_list_view_scroll_to (_tmp12_, _data45_->position, GTK_LIST_SCROLL_NONE, NULL);
				_data45_->stable_frames = (guint) 0;
			}
		} else {
			gdouble correction = 0.0;
			correction = current_top - _data45_->want;
			if (fabs (correction) > 0.5) {
				GtkScrolledWindow* _tmp13_;
				GtkAdjustment* _tmp14_;
				GtkAdjustment* _tmp15_;
				gdouble _tmp16_;
				gdouble _tmp17_;
				_tmp13_ = self->priv->message_scroll;
				_tmp14_ = gtk_scrolled_window_get_vadjustment (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = gtk_adjustment_get_value (_tmp15_);
				_tmp17_ = _tmp16_;
				dc_conversation_view_restore_scroll_value (self, _tmp17_ + correction);
				_data45_->stable_frames = (guint) 0;
			} else {
				guint _tmp18_;
				_tmp18_ = _data45_->stable_frames;
				_data45_->stable_frames = _tmp18_ + 1;
			}
		}
	}
	_tmp19_ = _data45_->elapsed_frames;
	_data45_->elapsed_frames = _tmp19_ + 1;
	if (_data45_->stable_frames >= ((guint) 3)) {
		_tmp20_ = _data45_->elapsed_frames >= _data45_->min_frames;
	} else {
		_tmp20_ = FALSE;
	}
	settled = _tmp20_;
	if (!settled) {
		_tmp21_ = _data45_->elapsed_frames < (_data45_->min_frames + 60);
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		result = G_SOURCE_CONTINUE;
		_g_object_unref0 (row);
		return result;
	}
	if (dc_conversation_view_is_near_bottom (self)) {
		_tmp22_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
	} else {
		_tmp22_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
	}
	self->priv->goal = _tmp22_;
	_tmp23_ = self->priv->scroll_down_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp23_, self->priv->goal != DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM);
	result = dc_conversation_view_end_tick_callback (self, _data45_->tick_id);
	_g_object_unref0 (row);
	return result;
}

static gboolean
___lambda85__gtk_tick_callback (GtkWidget* widget,
                                GdkFrameClock* frame_clock,
                                gpointer self)
{
	gboolean result;
	result = __lambda85_ (self, widget, frame_clock);
	return result;
}

static void
dc_conversation_view_anchor_message (DcConversationView* self,
                                     gint msg_id,
                                     guint position,
                                     gdouble wanted_top,
                                     guint min_frames)
{
	Block45Data* _data45_;
	guint _tmp0_;
	GtkListView* _tmp1_;
	g_return_if_fail (self != NULL);
	_data45_ = g_slice_new0 (Block45Data);
	_data45_->_ref_count_ = 1;
	_data45_->self = g_object_ref (self);
	_data45_->msg_id = msg_id;
	_data45_->position = position;
	_data45_->min_frames = min_frames;
	self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR;
	self->priv->goal_generation = self->priv->goal_generation + 1;
	_tmp0_ = self->priv->goal_generation;
	_data45_->generation = _tmp0_;
	_data45_->want = wanted_top;
	_data45_->stable_frames = (guint) 0;
	_data45_->elapsed_frames = (guint) 0;
	_data45_->tick_id = (guint) 0;
	_tmp1_ = self->priv->message_listview;
	_data45_->tick_id = gtk_widget_add_tick_callback ((GtkWidget*) _tmp1_, ___lambda85__gtk_tick_callback, block45_data_ref (_data45_), block45_data_unref);
	dc_conversation_view_track_tick_callback (self, _data45_->tick_id);
	block45_data_unref (_data45_);
	_data45_ = NULL;
}

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

static void
dc_conversation_view_load_messages (DcConversationView* self,
                                    gboolean preserve_scroll,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DcConversationViewLoadMessagesData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewLoadMessagesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_load_messages_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->preserve_scroll = preserve_scroll;
	dc_conversation_view_load_messages_co (_data_);
}

static void
dc_conversation_view_load_messages_finish (DcConversationView* self,
                                           GAsyncResult* _res_)
{
	DcConversationViewLoadMessagesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block46Data*
block46_data_ref (Block46Data* _data46_)
{
	g_atomic_int_inc (&_data46_->_ref_count_);
	return _data46_;
}

static void
block46_data_unref (void * _userdata_)
{
	Block46Data* _data46_;
	_data46_ = (Block46Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data46_->_ref_count_)) {
		DcConversationView* self;
		self = _data46_->self;
		_g_object_unref0 (self);
		g_slice_free (Block46Data, _data46_);
	}
}

static void
dc_conversation_view_load_messages_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DcConversationViewLoadMessagesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_load_messages_co (_data_);
}

static gboolean
_____lambda84_ (Block46Data* _data46_)
{
	DcConversationView* self;
	GtkButton* _tmp0_;
	gboolean result;
	self = _data46_->self;
	dc_conversation_view_restore_scroll_value (self, _data46_->previous_scroll_value);
	self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
	_tmp0_ = self->priv->scroll_down_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, !dc_conversation_view_is_near_bottom (self));
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
______lambda84__gsource_func (gpointer self)
{
	gboolean result;
	result = _____lambda84_ (self);
	return result;
}

static gboolean
dc_conversation_view_load_messages_co (DcConversationViewLoadMessagesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_ <= 0) {
		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_->_data46_ = g_slice_new0 (Block46Data);
		_data_->_data46_->_ref_count_ = 1;
		_data_->_data46_->self = g_object_ref (_data_->self);
		_data_->_state_ = 1;
		dc_conversation_view_load_chat_kind_if_needed (_data_->self, dc_conversation_view_load_messages_ready, _data_);
		return FALSE;
		_state_1:
		dc_conversation_view_load_chat_kind_if_needed_finish (_data_->self, _data_->_res_);
		_data_->_state_ = 2;
		dc_conversation_view_ensure_mention_roster (_data_->self, dc_conversation_view_load_messages_ready, _data_);
		return FALSE;
		_state_2:
		dc_conversation_view_ensure_mention_roster_finish (_data_->self, _data_->_res_);
		_data_->was_near_bottom = _data_->self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
		_data_->_data46_->previous_scroll_value = (gdouble) 0;
		if (_data_->preserve_scroll) {
			_data_->was_near_bottom = dc_conversation_view_is_near_bottom (_data_->self);
			_data_->_tmp3_ = _data_->self->priv->message_scroll;
			_data_->_tmp4_ = gtk_scrolled_window_get_vadjustment (_data_->_tmp3_);
			_data_->_tmp5_ = _data_->_tmp4_;
			_data_->_tmp6_ = gtk_adjustment_get_value (_data_->_tmp5_);
			_data_->_tmp7_ = _data_->_tmp6_;
			_data_->_data46_->previous_scroll_value = _data_->_tmp7_;
		}
		_data_->_tmp9_ = _data_->self->priv->rpc;
		_data_->_tmp10_ = _data_->self->priv->rpc;
		_data_->_tmp11_ = dc_rpc_client_get_account_id (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 3;
		dc_rpc_client_get_message_ids_for (_data_->_tmp9_, _data_->_tmp12_, _data_->_tmp13_, FALSE, dc_conversation_view_load_messages_ready, _data_);
		return FALSE;
		_state_3:
		_data_->_tmp14_ = dc_rpc_client_get_message_ids_for_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp8_ = _data_->_tmp14_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			block46_data_unref (_data_->_data46_);
			_data_->_data46_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp15_ = _data_->_tmp8_;
		_data_->_tmp8_ = NULL;
		_json_array_unref0 (_data_->self->priv->all_msg_ids);
		_data_->self->priv->all_msg_ids = _data_->_tmp15_;
		_data_->_tmp16_ = _data_->self->priv->all_msg_ids;
		if (_data_->_tmp16_ == NULL) {
			_json_array_unref0 (_data_->_tmp8_);
			block46_data_unref (_data_->_data46_);
			_data_->_data46_ = NULL;
			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_->_tmp18_ = _data_->self->priv->all_msg_ids;
		if (json_array_get_length (_data_->_tmp18_) > ((guint) 30)) {
			_data_->_tmp19_ = _data_->self->priv->all_msg_ids;
			_data_->_tmp17_ = json_array_get_length (_data_->_tmp19_) - 30;
		} else {
			_data_->_tmp17_ = (guint) 0;
		}
		_data_->self->priv->loaded_start_index = _data_->_tmp17_;
		_data_->_tmp20_ = _data_->self->priv->all_msg_ids;
		_data_->_state_ = 4;
		dc_conversation_view_fetch_messages_batch (_data_->self, _data_->self->priv->loaded_start_index, json_array_get_length (_data_->_tmp20_), dc_conversation_view_load_messages_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp21_ = dc_conversation_view_fetch_messages_batch_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->messages = _data_->_tmp21_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_json_array_unref0 (_data_->_tmp8_);
			block46_data_unref (_data_->_data46_);
			_data_->_data46_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp22_ = _data_->self->priv->pinned;
		_data_->_tmp23_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 5;
		dc_pinned_messages_manager_load_for_chat (_data_->_tmp22_, _data_->_tmp23_, dc_conversation_view_load_messages_ready, _data_);
		return FALSE;
		_state_5:
		dc_pinned_messages_manager_load_for_chat_finish (_data_->_tmp22_, _data_->_res_);
		_data_->_tmp24_ = _data_->self->priv->webxdc_bar;
		_data_->_tmp25_ = _data_->self->priv->_chat_id;
		dc_webxdc_apps_bar_load_for_chat (_data_->_tmp24_, _data_->_tmp25_, NULL, NULL);
		_data_->self->priv->loading_chat = TRUE;
		_data_->_tmp26_ = _data_->self->priv->goal_generation;
		_data_->self->priv->goal_generation = _data_->_tmp26_ + 1;
		if (!_data_->preserve_scroll) {
			_data_->_tmp28_ = TRUE;
		} else {
			_data_->_tmp28_ = _data_->was_near_bottom;
		}
		if (_data_->_tmp28_) {
			_data_->_tmp27_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
		} else {
			_data_->_tmp27_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
		}
		_data_->self->priv->goal = _data_->_tmp27_;
		_data_->_tmp29_ = _data_->self->priv->message_store;
		_data_->_tmp30_ = _data_->self->priv->message_store;
		_data_->_tmp31_ = _data_->messages;
		_data_->_tmp32_ = 0;
		_data_->_tmp33_ = dc_conversation_view_pinned_message_batch (_data_->self, _data_->_tmp31_, &_data_->_tmp32_);
		_data_->_tmp34_ = _data_->_tmp33_;
		_data_->_tmp34__length1 = _data_->_tmp32_;
		g_list_store_splice (_data_->_tmp29_, (guint) 0, g_list_model_get_n_items ((GListModel*) _data_->_tmp30_), _data_->_tmp34_, (guint) _data_->_tmp32_);
		_data_->_tmp34_ = (_vala_array_free (_data_->_tmp34_, _data_->_tmp34__length1, (GDestroyNotify) g_object_unref), NULL);
		dc_conversation_view_update_conversation_media_bar (_data_->self);
		_data_->self->priv->messages_loaded = TRUE;
		_data_->self->priv->messages_stale = FALSE;
		_data_->self->priv->loading_chat = FALSE;
		dc_conversation_view_flush_pending_seen (_data_->self);
		_data_->_tmp35_ = _data_->messages;
		_data_->_tmp36_ = vala_g_ptr_array_get_length (_data_->_tmp35_);
		_data_->_tmp37_ = _data_->_tmp36_;
		if (_data_->_tmp37_ > 0) {
			if (!_data_->preserve_scroll) {
				_data_->_tmp38_ = TRUE;
			} else {
				_data_->_tmp38_ = _data_->was_near_bottom;
			}
			if (_data_->_tmp38_) {
				dc_conversation_view_scroll_to_bottom (_data_->self);
			} else {
				g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ______lambda84__gsource_func, block46_data_ref (_data_->_data46_), block46_data_unref);
			}
		}
		_data_->_tmp39_ = _data_->self->priv->pinned;
		dc_pinned_messages_manager_update_bar (_data_->_tmp39_, NULL, NULL);
		dc_conversation_view_resume_pending_message_scroll (_data_->self);
		_g_ptr_array_unref0 (_data_->messages);
		_json_array_unref0 (_data_->_tmp8_);
		block46_data_unref (_data_->_data46_);
		_data_->_data46_ = NULL;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->self->priv->messages_loaded = FALSE;
		_data_->self->priv->messages_stale = TRUE;
		_data_->_tmp40_ = _data_->self->priv->window;
		_data_->_tmp41_ = _data_->e;
		_data_->_tmp42_ = _data_->_tmp41_->message;
		_data_->_tmp43_ = g_strconcat ("Failed to load messages: ", _data_->_tmp42_, NULL);
		_data_->_tmp44_ = _data_->_tmp43_;
		dc_window_show_toast (_data_->_tmp40_, _data_->_tmp44_);
		_g_free0 (_data_->_tmp44_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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
dc_conversation_view_ensure_mention_roster_data_free (gpointer _data)
{
	DcConversationViewEnsureMentionRosterData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewEnsureMentionRosterData, _data_);
}

static void
dc_conversation_view_ensure_mention_roster (DcConversationView* self,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	DcConversationViewEnsureMentionRosterData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewEnsureMentionRosterData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_ensure_mention_roster_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_ensure_mention_roster_co (_data_);
}

static void
dc_conversation_view_ensure_mention_roster_finish (DcConversationView* self,
                                                   GAsyncResult* _res_)
{
	DcConversationViewEnsureMentionRosterData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_ensure_mention_roster_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	DcConversationViewEnsureMentionRosterData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_ensure_mention_roster_co (_data_);
}

static gpointer
_json_array_ref0 (gpointer self)
{
	return self ? json_array_ref (self) : NULL;
}

static gboolean
dc_conversation_view_ensure_mention_roster_co (DcConversationViewEnsureMentionRosterData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->roster_loaded) {
		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_->self->priv->roster_loaded = TRUE;
	{
		_data_->_tmp0_ = dc_mention_roster_new ();
		_data_->roster = _data_->_tmp0_;
		_data_->_tmp1_ = _data_->self->priv->window;
		_data_->_tmp2_ = 0;
		_data_->_tmp3_ = dc_window_self_mention_keys (_data_->_tmp1_, &_data_->_tmp2_);
		{
			_data_->key_collection_length1 = 0;
			_data_->_key_collection_size_ = 0;
			_data_->key_collection = _data_->_tmp3_;
			_data_->key_collection_length1 = _data_->_tmp2_;
			for (_data_->key_it = 0; _data_->key_it < _data_->key_collection_length1; _data_->key_it = _data_->key_it + 1) {
				_data_->_tmp4_ = g_strdup (_data_->key_collection[_data_->key_it]);
				_data_->key = _data_->_tmp4_;
				{
					_data_->_tmp5_ = _data_->roster;
					_data_->_tmp6_ = _data_->key;
					dc_mention_roster_add_self_key (_data_->_tmp5_, _data_->_tmp6_);
					_g_free0 (_data_->key);
				}
			}
			_data_->key_collection = (_vala_array_free (_data_->key_collection, _data_->key_collection_length1, (GDestroyNotify) g_free), NULL);
		}
		_data_->_tmp7_ = _data_->self->priv->rpc;
		_data_->_tmp8_ = _data_->self->priv->rpc;
		_data_->_tmp9_ = dc_rpc_client_get_account_id (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 1;
		dc_rpc_client_get_full_chat_by_id_for (_data_->_tmp7_, _data_->_tmp10_, _data_->_tmp11_, dc_conversation_view_ensure_mention_roster_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp12_ = dc_rpc_client_get_full_chat_by_id_for_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error0_);
		_data_->chat = _data_->_tmp12_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->roster);
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = _data_->chat;
		if (_data_->_tmp14_ != NULL) {
			_data_->_tmp15_ = _data_->chat;
			_data_->_tmp13_ = json_object_has_member (_data_->_tmp15_, "contactIds");
		} else {
			_data_->_tmp13_ = FALSE;
		}
		if (_data_->_tmp13_) {
			_data_->_tmp16_ = _data_->chat;
			_data_->_tmp17_ = json_object_get_array_member (_data_->_tmp16_, "contactIds");
			_data_->_tmp18_ = _json_array_ref0 (_data_->_tmp17_);
			_data_->ids = _data_->_tmp18_;
			{
				_data_->i = (guint) 0;
				{
					_data_->_tmp19_ = TRUE;
					while (TRUE) {
						if (!_data_->_tmp19_) {
							_data_->_tmp20_ = _data_->i;
							_data_->i = _data_->_tmp20_ + 1;
						}
						_data_->_tmp19_ = FALSE;
						_data_->_tmp21_ = _data_->ids;
						if (!(_data_->i < json_array_get_length (_data_->_tmp21_))) {
							break;
						}
						_data_->_tmp22_ = _data_->ids;
						_data_->cid = (gint) json_array_get_int_element (_data_->_tmp22_, _data_->i);
						_data_->_tmp23_ = _data_->self->priv->rpc;
						_data_->_tmp24_ = _data_->self->priv->rpc;
						_data_->_tmp25_ = dc_rpc_client_get_account_id (_data_->_tmp24_);
						_data_->_tmp26_ = _data_->_tmp25_;
						_data_->_state_ = 2;
						dc_rpc_client_get_contact_for (_data_->_tmp23_, _data_->_tmp26_, _data_->cid, dc_conversation_view_ensure_mention_roster_ready, _data_);
						return FALSE;
						_state_2:
						_data_->_tmp27_ = dc_rpc_client_get_contact_for_finish (_data_->_tmp23_, _data_->_res_, &_data_->_inner_error0_);
						_data_->cobj = _data_->_tmp27_;
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							_json_array_unref0 (_data_->ids);
							_json_object_unref0 (_data_->chat);
							_g_object_unref0 (_data_->roster);
							goto __catch0_g_error;
						}
						_data_->_tmp28_ = _data_->cobj;
						if (_data_->_tmp28_ == NULL) {
							_json_object_unref0 (_data_->cobj);
							continue;
						}
						_data_->_tmp29_ = _data_->cobj;
						_data_->_tmp30_ = dc_rpc_parsers_parse_contact (_data_->cid, _data_->_tmp29_);
						_data_->c = _data_->_tmp30_;
						if (_data_->cid == 1) {
							_data_->_tmp34_ = dc_message_row_self_display_name;
							_data_->_tmp33_ = _data_->_tmp34_ != NULL;
						} else {
							_data_->_tmp33_ = FALSE;
						}
						if (_data_->_tmp33_) {
							_data_->_tmp35_ = dc_message_row_self_display_name;
							_data_->_tmp36_ = string_strip (_data_->_tmp35_);
							_data_->_tmp37_ = _data_->_tmp36_;
							_data_->_tmp38_ = strlen (_data_->_tmp37_);
							_data_->_tmp39_ = _data_->_tmp38_;
							_data_->_tmp32_ = _data_->_tmp39_ > 0;
							_g_free0 (_data_->_tmp37_);
						} else {
							_data_->_tmp32_ = FALSE;
						}
						if (_data_->_tmp32_) {
							_data_->_tmp40_ = dc_message_row_self_display_name;
							_data_->_tmp41_ = string_strip (_data_->_tmp40_);
							_g_free0 (_data_->_tmp31_);
							_data_->_tmp31_ = _data_->_tmp41_;
						} else {
							_data_->_tmp42_ = _data_->c;
							_data_->_tmp43_ = dc_contact_get_display_name (_data_->_tmp42_);
							_data_->_tmp44_ = _data_->_tmp43_;
							_data_->_tmp45_ = g_strdup (_data_->_tmp44_);
							_g_free0 (_data_->_tmp31_);
							_data_->_tmp31_ = _data_->_tmp45_;
						}
						_data_->_tmp46_ = _data_->_tmp31_;
						_data_->_tmp31_ = NULL;
						_data_->name = _data_->_tmp46_;
						_data_->_tmp47_ = _data_->roster;
						_data_->_tmp48_ = _data_->name;
						_data_->_tmp49_ = _data_->c;
						_data_->_tmp50_ = dc_contact_get_address (_data_->_tmp49_);
						_data_->_tmp51_ = _data_->_tmp50_;
						_data_->_tmp52_ = _data_->c;
						_data_->_tmp53_ = dc_contact_get_profile_image (_data_->_tmp52_);
						_data_->_tmp54_ = _data_->_tmp53_;
						_data_->_tmp55_ = dc_mention_member_new (_data_->cid, _data_->_tmp48_, _data_->_tmp51_, _data_->cid == 1, _data_->_tmp54_);
						_data_->_tmp56_ = _data_->_tmp55_;
						dc_mention_roster_add_member (_data_->_tmp47_, _data_->_tmp56_);
						_g_object_unref0 (_data_->_tmp56_);
						_g_free0 (_data_->name);
						_g_free0 (_data_->_tmp31_);
						_g_object_unref0 (_data_->c);
						_json_object_unref0 (_data_->cobj);
					}
				}
			}
			_json_array_unref0 (_data_->ids);
		}
		_data_->_tmp57_ = _data_->roster;
		_data_->_tmp58_ = _g_object_ref0 (_data_->_tmp57_);
		_g_object_unref0 (_data_->self->priv->reaction_roster);
		_data_->self->priv->reaction_roster = _data_->_tmp58_;
		_data_->_tmp59_ = _data_->self->priv->msg_actions;
		if (_data_->_tmp59_ != NULL) {
			_data_->_tmp60_ = _data_->self->priv->msg_actions;
			_data_->_tmp61_ = _data_->self->priv->reaction_roster;
			dc_message_actions_set_reaction_roster (_data_->_tmp60_, _data_->_tmp61_);
		}
		_data_->_tmp62_ = _data_->roster;
		_data_->_tmp63_ = _g_object_ref0 (_data_->_tmp62_);
		_g_object_unref0 (_data_->self->priv->mention_roster);
		_data_->self->priv->mention_roster = _data_->_tmp63_;
		if (_data_->self->priv->chat_kind == DC_CHAT_KIND_DIRECT) {
			_data_->_tmp64_ = NULL;
		} else {
			_data_->_tmp65_ = _data_->roster;
			_data_->_tmp64_ = _data_->_tmp65_;
		}
		_data_->_tmp66_ = _data_->self->priv->compose_bar;
		dc_compose_bar_set_mention_roster (_data_->_tmp66_, _data_->_tmp64_);
		_json_object_unref0 (_data_->chat);
		_g_object_unref0 (_data_->roster);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_g_object_unref0 (_data_->self->priv->reaction_roster);
		_data_->self->priv->reaction_roster = NULL;
		_g_object_unref0 (_data_->self->priv->mention_roster);
		_data_->self->priv->mention_roster = NULL;
		_data_->_tmp67_ = _data_->self->priv->msg_actions;
		if (_data_->_tmp67_ != NULL) {
			_data_->_tmp68_ = _data_->self->priv->msg_actions;
			dc_message_actions_set_reaction_roster (_data_->_tmp68_, NULL);
		}
		_data_->_tmp69_ = _data_->self->priv->compose_bar;
		dc_compose_bar_set_mention_roster (_data_->_tmp69_, NULL);
		_data_->self->priv->roster_loaded = FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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;
}

void
dc_conversation_view_invalidate_mention_roster (DcConversationView* self)
{
	g_return_if_fail (self != NULL);
	self->priv->roster_loaded = FALSE;
}

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

static void
dc_conversation_view_load_chat_kind_if_needed (DcConversationView* self,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	DcConversationViewLoadChatKindIfNeededData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewLoadChatKindIfNeededData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_load_chat_kind_if_needed_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_load_chat_kind_if_needed_co (_data_);
}

static void
dc_conversation_view_load_chat_kind_if_needed_finish (DcConversationView* self,
                                                      GAsyncResult* _res_)
{
	DcConversationViewLoadChatKindIfNeededData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_load_chat_kind_if_needed_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	DcConversationViewLoadChatKindIfNeededData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_load_chat_kind_if_needed_co (_data_);
}

static gboolean
dc_conversation_view_load_chat_kind_if_needed_co (DcConversationViewLoadChatKindIfNeededData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->chat_kind_loaded) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp0_ = _data_->self->priv->chat_kind != DC_CHAT_KIND_UNKNOWN;
	}
	if (_data_->_tmp0_) {
		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_->self->priv->chat_kind_loaded = TRUE;
	{
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_tmp3_ = dc_rpc_client_get_account_id (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 1;
		dc_rpc_client_get_full_chat_by_id_for (_data_->_tmp1_, _data_->_tmp4_, _data_->_tmp5_, dc_conversation_view_load_chat_kind_if_needed_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp6_ = dc_rpc_client_get_full_chat_by_id_for_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->chat = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp7_ = _data_->chat;
		if (_data_->_tmp7_ != NULL) {
			_data_->_tmp8_ = _data_->chat;
			_data_->self->priv->chat_kind = dc_rpc_parsers_parse_chat_kind (_data_->_tmp8_);
		}
		_json_object_unref0 (_data_->chat);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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 gboolean
dc_conversation_view_bubble_avatars_apply_to_this_chat (DcConversationView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	switch (self->priv->chat_kind) {
		case DC_CHAT_KIND_DIRECT:
		{
			DcSettingsManager* _tmp0_;
			gboolean _tmp1_;
			gboolean _tmp2_;
			_tmp0_ = self->priv->settings;
			_tmp1_ = dc_settings_manager_get_bubble_avatars_in_direct_chats (_tmp0_);
			_tmp2_ = _tmp1_;
			result = _tmp2_;
			return result;
		}
		case DC_CHAT_KIND_GROUP:
		{
			result = TRUE;
			return result;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
}

static void
dc_conversation_view_fetch_messages_batch_data_free (gpointer _data)
{
	DcConversationViewFetchMessagesBatchData* _data_;
	_data_ = _data;
	_g_ptr_array_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewFetchMessagesBatchData, _data_);
}

static void
dc_conversation_view_fetch_messages_batch (DcConversationView* self,
                                           guint start,
                                           guint end,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcConversationViewFetchMessagesBatchData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewFetchMessagesBatchData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_fetch_messages_batch_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->start = start;
	_data_->end = end;
	dc_conversation_view_fetch_messages_batch_co (_data_);
}

static GPtrArray*
dc_conversation_view_fetch_messages_batch_finish (DcConversationView* self,
                                                  GAsyncResult* _res_,
                                                  GError** error)
{
	GPtrArray* result;
	DcConversationViewFetchMessagesBatchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_conversation_view_fetch_messages_batch_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	DcConversationViewFetchMessagesBatchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_fetch_messages_batch_co (_data_);
}

static gboolean
dc_conversation_view_fetch_messages_batch_co (DcConversationViewFetchMessagesBatchData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->count = _data_->end - _data_->start;
	_data_->_tmp0_ = g_new0 (gint, _data_->count);
	_data_->ids = _data_->_tmp0_;
	_data_->ids_length1 = _data_->count;
	_data_->_ids_size_ = _data_->ids_length1;
	{
		_data_->i = (guint) 0;
		{
			_data_->_tmp1_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp1_) {
					_data_->_tmp2_ = _data_->i;
					_data_->i = _data_->_tmp2_ + 1;
				}
				_data_->_tmp1_ = FALSE;
				if (!(_data_->i < _data_->count)) {
					break;
				}
				_data_->_tmp3_ = _data_->ids;
				_data_->_tmp3__length1 = _data_->ids_length1;
				_data_->_tmp4_ = _data_->self->priv->all_msg_ids;
				_data_->_tmp3_[_data_->i] = (gint) json_array_get_int_element (_data_->_tmp4_, _data_->start + _data_->i);
			}
		}
	}
	_data_->_tmp5_ = _data_->self->priv->rpc;
	_data_->_tmp6_ = _data_->self->priv->rpc;
	_data_->_tmp7_ = dc_rpc_client_get_account_id (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = _data_->ids;
	_data_->_tmp9__length1 = _data_->ids_length1;
	_data_->_state_ = 1;
	dc_rpc_client_get_messages_for (_data_->_tmp5_, _data_->_tmp8_, _data_->_tmp9_, (gint) _data_->_tmp9__length1, dc_conversation_view_fetch_messages_batch_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp10_ = dc_rpc_client_get_messages_for_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_);
	_data_->map = _data_->_tmp10_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_data_->ids = (g_free (_data_->ids), NULL);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_data_->_result_ = _data_->_tmp11_;
	if (_data_->map != NULL) {
		_data_->_tmp12_ = _data_->ids;
		_data_->_tmp12__length1 = _data_->ids_length1;
		{
			_data_->mid_collection_length1 = 0;
			_data_->_mid_collection_size_ = 0;
			_data_->mid_collection = _data_->_tmp12_;
			_data_->mid_collection_length1 = _data_->_tmp12__length1;
			for (_data_->mid_it = 0; _data_->mid_it < _data_->mid_collection_length1; _data_->mid_it = _data_->mid_it + 1) {
				_data_->mid = _data_->mid_collection[_data_->mid_it];
				{
					_data_->_tmp13_ = g_strdup_printf ("%i", _data_->mid);
					_data_->k = _data_->_tmp13_;
					_data_->_tmp14_ = _data_->k;
					if (json_object_has_member (_data_->map, _data_->_tmp14_)) {
						_data_->_tmp15_ = _data_->k;
						_data_->_tmp16_ = json_object_get_object_member (_data_->map, _data_->_tmp15_);
						_data_->_tmp17_ = _data_->self->priv->rpc;
						_data_->_tmp18_ = dc_rpc_client_get_self_email (_data_->_tmp17_);
						_data_->_tmp19_ = _data_->_tmp18_;
						_data_->_tmp20_ = dc_rpc_parsers_parse_message (_data_->_tmp16_, _data_->_tmp19_);
						_data_->msg = _data_->_tmp20_;
						_data_->_tmp21_ = _data_->msg;
						_data_->_tmp22_ = dc_message_get_state (_data_->_tmp21_);
						_data_->_tmp23_ = _data_->_tmp22_;
						if (_data_->_tmp23_ != ((gint) DC_MESSAGE_STATE_OUT_DRAFT)) {
							_data_->_tmp24_ = _data_->_result_;
							_data_->_tmp25_ = _data_->msg;
							_data_->_tmp26_ = _g_object_ref0 (_data_->_tmp25_);
							g_ptr_array_add (_data_->_tmp24_, _data_->_tmp26_);
						}
						_g_object_unref0 (_data_->msg);
					}
					_g_free0 (_data_->k);
				}
			}
		}
	}
	_data_->result = _data_->_result_;
	_json_object_unref0 (_data_->map);
	_data_->ids = (g_free (_data_->ids), NULL);
	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 GObject**
dc_conversation_view_pinned_message_batch (DcConversationView* self,
                                           GPtrArray* messages,
                                           gint* result_length1)
{
	GObject** batch = NULL;
	gint _tmp0_;
	gint _tmp1_;
	GObject** _tmp2_;
	gint batch_length1;
	gint _batch_size_;
	GObject** _tmp24_;
	gint _tmp24__length1;
	GObject** result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (messages != NULL, NULL);
	_tmp0_ = vala_g_ptr_array_get_length (messages);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_new0 (GObject*, _tmp1_ + 1);
	batch = _tmp2_;
	batch_length1 = _tmp1_;
	_batch_size_ = batch_length1;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gint _tmp5_;
				gint _tmp6_;
				gconstpointer _tmp7_;
				DcPinnedMessagesManager* _tmp8_;
				gconstpointer _tmp9_;
				gint _tmp10_;
				gint _tmp11_;
				gconstpointer _tmp12_;
				DcMessage* old_msg = NULL;
				GListStore* _tmp13_;
				gconstpointer _tmp14_;
				gint _tmp15_;
				gint _tmp16_;
				DcMessage* _tmp17_;
				DcMessage* _tmp18_;
				GObject** _tmp21_;
				gint _tmp21__length1;
				gconstpointer _tmp22_;
				GObject* _tmp23_;
				if (!_tmp3_) {
					guint _tmp4_;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = vala_g_ptr_array_get_length (messages);
				_tmp6_ = _tmp5_;
				if (!(i < ((guint) _tmp6_))) {
					break;
				}
				_tmp7_ = g_ptr_array_index (messages, i);
				_tmp8_ = self->priv->pinned;
				_tmp9_ = g_ptr_array_index (messages, i);
				_tmp10_ = dc_message_get_id ((DcMessage*) _tmp9_);
				_tmp11_ = _tmp10_;
				dc_message_set_is_pinned ((DcMessage*) _tmp7_, dc_pinned_messages_manager_is_pinned (_tmp8_, _tmp11_));
				_tmp12_ = g_ptr_array_index (messages, i);
				dc_message_set_selection_visible ((DcMessage*) _tmp12_, self->priv->selection_mode);
				_tmp13_ = self->priv->message_store;
				_tmp14_ = g_ptr_array_index (messages, i);
				_tmp15_ = dc_message_get_id ((DcMessage*) _tmp14_);
				_tmp16_ = _tmp15_;
				_tmp17_ = dc_find_message ((GListModel*) _tmp13_, _tmp16_);
				old_msg = _tmp17_;
				_tmp18_ = old_msg;
				if (_tmp18_ != NULL) {
					DcMessage* _tmp19_;
					gconstpointer _tmp20_;
					_tmp19_ = old_msg;
					_tmp20_ = g_ptr_array_index (messages, i);
					dc_conversation_view_preserve_full_message_state (_tmp19_, (DcMessage*) _tmp20_);
				}
				_tmp21_ = batch;
				_tmp21__length1 = batch_length1;
				_tmp22_ = g_ptr_array_index (messages, i);
				_tmp23_ = _g_object_ref0 ((GObject*) ((DcMessage*) _tmp22_));
				_g_object_unref0 (_tmp21_[i]);
				_tmp21_[i] = _tmp23_;
				_g_object_unref0 (old_msg);
			}
		}
	}
	_tmp24_ = batch;
	_tmp24__length1 = batch_length1;
	if (result_length1) {
		*result_length1 = _tmp24__length1;
	}
	result = _tmp24_;
	return result;
}

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

static void
dc_conversation_view_load_earlier_messages (DcConversationView* self,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	DcConversationViewLoadEarlierMessagesData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewLoadEarlierMessagesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_load_earlier_messages_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_load_earlier_messages_co (_data_);
}

static void
dc_conversation_view_load_earlier_messages_finish (DcConversationView* self,
                                                   GAsyncResult* _res_)
{
	DcConversationViewLoadEarlierMessagesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_load_earlier_messages_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	DcConversationViewLoadEarlierMessagesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_load_earlier_messages_co (_data_);
}

static gboolean
dc_conversation_view_load_earlier_messages_co (DcConversationViewLoadEarlierMessagesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->loading_more) {
		_data_->_tmp1_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->all_msg_ids;
		_data_->_tmp1_ = _data_->_tmp2_ == NULL;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp0_ = _data_->self->priv->loaded_start_index == ((guint) 0);
	}
	if (_data_->_tmp0_) {
		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_->self->priv->loading_more = TRUE;
	dc_conversation_view_set_loading_more_visible (_data_->self, TRUE);
	if (_data_->self->priv->loaded_start_index > ((guint) 100)) {
		_data_->_tmp3_ = _data_->self->priv->loaded_start_index - 100;
	} else {
		_data_->_tmp3_ = (guint) 0;
	}
	_data_->new_start = _data_->_tmp3_;
	{
		_data_->_state_ = 1;
		dc_conversation_view_fetch_messages_batch (_data_->self, _data_->new_start, _data_->self->priv->loaded_start_index, dc_conversation_view_load_earlier_messages_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp4_ = dc_conversation_view_fetch_messages_batch_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->messages = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = _data_->self->priv->message_listview;
		_data_->_tmp6_ = 0.0;
		_data_->_tmp7_ = dc_conversation_view_find_message_row (_data_->self, (GtkWidget*) _data_->_tmp5_, 0, &_data_->_tmp6_);
		_data_->anchor_top = _data_->_tmp6_;
		_data_->anchor = _data_->_tmp7_;
		_data_->_tmp9_ = _data_->anchor;
		if (_data_->_tmp9_ != NULL) {
			_data_->_tmp10_ = _data_->anchor;
			_data_->_tmp11_ = dc_message_row_get_message_id (_data_->_tmp10_);
			_data_->_tmp12_ = _data_->_tmp11_;
			_data_->_tmp8_ = _data_->_tmp12_;
		} else {
			_data_->_tmp8_ = 0;
		}
		_data_->anchor_id = _data_->_tmp8_;
		_data_->_tmp13_ = _data_->self->priv->message_store;
		_data_->_tmp14_ = _data_->messages;
		_data_->_tmp15_ = 0;
		_data_->_tmp16_ = dc_conversation_view_pinned_message_batch (_data_->self, _data_->_tmp14_, &_data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp17__length1 = _data_->_tmp15_;
		g_list_store_splice (_data_->_tmp13_, (guint) 0, (guint) 0, _data_->_tmp17_, (guint) _data_->_tmp15_);
		_data_->_tmp17_ = (_vala_array_free (_data_->_tmp17_, _data_->_tmp17__length1, (GDestroyNotify) g_object_unref), NULL);
		dc_conversation_view_flush_pending_seen (_data_->self);
		_data_->self->priv->loaded_start_index = _data_->new_start;
		dc_conversation_view_update_conversation_media_bar (_data_->self);
		if (_data_->anchor_id != 0) {
			_data_->_tmp19_ = _data_->self->priv->filtered_message_store;
			_data_->_tmp18_ = dc_find_message_index ((GListModel*) _data_->_tmp19_, _data_->anchor_id);
		} else {
			_data_->_tmp18_ = -1;
		}
		_data_->anchor_pos = _data_->_tmp18_;
		if (_data_->anchor_pos >= 0) {
			dc_conversation_view_anchor_message (_data_->self, _data_->anchor_id, (guint) _data_->anchor_pos, _data_->anchor_top, (guint) 0);
		}
		dc_conversation_view_finish_loading_earlier (_data_->self, TRUE);
		_g_object_unref0 (_data_->anchor);
		_g_ptr_array_unref0 (_data_->messages);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->self->priv->pending_scroll_message_id = 0;
		_data_->self->priv->pending_voice_direction = 0;
		dc_conversation_view_finish_loading_earlier (_data_->self, FALSE);
		_data_->_tmp20_ = _data_->self->priv->window;
		_data_->_tmp21_ = _data_->e;
		_data_->_tmp22_ = _data_->_tmp21_->message;
		_data_->_tmp23_ = g_strconcat ("Failed to load earlier messages: ", _data_->_tmp22_, NULL);
		_data_->_tmp24_ = _data_->_tmp23_;
		dc_window_show_toast (_data_->_tmp20_, _data_->_tmp24_);
		_g_free0 (_data_->_tmp24_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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
dc_conversation_view_load_until_pending_message_data_free (gpointer _data)
{
	DcConversationViewLoadUntilPendingMessageData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewLoadUntilPendingMessageData, _data_);
}

static void
dc_conversation_view_load_until_pending_message (DcConversationView* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	DcConversationViewLoadUntilPendingMessageData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewLoadUntilPendingMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_load_until_pending_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_load_until_pending_message_co (_data_);
}

static void
dc_conversation_view_load_until_pending_message_finish (DcConversationView* self,
                                                        GAsyncResult* _res_)
{
	DcConversationViewLoadUntilPendingMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_load_until_pending_message_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	DcConversationViewLoadUntilPendingMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_load_until_pending_message_co (_data_);
}

static gboolean
dc_conversation_view_load_until_pending_message_co (DcConversationViewLoadUntilPendingMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->loading_more) {
		_data_->_tmp1_ = TRUE;
	} else {
		_data_->_tmp1_ = _data_->self->priv->pending_scroll_message_id == 0;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->all_msg_ids;
		_data_->_tmp0_ = _data_->_tmp2_ == NULL;
	}
	if (_data_->_tmp0_) {
		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_->self->priv->loading_more = TRUE;
	dc_conversation_view_set_loading_more_visible (_data_->self, TRUE);
	if (_data_->self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM) {
		_data_->self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
	}
	_data_->unavailable = FALSE;
	{
		while (TRUE) {
			if (!(_data_->self->priv->pending_scroll_message_id != 0)) {
				break;
			}
			_data_->target_id = _data_->self->priv->pending_scroll_message_id;
			_data_->_tmp3_ = _data_->self->priv->message_store;
			_data_->_tmp4_ = dc_find_message ((GListModel*) _data_->_tmp3_, _data_->target_id);
			_data_->_tmp5_ = _data_->_tmp4_;
			_data_->_tmp6_ = _data_->_tmp5_ != NULL;
			_g_object_unref0 (_data_->_tmp5_);
			if (_data_->_tmp6_) {
				break;
			}
			_data_->_tmp7_ = _data_->self->priv->all_msg_ids;
			_data_->target_index = dc_message_history_find_id (_data_->_tmp7_, _data_->target_id);
			if (_data_->target_index < 0) {
				_data_->_tmp8_ = TRUE;
			} else {
				_data_->_tmp8_ = ((guint) _data_->target_index) >= _data_->self->priv->loaded_start_index;
			}
			if (_data_->_tmp8_) {
				if (_data_->self->priv->pending_scroll_message_id == _data_->target_id) {
					_data_->self->priv->pending_scroll_message_id = 0;
				}
				_data_->unavailable = TRUE;
				break;
			}
			_data_->new_start = dc_message_history_earlier_batch_start (_data_->self->priv->loaded_start_index, (guint) _data_->target_index, (guint) 1000);
			_data_->_state_ = 1;
			dc_conversation_view_fetch_messages_batch (_data_->self, _data_->new_start, _data_->self->priv->loaded_start_index, dc_conversation_view_load_until_pending_message_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp9_ = dc_conversation_view_fetch_messages_batch_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			_data_->messages = _data_->_tmp9_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			if (_data_->self->priv->pending_scroll_message_id == 0) {
				_g_ptr_array_unref0 (_data_->messages);
				break;
			}
			_data_->_tmp10_ = _data_->self->priv->message_listview;
			_data_->_tmp11_ = 0.0;
			_data_->_tmp12_ = dc_conversation_view_find_message_row (_data_->self, (GtkWidget*) _data_->_tmp10_, 0, &_data_->_tmp11_);
			_data_->anchor_top = _data_->_tmp11_;
			_data_->anchor_row = _data_->_tmp12_;
			_data_->_tmp13_ = _data_->self->priv->message_store;
			_data_->_tmp14_ = _data_->messages;
			_data_->_tmp15_ = 0;
			_data_->_tmp16_ = dc_conversation_view_pinned_message_batch (_data_->self, _data_->_tmp14_, &_data_->_tmp15_);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp17__length1 = _data_->_tmp15_;
			g_list_store_splice (_data_->_tmp13_, (guint) 0, (guint) 0, _data_->_tmp17_, (guint) _data_->_tmp15_);
			_data_->_tmp17_ = (_vala_array_free (_data_->_tmp17_, _data_->_tmp17__length1, (GDestroyNotify) g_object_unref), NULL);
			dc_conversation_view_flush_pending_seen (_data_->self);
			_data_->self->priv->loaded_start_index = _data_->new_start;
			dc_conversation_view_update_conversation_media_bar (_data_->self);
			_data_->_tmp18_ = _data_->anchor_row;
			if (_data_->_tmp18_ != NULL) {
				_data_->_tmp19_ = _data_->self->priv->filtered_message_store;
				_data_->_tmp20_ = _data_->anchor_row;
				_data_->_tmp21_ = dc_message_row_get_message_id (_data_->_tmp20_);
				_data_->_tmp22_ = _data_->_tmp21_;
				_data_->anchor_pos = dc_find_message_index ((GListModel*) _data_->_tmp19_, _data_->_tmp22_);
				if (_data_->anchor_pos >= 0) {
					_data_->_tmp23_ = _data_->anchor_row;
					_data_->_tmp24_ = dc_message_row_get_message_id (_data_->_tmp23_);
					_data_->_tmp25_ = _data_->_tmp24_;
					dc_conversation_view_anchor_message (_data_->self, _data_->_tmp25_, (guint) _data_->anchor_pos, _data_->anchor_top, (guint) 0);
				}
			}
			_g_object_unref0 (_data_->anchor_row);
			_g_ptr_array_unref0 (_data_->messages);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->self->priv->pending_scroll_message_id = 0;
		dc_conversation_view_finish_loading_earlier (_data_->self, FALSE);
		_data_->_tmp26_ = _data_->self->priv->window;
		_data_->_tmp27_ = _data_->e;
		_data_->_tmp28_ = _data_->_tmp27_->message;
		_data_->_tmp29_ = g_strconcat ("Failed to load message: ", _data_->_tmp28_, NULL);
		_data_->_tmp30_ = _data_->_tmp29_;
		dc_window_show_toast (_data_->_tmp26_, _data_->_tmp30_);
		_g_free0 (_data_->_tmp30_);
		_g_error_free0 (_data_->e);
		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;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	dc_conversation_view_finish_loading_earlier (_data_->self, TRUE);
	if (_data_->unavailable) {
		_data_->self->priv->pending_voice_direction = 0;
		_data_->_tmp31_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp31_, "Message is no longer available");
	}
	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 DcMessageRow*
dc_conversation_view_find_message_row (DcConversationView* self,
                                       GtkWidget* widget,
                                       gint message_id,
                                       gdouble* top)
{
	gdouble _vala_top = 0.0;
	DcMessageRow* row = NULL;
	DcMessageRow* _tmp0_;
	DcMessageRow* _tmp1_;
	DcMessageRow* _result_ = NULL;
	DcMessageRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (widget != NULL, NULL);
	_vala_top = DBL_MAX;
	_tmp0_ = _g_object_ref0 (DC_IS_MESSAGE_ROW (widget) ? ((DcMessageRow*) widget) : NULL);
	row = _tmp0_;
	_tmp1_ = row;
	if (_tmp1_ != NULL) {
		graphene_point_t point = {0};
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_ = FALSE;
		graphene_point_t _tmp12_;
		gboolean _tmp13_ = FALSE;
		DcMessageRow* _tmp14_;
		gboolean visible = FALSE;
		DcMessageRow* _tmp16_ = NULL;
		gboolean _tmp17_ = FALSE;
		DcMessageRow* _tmp19_;
		memset (&point, 0, sizeof (graphene_point_t));
		if (message_id != 0) {
			DcMessageRow* _tmp4_;
			gint _tmp5_;
			gint _tmp6_;
			_tmp4_ = row;
			_tmp5_ = dc_message_row_get_message_id (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp3_ = _tmp6_ != message_id;
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			_tmp2_ = TRUE;
		} else {
			DcMessageRow* _tmp7_;
			GtkScrolledWindow* _tmp8_;
			graphene_point_t _tmp9_ = {0};
			graphene_point_t _tmp10_ = {0};
			gboolean _tmp11_;
			_tmp7_ = row;
			_tmp8_ = self->priv->message_scroll;
			memset (&_tmp9_, 0, sizeof (graphene_point_t));
			_tmp9_.x = (gfloat) 0;
			_tmp9_.y = (gfloat) 0;
			_tmp11_ = gtk_widget_compute_point ((GtkWidget*) _tmp7_, (GtkWidget*) _tmp8_, &_tmp9_, &_tmp10_);
			point = _tmp10_;
			_tmp2_ = !_tmp11_;
		}
		if (_tmp2_) {
			result = NULL;
			_g_object_unref0 (row);
			if (top) {
				*top = _vala_top;
			}
			return result;
		}
		_tmp12_ = point;
		_vala_top = (gdouble) _tmp12_.y;
		_tmp14_ = row;
		if ((_vala_top + gtk_widget_get_height ((GtkWidget*) _tmp14_)) > ((gdouble) 0)) {
			GtkScrolledWindow* _tmp15_;
			_tmp15_ = self->priv->message_scroll;
			_tmp13_ = _vala_top < ((gdouble) gtk_widget_get_height ((GtkWidget*) _tmp15_));
		} else {
			_tmp13_ = FALSE;
		}
		visible = _tmp13_;
		if (message_id != 0) {
			_tmp17_ = TRUE;
		} else {
			_tmp17_ = visible;
		}
		if (_tmp17_) {
			DcMessageRow* _tmp18_;
			_tmp18_ = row;
			_tmp16_ = _tmp18_;
		} else {
			_tmp16_ = NULL;
		}
		_tmp19_ = _g_object_ref0 (_tmp16_);
		result = _tmp19_;
		_g_object_unref0 (row);
		if (top) {
			*top = _vala_top;
		}
		return result;
	}
	_result_ = NULL;
	{
		GtkWidget* child = NULL;
		GtkWidget* _tmp20_;
		GtkWidget* _tmp21_;
		_tmp20_ = gtk_widget_get_first_child (widget);
		_tmp21_ = _g_object_ref0 (_tmp20_);
		child = _tmp21_;
		{
			gboolean _tmp22_ = FALSE;
			_tmp22_ = TRUE;
			while (TRUE) {
				GtkWidget* _tmp26_;
				gdouble child_top = 0.0;
				DcMessageRow* found = NULL;
				GtkWidget* _tmp27_;
				gdouble _tmp28_ = 0.0;
				DcMessageRow* _tmp29_;
				gboolean _tmp30_ = FALSE;
				DcMessageRow* _tmp31_;
				if (!_tmp22_) {
					GtkWidget* _tmp23_;
					GtkWidget* _tmp24_;
					GtkWidget* _tmp25_;
					_tmp23_ = child;
					_tmp24_ = gtk_widget_get_next_sibling (_tmp23_);
					_tmp25_ = _g_object_ref0 (_tmp24_);
					_g_object_unref0 (child);
					child = _tmp25_;
				}
				_tmp22_ = FALSE;
				_tmp26_ = child;
				if (!(_tmp26_ != NULL)) {
					break;
				}
				_tmp27_ = child;
				_tmp29_ = dc_conversation_view_find_message_row (self, _tmp27_, message_id, &_tmp28_);
				child_top = _tmp28_;
				found = _tmp29_;
				_tmp31_ = found;
				if (_tmp31_ != NULL) {
					_tmp30_ = child_top < _vala_top;
				} else {
					_tmp30_ = FALSE;
				}
				if (_tmp30_) {
					DcMessageRow* _tmp32_;
					DcMessageRow* _tmp33_;
					_tmp32_ = found;
					_tmp33_ = _g_object_ref0 (_tmp32_);
					_g_object_unref0 (_result_);
					_result_ = _tmp33_;
					_vala_top = child_top;
					if (message_id != 0) {
						_g_object_unref0 (found);
						break;
					}
				}
				_g_object_unref0 (found);
			}
		}
		_g_object_unref0 (child);
	}
	result = _result_;
	_g_object_unref0 (row);
	if (top) {
		*top = _vala_top;
	}
	return result;
}

static void
dc_conversation_view_finish_loading_earlier (DcConversationView* self,
                                             gboolean resume_pending)
{
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->loading_more = FALSE;
	dc_conversation_view_set_loading_more_visible (self, FALSE);
	if (self->priv->goal != DC_CONVERSATION_VIEW_VIEWPORT_GOAL_ANCHOR) {
		DcConversationViewViewportGoal _tmp0_ = 0;
		if (dc_conversation_view_is_near_bottom (self)) {
			_tmp0_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
		} else {
			_tmp0_ = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_FREE;
		}
		self->priv->goal = _tmp0_;
	}
	_tmp1_ = self->priv->scroll_down_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, !dc_conversation_view_is_near_bottom (self));
	dc_conversation_view_update_date_pill (self);
	if (resume_pending) {
		dc_conversation_view_resume_pending_message_scroll (self);
	}
}

static void
dc_conversation_view_resume_pending_message_scroll (DcConversationView* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->pending_scroll_message_id == 0) {
		return;
	}
	if (dc_conversation_view_scroll_to_loaded_message (self, self->priv->pending_scroll_message_id)) {
		self->priv->pending_scroll_message_id = 0;
		dc_conversation_view_resume_pending_voice_navigation (self);
	} else {
		gboolean _tmp0_ = FALSE;
		if (!self->priv->loading_more) {
			JsonArray* _tmp1_;
			_tmp1_ = self->priv->all_msg_ids;
			_tmp0_ = _tmp1_ != NULL;
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			dc_conversation_view_load_until_pending_message (self, NULL, NULL);
		}
	}
}

static void
dc_conversation_view_resume_pending_voice_navigation (DcConversationView* self)
{
	gint direction = 0;
	DcAudioPlaybackItem* item = NULL;
	DcAudioPlayback* _tmp0_;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	DcAudioPlaybackItem* _tmp5_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	DcAudioPlaybackItem* _tmp8_;
	g_return_if_fail (self != NULL);
	if (self->priv->pending_voice_direction == 0) {
		return;
	}
	direction = self->priv->pending_voice_direction;
	self->priv->pending_voice_direction = 0;
	_tmp0_ = dc_audio_playback_shared ();
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_audio_playback_get_current_item (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp1_);
	item = _tmp5_;
	_tmp8_ = item;
	if (_tmp8_ != NULL) {
		DcAudioPlaybackItem* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		DcRpcClient* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		_tmp9_ = item;
		_tmp10_ = dc_audio_playback_item_get_account_id (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = self->priv->rpc;
		_tmp13_ = dc_rpc_client_get_account_id (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp7_ = _tmp11_ == _tmp14_;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		DcAudioPlaybackItem* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		_tmp15_ = item;
		_tmp16_ = dc_audio_playback_item_get_chat_id (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = self->priv->_chat_id;
		_tmp6_ = _tmp17_ == _tmp18_;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		dc_conversation_view_play_adjacent_voice_message (self, direction, NULL, NULL);
	}
	_g_object_unref0 (item);
}

static void
dc_conversation_view_set_loading_more_visible (DcConversationView* self,
                                               gboolean visible)
{
	GtkSpinner* _tmp0_;
	GtkSpinner* _tmp1_;
	GtkRevealer* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->loading_more_spinner;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, visible);
	_tmp1_ = self->priv->loading_more_spinner;
	gtk_spinner_set_spinning (_tmp1_, visible);
	if (visible) {
		GtkLabel* _tmp2_;
		_tmp2_ = self->priv->loading_pill_label;
		gtk_label_set_label (_tmp2_, "Loading…");
	}
	_tmp3_ = self->priv->loading_more_revealer;
	gtk_revealer_set_reveal_child (_tmp3_, visible);
}

/** Update the floating date pill to show the date of the first
            visible message, or hide it when at the bottom. */
static void
dc_conversation_view_update_date_pill (DcConversationView* self)
{
	gboolean _tmp0_ = FALSE;
	GtkWidget* w = NULL;
	GtkListView* _tmp3_;
	GtkListView* _tmp4_;
	GtkWidget* _tmp5_;
	GtkWidget* _tmp6_;
	DcMessageRow* row = NULL;
	GtkWidget* _tmp13_;
	DcMessageRow* _tmp14_;
	DcMessageRow* _tmp15_;
	DcMessage* msg = NULL;
	GListStore* _tmp17_;
	DcMessageRow* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	DcMessage* _tmp21_;
	DcMessage* _tmp22_;
	GtkSpinner* _tmp24_;
	GtkSpinner* _tmp25_;
	GtkLabel* _tmp26_;
	DcMessage* _tmp27_;
	gint64 _tmp28_;
	gint64 _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	GtkRevealer* _tmp32_;
	g_return_if_fail (self != NULL);
	if (self->priv->goal == DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM) {
		_tmp0_ = TRUE;
	} else {
		GListStore* _tmp1_;
		_tmp1_ = self->priv->message_store;
		_tmp0_ = g_list_model_get_n_items ((GListModel*) _tmp1_) == ((guint) 0);
	}
	if (_tmp0_) {
		GtkRevealer* _tmp2_;
		_tmp2_ = self->priv->loading_more_revealer;
		gtk_revealer_set_reveal_child (_tmp2_, FALSE);
		return;
	}
	_tmp3_ = self->priv->message_listview;
	_tmp4_ = self->priv->message_listview;
	_tmp5_ = gtk_widget_pick ((GtkWidget*) _tmp3_, (gdouble) (gtk_widget_get_width ((GtkWidget*) _tmp4_) / 2), (gdouble) 5, GTK_PICK_DEFAULT);
	_tmp6_ = _g_object_ref0 (_tmp5_);
	w = _tmp6_;
	while (TRUE) {
		gboolean _tmp7_ = FALSE;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp10_;
		GtkWidget* _tmp11_;
		GtkWidget* _tmp12_;
		_tmp8_ = w;
		if (_tmp8_ != NULL) {
			GtkWidget* _tmp9_;
			_tmp9_ = w;
			_tmp7_ = !DC_IS_MESSAGE_ROW (_tmp9_);
		} else {
			_tmp7_ = FALSE;
		}
		if (!_tmp7_) {
			break;
		}
		_tmp10_ = w;
		_tmp11_ = gtk_widget_get_parent (_tmp10_);
		_tmp12_ = _g_object_ref0 (_tmp11_);
		_g_object_unref0 (w);
		w = _tmp12_;
	}
	_tmp13_ = w;
	_tmp14_ = _g_object_ref0 (DC_IS_MESSAGE_ROW (_tmp13_) ? ((DcMessageRow*) _tmp13_) : NULL);
	row = _tmp14_;
	_tmp15_ = row;
	if (_tmp15_ == NULL) {
		GtkRevealer* _tmp16_;
		_tmp16_ = self->priv->loading_more_revealer;
		gtk_revealer_set_reveal_child (_tmp16_, FALSE);
		_g_object_unref0 (row);
		_g_object_unref0 (w);
		return;
	}
	_tmp17_ = self->priv->message_store;
	_tmp18_ = row;
	_tmp19_ = dc_message_row_get_message_id (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = dc_find_message ((GListModel*) _tmp17_, _tmp20_);
	msg = _tmp21_;
	_tmp22_ = msg;
	if (_tmp22_ == NULL) {
		GtkRevealer* _tmp23_;
		_tmp23_ = self->priv->loading_more_revealer;
		gtk_revealer_set_reveal_child (_tmp23_, FALSE);
		_g_object_unref0 (msg);
		_g_object_unref0 (row);
		_g_object_unref0 (w);
		return;
	}
	_tmp24_ = self->priv->loading_more_spinner;
	gtk_spinner_set_spinning (_tmp24_, FALSE);
	_tmp25_ = self->priv->loading_more_spinner;
	gtk_widget_set_visible ((GtkWidget*) _tmp25_, FALSE);
	_tmp26_ = self->priv->loading_pill_label;
	_tmp27_ = msg;
	_tmp28_ = dc_message_get_timestamp (_tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = dc_message_row_format_date_label (_tmp29_);
	_tmp31_ = _tmp30_;
	gtk_label_set_label (_tmp26_, _tmp31_);
	_g_free0 (_tmp31_);
	_tmp32_ = self->priv->loading_more_revealer;
	gtk_revealer_set_reveal_child (_tmp32_, TRUE);
	_g_object_unref0 (msg);
	_g_object_unref0 (row);
	_g_object_unref0 (w);
}

static gboolean
dc_conversation_view_is_near_bottom (DcConversationView* self)
{
	GtkAdjustment* adj = NULL;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkAdjustment* _tmp3_;
	GtkAdjustment* _tmp4_;
	gdouble _tmp5_;
	gdouble _tmp6_;
	GtkAdjustment* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	GtkAdjustment* _tmp10_;
	gdouble _tmp11_;
	gdouble _tmp12_;
	GtkAdjustment* _tmp13_;
	gdouble _tmp14_;
	gdouble _tmp15_;
	GtkAdjustment* _tmp16_;
	gdouble _tmp17_;
	gdouble _tmp18_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->message_scroll;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	adj = _tmp3_;
	_tmp4_ = adj;
	_tmp5_ = gtk_adjustment_get_upper (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = adj;
	_tmp8_ = gtk_adjustment_get_page_size (_tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp6_ <= _tmp9_) {
		result = TRUE;
		_g_object_unref0 (adj);
		return result;
	}
	_tmp10_ = adj;
	_tmp11_ = gtk_adjustment_get_upper (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = adj;
	_tmp14_ = gtk_adjustment_get_value (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = adj;
	_tmp17_ = gtk_adjustment_get_page_size (_tmp16_);
	_tmp18_ = _tmp17_;
	result = ((_tmp12_ - _tmp15_) - _tmp18_) < ((gdouble) 80);
	_g_object_unref0 (adj);
	return result;
}

static gboolean
dc_conversation_view_is_near_top (DcConversationView* self)
{
	GtkAdjustment* adj = NULL;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkAdjustment* _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->message_scroll;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	adj = _tmp3_;
	_tmp4_ = gtk_adjustment_get_value (adj);
	_tmp5_ = _tmp4_;
	result = _tmp5_ < ((gdouble) 80);
	_g_object_unref0 (adj);
	return result;
}

static gdouble
dc_conversation_view_max_scroll_value (DcConversationView* self)
{
	GtkAdjustment* adj = NULL;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkAdjustment* _tmp3_;
	gdouble value = 0.0;
	GtkAdjustment* _tmp4_;
	gdouble _tmp5_;
	gdouble _tmp6_;
	GtkAdjustment* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	gdouble _tmp10_ = 0.0;
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	_tmp0_ = self->priv->message_scroll;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	adj = _tmp3_;
	_tmp4_ = adj;
	_tmp5_ = gtk_adjustment_get_upper (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = adj;
	_tmp8_ = gtk_adjustment_get_page_size (_tmp7_);
	_tmp9_ = _tmp8_;
	value = _tmp6_ - _tmp9_;
	if (value > ((gdouble) 0)) {
		_tmp10_ = value;
	} else {
		_tmp10_ = (gdouble) 0;
	}
	result = _tmp10_;
	_g_object_unref0 (adj);
	return result;
}

static void
dc_conversation_view_maybe_autoscroll (DcConversationView* self)
{
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	g_return_if_fail (self != NULL);
	if (self->priv->goal != DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM) {
		return;
	}
	_tmp0_ = self->priv->message_scroll;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_adjustment_set_value (_tmp2_, dc_conversation_view_max_scroll_value (self));
}

void
dc_conversation_view_scroll_to_bottom (DcConversationView* self)
{
	guint _tmp0_;
	guint n = 0U;
	GtkFilterListModel* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->goal_generation;
	self->priv->goal_generation = _tmp0_ + 1;
	self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
	dc_conversation_view_maybe_autoscroll (self);
	_tmp1_ = self->priv->filtered_message_store;
	n = g_list_model_get_n_items ((GListModel*) _tmp1_);
	if (n > ((guint) 0)) {
		GtkListView* _tmp2_;
		_tmp2_ = self->priv->message_listview;
		gtk_list_view_scroll_to (_tmp2_, n - 1, GTK_LIST_SCROLL_NONE, NULL);
	}
}

static void
dc_conversation_view_insert_message_sorted (DcConversationView* self,
                                            DcMessage* msg)
{
	gint count = 0;
	GListStore* _tmp0_;
	GListStore* _tmp44_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (msg != NULL);
	_tmp0_ = self->priv->message_store;
	count = (gint) g_list_model_get_n_items ((GListModel*) _tmp0_);
	if (count > 0) {
		DcMessage* last = NULL;
		GListStore* _tmp1_;
		GObject* _tmp2_;
		gboolean _tmp3_ = FALSE;
		gint64 _tmp4_;
		gint64 _tmp5_;
		DcMessage* _tmp6_;
		gint64 _tmp7_;
		gint64 _tmp8_;
		_tmp1_ = self->priv->message_store;
		_tmp2_ = g_list_model_get_item ((GListModel*) _tmp1_, (guint) (count - 1));
		last = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, DC_TYPE_MESSAGE, DcMessage);
		_tmp4_ = dc_message_get_timestamp (msg);
		_tmp5_ = _tmp4_;
		_tmp6_ = last;
		_tmp7_ = dc_message_get_timestamp (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp5_ > _tmp8_) {
			_tmp3_ = TRUE;
		} else {
			gboolean _tmp9_ = FALSE;
			gint64 _tmp10_;
			gint64 _tmp11_;
			DcMessage* _tmp12_;
			gint64 _tmp13_;
			gint64 _tmp14_;
			_tmp10_ = dc_message_get_timestamp (msg);
			_tmp11_ = _tmp10_;
			_tmp12_ = last;
			_tmp13_ = dc_message_get_timestamp (_tmp12_);
			_tmp14_ = _tmp13_;
			if (_tmp11_ == _tmp14_) {
				gint _tmp15_;
				gint _tmp16_;
				DcMessage* _tmp17_;
				gint _tmp18_;
				gint _tmp19_;
				_tmp15_ = dc_message_get_id (msg);
				_tmp16_ = _tmp15_;
				_tmp17_ = last;
				_tmp18_ = dc_message_get_id (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp9_ = _tmp16_ >= _tmp19_;
			} else {
				_tmp9_ = FALSE;
			}
			_tmp3_ = _tmp9_;
		}
		if (_tmp3_) {
			GListStore* _tmp20_;
			_tmp20_ = self->priv->message_store;
			g_list_store_append (_tmp20_, (GObject*) msg);
			dc_conversation_view_update_conversation_media_bar (self);
			_g_object_unref0 (last);
			return;
		}
		_g_object_unref0 (last);
	}
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp21_ = FALSE;
			_tmp21_ = TRUE;
			while (TRUE) {
				GListStore* _tmp23_;
				DcMessage* m = NULL;
				GListStore* _tmp24_;
				GObject* _tmp25_;
				gboolean _tmp26_ = FALSE;
				DcMessage* _tmp27_;
				gint64 _tmp28_;
				gint64 _tmp29_;
				gint64 _tmp30_;
				gint64 _tmp31_;
				if (!_tmp21_) {
					guint _tmp22_;
					_tmp22_ = i;
					i = _tmp22_ + 1;
				}
				_tmp21_ = FALSE;
				_tmp23_ = self->priv->message_store;
				if (!(i < g_list_model_get_n_items ((GListModel*) _tmp23_))) {
					break;
				}
				_tmp24_ = self->priv->message_store;
				_tmp25_ = g_list_model_get_item ((GListModel*) _tmp24_, i);
				m = G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, DC_TYPE_MESSAGE, DcMessage);
				_tmp27_ = m;
				_tmp28_ = dc_message_get_timestamp (_tmp27_);
				_tmp29_ = _tmp28_;
				_tmp30_ = dc_message_get_timestamp (msg);
				_tmp31_ = _tmp30_;
				if (_tmp29_ > _tmp31_) {
					_tmp26_ = TRUE;
				} else {
					gboolean _tmp32_ = FALSE;
					DcMessage* _tmp33_;
					gint64 _tmp34_;
					gint64 _tmp35_;
					gint64 _tmp36_;
					gint64 _tmp37_;
					_tmp33_ = m;
					_tmp34_ = dc_message_get_timestamp (_tmp33_);
					_tmp35_ = _tmp34_;
					_tmp36_ = dc_message_get_timestamp (msg);
					_tmp37_ = _tmp36_;
					if (_tmp35_ == _tmp37_) {
						DcMessage* _tmp38_;
						gint _tmp39_;
						gint _tmp40_;
						gint _tmp41_;
						gint _tmp42_;
						_tmp38_ = m;
						_tmp39_ = dc_message_get_id (_tmp38_);
						_tmp40_ = _tmp39_;
						_tmp41_ = dc_message_get_id (msg);
						_tmp42_ = _tmp41_;
						_tmp32_ = _tmp40_ > _tmp42_;
					} else {
						_tmp32_ = FALSE;
					}
					_tmp26_ = _tmp32_;
				}
				if (_tmp26_) {
					GListStore* _tmp43_;
					_tmp43_ = self->priv->message_store;
					g_list_store_insert (_tmp43_, (guint) ((gint) i), (GObject*) msg);
					dc_conversation_view_update_conversation_media_bar (self);
					_g_object_unref0 (m);
					return;
				}
				_g_object_unref0 (m);
			}
		}
	}
	_tmp44_ = self->priv->message_store;
	g_list_store_append (_tmp44_, (GObject*) msg);
	dc_conversation_view_update_conversation_media_bar (self);
}

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

static void
dc_conversation_view_save_webxdc_from_bar (DcConversationView* self,
                                           gint msg_id,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcConversationViewSaveWebxdcFromBarData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewSaveWebxdcFromBarData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_save_webxdc_from_bar_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	dc_conversation_view_save_webxdc_from_bar_co (_data_);
}

static void
dc_conversation_view_save_webxdc_from_bar_finish (DcConversationView* self,
                                                  GAsyncResult* _res_)
{
	DcConversationViewSaveWebxdcFromBarData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/** "Save to disk" from the apps bar context menu. */
static void
dc_conversation_view_save_webxdc_from_bar_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	DcConversationViewSaveWebxdcFromBarData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_save_webxdc_from_bar_co (_data_);
}

static gboolean
dc_conversation_view_save_webxdc_from_bar_co (DcConversationViewSaveWebxdcFromBarData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->message_store;
	_data_->_tmp1_ = dc_find_message ((GListModel*) _data_->_tmp0_, _data_->msg_id);
	_data_->msg = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->msg;
	if (_data_->_tmp2_ == NULL) {
		{
			_data_->_tmp4_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_fetch_message (_data_->_tmp4_, _data_->msg_id, dc_conversation_view_save_webxdc_from_bar_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp5_ = dc_rpc_client_fetch_message_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp3_ = _data_->_tmp5_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp6_ = _data_->_tmp3_;
			_data_->_tmp3_ = NULL;
			_g_object_unref0 (_data_->msg);
			_data_->msg = _data_->_tmp6_;
			_g_object_unref0 (_data_->_tmp3_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp7_ = _data_->self->priv->window;
			_data_->_tmp8_ = _data_->e;
			_data_->_tmp9_ = _data_->_tmp8_->message;
			_data_->_tmp10_ = g_strconcat ("Failed to load app: ", _data_->_tmp9_, NULL);
			_data_->_tmp11_ = _data_->_tmp10_;
			dc_window_show_toast (_data_->_tmp7_, _data_->_tmp11_);
			_g_free0 (_data_->_tmp11_);
			_g_error_free0 (_data_->e);
			_g_object_unref0 (_data_->msg);
			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;
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->msg);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp14_ = _data_->msg;
	if (_data_->_tmp14_ == NULL) {
		_data_->_tmp13_ = TRUE;
	} else {
		_data_->_tmp15_ = _data_->msg;
		_data_->_tmp16_ = dc_message_get_file_path (_data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp13_ = _data_->_tmp17_ == NULL;
	}
	if (_data_->_tmp13_) {
		_data_->_tmp12_ = TRUE;
	} else {
		_data_->_tmp18_ = _data_->msg;
		_data_->_tmp19_ = dc_message_get_file_path (_data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = strlen (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp12_ = _data_->_tmp22_ == 0;
	}
	if (_data_->_tmp12_) {
		_data_->_tmp23_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp23_, "The app file is not downloaded");
		_g_object_unref0 (_data_->msg);
		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_->_tmp24_ = _data_->self->priv->window;
	_data_->_tmp25_ = _data_->msg;
	_data_->_tmp26_ = dc_message_get_file_path (_data_->_tmp25_);
	_data_->_tmp27_ = _data_->_tmp26_;
	_data_->_tmp28_ = _data_->msg;
	_data_->_tmp29_ = dc_message_get_file_name (_data_->_tmp28_);
	_data_->_tmp30_ = _data_->_tmp29_;
	_data_->_state_ = 2;
	dc_window_save_attachment (_data_->_tmp24_, _data_->_tmp27_, _data_->_tmp30_, dc_conversation_view_save_webxdc_from_bar_ready, _data_);
	return FALSE;
	_state_2:
	dc_window_save_attachment_finish (_data_->_tmp24_, _data_->_res_);
	_g_object_unref0 (_data_->msg);
	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 Block47Data*
block47_data_ref (Block47Data* _data47_)
{
	g_atomic_int_inc (&_data47_->_ref_count_);
	return _data47_;
}

static void
block47_data_unref (void * _userdata_)
{
	Block47Data* _data47_;
	_data47_ = (Block47Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data47_->_ref_count_)) {
		DcConversationView* self;
		self = _data47_->self;
		_g_object_unref0 (self);
		g_slice_free (Block47Data, _data47_);
	}
}

static void
____lambda185_ (Block47Data* _data47_,
                GObject* obj,
                GAsyncResult* res)
{
	DcConversationView* self;
	DcLinkPreviewFetcherResult* r = NULL;
	DcLinkPreviewFetcher* _tmp0_;
	DcLinkPreviewFetcherResult* _tmp1_;
	DcLinkPreviewFetcherResult* _tmp2_;
	DcComposeBar* _tmp3_;
	DcLinkPreviewFetcherResult* _tmp4_;
	const gchar* _tmp5_;
	DcLinkPreviewFetcherResult* _tmp6_;
	const gchar* _tmp7_;
	DcLinkPreviewFetcherResult* _tmp8_;
	const gchar* _tmp9_;
	DcLinkPreviewFetcherResult* _tmp10_;
	const gchar* _tmp11_;
	self = _data47_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->link_preview_fetcher;
	_tmp1_ = dc_link_preview_fetcher_fetch_finish (_tmp0_, res);
	r = _tmp1_;
	_tmp2_ = r;
	if (_tmp2_ == NULL) {
		_dc_link_preview_fetcher_result_unref0 (r);
		return;
	}
	_tmp3_ = self->priv->compose_bar;
	_tmp4_ = r;
	_tmp5_ = _tmp4_->image_path;
	_tmp6_ = r;
	_tmp7_ = _tmp6_->file_name;
	_tmp8_ = r;
	_tmp9_ = _tmp8_->title;
	_tmp10_ = r;
	_tmp11_ = _tmp10_->description;
	if (!dc_compose_bar_add_link_preview (_tmp3_, _data47_->generation, _tmp5_, _tmp7_, _tmp9_, _tmp11_)) {
		DcLinkPreviewFetcherResult* _tmp12_;
		const gchar* _tmp13_;
		_tmp12_ = r;
		_tmp13_ = _tmp12_->image_path;
		g_unlink (_tmp13_);
	}
	_dc_link_preview_fetcher_result_unref0 (r);
}

static void
_____lambda185__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	____lambda185_ (self, source_object, res);
	block47_data_unref (self);
}

static void
dc_conversation_view_on_link_previews_requested (DcConversationView* self,
                                                 gchar** urls,
                                                 gint urls_length1,
                                                 guint generation)
{
	Block47Data* _data47_;
	DcLinkPreviewFetcher* _tmp0_;
	g_return_if_fail (self != NULL);
	_data47_ = g_slice_new0 (Block47Data);
	_data47_->_ref_count_ = 1;
	_data47_->self = g_object_ref (self);
	_data47_->generation = generation;
	_tmp0_ = self->priv->link_preview_fetcher;
	if (_tmp0_ == NULL) {
		DcRpcClient* _tmp1_;
		DcLinkPreviewFetcher* _tmp2_;
		_tmp1_ = self->priv->rpc;
		_tmp2_ = dc_link_preview_fetcher_new (_tmp1_);
		_g_object_unref0 (self->priv->link_preview_fetcher);
		self->priv->link_preview_fetcher = _tmp2_;
	}
	{
		gchar** url_collection = NULL;
		gint url_collection_length1 = 0;
		gint _url_collection_size_ = 0;
		gint url_it = 0;
		url_collection = urls;
		url_collection_length1 = urls_length1;
		for (url_it = 0; url_it < url_collection_length1; url_it = url_it + 1) {
			gchar* _tmp3_;
			gchar* url = NULL;
			_tmp3_ = g_strdup (url_collection[url_it]);
			url = _tmp3_;
			{
				DcLinkPreviewFetcher* _tmp4_;
				const gchar* _tmp5_;
				DcSettingsManager* _tmp6_;
				gboolean _tmp7_;
				gboolean _tmp8_;
				_tmp4_ = self->priv->link_preview_fetcher;
				_tmp5_ = url;
				_tmp6_ = self->priv->settings;
				_tmp7_ = dc_settings_manager_get_clean_pasted_links (_tmp6_);
				_tmp8_ = _tmp7_;
				dc_link_preview_fetcher_fetch (_tmp4_, _tmp5_, _tmp8_, _____lambda185__gasync_ready_callback, block47_data_ref (_data47_));
				_g_free0 (url);
			}
		}
	}
	block47_data_unref (_data47_);
	_data47_ = NULL;
}

static void
dc_conversation_view_on_send_message (DcConversationView* self,
                                      const gchar* text,
                                      const gchar* file_path,
                                      const gchar* file_name,
                                      gint quote_msg_id)
{
	DcPendingSend* _tmp0_;
	DcPendingSend* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = dc_pending_send_new (text, file_path, file_name, quote_msg_id, FALSE, FALSE);
	_tmp1_ = _tmp0_;
	dc_conversation_view_queue_send (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
dc_conversation_view_on_send_voice_message (DcConversationView* self,
                                            const gchar* file_path,
                                            const gchar* text,
                                            gint quote_msg_id,
                                            gboolean temporary)
{
	DcPendingSend* _tmp0_;
	DcPendingSend* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file_path != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = dc_pending_send_new (text, file_path, DC_COMPOSE_BAR_VOICE_FILE_NAME, quote_msg_id, TRUE, temporary);
	_tmp1_ = _tmp0_;
	dc_conversation_view_queue_send (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
dc_conversation_view_queue_send (DcConversationView* self,
                                 DcPendingSend* job)
{
	GQueue* _tmp0_;
	DcPendingSend* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	dc_conversation_view_discard_pending_draft_save (self);
	dc_conversation_view_remove_draft (self, NULL, NULL);
	_tmp0_ = self->priv->send_queue;
	_tmp1_ = _g_object_ref0 (job);
	g_queue_push_tail (_tmp0_, _tmp1_);
	dc_conversation_view_process_send_queue (self, NULL, NULL);
}

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

static void
dc_conversation_view_process_send_queue (DcConversationView* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	DcConversationViewProcessSendQueueData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewProcessSendQueueData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_process_send_queue_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_process_send_queue_co (_data_);
}

static void
dc_conversation_view_process_send_queue_finish (DcConversationView* self,
                                                GAsyncResult* _res_)
{
	DcConversationViewProcessSendQueueData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_process_send_queue_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	DcConversationViewProcessSendQueueData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_process_send_queue_co (_data_);
}

static gboolean
dc_conversation_view_process_send_queue_co (DcConversationViewProcessSendQueueData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->sending_queue) {
		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_->self->priv->sending_queue = TRUE;
	while (TRUE) {
		_data_->_tmp0_ = _data_->self->priv->send_queue;
		if (!(!g_queue_is_empty (_data_->_tmp0_))) {
			break;
		}
		_data_->_tmp1_ = _data_->self->priv->send_queue;
		_data_->_tmp2_ = g_queue_pop_head (_data_->_tmp1_);
		_data_->_tmp3_ = (DcPendingSend*) _data_->_tmp2_;
		_data_->_state_ = 1;
		dc_conversation_view_do_send (_data_->self, _data_->_tmp3_, dc_conversation_view_process_send_queue_ready, _data_);
		return FALSE;
		_state_1:
		dc_conversation_view_do_send_finish (_data_->self, _data_->_res_);
		_g_object_unref0 (_data_->_tmp3_);
	}
	_data_->self->priv->sending_queue = FALSE;
	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
dc_conversation_view_do_send_data_free (gpointer _data)
{
	DcConversationViewDoSendData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewDoSendData, _data_);
}

static void
dc_conversation_view_do_send (DcConversationView* self,
                              DcPendingSend* job,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	DcConversationViewDoSendData* _data_;
	DcConversationView* _tmp0_;
	DcPendingSend* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_data_ = g_slice_new0 (DcConversationViewDoSendData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_do_send_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	dc_conversation_view_do_send_co (_data_);
}

static void
dc_conversation_view_do_send_finish (DcConversationView* self,
                                     GAsyncResult* _res_)
{
	DcConversationViewDoSendData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_do_send_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	DcConversationViewDoSendData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_do_send_co (_data_);
}

static gboolean
dc_conversation_view_do_send_co (DcConversationViewDoSendData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp1_ = _data_->job->text;
		_data_->_tmp2_ = strlen (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		if (_data_->_tmp3_ > 0) {
			_data_->_tmp4_ = _data_->job->text;
			_data_->_tmp0_ = _data_->_tmp4_;
		} else {
			_data_->_tmp0_ = NULL;
		}
		_data_->_tmp5_ = g_strdup (_data_->_tmp0_);
		_data_->send_text = _data_->_tmp5_;
		if (_data_->job->voice) {
			_data_->_tmp7_ = g_strdup ("Voice");
			_g_free0 (_data_->_tmp6_);
			_data_->_tmp6_ = _data_->_tmp7_;
		} else {
			_data_->_tmp8_ = _data_->job->file_path;
			_data_->_tmp9_ = _data_->job->file_name;
			_data_->_tmp10_ = dc_attachment_types_infer_outgoing_view_type (_data_->_tmp8_, _data_->_tmp9_);
			_g_free0 (_data_->_tmp6_);
			_data_->_tmp6_ = _data_->_tmp10_;
		}
		_data_->_tmp11_ = _data_->_tmp6_;
		_data_->_tmp6_ = NULL;
		_data_->view_type = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->self->priv->rpc;
		_data_->_tmp13_ = _data_->self->priv->_chat_id;
		_data_->_tmp14_ = _data_->send_text;
		_data_->_tmp15_ = _data_->job->file_path;
		_data_->_tmp16_ = _data_->job->file_name;
		_data_->_tmp17_ = _data_->view_type;
		_data_->_state_ = 1;
		dc_rpc_client_send_msg (_data_->_tmp12_, _data_->_tmp13_, _data_->_tmp14_, _data_->_tmp15_, _data_->_tmp16_, _data_->job->quote_msg_id, _data_->_tmp17_, dc_conversation_view_do_send_ready, _data_);
		return FALSE;
		_state_1:
		_data_->msg_id = dc_rpc_client_send_msg_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->view_type);
			_g_free0 (_data_->_tmp6_);
			_g_free0 (_data_->send_text);
			goto __catch0_g_error;
		}
		if (_data_->msg_id > 0) {
			_data_->_tmp18_ = _data_->self->priv->rpc;
			_data_->_state_ = 2;
			dc_rpc_client_fetch_message (_data_->_tmp18_, _data_->msg_id, dc_conversation_view_do_send_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp19_ = dc_rpc_client_fetch_message_finish (_data_->_tmp18_, _data_->_res_, &_data_->_inner_error0_);
			_data_->msg = _data_->_tmp19_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->view_type);
				_g_free0 (_data_->_tmp6_);
				_g_free0 (_data_->send_text);
				goto __catch0_g_error;
			}
			_data_->_tmp20_ = _data_->msg;
			if (_data_->_tmp20_ != NULL) {
				_data_->_tmp21_ = _data_->msg;
				dc_message_set_selection_visible (_data_->_tmp21_, _data_->self->priv->selection_mode);
				_data_->_tmp22_ = _data_->msg;
				dc_conversation_view_insert_message_sorted (_data_->self, _data_->_tmp22_);
				dc_conversation_view_scroll_to_bottom (_data_->self);
			}
			_g_object_unref0 (_data_->msg);
		}
		_g_free0 (_data_->view_type);
		_g_free0 (_data_->_tmp6_);
		_g_free0 (_data_->send_text);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp23_ = _data_->self->priv->window;
		_data_->_tmp24_ = _data_->e;
		_data_->_tmp25_ = _data_->_tmp24_->message;
		_data_->_tmp26_ = g_strconcat ("Send failed: ", _data_->_tmp25_, NULL);
		_data_->_tmp27_ = _data_->_tmp26_;
		dc_window_show_toast (_data_->_tmp23_, _data_->_tmp27_);
		_g_free0 (_data_->_tmp27_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		if (_data_->job->owns_file) {
			_data_->_tmp29_ = _data_->job->file_path;
			_data_->_tmp28_ = _data_->_tmp29_ != NULL;
		} else {
			_data_->_tmp28_ = FALSE;
		}
		if (_data_->_tmp28_) {
			_data_->_tmp30_ = _data_->job->file_path;
			g_unlink (_data_->_tmp30_);
		}
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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 gboolean
__lambda186_ (DcConversationView* self)
{
	gboolean result;
	self->priv->draft_save_timer = (guint) 0;
	dc_conversation_view_flush_pending_draft_save (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda186__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda186_ ((DcConversationView*) self);
	return result;
}

static void
dc_conversation_view_on_draft_changed (DcConversationView* self,
                                       const gchar* text,
                                       const gchar* file_path,
                                       const gchar* file_name,
                                       gint quote_msg_id,
                                       gboolean voice)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	if (self->priv->closed) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = !self->priv->draft_rpc_available;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		DcRpcClient* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = self->priv->rpc;
		_tmp3_ = dc_rpc_client_get_account_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ <= 0;
	}
	if (_tmp0_) {
		return;
	}
	dc_conversation_view_cancel_pending_draft_timer (self);
	self->priv->draft_save_pending = TRUE;
	_tmp5_ = g_strdup (text);
	_g_free0 (self->priv->pending_draft_text);
	self->priv->pending_draft_text = _tmp5_;
	_tmp6_ = g_strdup (file_path);
	_g_free0 (self->priv->pending_draft_file_path);
	self->priv->pending_draft_file_path = _tmp6_;
	_tmp7_ = g_strdup (file_name);
	_g_free0 (self->priv->pending_draft_file_name);
	self->priv->pending_draft_file_name = _tmp7_;
	self->priv->pending_draft_quote_msg_id = quote_msg_id;
	self->priv->pending_draft_voice = voice;
	self->priv->draft_save_timer = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 600, ___lambda186__gsource_func, g_object_ref (self), g_object_unref);
}

static void
dc_conversation_view_cancel_pending_draft_timer (DcConversationView* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->draft_save_timer == ((guint) 0)) {
		return;
	}
	g_source_remove (self->priv->draft_save_timer);
	self->priv->draft_save_timer = (guint) 0;
}

static void
dc_conversation_view_clear_pending_draft_snapshot (DcConversationView* self)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->draft_save_pending = FALSE;
	_tmp0_ = g_strdup ("");
	_g_free0 (self->priv->pending_draft_text);
	self->priv->pending_draft_text = _tmp0_;
	_g_free0 (self->priv->pending_draft_file_path);
	self->priv->pending_draft_file_path = NULL;
	_g_free0 (self->priv->pending_draft_file_name);
	self->priv->pending_draft_file_name = NULL;
	self->priv->pending_draft_quote_msg_id = 0;
	self->priv->pending_draft_voice = FALSE;
}

static void
dc_conversation_view_discard_pending_draft_save (DcConversationView* self)
{
	g_return_if_fail (self != NULL);
	dc_conversation_view_cancel_pending_draft_timer (self);
	dc_conversation_view_clear_pending_draft_snapshot (self);
}

static void
dc_conversation_view_flush_pending_draft_save (DcConversationView* self)
{
	gchar* text = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* file_path = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* file_name = NULL;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gint quote_msg_id = 0;
	gboolean voice = FALSE;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	dc_conversation_view_cancel_pending_draft_timer (self);
	if (!self->priv->draft_save_pending) {
		return;
	}
	_tmp0_ = self->priv->pending_draft_text;
	_tmp1_ = g_strdup (_tmp0_);
	text = _tmp1_;
	_tmp2_ = self->priv->pending_draft_file_path;
	_tmp3_ = g_strdup (_tmp2_);
	file_path = _tmp3_;
	_tmp4_ = self->priv->pending_draft_file_name;
	_tmp5_ = g_strdup (_tmp4_);
	file_name = _tmp5_;
	quote_msg_id = self->priv->pending_draft_quote_msg_id;
	voice = self->priv->pending_draft_voice;
	dc_conversation_view_clear_pending_draft_snapshot (self);
	_tmp6_ = text;
	_tmp7_ = file_path;
	_tmp8_ = file_name;
	dc_conversation_view_start_detached_draft_save (self, _tmp6_, _tmp7_, _tmp8_, quote_msg_id, voice);
	_g_free0 (file_name);
	_g_free0 (file_path);
	_g_free0 (text);
}

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

static void
dc_conversation_view_load_draft (DcConversationView* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcConversationViewLoadDraftData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewLoadDraftData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_load_draft_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_load_draft_co (_data_);
}

static void
dc_conversation_view_load_draft_finish (DcConversationView* self,
                                        GAsyncResult* _res_)
{
	DcConversationViewLoadDraftData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_load_draft_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcConversationViewLoadDraftData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_load_draft_co (_data_);
}

static gboolean
dc_conversation_view_load_draft_co (DcConversationViewLoadDraftData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!_data_->self->priv->draft_rpc_available) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp0_ = _data_->_tmp3_ <= 0;
	}
	if (_data_->_tmp0_) {
		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->rpc;
		_data_->_tmp5_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 1;
		dc_rpc_client_get_draft (_data_->_tmp4_, _data_->_tmp5_, dc_conversation_view_load_draft_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp6_ = dc_rpc_client_get_draft_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		_data_->draft = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp8_ = _data_->draft;
		if (_data_->_tmp8_ == NULL) {
			_data_->_tmp7_ = TRUE;
		} else {
			_data_->_tmp9_ = _data_->self->priv->compose_bar;
			_data_->_tmp7_ = dc_compose_bar_has_unsent_content (_data_->_tmp9_);
		}
		if (_data_->_tmp7_) {
			_g_object_unref0 (_data_->draft);
			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_->_tmp10_ = _data_->self->priv->compose_bar;
		_data_->_tmp11_ = _data_->draft;
		dc_compose_bar_restore_draft (_data_->_tmp10_, _data_->_tmp11_);
		_g_object_unref0 (_data_->draft);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp12_ = _data_->e;
		_data_->self->priv->draft_rpc_available = !dc_conversation_view_is_missing_draft_rpc (_data_->_tmp12_);
		if (_data_->self->priv->draft_rpc_available) {
			_data_->_tmp13_ = _data_->e;
			_data_->_tmp14_ = _data_->_tmp13_->message;
			g_warning ("conversation_view.vala:2275: load_draft: %s", _data_->_tmp14_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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 Block48Data*
block48_data_ref (Block48Data* _data48_)
{
	g_atomic_int_inc (&_data48_->_ref_count_);
	return _data48_;
}

static void
block48_data_unref (void * _userdata_)
{
	Block48Data* _data48_;
	_data48_ = (Block48Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data48_->_ref_count_)) {
		g_weak_ref_clear (&_data48_->view_ref);
		g_slice_free (Block48Data, _data48_);
	}
}

static void
__lambda95_ (Block48Data* _data48_,
             GObject* obj,
             GAsyncResult* _result_)
{
	DcConversationViewDraftSaveResult outcome = 0;
	DcConversationView* view = NULL;
	GObject* _tmp0_;
	DcConversationView* _tmp1_;
	gboolean _tmp2_ = FALSE;
	DcConversationView* _tmp3_;
	g_return_if_fail (_result_ != NULL);
	outcome = dc_conversation_view_save_draft_snapshot_finish (_result_);
	_tmp0_ = g_weak_ref_get (&_data48_->view_ref);
	_tmp1_ = DC_IS_CONVERSATION_VIEW (_tmp0_) ? ((DcConversationView*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	view = _tmp1_;
	_tmp3_ = view;
	if (_tmp3_ != NULL) {
		DcConversationView* _tmp4_;
		_tmp4_ = view;
		_tmp2_ = !_tmp4_->priv->closed;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		DcConversationView* _tmp5_;
		_tmp5_ = view;
		_tmp5_->priv->draft_rpc_available = outcome != DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_UNAVAILABLE;
		if (outcome == DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_SAVED) {
			DcConversationView* _tmp6_;
			DcWindow* _tmp7_;
			_tmp6_ = view;
			_tmp7_ = _tmp6_->priv->window;
			dc_window_request_reload_chats (_tmp7_);
		}
	}
	_g_object_unref0 (view);
}

static void
___lambda95__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda95_ (self, source_object, res);
	block48_data_unref (self);
}

static void
dc_conversation_view_start_detached_draft_save (DcConversationView* target,
                                                const gchar* text,
                                                const gchar* file_path,
                                                const gchar* file_name,
                                                gint quote_msg_id,
                                                gboolean voice)
{
	Block48Data* _data48_;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	g_return_if_fail (target != NULL);
	g_return_if_fail (text != NULL);
	_data48_ = g_slice_new0 (Block48Data);
	_data48_->_ref_count_ = 1;
	g_weak_ref_init (&_data48_->view_ref, (GObject*) target);
	_tmp0_ = target->priv->rpc;
	_tmp1_ = target->priv->_chat_id;
	dc_conversation_view_save_draft_snapshot (_tmp0_, _tmp1_, text, file_path, file_name, quote_msg_id, voice, ___lambda95__gasync_ready_callback, block48_data_ref (_data48_));
	block48_data_unref (_data48_);
	_data48_ = NULL;
}

static void
dc_conversation_view_save_draft_snapshot_data_free (gpointer _data)
{
	DcConversationViewSaveDraftSnapshotData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->rpc);
	_g_free0 (_data_->text);
	_g_free0 (_data_->file_path);
	_g_free0 (_data_->file_name);
	g_slice_free (DcConversationViewSaveDraftSnapshotData, _data_);
}

static void
dc_conversation_view_save_draft_snapshot (DcRpcClient* rpc,
                                          gint chat_id,
                                          const gchar* text,
                                          const gchar* file_path,
                                          const gchar* file_name,
                                          gint quote_msg_id,
                                          gboolean voice,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	DcConversationViewSaveDraftSnapshotData* _data_;
	DcRpcClient* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (rpc != NULL);
	g_return_if_fail (text != NULL);
	_data_ = g_slice_new0 (DcConversationViewSaveDraftSnapshotData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_save_draft_snapshot_data_free);
	_tmp0_ = _g_object_ref0 (rpc);
	_g_object_unref0 (_data_->rpc);
	_data_->rpc = _tmp0_;
	_data_->chat_id = chat_id;
	_tmp1_ = g_strdup (text);
	_g_free0 (_data_->text);
	_data_->text = _tmp1_;
	_tmp2_ = g_strdup (file_path);
	_g_free0 (_data_->file_path);
	_data_->file_path = _tmp2_;
	_tmp3_ = g_strdup (file_name);
	_g_free0 (_data_->file_name);
	_data_->file_name = _tmp3_;
	_data_->quote_msg_id = quote_msg_id;
	_data_->voice = voice;
	dc_conversation_view_save_draft_snapshot_co (_data_);
}

static DcConversationViewDraftSaveResult
dc_conversation_view_save_draft_snapshot_finish (GAsyncResult* _res_)
{
	DcConversationViewDraftSaveResult result;
	DcConversationViewSaveDraftSnapshotData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dc_conversation_view_save_draft_snapshot_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	DcConversationViewSaveDraftSnapshotData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_save_draft_snapshot_co (_data_);
}

static gboolean
dc_conversation_view_save_draft_snapshot_co (DcConversationViewSaveDraftSnapshotData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dc_rpc_client_get_account_id (_data_->rpc);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_ <= 0) {
		_data_->result = DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_FAILED;
		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_->_tmp2_ = strlen (_data_->text);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->has_text = _data_->_tmp3_ > 0;
		if (_data_->file_path != NULL) {
			_data_->_tmp5_ = strlen (_data_->file_path);
			_data_->_tmp6_ = _data_->_tmp5_;
			_data_->_tmp4_ = _data_->_tmp6_ > 0;
		} else {
			_data_->_tmp4_ = FALSE;
		}
		_data_->has_file = _data_->_tmp4_;
		_data_->has_quote = _data_->quote_msg_id > 0;
		if (!_data_->has_text) {
			_data_->_tmp8_ = !_data_->has_file;
		} else {
			_data_->_tmp8_ = FALSE;
		}
		if (_data_->_tmp8_) {
			_data_->_tmp7_ = !_data_->has_quote;
		} else {
			_data_->_tmp7_ = FALSE;
		}
		if (_data_->_tmp7_) {
			_data_->_state_ = 1;
			dc_rpc_client_remove_draft (_data_->rpc, _data_->chat_id, dc_conversation_view_save_draft_snapshot_ready, _data_);
			return FALSE;
			_state_1:
			dc_rpc_client_remove_draft_finish (_data_->rpc, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			if (_data_->has_text) {
				_data_->_tmp9_ = _data_->text;
			} else {
				_data_->_tmp9_ = NULL;
			}
			if (_data_->has_file) {
				_data_->_tmp10_ = _data_->file_path;
			} else {
				_data_->_tmp10_ = NULL;
			}
			if (_data_->has_file) {
				_data_->_tmp11_ = _data_->file_name;
			} else {
				_data_->_tmp11_ = NULL;
			}
			if (_data_->has_file) {
				if (_data_->voice) {
					_data_->_tmp14_ = g_strdup ("Voice");
					_g_free0 (_data_->_tmp13_);
					_data_->_tmp13_ = _data_->_tmp14_;
				} else {
					_data_->_tmp15_ = dc_attachment_types_infer_outgoing_view_type (_data_->file_path, _data_->file_name);
					_g_free0 (_data_->_tmp13_);
					_data_->_tmp13_ = _data_->_tmp15_;
				}
				_data_->_tmp16_ = _data_->_tmp13_;
				_data_->_tmp13_ = NULL;
				_g_free0 (_data_->_tmp12_);
				_data_->_tmp12_ = _data_->_tmp16_;
				_g_free0 (_data_->_tmp13_);
			} else {
				_g_free0 (_data_->_tmp12_);
				_data_->_tmp12_ = NULL;
			}
			_data_->_state_ = 2;
			dc_rpc_client_set_draft (_data_->rpc, _data_->chat_id, _data_->_tmp9_, _data_->_tmp10_, _data_->_tmp11_, _data_->quote_msg_id, _data_->_tmp12_, dc_conversation_view_save_draft_snapshot_ready, _data_);
			return FALSE;
			_state_2:
			dc_rpc_client_set_draft_finish (_data_->rpc, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->_tmp12_);
				goto __catch0_g_error;
			}
			_g_free0 (_data_->_tmp12_);
		}
		_data_->result = DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_SAVED;
		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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp17_ = _data_->e;
		_data_->available = !dc_conversation_view_is_missing_draft_rpc (_data_->_tmp17_);
		if (_data_->available) {
			_data_->_tmp18_ = _data_->e;
			_data_->_tmp19_ = _data_->_tmp18_->message;
			g_warning ("conversation_view.vala:2323: save_draft: %s", _data_->_tmp19_);
		}
		if (_data_->available) {
			_data_->_tmp20_ = DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_FAILED;
		} else {
			_data_->_tmp20_ = DC_CONVERSATION_VIEW_DRAFT_SAVE_RESULT_UNAVAILABLE;
		}
		_data_->result = _data_->_tmp20_;
		_g_error_free0 (_data_->e);
		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;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_conversation_view_remove_draft (DcConversationView* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	DcConversationViewRemoveDraftData* _data_;
	DcConversationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcConversationViewRemoveDraftData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_remove_draft_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_conversation_view_remove_draft_co (_data_);
}

static void
dc_conversation_view_remove_draft_finish (DcConversationView* self,
                                          GAsyncResult* _res_)
{
	DcConversationViewRemoveDraftData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_conversation_view_remove_draft_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DcConversationViewRemoveDraftData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_remove_draft_co (_data_);
}

static gboolean
dc_conversation_view_remove_draft_co (DcConversationViewRemoveDraftData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!_data_->self->priv->draft_rpc_available) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp0_ = _data_->_tmp3_ <= 0;
	}
	if (_data_->_tmp0_) {
		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->rpc;
		_data_->_tmp5_ = _data_->self->priv->_chat_id;
		_data_->_state_ = 1;
		dc_rpc_client_remove_draft (_data_->_tmp4_, _data_->_tmp5_, dc_conversation_view_remove_draft_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_remove_draft_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp6_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->self->priv->draft_rpc_available = !dc_conversation_view_is_missing_draft_rpc (_data_->_tmp7_);
		if (_data_->self->priv->draft_rpc_available) {
			_data_->_tmp8_ = _data_->e;
			_data_->_tmp9_ = _data_->_tmp8_->message;
			g_warning ("conversation_view.vala:2337: remove_draft: %s", _data_->_tmp9_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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 gboolean
dc_conversation_view_is_missing_draft_rpc (GError* e)
{
	gchar* msg = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp4_;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = e->message;
	_tmp1_ = g_utf8_strdown (_tmp0_, (gssize) -1);
	msg = _tmp1_;
	_tmp4_ = msg;
	if (string_contains (_tmp4_, "method not found")) {
		_tmp3_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = msg;
		_tmp3_ = string_contains (_tmp5_, "procedure not found");
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = msg;
		_tmp2_ = string_contains (_tmp6_, "unknown method");
	}
	result = _tmp2_;
	_g_free0 (msg);
	return result;
}

static gboolean
dc_conversation_view_can_accept_file_attachment (DcConversationView* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (!self->priv->selection_mode) {
		_tmp1_ = !self->priv->is_contact_request;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		DcComposeBar* _tmp2_;
		_tmp2_ = self->priv->compose_bar;
		_tmp0_ = dc_compose_bar_can_accept_attachment (_tmp2_);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
dc_conversation_view_attach_local_file (DcConversationView* self,
                                        const gchar* path,
                                        const gchar* name)
{
	gboolean _tmp1_ = FALSE;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gboolean _tmp6_;
	DcComposeBar* _tmp8_;
	DcComposeBar* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	g_return_if_fail (name != NULL);
	if (!dc_conversation_view_can_accept_file_attachment (self)) {
		DcWindow* _tmp0_;
		_tmp0_ = self->priv->window;
		dc_window_show_toast (_tmp0_, "Attach failed: cannot attach here");
		return;
	}
	_tmp2_ = string_strip (path);
	_tmp3_ = _tmp2_;
	_tmp4_ = strlen (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_ == 0;
	_g_free0 (_tmp3_);
	if (_tmp6_) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = !g_file_test (path, G_FILE_TEST_EXISTS);
	}
	if (_tmp1_) {
		DcWindow* _tmp7_;
		_tmp7_ = self->priv->window;
		dc_window_show_toast (_tmp7_, "Attach failed: file not found");
		return;
	}
	_tmp8_ = self->priv->compose_bar;
	dc_compose_bar_set_pending_attachment (_tmp8_, path, name, FALSE, "");
	_tmp9_ = self->priv->compose_bar;
	dc_compose_bar_grab_entry_focus (_tmp9_);
}

static gboolean
_dc_conversation_view_can_accept_file_attachment_dc_file_drop_target_accept (DcFileDropTarget* _sender,
                                                                             gpointer self)
{
	gboolean result;
	result = dc_conversation_view_can_accept_file_attachment ((DcConversationView*) self);
	return result;
}

static void
_dc_conversation_view_attach_local_file_dc_file_drop_target_dropped (DcFileDropTarget* _sender,
                                                                     const gchar* path,
                                                                     const gchar* name,
                                                                     gpointer self)
{
	dc_conversation_view_attach_local_file ((DcConversationView*) self, path, name);
}

static void
__lambda194_ (DcConversationView* self,
              const gchar* message)
{
	DcWindow* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->window;
	_tmp1_ = g_strconcat ("Attach failed: ", message, NULL);
	_tmp2_ = _tmp1_;
	dc_window_show_toast (_tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
}

static void
___lambda194__dc_file_drop_target_failed (DcFileDropTarget* _sender,
                                          const gchar* message,
                                          gpointer self)
{
	__lambda194_ ((DcConversationView*) self, message);
}

static void
dc_conversation_view_install_file_drop_target (DcConversationView* self)
{
	DcFileDropTarget* _tmp0_;
	DcFileDropTarget* _tmp1_;
	DcFileDropTarget* _tmp2_;
	gulong _tmp3_;
	DcFileDropTarget* _tmp4_;
	DcFileDropTarget* _tmp5_;
	gulong _tmp6_;
	DcFileDropTarget* _tmp7_;
	DcFileDropTarget* _tmp8_;
	gulong _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_file_drop_target_new ((GtkWidget*) self, "chat-drop-active");
	_g_object_unref0 (self->priv->file_drop_target);
	self->priv->file_drop_target = _tmp0_;
	_tmp1_ = self->priv->file_drop_target;
	_tmp2_ = self->priv->file_drop_target;
	_tmp3_ = g_signal_connect_object (_tmp2_, "accept", (GCallback) _dc_conversation_view_can_accept_file_attachment_dc_file_drop_target_accept, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp1_, _tmp3_);
	_tmp4_ = self->priv->file_drop_target;
	_tmp5_ = self->priv->file_drop_target;
	_tmp6_ = g_signal_connect_object (_tmp5_, "dropped", (GCallback) _dc_conversation_view_attach_local_file_dc_file_drop_target_dropped, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp4_, _tmp6_);
	_tmp7_ = self->priv->file_drop_target;
	_tmp8_ = self->priv->file_drop_target;
	_tmp9_ = g_signal_connect_object (_tmp8_, "failed", (GCallback) ___lambda194__dc_file_drop_target_failed, self, 0);
	dc_conversation_view_track_signal (self, (GObject*) _tmp7_, _tmp9_);
}

static DcMessageRow*
dc_conversation_view_pick_message_row (DcConversationView* self,
                                       gdouble x,
                                       gdouble y)
{
	GtkWidget* w = NULL;
	GtkListView* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp9_;
	DcMessageRow* _tmp10_;
	DcMessageRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->message_listview;
	_tmp1_ = gtk_widget_pick ((GtkWidget*) _tmp0_, x, y, GTK_PICK_DEFAULT);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	w = _tmp2_;
	while (TRUE) {
		gboolean _tmp3_ = FALSE;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		GtkWidget* _tmp8_;
		_tmp4_ = w;
		if (_tmp4_ != NULL) {
			GtkWidget* _tmp5_;
			_tmp5_ = w;
			_tmp3_ = !DC_IS_MESSAGE_ROW (_tmp5_);
		} else {
			_tmp3_ = FALSE;
		}
		if (!_tmp3_) {
			break;
		}
		_tmp6_ = w;
		_tmp7_ = gtk_widget_get_parent (_tmp6_);
		_tmp8_ = _g_object_ref0 (_tmp7_);
		_g_object_unref0 (w);
		w = _tmp8_;
	}
	_tmp9_ = w;
	_tmp10_ = _g_object_ref0 (DC_IS_MESSAGE_ROW (_tmp9_) ? ((DcMessageRow*) _tmp9_) : NULL);
	result = _tmp10_;
	_g_object_unref0 (w);
	return result;
}

static gboolean
dc_conversation_view_pointer_on_selectable_text (DcConversationView* self,
                                                 gdouble x,
                                                 gdouble y)
{
	GtkWidget* w = NULL;
	GtkListView* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->message_listview;
	_tmp1_ = gtk_widget_pick ((GtkWidget*) _tmp0_, x, y, GTK_PICK_DEFAULT);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	w = _tmp2_;
	while (TRUE) {
		gboolean _tmp3_ = FALSE;
		GtkWidget* _tmp4_;
		GtkLabel* lbl = NULL;
		GtkWidget* _tmp6_;
		GtkLabel* _tmp7_;
		gboolean _tmp8_ = FALSE;
		GtkLabel* _tmp9_;
		GtkWidget* _tmp13_;
		GtkWidget* _tmp14_;
		GtkWidget* _tmp15_;
		_tmp4_ = w;
		if (_tmp4_ != NULL) {
			GtkWidget* _tmp5_;
			_tmp5_ = w;
			_tmp3_ = !DC_IS_MESSAGE_ROW (_tmp5_);
		} else {
			_tmp3_ = FALSE;
		}
		if (!_tmp3_) {
			break;
		}
		_tmp6_ = w;
		_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, gtk_label_get_type ()) ? ((GtkLabel*) _tmp6_) : NULL);
		lbl = _tmp7_;
		_tmp9_ = lbl;
		if (_tmp9_ != NULL) {
			GtkLabel* _tmp10_;
			gboolean _tmp11_;
			gboolean _tmp12_;
			_tmp10_ = lbl;
			_tmp11_ = gtk_label_get_selectable (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp8_ = _tmp12_;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			result = TRUE;
			_g_object_unref0 (lbl);
			_g_object_unref0 (w);
			return result;
		}
		_tmp13_ = w;
		_tmp14_ = gtk_widget_get_parent (_tmp13_);
		_tmp15_ = _g_object_ref0 (_tmp14_);
		_g_object_unref0 (w);
		w = _tmp15_;
		_g_object_unref0 (lbl);
	}
	result = FALSE;
	_g_object_unref0 (w);
	return result;
}

static gboolean
dc_conversation_view_pointer_on_message_bubble (DcConversationView* self,
                                                gdouble x,
                                                gdouble y)
{
	GtkWidget* w = NULL;
	GtkListView* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	gboolean _tmp3_ = FALSE;
	GtkWidget* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->message_listview;
	_tmp1_ = gtk_widget_pick ((GtkWidget*) _tmp0_, x, y, GTK_PICK_DEFAULT);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	w = _tmp2_;
	_tmp4_ = w;
	if (_tmp4_ != NULL) {
		GtkWidget* _tmp5_;
		_tmp5_ = w;
		_tmp3_ = gtk_widget_has_css_class (_tmp5_, "message-bubble");
	} else {
		_tmp3_ = FALSE;
	}
	result = _tmp3_;
	_g_object_unref0 (w);
	return result;
}

static gboolean
dc_conversation_view_pointer_on_audio (DcConversationView* self,
                                       gdouble x,
                                       gdouble y)
{
	GtkWidget* w = NULL;
	GtkListView* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->message_listview;
	_tmp1_ = gtk_widget_pick ((GtkWidget*) _tmp0_, x, y, GTK_PICK_DEFAULT);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	w = _tmp2_;
	while (TRUE) {
		gboolean _tmp3_ = FALSE;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		_tmp4_ = w;
		if (_tmp4_ != NULL) {
			GtkWidget* _tmp5_;
			_tmp5_ = w;
			_tmp3_ = !DC_IS_MESSAGE_ROW (_tmp5_);
		} else {
			_tmp3_ = FALSE;
		}
		if (!_tmp3_) {
			break;
		}
		_tmp6_ = w;
		if (DC_IS_AUDIO_PLAYER (_tmp6_)) {
			result = TRUE;
			_g_object_unref0 (w);
			return result;
		}
		_tmp7_ = w;
		_tmp8_ = gtk_widget_get_parent (_tmp7_);
		_tmp9_ = _g_object_ref0 (_tmp8_);
		_g_object_unref0 (w);
		w = _tmp9_;
	}
	result = FALSE;
	_g_object_unref0 (w);
	return result;
}

static gboolean
dc_conversation_view_search_filter_active (DcConversationView* self)
{
	gboolean _tmp0_ = FALSE;
	GtkRevealer* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->message_search_revealer;
	_tmp2_ = gtk_revealer_get_reveal_child (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		GtkSearchEntry* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp4_ = self->priv->message_search_entry;
		_tmp5_ = gtk_editable_get_text ((GtkEditable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = string_strip (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp0_ = _tmp10_ > 0;
		_g_free0 (_tmp8_);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
dc_conversation_view_pointer_on_css (DcConversationView* self,
                                     gdouble x,
                                     gdouble y,
                                     gchar** classes,
                                     gint classes_length1)
{
	GtkWidget* w = NULL;
	GtkListView* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->message_listview;
	_tmp1_ = gtk_widget_pick ((GtkWidget*) _tmp0_, x, y, GTK_PICK_DEFAULT);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	w = _tmp2_;
	while (TRUE) {
		gboolean _tmp3_ = FALSE;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		GtkWidget* _tmp10_;
		_tmp4_ = w;
		if (_tmp4_ != NULL) {
			GtkWidget* _tmp5_;
			_tmp5_ = w;
			_tmp3_ = !DC_IS_MESSAGE_ROW (_tmp5_);
		} else {
			_tmp3_ = FALSE;
		}
		if (!_tmp3_) {
			break;
		}
		{
			gchar** cls_collection = NULL;
			gint cls_collection_length1 = 0;
			gint _cls_collection_size_ = 0;
			gint cls_it = 0;
			cls_collection = classes;
			cls_collection_length1 = classes_length1;
			for (cls_it = 0; cls_it < cls_collection_length1; cls_it = cls_it + 1) {
				const gchar* cls = NULL;
				cls = cls_collection[cls_it];
				{
					GtkWidget* _tmp6_;
					const gchar* _tmp7_;
					_tmp6_ = w;
					_tmp7_ = cls;
					if (gtk_widget_has_css_class (_tmp6_, _tmp7_)) {
						result = TRUE;
						_g_object_unref0 (w);
						return result;
					}
				}
			}
		}
		_tmp8_ = w;
		_tmp9_ = gtk_widget_get_parent (_tmp8_);
		_tmp10_ = _g_object_ref0 (_tmp9_);
		_g_object_unref0 (w);
		w = _tmp10_;
	}
	result = FALSE;
	_g_object_unref0 (w);
	return result;
}

static gboolean
dc_conversation_view_should_activate_message_at_pointer (DcConversationView* self,
                                                         DcMessage* msg,
                                                         gboolean pointer_on_media)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (msg != NULL, FALSE);
	if (dc_message_is_image_file (msg)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = dc_message_is_video_file (msg);
	}
	if (_tmp0_) {
		result = pointer_on_media;
		return result;
	}
	result = TRUE;
	return result;
}

static void
dc_conversation_view_on_message_activated (DcConversationView* self,
                                           DcMessage* msg)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (msg != NULL);
	_tmp0_ = dc_message_get_has_file (msg);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	if (dc_message_is_webxdc (msg)) {
		DcWindow* _tmp2_;
		DcWindow* _tmp3_;
		DcRpcClient* _tmp4_;
		_tmp2_ = self->priv->window;
		_tmp3_ = self->priv->window;
		_tmp4_ = self->priv->rpc;
		dc_window_prompt_webxdc_app (_tmp2_, (GtkWidget*) _tmp3_, _tmp4_, msg, NULL, NULL);
		return;
	}
	_tmp5_ = dc_message_get_has_local_file (msg);
	_tmp6_ = _tmp5_;
	if (!_tmp6_) {
		DcWindow* _tmp7_;
		_tmp7_ = self->priv->window;
		dc_window_show_toast (_tmp7_, "File not available");
		return;
	}
	if (dc_message_is_video_sticker_file (msg)) {
		DcWindow* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		_tmp8_ = self->priv->window;
		_tmp9_ = dc_message_get_file_path (msg);
		_tmp10_ = _tmp9_;
		_tmp11_ = dc_message_get_file_name (msg);
		_tmp12_ = _tmp11_;
		dc_window_show_video (_tmp8_, _tmp10_, _tmp12_);
	} else {
		if (dc_message_is_image_file (msg)) {
			gchar** paths = NULL;
			gint paths_length1 = 0;
			gint _paths_size_ = 0;
			gint start = 0;
			const gchar* _tmp13_;
			const gchar* _tmp14_;
			gchar** _tmp15_ = NULL;
			gint _tmp16_ = 0;
			gint _tmp17_ = 0;
			DcWindow* _tmp18_;
			gchar** _tmp19_;
			gint _tmp19__length1;
			const gchar* _tmp20_;
			const gchar* _tmp21_;
			_tmp13_ = dc_message_get_file_path (msg);
			_tmp14_ = _tmp13_;
			dc_conversation_view_collect_image_paths (self, _tmp14_, &_tmp15_, &_tmp16_, &_tmp17_);
			paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL);
			paths = _tmp15_;
			paths_length1 = _tmp16_;
			_paths_size_ = paths_length1;
			start = _tmp17_;
			_tmp18_ = self->priv->window;
			_tmp19_ = paths;
			_tmp19__length1 = paths_length1;
			dc_window_show_image_list (_tmp18_, _tmp19_, (gint) _tmp19__length1, start);
			_tmp20_ = dc_message_get_file_path (msg);
			_tmp21_ = _tmp20_;
			dc_conversation_view_extend_image_list (self, _tmp21_, NULL, NULL);
			paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL);
		} else {
			if (dc_message_is_video_file (msg)) {
				DcWindow* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				const gchar* _tmp25_;
				const gchar* _tmp26_;
				_tmp22_ = self->priv->window;
				_tmp23_ = dc_message_get_file_path (msg);
				_tmp24_ = _tmp23_;
				_tmp25_ = dc_message_get_file_name (msg);
				_tmp26_ = _tmp25_;
				dc_window_show_video (_tmp22_, _tmp24_, _tmp26_);
			} else {
				if (dc_message_is_audio_file (msg)) {
				} else {
					if (dc_message_is_text_preview_file (msg)) {
						dc_conversation_view_preview_text_attachment (self, msg);
					} else {
						DcWindow* _tmp27_;
						const gchar* _tmp28_;
						const gchar* _tmp29_;
						const gchar* _tmp30_;
						const gchar* _tmp31_;
						_tmp27_ = self->priv->window;
						_tmp28_ = dc_message_get_file_path (msg);
						_tmp29_ = _tmp28_;
						_tmp30_ = dc_message_get_file_name (msg);
						_tmp31_ = _tmp30_;
						dc_window_save_attachment (_tmp27_, _tmp29_, _tmp31_, NULL, NULL);
					}
				}
			}
		}
	}
}

static void
dc_conversation_view_preview_text_attachment (DcConversationView* self,
                                              DcMessage* msg)
{
	gchar* path = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* content = NULL;
	gsize length = 0UL;
	const gchar* _tmp15_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	gboolean _tmp25_;
	DcFullMessageDialog* dialog = NULL;
	DcWindow* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	const gchar* _tmp30_;
	DcSettingsManager* _tmp31_;
	DcFullMessageDialog* _tmp32_;
	DcFullMessageDialog* _tmp33_;
	DcFullMessageDialog* _tmp34_;
	DcWindow* _tmp35_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (msg != NULL);
	_tmp0_ = dc_message_get_file_path (msg);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	path = _tmp2_;
	{
		const gchar* _tmp3_;
		gchar* _tmp4_ = NULL;
		gsize _tmp5_ = 0UL;
		_tmp3_ = path;
		g_file_get_contents (_tmp3_, &_tmp4_, &_tmp5_, &_inner_error0_);
		_g_free0 (content);
		content = _tmp4_;
		length = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		DcWindow* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = self->priv->window;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		_tmp9_ = g_strconcat ("Preview failed: ", _tmp8_, NULL);
		_tmp10_ = _tmp9_;
		dc_window_show_toast (_tmp6_, _tmp10_);
		_g_free0 (_tmp10_);
		_g_error_free0 (e);
		_g_free0 (content);
		_g_free0 (path);
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (content);
		_g_free0 (path);
		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;
	}
	if (length > DC_CONVERSATION_VIEW_TEXT_PREVIEW_MAX_BYTES) {
		DcWindow* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		_tmp11_ = self->priv->window;
		_tmp12_ = path;
		_tmp13_ = dc_message_get_file_name (msg);
		_tmp14_ = _tmp13_;
		dc_window_save_attachment (_tmp11_, _tmp12_, _tmp14_, NULL, NULL);
		_g_free0 (content);
		_g_free0 (path);
		return;
	}
	_tmp15_ = content;
	if (!g_utf8_validate (_tmp15_, (gssize) -1, NULL)) {
		const gchar* _tmp16_;
		gchar* _tmp17_;
		_tmp16_ = content;
		_tmp17_ = g_utf8_make_valid (_tmp16_, (gssize) -1);
		_g_free0 (content);
		content = _tmp17_;
	}
	if (dc_message_is_html_file (msg)) {
		const gchar* _tmp18_;
		gchar* _tmp19_;
		_tmp18_ = content;
		_tmp19_ = dc_conversation_view_html_to_text (_tmp18_);
		_g_free0 (content);
		content = _tmp19_;
	}
	_tmp20_ = content;
	_tmp21_ = string_strip (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = strlen (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = _tmp24_ == 0;
	_g_free0 (_tmp22_);
	if (_tmp25_) {
		DcWindow* _tmp26_;
		_tmp26_ = self->priv->window;
		dc_window_show_toast (_tmp26_, "File is empty");
		_g_free0 (content);
		_g_free0 (path);
		return;
	}
	_tmp27_ = self->priv->window;
	_tmp28_ = dc_message_display_file_name (msg, "file");
	_tmp29_ = _tmp28_;
	_tmp30_ = content;
	_tmp31_ = self->priv->settings;
	_tmp32_ = dc_full_message_dialog_new_for_file (_tmp27_, _tmp29_, _tmp30_, dc_settings_manager_effective_font_size (_tmp31_), dc_message_is_markdown_file (msg));
	g_object_ref_sink (_tmp32_);
	_tmp33_ = _tmp32_;
	_g_free0 (_tmp29_);
	dialog = _tmp33_;
	_tmp34_ = dialog;
	_tmp35_ = self->priv->window;
	adw_dialog_present ((AdwDialog*) _tmp34_, (GtkWidget*) _tmp35_);
	_g_object_unref0 (dialog);
	_g_free0 (content);
	_g_free0 (path);
}

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

static void
dc_conversation_view_collect_image_paths (DcConversationView* self,
                                          const gchar* current_path,
                                          gchar*** paths,
                                          gint* paths_length1,
                                          gint* start_index)
{
	gchar** _vala_paths = NULL;
	gint _vala_paths_length1 = 0;
	gint _vala_start_index = 0;
	GPtrArray* list = NULL;
	GPtrArray* _tmp0_;
	gint found = 0;
	guint n = 0U;
	GListStore* _tmp1_;
	GPtrArray* _tmp23_;
	gsize _tmp24_ = 0;
	gpointer* _tmp25_;
	gint _tmp26_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (current_path != NULL);
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	list = _tmp0_;
	found = -1;
	_tmp1_ = self->priv->message_store;
	n = g_list_model_get_n_items ((GListModel*) _tmp1_);
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				DcMessage* m = NULL;
				GListStore* _tmp4_;
				GObject* _tmp5_;
				DcMessage* _tmp6_;
				gboolean _tmp7_ = FALSE;
				DcMessage* _tmp8_;
				gboolean _tmp9_;
				gboolean _tmp10_;
				DcMessage* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				GPtrArray* _tmp18_;
				DcMessage* _tmp19_;
				const gchar* _tmp20_;
				const gchar* _tmp21_;
				gchar* _tmp22_;
				if (!_tmp2_) {
					guint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				if (!(i < n)) {
					break;
				}
				_tmp4_ = self->priv->message_store;
				_tmp5_ = g_list_model_get_item ((GListModel*) _tmp4_, i);
				m = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, DC_TYPE_MESSAGE, DcMessage);
				_tmp6_ = m;
				if (_tmp6_ == NULL) {
					_g_object_unref0 (m);
					continue;
				}
				_tmp8_ = m;
				_tmp9_ = dc_message_get_has_local_file (_tmp8_);
				_tmp10_ = _tmp9_;
				if (!_tmp10_) {
					_tmp7_ = TRUE;
				} else {
					DcMessage* _tmp11_;
					_tmp11_ = m;
					_tmp7_ = !dc_message_is_image_file (_tmp11_);
				}
				if (_tmp7_) {
					_g_object_unref0 (m);
					continue;
				}
				_tmp12_ = m;
				_tmp13_ = dc_message_get_file_path (_tmp12_);
				_tmp14_ = _tmp13_;
				if (g_strcmp0 (_tmp14_, current_path) == 0) {
					GPtrArray* _tmp15_;
					gint _tmp16_;
					gint _tmp17_;
					_tmp15_ = list;
					_tmp16_ = vala_g_ptr_array_get_length (_tmp15_);
					_tmp17_ = _tmp16_;
					found = (gint) _tmp17_;
				}
				_tmp18_ = list;
				_tmp19_ = m;
				_tmp20_ = dc_message_get_file_path (_tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = g_strdup (_tmp21_);
				g_ptr_array_add (_tmp18_, _tmp22_);
				_g_object_unref0 (m);
			}
		}
	}
	_tmp23_ = list;
	_tmp25_ = g_ptr_array_steal (_tmp23_, &_tmp24_);
	_vala_paths = (_vala_array_free (_vala_paths, _vala_paths_length1, (GDestroyNotify) g_free), NULL);
	_vala_paths = _tmp25_;
	_vala_paths_length1 = _tmp24_;
	if (found >= 0) {
		_tmp26_ = found;
	} else {
		_tmp26_ = 0;
	}
	_vala_start_index = _tmp26_;
	_g_ptr_array_unref0 (list);
	if (paths) {
		*paths = _vala_paths;
	} else {
		_vala_paths = (_vala_array_free (_vala_paths, _vala_paths_length1, (GDestroyNotify) g_free), NULL);
	}
	if (paths_length1) {
		*paths_length1 = _vala_paths_length1;
	}
	if (start_index) {
		*start_index = _vala_start_index;
	}
}

static void
dc_conversation_view_extend_image_list_data_free (gpointer _data)
{
	DcConversationViewExtendImageListData* _data_;
	_data_ = _data;
	_g_free0 (_data_->current_path);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcConversationViewExtendImageListData, _data_);
}

static void
dc_conversation_view_extend_image_list (DcConversationView* self,
                                        const gchar* current_path,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	DcConversationViewExtendImageListData* _data_;
	DcConversationView* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (current_path != NULL);
	_data_ = g_slice_new0 (DcConversationViewExtendImageListData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_conversation_view_extend_image_list_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (current_path);
	_g_free0 (_data_->current_path);
	_data_->current_path = _tmp1_;
	dc_conversation_view_extend_image_list_co (_data_);
}

static void
dc_conversation_view_extend_image_list_finish (DcConversationView* self,
                                               GAsyncResult* _res_)
{
	DcConversationViewExtendImageListData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/**
         * The viewer opens instantly on the rows the conversation has
         * loaded so far, which stops at the oldest fetched message. Fetch
         * the chat's whole image list (a metadata-only core query, like the
         * gallery does) and hand it to the viewer so prev/next reach every
         * picture in the chat, not just the loaded window.
         */
static void
dc_conversation_view_extend_image_list_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	DcConversationViewExtendImageListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_conversation_view_extend_image_list_co (_data_);
}

static void
_vala_array_add39 (DcMessage** * array,
                   gint* length,
                   gint* size,
                   DcMessage* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (DcMessage*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gboolean
dc_conversation_view_extend_image_list_co (DcConversationViewExtendImageListData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_new0 (DcMessage*, 0 + 1);
	_data_->all = _data_->_tmp0_;
	_data_->all_length1 = 0;
	_data_->_all_size_ = _data_->all_length1;
	{
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = _data_->self->priv->_chat_id;
		_data_->_tmp3_ = 0;
		_data_->_state_ = 1;
		dc_rpc_client_get_chat_media (_data_->_tmp1_, _data_->_tmp2_, DC_CONVERSATION_VIEW_CHAT_IMAGE_TYPES, (gint) G_N_ELEMENTS (DC_CONVERSATION_VIEW_CHAT_IMAGE_TYPES), dc_conversation_view_extend_image_list_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp4_ = dc_rpc_client_get_chat_media_finish (_data_->_tmp1_, _data_->_res_, &_data_->_tmp3_, &_data_->_inner_error0_);
		_data_->ids = _data_->_tmp4_;
		_data_->ids_length1 = _data_->_tmp3_;
		_data_->_ids_size_ = _data_->ids_length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->self->priv->closed) {
			_data_->_tmp5_ = TRUE;
		} else {
			_data_->_tmp6_ = _data_->self->priv->window;
			_data_->_tmp7_ = dc_window_image_viewer_path (_data_->_tmp6_);
			_data_->_tmp8_ = _data_->_tmp7_;
			_data_->_tmp5_ = g_strcmp0 (_data_->_tmp8_, _data_->current_path) != 0;
			_g_free0 (_data_->_tmp8_);
		}
		if (_data_->_tmp5_) {
			_data_->ids = (g_free (_data_->ids), NULL);
			_data_->all = (_vala_array_free (_data_->all, _data_->all_length1, (GDestroyNotify) g_object_unref), NULL);
			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_->off = 0;
			{
				_data_->_tmp9_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp9_) {
						_data_->off += DC_CONVERSATION_VIEW_IMAGE_LIST_CHUNK;
					}
					_data_->_tmp9_ = FALSE;
					_data_->_tmp10_ = _data_->ids;
					_data_->_tmp10__length1 = _data_->ids_length1;
					if (!(_data_->off < _data_->_tmp10__length1)) {
						break;
					}
					_data_->_tmp11_ = _data_->ids;
					_data_->_tmp11__length1 = _data_->ids_length1;
					_data_->len = MIN (DC_CONVERSATION_VIEW_IMAGE_LIST_CHUNK, _data_->_tmp11__length1 - _data_->off);
					_data_->_tmp12_ = _data_->self->priv->rpc;
					_data_->_tmp13_ = _data_->ids;
					_data_->_tmp13__length1 = _data_->ids_length1;
					_data_->_tmp14_ = 0;
					_data_->_state_ = 2;
					dc_rpc_client_get_parsed_messages (_data_->_tmp12_, _data_->_tmp13_ + _data_->off, (gint) ((_data_->off + _data_->len) - _data_->off), dc_conversation_view_extend_image_list_ready, _data_);
					return FALSE;
					_state_2:
					_data_->_tmp15_ = dc_rpc_client_get_parsed_messages_finish (_data_->_tmp12_, _data_->_res_, &_data_->_tmp14_, &_data_->_inner_error0_);
					_data_->msgs = _data_->_tmp15_;
					_data_->msgs_length1 = _data_->_tmp14_;
					_data_->_msgs_size_ = _data_->msgs_length1;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_data_->ids = (g_free (_data_->ids), NULL);
						goto __catch0_g_error;
					}
					if (_data_->self->priv->closed) {
						_data_->_tmp16_ = TRUE;
					} else {
						_data_->_tmp17_ = _data_->self->priv->window;
						_data_->_tmp18_ = dc_window_image_viewer_path (_data_->_tmp17_);
						_data_->_tmp19_ = _data_->_tmp18_;
						_data_->_tmp16_ = g_strcmp0 (_data_->_tmp19_, _data_->current_path) != 0;
						_g_free0 (_data_->_tmp19_);
					}
					if (_data_->_tmp16_) {
						_data_->msgs = (_vala_array_free (_data_->msgs, _data_->msgs_length1, (GDestroyNotify) g_object_unref), NULL);
						_data_->ids = (g_free (_data_->ids), NULL);
						_data_->all = (_vala_array_free (_data_->all, _data_->all_length1, (GDestroyNotify) g_object_unref), NULL);
						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_->_tmp20_ = _data_->msgs;
					_data_->_tmp20__length1 = _data_->msgs_length1;
					{
						_data_->m_collection_length1 = 0;
						_data_->_m_collection_size_ = 0;
						_data_->m_collection = _data_->_tmp20_;
						_data_->m_collection_length1 = _data_->_tmp20__length1;
						for (_data_->m_it = 0; _data_->m_it < _data_->m_collection_length1; _data_->m_it = _data_->m_it + 1) {
							_data_->_tmp21_ = _g_object_ref0 (_data_->m_collection[_data_->m_it]);
							_data_->m = _data_->_tmp21_;
							{
								_data_->_tmp22_ = _data_->m;
								_data_->_tmp23_ = _g_object_ref0 (_data_->_tmp22_);
								_vala_array_add39 (&_data_->all, &_data_->all_length1, &_data_->_all_size_, _data_->_tmp23_);
								_g_object_unref0 (_data_->m);
							}
						}
					}
					_data_->msgs = (_vala_array_free (_data_->msgs, _data_->msgs_length1, (GDestroyNotify) g_object_unref), NULL);
				}
			}
		}
		_data_->ids = (g_free (_data_->ids), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp24_ = _data_->e;
		_data_->_tmp25_ = _data_->_tmp24_->message;
		g_debug ("conversation_view.vala:2543: chat image list: %s", _data_->_tmp25_);
		_g_error_free0 (_data_->e);
		_data_->all = (_vala_array_free (_data_->all, _data_->all_length1, (GDestroyNotify) g_object_unref), NULL);
		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;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_data_->all = (_vala_array_free (_data_->all, _data_->all_length1, (GDestroyNotify) g_object_unref), NULL);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp26_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	_data_->list = _data_->_tmp26_;
	_data_->_tmp27_ = _data_->all;
	_data_->_tmp27__length1 = _data_->all_length1;
	{
		_data_->_vala1_m_collection_length1 = 0;
		_data_->__vala1_m_collection_size_ = 0;
		_data_->_vala1_m_collection = _data_->_tmp27_;
		_data_->_vala1_m_collection_length1 = _data_->_tmp27__length1;
		for (_data_->_vala1_m_it = 0; _data_->_vala1_m_it < _data_->_vala1_m_collection_length1; _data_->_vala1_m_it = _data_->_vala1_m_it + 1) {
			_data_->_tmp28_ = _g_object_ref0 (_data_->_vala1_m_collection[_data_->_vala1_m_it]);
			_data_->_vala1_m = _data_->_tmp28_;
			{
				_data_->_tmp30_ = _data_->_vala1_m;
				_data_->_tmp31_ = dc_message_get_has_local_file (_data_->_tmp30_);
				_data_->_tmp32_ = _data_->_tmp31_;
				if (!_data_->_tmp32_) {
					_data_->_tmp29_ = TRUE;
				} else {
					_data_->_tmp33_ = _data_->_vala1_m;
					_data_->_tmp29_ = !dc_message_is_image_file (_data_->_tmp33_);
				}
				if (_data_->_tmp29_) {
					_g_object_unref0 (_data_->_vala1_m);
					continue;
				}
				_data_->_tmp34_ = _data_->list;
				_data_->_tmp35_ = _data_->_vala1_m;
				_data_->_tmp36_ = dc_message_get_file_path (_data_->_tmp35_);
				_data_->_tmp37_ = _data_->_tmp36_;
				_data_->_tmp38_ = g_strdup (_data_->_tmp37_);
				g_ptr_array_add (_data_->_tmp34_, _data_->_tmp38_);
				_g_object_unref0 (_data_->_vala1_m);
			}
		}
	}
	_data_->_tmp39_ = _data_->list;
	_data_->_tmp40_ = vala_g_ptr_array_get_length (_data_->_tmp39_);
	_data_->_tmp41_ = _data_->_tmp40_;
	if (_data_->_tmp41_ == 0) {
		_g_ptr_array_unref0 (_data_->list);
		_data_->all = (_vala_array_free (_data_->all, _data_->all_length1, (GDestroyNotify) g_object_unref), NULL);
		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->window;
	_data_->_tmp43_ = _data_->list;
	_data_->_tmp44_ = 0;
	_data_->_tmp45_ = g_ptr_array_steal (_data_->_tmp43_, &_data_->_tmp44_);
	_data_->_tmp46_ = _data_->_tmp45_;
	_data_->_tmp46__length1 = _data_->_tmp44_;
	dc_window_replace_image_list (_data_->_tmp42_, _data_->_tmp46_, (gint) _data_->_tmp44_, _data_->current_path);
	_data_->_tmp46_ = (_vala_array_free (_data_->_tmp46_, _data_->_tmp46__length1, (GDestroyNotify) g_free), NULL);
	_g_ptr_array_unref0 (_data_->list);
	_data_->all = (_vala_array_free (_data_->all, _data_->all_length1, (GDestroyNotify) g_object_unref), NULL);
	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;
}

/**
         * End every relationship that can outlive the GtkStack entry. This is
         * intentionally explicit: waiting for dispose would deadlock on the
         * signal cycles that close() is responsible for breaking.
         */
static guint*
_vala_array_dup15 (guint* self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint));
	}
	return NULL;
}

void
dc_conversation_view_close (DcConversationView* self)
{
	guint _tmp0_;
	guint* active_ticks = NULL;
	guint* _tmp1_;
	gint _tmp1__length1;
	guint* _tmp2_;
	gint _tmp2__length1;
	gint active_ticks_length1;
	gint _active_ticks_size_;
	guint* _tmp3_;
	guint* _tmp4_;
	gint _tmp4__length1;
	GPtrArray* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	DcAudioPlayback* playback = NULL;
	DcAudioPlayback* _tmp20_;
	DcWebxdcAppsBar* _tmp23_;
	DcComposeBar* _tmp24_;
	GtkListView* _tmp25_;
	GtkListView* _tmp26_;
	GtkFilterListModel* _tmp27_;
	GListStore* _tmp28_;
	gint* _tmp29_;
	DcMessageActions* _tmp30_;
	DcComposeBar* _tmp31_;
	g_return_if_fail (self != NULL);
	if (self->priv->closed) {
		return;
	}
	self->priv->closed = TRUE;
	dc_conversation_view_flush_pending_draft_save (self);
	_tmp0_ = self->priv->goal_generation;
	self->priv->goal_generation = _tmp0_ + 1;
	self->priv->pending_scroll_message_id = 0;
	self->priv->pending_voice_direction = 0;
	self->priv->loading_more = FALSE;
	_tmp1_ = self->priv->tick_callback_ids;
	_tmp1__length1 = self->priv->tick_callback_ids_length1;
	_tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup15 (_tmp1_, _tmp1__length1) : _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	active_ticks = _tmp2_;
	active_ticks_length1 = _tmp2__length1;
	_active_ticks_size_ = active_ticks_length1;
	_tmp3_ = g_new0 (guint, 0);
	self->priv->tick_callback_ids = (g_free (self->priv->tick_callback_ids), NULL);
	self->priv->tick_callback_ids = _tmp3_;
	self->priv->tick_callback_ids_length1 = 0;
	self->priv->_tick_callback_ids_size_ = self->priv->tick_callback_ids_length1;
	_tmp4_ = active_ticks;
	_tmp4__length1 = active_ticks_length1;
	{
		guint* callback_id_collection = NULL;
		gint callback_id_collection_length1 = 0;
		gint _callback_id_collection_size_ = 0;
		gint callback_id_it = 0;
		callback_id_collection = _tmp4_;
		callback_id_collection_length1 = _tmp4__length1;
		for (callback_id_it = 0; callback_id_it < callback_id_collection_length1; callback_id_it = callback_id_it + 1) {
			guint callback_id = 0U;
			callback_id = callback_id_collection[callback_id_it];
			{
				GtkListView* _tmp5_;
				_tmp5_ = self->priv->message_listview;
				gtk_widget_remove_tick_callback ((GtkWidget*) _tmp5_, callback_id);
			}
		}
	}
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp6_ = FALSE;
			_tmp6_ = TRUE;
			while (TRUE) {
				GPtrArray* _tmp8_;
				gint _tmp9_;
				gint _tmp10_;
				GPtrArray* _tmp11_;
				gconstpointer _tmp12_;
				if (!_tmp6_) {
					guint _tmp7_;
					_tmp7_ = i;
					i = _tmp7_ + 1;
				}
				_tmp6_ = FALSE;
				_tmp8_ = self->priv->signal_handlers;
				_tmp9_ = vala_g_ptr_array_get_length (_tmp8_);
				_tmp10_ = _tmp9_;
				if (!(i < ((guint) _tmp10_))) {
					break;
				}
				_tmp11_ = self->priv->signal_handlers;
				_tmp12_ = g_ptr_array_index (_tmp11_, i);
				dc_conversation_signal_handler_disconnect_handler ((DcConversationSignalHandler*) _tmp12_);
			}
		}
	}
	_tmp13_ = self->priv->signal_handlers;
	_tmp14_ = vala_g_ptr_array_get_length (_tmp13_);
	_tmp15_ = _tmp14_;
	if (_tmp15_ > 0) {
		GPtrArray* _tmp16_;
		GPtrArray* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		_tmp16_ = self->priv->signal_handlers;
		_tmp17_ = self->priv->signal_handlers;
		_tmp18_ = vala_g_ptr_array_get_length (_tmp17_);
		_tmp19_ = _tmp18_;
		g_ptr_array_remove_range (_tmp16_, (guint) 0, (guint) _tmp19_);
	}
	_tmp20_ = dc_audio_playback_shared ();
	playback = _tmp20_;
	if (self->priv->playback_message_handler != ((gulong) 0)) {
		DcAudioPlayback* _tmp21_;
		_tmp21_ = playback;
		g_signal_handler_disconnect ((GObject*) _tmp21_, self->priv->playback_message_handler);
		self->priv->playback_message_handler = (gulong) 0;
	}
	if (self->priv->playback_finished_handler != ((gulong) 0)) {
		DcAudioPlayback* _tmp22_;
		_tmp22_ = playback;
		g_signal_handler_disconnect ((GObject*) _tmp22_, self->priv->playback_finished_handler);
		self->priv->playback_finished_handler = (gulong) 0;
	}
	_tmp23_ = self->priv->webxdc_bar;
	dc_webxdc_apps_bar_close (_tmp23_);
	_tmp24_ = self->priv->compose_bar;
	dc_compose_bar_close (_tmp24_);
	_tmp25_ = self->priv->message_listview;
	gtk_list_view_set_model (_tmp25_, NULL);
	_tmp26_ = self->priv->message_listview;
	gtk_list_view_set_factory (_tmp26_, NULL);
	_tmp27_ = self->priv->filtered_message_store;
	gtk_filter_list_model_set_model (_tmp27_, NULL);
	_tmp28_ = self->priv->message_store;
	g_list_store_remove_all (_tmp28_);
	_json_array_unref0 (self->priv->all_msg_ids);
	self->priv->all_msg_ids = NULL;
	_tmp29_ = g_new0 (gint, 0);
	self->priv->pending_seen_ids = (g_free (self->priv->pending_seen_ids), NULL);
	self->priv->pending_seen_ids = _tmp29_;
	self->priv->pending_seen_ids_length1 = 0;
	self->priv->_pending_seen_ids_size_ = self->priv->pending_seen_ids_length1;
	_g_object_unref0 (self->priv->mention_roster);
	self->priv->mention_roster = NULL;
	_g_object_unref0 (self->priv->reaction_roster);
	self->priv->reaction_roster = NULL;
	_tmp30_ = self->priv->msg_actions;
	dc_message_actions_set_reaction_roster (_tmp30_, NULL);
	_tmp31_ = self->priv->compose_bar;
	dc_compose_bar_set_mention_roster (_tmp31_, NULL);
	_g_object_unref0 (playback);
	active_ticks = (g_free (active_ticks), NULL);
}

static void
dc_conversation_view_real_dispose (GObject* base)
{
	DcConversationView * self;
	self = (DcConversationView*) base;
	dc_conversation_view_close (self);
	G_OBJECT_CLASS (dc_conversation_view_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
}

gint
dc_conversation_view_get_chat_id (DcConversationView* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_chat_id;
	return result;
}

static void
dc_conversation_view_set_chat_id (DcConversationView* self,
                                  gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_conversation_view_get_chat_id (self);
	if (old_value != value) {
		self->priv->_chat_id = value;
		g_object_notify_by_pspec ((GObject *) self, dc_conversation_view_properties[DC_CONVERSATION_VIEW_CHAT_ID_PROPERTY]);
	}
}

static void
dc_conversation_view_class_init (DcConversationViewClass * klass,
                                 gpointer klass_data)
{
	dc_conversation_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcConversationView_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dc_conversation_view_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_conversation_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_conversation_view_set_property;
	G_OBJECT_CLASS (klass)->finalize = dc_conversation_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_CONVERSATION_VIEW_CHAT_ID_PROPERTY, dc_conversation_view_properties[DC_CONVERSATION_VIEW_CHAT_ID_PROPERTY] = g_param_spec_int ("chat-id", "chat-id", "chat-id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
dc_conversation_view_instance_init (DcConversationView * self,
                                    gpointer klass)
{
	GPtrArray* _tmp0_;
	guint* _tmp1_;
	gint* _tmp2_;
	gchar* _tmp3_;
	GQueue* _tmp4_;
	self->priv = dc_conversation_view_get_instance_private (self);
	self->priv->link_preview_fetcher = NULL;
	self->priv->chat_kind = DC_CHAT_KIND_UNKNOWN;
	self->priv->chat_kind_loaded = FALSE;
	self->priv->is_contact_request = FALSE;
	self->priv->selection_mode = FALSE;
	self->priv->playback_message_handler = (gulong) 0;
	self->priv->playback_finished_handler = (gulong) 0;
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	self->priv->signal_handlers = _tmp0_;
	_tmp1_ = g_new0 (guint, 0);
	self->priv->tick_callback_ids = _tmp1_;
	self->priv->tick_callback_ids_length1 = 0;
	self->priv->_tick_callback_ids_size_ = self->priv->tick_callback_ids_length1;
	self->priv->closed = FALSE;
	self->priv->goal = DC_CONVERSATION_VIEW_VIEWPORT_GOAL_BOTTOM;
	self->priv->goal_generation = (guint) 0;
	_tmp2_ = g_new0 (gint, 0);
	self->priv->pending_seen_ids = _tmp2_;
	self->priv->pending_seen_ids_length1 = 0;
	self->priv->_pending_seen_ids_size_ = self->priv->pending_seen_ids_length1;
	self->priv->all_msg_ids = NULL;
	self->priv->loaded_start_index = (guint) 0;
	self->priv->loading_more = FALSE;
	self->priv->pending_scroll_message_id = 0;
	self->priv->pending_voice_direction = 0;
	self->priv->loading_chat = FALSE;
	self->priv->messages_loaded = FALSE;
	self->priv->messages_stale = FALSE;
	self->priv->draft_loaded = FALSE;
	self->priv->draft_rpc_available = TRUE;
	self->priv->draft_save_timer = (guint) 0;
	self->priv->draft_save_pending = FALSE;
	_tmp3_ = g_strdup ("");
	self->priv->pending_draft_text = _tmp3_;
	self->priv->pending_draft_file_path = NULL;
	self->priv->pending_draft_file_name = NULL;
	self->priv->pending_draft_quote_msg_id = 0;
	self->priv->pending_draft_voice = FALSE;
	self->priv->scroll_freeze_until_us = (gint64) 0;
	_tmp4_ = g_queue_new ();
	self->priv->send_queue = _tmp4_;
	self->priv->sending_queue = FALSE;
	self->priv->mention_roster = NULL;
	self->priv->reaction_roster = NULL;
	self->priv->roster_loaded = FALSE;
}

static void
dc_conversation_view_finalize (GObject * obj)
{
	DcConversationView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_CONVERSATION_VIEW, DcConversationView);
	_g_object_unref0 (self->priv->link_preview_fetcher);
	_g_object_unref0 (self->priv->message_listview);
	_g_object_unref0 (self->priv->message_scroll);
	_g_object_unref0 (self->priv->message_store);
	_g_object_unref0 (self->priv->filtered_message_store);
	_g_object_unref0 (self->priv->message_filter);
	_g_object_unref0 (self->priv->compose_bar);
	_g_object_unref0 (self->priv->selection_bar);
	_g_object_unref0 (self->priv->selection_delete_btn);
	_g_object_unref0 (self->priv->selection_forward_btn);
	_g_object_unref0 (self->priv->request_bar);
	_g_object_unref0 (self->priv->scroll_down_btn);
	_g_object_unref0 (self->priv->loading_pill_label);
	_g_object_unref0 (self->priv->loading_more_revealer);
	_g_object_unref0 (self->priv->loading_more_spinner);
	_g_object_unref0 (self->priv->message_search_revealer);
	_g_object_unref0 (self->priv->message_search_entry);
	_g_object_unref0 (self->priv->file_drop_target);
	_g_object_unref0 (self->priv->media_bar);
	_g_ptr_array_unref0 (self->priv->signal_handlers);
	self->priv->tick_callback_ids = (g_free (self->priv->tick_callback_ids), NULL);
	self->priv->pending_seen_ids = (g_free (self->priv->pending_seen_ids), NULL);
	_json_array_unref0 (self->priv->all_msg_ids);
	_g_free0 (self->priv->pending_draft_text);
	_g_free0 (self->priv->pending_draft_file_path);
	_g_free0 (self->priv->pending_draft_file_name);
	(self->priv->send_queue == NULL) ? NULL : (self->priv->send_queue = (_g_queue_free__g_object_unref0_ (self->priv->send_queue), NULL));
	_g_object_unref0 (self->priv->pinned);
	_g_object_unref0 (self->priv->webxdc_bar);
	_g_object_unref0 (self->priv->msg_actions);
	_g_object_unref0 (self->priv->mention_roster);
	_g_object_unref0 (self->priv->reaction_roster);
	G_OBJECT_CLASS (dc_conversation_view_parent_class)->finalize (obj);
}

/**
     * Per-chat conversation view. One instance per chat, cached by the
     * window so each conversation keeps its own draft, scroll position,
     * message store, search state, and pinned bar across chat switches.
     */
static GType
dc_conversation_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcConversationViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_conversation_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcConversationView), 0, (GInstanceInitFunc) dc_conversation_view_instance_init, NULL };
	GType dc_conversation_view_type_id;
	dc_conversation_view_type_id = g_type_register_static (gtk_box_get_type (), "DcConversationView", &g_define_type_info, 0);
	DcConversationView_private_offset = g_type_add_instance_private (dc_conversation_view_type_id, sizeof (DcConversationViewPrivate));
	return dc_conversation_view_type_id;
}

GType
dc_conversation_view_get_type (void)
{
	static volatile gsize dc_conversation_view_type_id__once = 0;
	if (g_once_init_enter (&dc_conversation_view_type_id__once)) {
		GType dc_conversation_view_type_id;
		dc_conversation_view_type_id = dc_conversation_view_get_type_once ();
		g_once_init_leave (&dc_conversation_view_type_id__once, dc_conversation_view_type_id);
	}
	return dc_conversation_view_type_id__once;
}

static void
_vala_dc_conversation_view_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	DcConversationView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_CONVERSATION_VIEW, DcConversationView);
	switch (property_id) {
		case DC_CONVERSATION_VIEW_CHAT_ID_PROPERTY:
		g_value_set_int (value, dc_conversation_view_get_chat_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_conversation_view_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	DcConversationView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_CONVERSATION_VIEW, DcConversationView);
	switch (property_id) {
		case DC_CONVERSATION_VIEW_CHAT_ID_PROPERTY:
		dc_conversation_view_set_chat_id (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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 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;
}

