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

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <float.h>
#include <math.h>
#include <pango/pango.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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_MESSAGE_DETAILS_DIALOG (dc_message_details_dialog_get_type ())
#define DC_MESSAGE_DETAILS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE_DETAILS_DIALOG, DcMessageDetailsDialog))
#define DC_MESSAGE_DETAILS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE_DETAILS_DIALOG, DcMessageDetailsDialogClass))
#define DC_IS_MESSAGE_DETAILS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE_DETAILS_DIALOG))
#define DC_IS_MESSAGE_DETAILS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE_DETAILS_DIALOG))
#define DC_MESSAGE_DETAILS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE_DETAILS_DIALOG, DcMessageDetailsDialogClass))

typedef struct _DcMessageDetailsDialog DcMessageDetailsDialog;
typedef struct _DcMessageDetailsDialogClass DcMessageDetailsDialogClass;
typedef struct _DcMessageDetailsDialogPrivate DcMessageDetailsDialogPrivate;

#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_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_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_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_MESSAGE_DETAILS_DIALOG_0_PROPERTY,
	DC_MESSAGE_DETAILS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* dc_message_details_dialog_properties[DC_MESSAGE_DETAILS_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define DC_TYPE_MESSAGE_REACTION (dc_message_reaction_get_type ())
#define DC_MESSAGE_REACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE_REACTION, DcMessageReaction))
#define DC_MESSAGE_REACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE_REACTION, DcMessageReactionClass))
#define DC_IS_MESSAGE_REACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE_REACTION))
#define DC_IS_MESSAGE_REACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE_REACTION))
#define DC_MESSAGE_REACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE_REACTION, DcMessageReactionClass))

typedef struct _DcMessageReaction DcMessageReaction;
typedef struct _DcMessageReactionClass DcMessageReactionClass;
typedef struct _DcMessageReactionPrivate DcMessageReactionPrivate;

#define DC_TYPE_MESSAGE_REACTION_USER (dc_message_reaction_user_get_type ())
#define DC_MESSAGE_REACTION_USER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE_REACTION_USER, DcMessageReactionUser))
#define DC_MESSAGE_REACTION_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE_REACTION_USER, DcMessageReactionUserClass))
#define DC_IS_MESSAGE_REACTION_USER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE_REACTION_USER))
#define DC_IS_MESSAGE_REACTION_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE_REACTION_USER))
#define DC_MESSAGE_REACTION_USER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE_REACTION_USER, DcMessageReactionUserClass))

typedef struct _DcMessageReactionUser DcMessageReactionUser;
typedef struct _DcMessageReactionUserClass DcMessageReactionUserClass;
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
typedef struct _Block92Data Block92Data;
typedef struct _DcMessagePrivate DcMessagePrivate;
typedef struct _Block21Data Block21Data;

#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;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DcMessageDetailsDialogSaveEditData DcMessageDetailsDialogSaveEditData;
typedef struct _DcMessageDetailsDialogOpenReactionUserChatData DcMessageDetailsDialogOpenReactionUserChatData;
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 _DcMessageDetailsDialogConfirmDeleteMessageData DcMessageDetailsDialogConfirmDeleteMessageData;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
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 ())

struct _DcMessageDetailsDialog {
	AdwDialog parent_instance;
	DcMessageDetailsDialogPrivate * priv;
};

struct _DcMessageDetailsDialogClass {
	AdwDialogClass parent_class;
};

struct _DcMessageDetailsDialogPrivate {
	DcWindow* window;
	DcRpcClient* rpc;
	DcMessageActions* actions;
	DcMessage* msg;
	DcMentionRoster* reaction_roster;
	GtkTextView* edit_view;
	GtkButton* save_edit_btn;
	GtkLabel* edit_status_lbl;
	gchar* edit_original_text;
};

struct _DcMessageReaction {
	GObject parent_instance;
	DcMessageReactionPrivate * priv;
	GPtrArray* users;
};

struct _DcMessageReactionClass {
	GObjectClass parent_class;
};

struct _Block92Data {
	int _ref_count_;
	DcMessageDetailsDialog* self;
	gint contact_id;
};

struct _DcMessage {
	GObject parent_instance;
	DcMessagePrivate * priv;
	GPtrArray* reaction_details;
};

struct _DcMessageClass {
	GObjectClass parent_class;
};

struct _Block21Data {
	int _ref_count_;
	GPtrArray* self;
	GCompareFunc compare_func;
};

struct _DcMessageDetailsDialogSaveEditData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageDetailsDialog* self;
	gboolean _tmp0_;
	GtkTextView* _tmp1_;
	GtkButton* _tmp2_;
	gchar* text;
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	gchar* _tmp6_;
	gboolean _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gboolean _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	GtkButton* _tmp16_;
	GtkLabel* _tmp17_;
	GtkLabel* _tmp18_;
	DcRpcClient* _tmp19_;
	DcMessage* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	const gchar* _tmp23_;
	DcMessage* _tmp24_;
	const gchar* _tmp25_;
	DcMessage* _tmp26_;
	DcMessageActions* _tmp27_;
	DcMessage* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	GtkLabel* _tmp33_;
	GtkLabel* _tmp34_;
	GError* e;
	GtkLabel* _tmp35_;
	GtkLabel* _tmp36_;
	GError* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	DcWindow* _tmp41_;
	GError* _tmp42_;
	const gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	GError* _inner_error0_;
};

struct _DcMessageDetailsDialogOpenReactionUserChatData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageDetailsDialog* self;
	gint contact_id;
	gint chat_id;
	DcRpcClient* _tmp0_;
	DcWindow* _tmp1_;
	DcWindow* _tmp2_;
	GError* e;
	DcWindow* _tmp3_;
	GError* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GError* _inner_error0_;
};

struct _DcMessageDetailsDialogConfirmDeleteMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageDetailsDialog* self;
	const gchar* _tmp0_;
	DcMessage* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gchar* body;
	gchar* _tmp4_;
	DcDeleteChoice choice;
	const gchar* _tmp5_;
	DcMessage* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	DcMessageActions* _tmp9_;
	DcMessage* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
};

static gint DcMessageDetailsDialog_private_offset;
static gpointer dc_message_details_dialog_parent_class = NULL;
VALA_EXTERN gchar* dc_message_row_self_display_name;
VALA_EXTERN gchar* dc_message_row_self_avatar_path;

VALA_EXTERN GType dc_message_details_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageDetailsDialog, 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_message_actions_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageActions, g_object_unref)
VALA_EXTERN GType dc_message_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessage, g_object_unref)
VALA_EXTERN GType dc_mention_roster_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMentionRoster, g_object_unref)
VALA_EXTERN DcMessageDetailsDialog* dc_message_details_dialog_new (DcWindow* window,
                                                       DcRpcClient* rpc,
                                                       DcMessageActions* actions,
                                                       DcMessage* msg,
                                                       DcMentionRoster* reaction_roster);
VALA_EXTERN DcMessageDetailsDialog* dc_message_details_dialog_construct (GType object_type,
                                                             DcWindow* window,
                                                             DcRpcClient* rpc,
                                                             DcMessageActions* actions,
                                                             DcMessage* msg,
                                                             DcMentionRoster* reaction_roster);
static GtkWidget* dc_message_details_dialog_build_sender_button (DcMessageDetailsDialog* self);
VALA_EXTERN gboolean dc_message_get_can_edit_text (DcMessage* self);
static GtkWidget* dc_message_details_dialog_build_edit_section (DcMessageDetailsDialog* self);
static GtkWidget* dc_message_details_dialog_build_reactions_section (DcMessageDetailsDialog* self);
static GtkWidget* dc_message_details_dialog_build_message_info_section (DcMessageDetailsDialog* self);
VALA_EXTERN gboolean dc_message_get_has_file (DcMessage* self);
static GtkWidget* dc_message_details_dialog_build_attachment_section (DcMessageDetailsDialog* self);
static gboolean dc_message_details_dialog_has_value (const gchar* value);
VALA_EXTERN const gchar* dc_message_get_quote_text (DcMessage* self);
VALA_EXTERN gint dc_message_get_quote_msg_id (DcMessage* self);
static GtkWidget* dc_message_details_dialog_build_quote_section (DcMessageDetailsDialog* self);
static GtkWidget* dc_message_details_dialog_build_actions_section (DcMessageDetailsDialog* self);
VALA_EXTERN void dc_install_escape_close (AdwDialog* dialog);
static void dc_message_details_dialog_sender_identity (DcMessageDetailsDialog* self,
                                                gchar** name,
                                                gchar** address,
                                                gchar** avatar_path);
static gboolean dc_message_details_dialog_sender_chat_available (DcMessageDetailsDialog* self);
static void __lambda91_ (DcMessageDetailsDialog* self);
VALA_EXTERN void dc_message_actions_open_sender_chat (DcMessageActions* self,
                                          gint msg_id,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN void dc_message_actions_open_sender_chat_finish (DcMessageActions* self,
                                                 GAsyncResult* _res_);
VALA_EXTERN gint dc_message_get_id (DcMessage* self);
static void ___lambda91__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
VALA_EXTERN gboolean dc_message_get_is_outgoing (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_sender_was_seen_recently (DcMessage* self);
VALA_EXTERN GtkWidget* dc_presence_avatar (gint size,
                               const gchar* text,
                               const gchar* path,
                               gboolean online,
                               const gchar* avatar_css,
                               const gchar* ring_css);
static GtkLabel* dc_message_details_dialog_heading (DcMessageDetailsDialog* self,
                                             const gchar* text);
VALA_EXTERN const gchar* dc_message_get_text (DcMessage* self);
static void dc_message_details_dialog_update_edit_button (DcMessageDetailsDialog* self);
static void _dc_message_details_dialog_update_edit_button_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                                            gpointer self);
static GtkLabel* dc_message_details_dialog_dim (DcMessageDetailsDialog* self,
                                         const gchar* text);
static void __lambda96_ (DcMessageDetailsDialog* self);
static void dc_message_details_dialog_save_edit (DcMessageDetailsDialog* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_message_details_dialog_save_edit_finish (DcMessageDetailsDialog* self,
                                                 GAsyncResult* _res_);
static void ___lambda96__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static GtkListBox* dc_message_details_dialog_boxed_list (DcMessageDetailsDialog* self);
VALA_EXTERN GType dc_message_reaction_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageReaction, g_object_unref)
static GPtrArray* dc_message_details_dialog_sorted_reactions (DcMessageDetailsDialog* self);
static AdwActionRow* dc_message_details_dialog_info_row (DcMessageDetailsDialog* self,
                                                  const gchar* title,
                                                  const gchar* subtitle,
                                                  gint subtitle_lines);
VALA_EXTERN GType dc_message_reaction_user_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageReactionUser, g_object_unref)
static AdwActionRow* dc_message_details_dialog_reaction_count_row (DcMessageDetailsDialog* self,
                                                            DcMessageReaction* reaction);
static gint* dc_message_details_dialog_sorted_reaction_user_ids (DcMessageDetailsDialog* self,
                                                          DcMessageReaction* reaction,
                                                          gint* result_length1);
static AdwActionRow* dc_message_details_dialog_reaction_user_row (DcMessageDetailsDialog* self,
                                                           const gchar* emoji,
                                                           gint contact_id);
VALA_EXTERN const gchar* dc_message_reaction_get_emoji (DcMessageReaction* self);
VALA_EXTERN gint dc_message_get_chat_id (DcMessage* self);
static gchar* dc_message_details_dialog_format_full_timestamp (DcMessageDetailsDialog* self,
                                                        gint64 ts);
VALA_EXTERN gint64 dc_message_get_timestamp (DcMessage* self);
static gchar* dc_message_details_dialog_delivery_state (DcMessageDetailsDialog* self);
static gchar* dc_message_details_dialog_message_type (DcMessageDetailsDialog* self);
static gchar* dc_message_details_dialog_flags_text (DcMessageDetailsDialog* self);
VALA_EXTERN gint dc_message_get_sender_contact_id (DcMessage* self);
VALA_EXTERN const gchar* dc_rpc_client_get_self_email (DcRpcClient* self);
VALA_EXTERN const gchar* dc_message_get_sender_address (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_override_sender_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_download_state (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_file_mime (DcMessage* self);
VALA_EXTERN gint dc_message_get_file_bytes (DcMessage* self);
static gchar* dc_message_details_dialog_format_bytes (gint64 bytes);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_has_local_file (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_quote_sender_name (DcMessage* self);
static void __lambda99_ (DcMessageDetailsDialog* self);
static void dc_message_details_dialog_confirm_delete_message (DcMessageDetailsDialog* self,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static void dc_message_details_dialog_confirm_delete_message_finish (DcMessageDetailsDialog* self,
                                                              GAsyncResult* _res_);
static void ___lambda99__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda100_ (DcMessageDetailsDialog* self);
VALA_EXTERN void dc_message_actions_start_forwarding (DcMessageActions* self,
                                          gint msg_id);
static void ___lambda100__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda101_ (DcMessageDetailsDialog* self);
VALA_EXTERN void dc_message_actions_start_replying (DcMessageActions* self,
                                        gint msg_id);
static void ___lambda101__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN gint dc_message_reaction_get_count (DcMessageReaction* self);
static Block92Data* block92_data_ref (Block92Data* _data92_);
static void block92_data_unref (void * _userdata_);
static gchar* dc_message_details_dialog_reaction_user_name (DcMessageDetailsDialog* self,
                                                     gint contact_id);
static void ___lambda98_ (Block92Data* _data92_);
static void dc_message_details_dialog_open_reaction_user_chat (DcMessageDetailsDialog* self,
                                                        gint contact_id,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_);
static void dc_message_details_dialog_open_reaction_user_chat_finish (DcMessageDetailsDialog* self,
                                                               GAsyncResult* _res_);
static void ____lambda98__adw_action_row_activated (AdwActionRow* _sender,
                                             gpointer self);
static void _g_object_unref0_ (gpointer var);
VALA_EXTERN const gchar* dc_message_get_reactions (DcMessage* self);
VALA_EXTERN DcMessageReaction* dc_message_reaction_new (const gchar* emoji);
VALA_EXTERN DcMessageReaction* dc_message_reaction_construct (GType object_type,
                                                  const gchar* emoji);
VALA_EXTERN void dc_message_reaction_set_count (DcMessageReaction* self,
                                    gint value);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static gint ___lambda0__gcompare_data_func (gconstpointer a,
                                     gconstpointer b,
                                     gpointer self);
static gint __lambda97_ (DcMessageReaction* a,
                  DcMessageReaction* b);
static gint ___lambda97__gcompare_func (gconstpointer a,
                                 gconstpointer b);
VALA_EXTERN gint dc_message_reaction_user_get_contact_id (DcMessageReactionUser* self);
static void _vala_array_add54 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
VALA_EXTERN GType dc_mention_member_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMentionMember, g_object_unref)
VALA_EXTERN DcMentionMember* dc_mention_roster_lookup_contact (DcMentionRoster* self,
                                                   gint contact_id);
VALA_EXTERN const gchar* dc_mention_member_get_display_name (DcMentionMember* self);
VALA_EXTERN const gchar* dc_mention_member_get_address (DcMentionMember* self);
VALA_EXTERN const gchar* dc_message_get_sender_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_sender_avatar_path (DcMessage* self);
static gchar* dc_message_details_dialog_text_buffer_text (GtkTextBuffer* buffer);
static void dc_message_details_dialog_save_edit_data_free (gpointer _data);
static gboolean dc_message_details_dialog_save_edit_co (DcMessageDetailsDialogSaveEditData* _data_);
VALA_EXTERN void dc_rpc_client_send_edit_request (DcRpcClient* self,
                                      gint msg_id,
                                      const gchar* new_text,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_send_edit_request_finish (DcRpcClient* self,
                                             GAsyncResult* _res_,
                                             GError** error);
static void dc_message_details_dialog_save_edit_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
VALA_EXTERN void dc_message_set_text (DcMessage* self,
                          const gchar* value);
VALA_EXTERN void dc_message_set_is_edited (DcMessage* self,
                               gboolean value);
VALA_EXTERN void dc_message_actions_update_row (DcMessageActions* self,
                                    gint msg_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN void dc_message_actions_update_row_finish (DcMessageActions* self,
                                           GAsyncResult* _res_);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
static void dc_message_details_dialog_open_reaction_user_chat_data_free (gpointer _data);
static gboolean dc_message_details_dialog_open_reaction_user_chat_co (DcMessageDetailsDialogOpenReactionUserChatData* _data_);
VALA_EXTERN void dc_rpc_client_get_or_create_chat_by_contact (DcRpcClient* self,
                                                  gint contact_id,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_or_create_chat_by_contact_finish (DcRpcClient* self,
                                                         GAsyncResult* _res_,
                                                         GError** error);
static void dc_message_details_dialog_open_reaction_user_chat_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
VALA_EXTERN void dc_window_request_reload_chats (DcWindow* self);
VALA_EXTERN gboolean dc_window_select_chat_by_id (DcWindow* self,
                                      gint chat_id);
static void dc_message_details_dialog_confirm_delete_message_data_free (gpointer _data);
static gboolean dc_message_details_dialog_confirm_delete_message_co (DcMessageDetailsDialogConfirmDeleteMessageData* _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_message_details_dialog_confirm_delete_message_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
VALA_EXTERN void dc_message_actions_delete_message (DcMessageActions* self,
                                        gint msg_id,
                                        gboolean for_all,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN void dc_message_actions_delete_message_finish (DcMessageActions* self,
                                               GAsyncResult* _res_);
VALA_EXTERN gboolean dc_message_get_is_failed (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_is_read (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_is_delivered (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_is_pending (DcMessage* 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_message_get_is_info (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_view_type (DcMessage* self);
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_is_audio_file (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_is_forwarded (DcMessage* self);
static void _vala_array_add55 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN gboolean dc_message_get_is_edited (DcMessage* self);
static void _vala_array_add56 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN gboolean dc_message_get_is_pinned (DcMessage* self);
static void _vala_array_add57 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void _vala_array_add58 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN gboolean dc_message_get_has_html (DcMessage* self);
static void _vala_array_add59 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN gboolean dc_message_get_has_full_message_action (DcMessage* self);
static void _vala_array_add60 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void dc_message_details_dialog_finalize (GObject * obj);
static GType dc_message_details_dialog_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dc_message_details_dialog_get_instance_private (DcMessageDetailsDialog* self)
{
	return G_STRUCT_MEMBER_P (self, DcMessageDetailsDialog_private_offset);
}

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

DcMessageDetailsDialog*
dc_message_details_dialog_construct (GType object_type,
                                     DcWindow* window,
                                     DcRpcClient* rpc,
                                     DcMessageActions* actions,
                                     DcMessage* msg,
                                     DcMentionRoster* reaction_roster)
{
	DcMessageDetailsDialog * self = NULL;
	DcMessageActions* _tmp0_;
	DcMessage* _tmp1_;
	DcMentionRoster* _tmp2_;
	GtkBox* box = NULL;
	GtkBox* _tmp3_;
	AdwHeaderBar* header = NULL;
	AdwHeaderBar* _tmp4_;
	AdwHeaderBar* _tmp5_;
	GtkBox* _tmp6_;
	AdwHeaderBar* _tmp7_;
	GtkBox* content = NULL;
	GtkBox* _tmp8_;
	GtkBox* _tmp9_;
	GtkBox* _tmp10_;
	GtkBox* _tmp11_;
	GtkBox* _tmp12_;
	GtkBox* _tmp13_;
	GtkWidget* _tmp14_;
	GtkWidget* _tmp15_;
	gboolean _tmp16_;
	gboolean _tmp17_;
	GtkBox* _tmp24_;
	GtkSeparator* _tmp25_;
	GtkSeparator* _tmp26_;
	GtkBox* _tmp27_;
	GtkWidget* _tmp28_;
	GtkWidget* _tmp29_;
	GtkBox* _tmp30_;
	GtkSeparator* _tmp31_;
	GtkSeparator* _tmp32_;
	GtkBox* _tmp33_;
	GtkWidget* _tmp34_;
	GtkWidget* _tmp35_;
	gboolean _tmp36_;
	gboolean _tmp37_;
	gboolean _tmp44_ = FALSE;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	GtkBox* _tmp55_;
	GtkSeparator* _tmp56_;
	GtkSeparator* _tmp57_;
	GtkBox* _tmp58_;
	GtkWidget* _tmp59_;
	GtkWidget* _tmp60_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp61_;
	GtkBox* _tmp62_;
	GtkBox* _tmp63_;
	GtkBox* _tmp64_;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	g_return_val_if_fail (actions != NULL, NULL);
	g_return_val_if_fail (msg != NULL, NULL);
	self = (DcMessageDetailsDialog*) g_object_new (object_type, NULL);
	self->priv->window = window;
	self->priv->rpc = rpc;
	_tmp0_ = _g_object_ref0 (actions);
	_g_object_unref0 (self->priv->actions);
	self->priv->actions = _tmp0_;
	_tmp1_ = _g_object_ref0 (msg);
	_g_object_unref0 (self->priv->msg);
	self->priv->msg = _tmp1_;
	_tmp2_ = _g_object_ref0 (reaction_roster);
	_g_object_unref0 (self->priv->reaction_roster);
	self->priv->reaction_roster = _tmp2_;
	adw_dialog_set_title ((AdwDialog*) self, "Message Details");
	adw_dialog_set_content_width ((AdwDialog*) self, 480);
	adw_dialog_set_content_height ((AdwDialog*) self, 620);
	_tmp3_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp3_);
	box = _tmp3_;
	_tmp4_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp4_);
	header = _tmp4_;
	_tmp5_ = header;
	adw_header_bar_set_show_end_title_buttons (_tmp5_, TRUE);
	_tmp6_ = box;
	_tmp7_ = header;
	gtk_box_append (_tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 14);
	g_object_ref_sink (_tmp8_);
	content = _tmp8_;
	_tmp9_ = content;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp9_, 16);
	_tmp10_ = content;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp10_, 16);
	_tmp11_ = content;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp11_, 12);
	_tmp12_ = content;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp12_, 16);
	_tmp13_ = content;
	_tmp14_ = dc_message_details_dialog_build_sender_button (self);
	_tmp15_ = _tmp14_;
	gtk_box_append (_tmp13_, _tmp15_);
	_g_object_unref0 (_tmp15_);
	_tmp16_ = dc_message_get_can_edit_text (msg);
	_tmp17_ = _tmp16_;
	if (_tmp17_) {
		GtkBox* _tmp18_;
		GtkSeparator* _tmp19_;
		GtkSeparator* _tmp20_;
		GtkBox* _tmp21_;
		GtkWidget* _tmp22_;
		GtkWidget* _tmp23_;
		_tmp18_ = content;
		_tmp19_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
		g_object_ref_sink (_tmp19_);
		_tmp20_ = _tmp19_;
		gtk_box_append (_tmp18_, (GtkWidget*) _tmp20_);
		_g_object_unref0 (_tmp20_);
		_tmp21_ = content;
		_tmp22_ = dc_message_details_dialog_build_edit_section (self);
		_tmp23_ = _tmp22_;
		gtk_box_append (_tmp21_, _tmp23_);
		_g_object_unref0 (_tmp23_);
	}
	_tmp24_ = content;
	_tmp25_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp25_);
	_tmp26_ = _tmp25_;
	gtk_box_append (_tmp24_, (GtkWidget*) _tmp26_);
	_g_object_unref0 (_tmp26_);
	_tmp27_ = content;
	_tmp28_ = dc_message_details_dialog_build_reactions_section (self);
	_tmp29_ = _tmp28_;
	gtk_box_append (_tmp27_, _tmp29_);
	_g_object_unref0 (_tmp29_);
	_tmp30_ = content;
	_tmp31_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp31_);
	_tmp32_ = _tmp31_;
	gtk_box_append (_tmp30_, (GtkWidget*) _tmp32_);
	_g_object_unref0 (_tmp32_);
	_tmp33_ = content;
	_tmp34_ = dc_message_details_dialog_build_message_info_section (self);
	_tmp35_ = _tmp34_;
	gtk_box_append (_tmp33_, _tmp35_);
	_g_object_unref0 (_tmp35_);
	_tmp36_ = dc_message_get_has_file (msg);
	_tmp37_ = _tmp36_;
	if (_tmp37_) {
		GtkBox* _tmp38_;
		GtkSeparator* _tmp39_;
		GtkSeparator* _tmp40_;
		GtkBox* _tmp41_;
		GtkWidget* _tmp42_;
		GtkWidget* _tmp43_;
		_tmp38_ = content;
		_tmp39_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
		g_object_ref_sink (_tmp39_);
		_tmp40_ = _tmp39_;
		gtk_box_append (_tmp38_, (GtkWidget*) _tmp40_);
		_g_object_unref0 (_tmp40_);
		_tmp41_ = content;
		_tmp42_ = dc_message_details_dialog_build_attachment_section (self);
		_tmp43_ = _tmp42_;
		gtk_box_append (_tmp41_, _tmp43_);
		_g_object_unref0 (_tmp43_);
	}
	_tmp45_ = dc_message_get_quote_text (msg);
	_tmp46_ = _tmp45_;
	if (dc_message_details_dialog_has_value (_tmp46_)) {
		_tmp44_ = TRUE;
	} else {
		gint _tmp47_;
		gint _tmp48_;
		_tmp47_ = dc_message_get_quote_msg_id (msg);
		_tmp48_ = _tmp47_;
		_tmp44_ = _tmp48_ > 0;
	}
	if (_tmp44_) {
		GtkBox* _tmp49_;
		GtkSeparator* _tmp50_;
		GtkSeparator* _tmp51_;
		GtkBox* _tmp52_;
		GtkWidget* _tmp53_;
		GtkWidget* _tmp54_;
		_tmp49_ = content;
		_tmp50_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
		g_object_ref_sink (_tmp50_);
		_tmp51_ = _tmp50_;
		gtk_box_append (_tmp49_, (GtkWidget*) _tmp51_);
		_g_object_unref0 (_tmp51_);
		_tmp52_ = content;
		_tmp53_ = dc_message_details_dialog_build_quote_section (self);
		_tmp54_ = _tmp53_;
		gtk_box_append (_tmp52_, _tmp54_);
		_g_object_unref0 (_tmp54_);
	}
	_tmp55_ = content;
	_tmp56_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp56_);
	_tmp57_ = _tmp56_;
	gtk_box_append (_tmp55_, (GtkWidget*) _tmp57_);
	_g_object_unref0 (_tmp57_);
	_tmp58_ = content;
	_tmp59_ = dc_message_details_dialog_build_actions_section (self);
	_tmp60_ = _tmp59_;
	gtk_box_append (_tmp58_, _tmp60_);
	_g_object_unref0 (_tmp60_);
	_tmp61_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp61_);
	scroll = _tmp61_;
	gtk_widget_set_vexpand ((GtkWidget*) scroll, TRUE);
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp62_ = content;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp62_);
	_tmp63_ = box;
	gtk_box_append (_tmp63_, (GtkWidget*) scroll);
	_tmp64_ = box;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp64_);
	dc_install_escape_close ((AdwDialog*) self);
	_g_object_unref0 (scroll);
	_g_object_unref0 (content);
	_g_object_unref0 (header);
	_g_object_unref0 (box);
	return self;
}

DcMessageDetailsDialog*
dc_message_details_dialog_new (DcWindow* window,
                               DcRpcClient* rpc,
                               DcMessageActions* actions,
                               DcMessage* msg,
                               DcMentionRoster* reaction_roster)
{
	return dc_message_details_dialog_construct (DC_TYPE_MESSAGE_DETAILS_DIALOG, window, rpc, actions, msg, reaction_roster);
}

static void
__lambda91_ (DcMessageDetailsDialog* self)
{
	DcMessageActions* _tmp0_;
	DcMessage* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	adw_dialog_close ((AdwDialog*) self);
	_tmp0_ = self->priv->actions;
	_tmp1_ = self->priv->msg;
	_tmp2_ = dc_message_get_id (_tmp1_);
	_tmp3_ = _tmp2_;
	dc_message_actions_open_sender_chat (_tmp0_, _tmp3_, NULL, NULL);
}

static void
___lambda91__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda91_ ((DcMessageDetailsDialog*) self);
}

static GtkWidget*
dc_message_details_dialog_build_sender_button (DcMessageDetailsDialog* self)
{
	gchar* name = NULL;
	gchar* address = NULL;
	gchar* avatar_path = NULL;
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	GtkButton* button = NULL;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	GtkButton* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkButton* _tmp9_;
	GtkBox* row = NULL;
	GtkBox* _tmp10_;
	GtkBox* _tmp11_;
	gboolean _tmp12_ = FALSE;
	DcMessage* _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	GtkBox* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	GtkWidget* _tmp22_;
	GtkWidget* _tmp23_;
	GtkBox* labels = NULL;
	GtkBox* _tmp24_;
	GtkBox* _tmp25_;
	GtkBox* _tmp26_;
	GtkLabel* name_lbl = NULL;
	const gchar* _tmp27_;
	GtkLabel* _tmp28_;
	GtkLabel* _tmp29_;
	GtkLabel* _tmp30_;
	GtkLabel* _tmp31_;
	GtkLabel* _tmp32_;
	GtkBox* _tmp33_;
	GtkLabel* _tmp34_;
	const gchar* _tmp35_ = NULL;
	gboolean _tmp36_ = FALSE;
	const gchar* _tmp37_;
	GtkLabel* sub = NULL;
	GtkLabel* _tmp46_;
	GtkBox* _tmp47_;
	GtkBox* _tmp48_;
	GtkBox* _tmp49_;
	GtkBox* _tmp50_;
	GtkImage* _tmp51_;
	GtkImage* _tmp52_;
	GtkButton* _tmp53_;
	GtkBox* _tmp54_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	dc_message_details_dialog_sender_identity (self, &_tmp0_, &_tmp1_, &_tmp2_);
	_g_free0 (name);
	name = _tmp0_;
	_g_free0 (address);
	address = _tmp1_;
	_g_free0 (avatar_path);
	avatar_path = _tmp2_;
	_tmp3_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp3_);
	button = _tmp3_;
	_tmp4_ = button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "flat");
	_tmp5_ = button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "message-details-sender");
	_tmp6_ = button;
	gtk_widget_set_halign ((GtkWidget*) _tmp6_, GTK_ALIGN_FILL);
	_tmp7_ = button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, "Open chat with sender");
	_tmp8_ = button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp8_, dc_message_details_dialog_sender_chat_available (self));
	_tmp9_ = button;
	g_signal_connect_object (_tmp9_, "clicked", (GCallback) ___lambda91__gtk_button_clicked, self, 0);
	_tmp10_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	g_object_ref_sink (_tmp10_);
	row = _tmp10_;
	_tmp11_ = row;
	gtk_widget_set_halign ((GtkWidget*) _tmp11_, GTK_ALIGN_FILL);
	_tmp13_ = self->priv->msg;
	_tmp14_ = dc_message_get_is_outgoing (_tmp13_);
	_tmp15_ = _tmp14_;
	if (!_tmp15_) {
		DcMessage* _tmp16_;
		gboolean _tmp17_;
		gboolean _tmp18_;
		_tmp16_ = self->priv->msg;
		_tmp17_ = dc_message_get_sender_was_seen_recently (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp12_ = _tmp18_;
	} else {
		_tmp12_ = FALSE;
	}
	_tmp19_ = row;
	_tmp20_ = name;
	_tmp21_ = avatar_path;
	_tmp22_ = dc_presence_avatar (56, _tmp20_, _tmp21_, _tmp12_, NULL, "list-presence-avatar-ring");
	_tmp23_ = _tmp22_;
	gtk_box_append (_tmp19_, _tmp23_);
	_g_object_unref0 (_tmp23_);
	_tmp24_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
	g_object_ref_sink (_tmp24_);
	labels = _tmp24_;
	_tmp25_ = labels;
	gtk_widget_set_valign ((GtkWidget*) _tmp25_, GTK_ALIGN_CENTER);
	_tmp26_ = labels;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp26_, TRUE);
	_tmp27_ = name;
	_tmp28_ = (GtkLabel*) gtk_label_new (_tmp27_);
	g_object_ref_sink (_tmp28_);
	name_lbl = _tmp28_;
	_tmp29_ = name_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp29_, "title-3");
	_tmp30_ = name_lbl;
	gtk_widget_set_halign ((GtkWidget*) _tmp30_, GTK_ALIGN_START);
	_tmp31_ = name_lbl;
	gtk_label_set_xalign (_tmp31_, (gfloat) 0);
	_tmp32_ = name_lbl;
	gtk_label_set_ellipsize (_tmp32_, PANGO_ELLIPSIZE_END);
	_tmp33_ = labels;
	_tmp34_ = name_lbl;
	gtk_box_append (_tmp33_, (GtkWidget*) _tmp34_);
	_tmp37_ = address;
	if (_tmp37_ != NULL) {
		const gchar* _tmp38_;
		gint _tmp39_;
		gint _tmp40_;
		_tmp38_ = address;
		_tmp39_ = strlen (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp36_ = _tmp40_ > 0;
	} else {
		_tmp36_ = FALSE;
	}
	if (_tmp36_) {
		const gchar* _tmp41_;
		_tmp41_ = address;
		_tmp35_ = _tmp41_;
	} else {
		const gchar* _tmp42_ = NULL;
		DcMessage* _tmp43_;
		gboolean _tmp44_;
		gboolean _tmp45_;
		_tmp43_ = self->priv->msg;
		_tmp44_ = dc_message_get_is_outgoing (_tmp43_);
		_tmp45_ = _tmp44_;
		if (_tmp45_) {
			_tmp42_ = "Outgoing message";
		} else {
			_tmp42_ = "Incoming message";
		}
		_tmp35_ = _tmp42_;
	}
	_tmp46_ = (GtkLabel*) gtk_label_new (_tmp35_);
	g_object_ref_sink (_tmp46_);
	sub = _tmp46_;
	gtk_widget_add_css_class ((GtkWidget*) sub, "dim-label");
	gtk_widget_set_halign ((GtkWidget*) sub, GTK_ALIGN_START);
	gtk_label_set_xalign (sub, (gfloat) 0);
	gtk_label_set_ellipsize (sub, PANGO_ELLIPSIZE_END);
	_tmp47_ = labels;
	gtk_box_append (_tmp47_, (GtkWidget*) sub);
	_tmp48_ = row;
	_tmp49_ = labels;
	gtk_box_append (_tmp48_, (GtkWidget*) _tmp49_);
	_tmp50_ = row;
	_tmp51_ = (GtkImage*) gtk_image_new_from_icon_name ("go-next-symbolic");
	g_object_ref_sink (_tmp51_);
	_tmp52_ = _tmp51_;
	gtk_box_append (_tmp50_, (GtkWidget*) _tmp52_);
	_g_object_unref0 (_tmp52_);
	_tmp53_ = button;
	_tmp54_ = row;
	gtk_button_set_child (_tmp53_, (GtkWidget*) _tmp54_);
	result = (GtkWidget*) button;
	_g_object_unref0 (sub);
	_g_object_unref0 (name_lbl);
	_g_object_unref0 (labels);
	_g_object_unref0 (row);
	_g_free0 (avatar_path);
	_g_free0 (address);
	_g_free0 (name);
	return result;
}

static void
_dc_message_details_dialog_update_edit_button_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                                       gpointer self)
{
	dc_message_details_dialog_update_edit_button ((DcMessageDetailsDialog*) self);
}

static void
__lambda96_ (DcMessageDetailsDialog* self)
{
	dc_message_details_dialog_save_edit (self, NULL, NULL);
}

static void
___lambda96__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda96_ ((DcMessageDetailsDialog*) self);
}

static GtkWidget*
dc_message_details_dialog_build_edit_section (DcMessageDetailsDialog* self)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp3_;
	const gchar* _tmp4_ = NULL;
	DcMessage* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	GtkTextView* _tmp9_;
	GtkTextView* _tmp10_;
	GtkTextView* _tmp11_;
	GtkTextView* _tmp12_;
	GtkTextView* _tmp13_;
	GtkTextView* _tmp14_;
	GtkTextView* _tmp15_;
	GtkTextView* _tmp16_;
	GtkTextBuffer* _tmp17_;
	GtkTextBuffer* _tmp18_;
	const gchar* _tmp19_;
	GtkTextView* _tmp20_;
	GtkTextView* _tmp21_;
	GtkTextBuffer* _tmp22_;
	GtkTextBuffer* _tmp23_;
	GtkScrolledWindow* editor_scroll = NULL;
	GtkScrolledWindow* _tmp24_;
	GtkTextView* _tmp25_;
	GtkBox* _tmp26_;
	GtkBox* actions_row = NULL;
	GtkBox* _tmp27_;
	GtkLabel* _tmp28_;
	GtkLabel* _tmp29_;
	GtkLabel* _tmp30_;
	GtkLabel* _tmp31_;
	GtkButton* _tmp32_;
	GtkButton* _tmp33_;
	GtkButton* _tmp34_;
	GtkButton* _tmp35_;
	GtkBox* _tmp36_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = box;
	_tmp2_ = dc_message_details_dialog_heading (self, "Edit Message");
	_tmp3_ = _tmp2_;
	gtk_box_append (_tmp1_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp5_ = self->priv->msg;
	_tmp6_ = dc_message_get_text (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp4_ = _tmp7_;
	if (_tmp4_ == NULL) {
		_tmp4_ = "";
	}
	_tmp8_ = g_strdup (_tmp4_);
	_g_free0 (self->priv->edit_original_text);
	self->priv->edit_original_text = _tmp8_;
	_tmp9_ = (GtkTextView*) gtk_text_view_new ();
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->edit_view);
	self->priv->edit_view = _tmp9_;
	_tmp10_ = self->priv->edit_view;
	gtk_text_view_set_wrap_mode (_tmp10_, GTK_WRAP_WORD_CHAR);
	_tmp11_ = self->priv->edit_view;
	gtk_text_view_set_accepts_tab (_tmp11_, FALSE);
	_tmp12_ = self->priv->edit_view;
	gtk_text_view_set_top_margin (_tmp12_, 8);
	_tmp13_ = self->priv->edit_view;
	gtk_text_view_set_bottom_margin (_tmp13_, 8);
	_tmp14_ = self->priv->edit_view;
	gtk_text_view_set_left_margin (_tmp14_, 10);
	_tmp15_ = self->priv->edit_view;
	gtk_text_view_set_right_margin (_tmp15_, 10);
	_tmp16_ = self->priv->edit_view;
	_tmp17_ = gtk_text_view_get_buffer (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = self->priv->edit_original_text;
	g_object_set (_tmp18_, "text", _tmp19_, NULL);
	_tmp20_ = self->priv->edit_view;
	gtk_widget_add_css_class ((GtkWidget*) _tmp20_, "message-details-edit-view");
	_tmp21_ = self->priv->edit_view;
	_tmp22_ = gtk_text_view_get_buffer (_tmp21_);
	_tmp23_ = _tmp22_;
	g_signal_connect_object (_tmp23_, "changed", (GCallback) _dc_message_details_dialog_update_edit_button_gtk_text_buffer_changed, self, 0);
	_tmp24_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp24_);
	editor_scroll = _tmp24_;
	g_object_set (editor_scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set (editor_scroll, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	g_object_set ((GtkWidget*) editor_scroll, "height-request", 140, NULL);
	_tmp25_ = self->priv->edit_view;
	gtk_scrolled_window_set_child (editor_scroll, (GtkWidget*) _tmp25_);
	_tmp26_ = box;
	gtk_box_append (_tmp26_, (GtkWidget*) editor_scroll);
	_tmp27_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp27_);
	actions_row = _tmp27_;
	_tmp28_ = dc_message_details_dialog_dim (self, "");
	_g_object_unref0 (self->priv->edit_status_lbl);
	self->priv->edit_status_lbl = _tmp28_;
	_tmp29_ = self->priv->edit_status_lbl;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp29_, TRUE);
	_tmp30_ = self->priv->edit_status_lbl;
	gtk_widget_set_valign ((GtkWidget*) _tmp30_, GTK_ALIGN_CENTER);
	_tmp31_ = self->priv->edit_status_lbl;
	gtk_box_append (actions_row, (GtkWidget*) _tmp31_);
	_tmp32_ = (GtkButton*) gtk_button_new_with_label ("Save");
	g_object_ref_sink (_tmp32_);
	_g_object_unref0 (self->priv->save_edit_btn);
	self->priv->save_edit_btn = _tmp32_;
	_tmp33_ = self->priv->save_edit_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp33_, "suggested-action");
	_tmp34_ = self->priv->save_edit_btn;
	g_signal_connect_object (_tmp34_, "clicked", (GCallback) ___lambda96__gtk_button_clicked, self, 0);
	_tmp35_ = self->priv->save_edit_btn;
	gtk_box_append (actions_row, (GtkWidget*) _tmp35_);
	_tmp36_ = box;
	gtk_box_append (_tmp36_, (GtkWidget*) actions_row);
	dc_message_details_dialog_update_edit_button (self);
	result = (GtkWidget*) box;
	_g_object_unref0 (actions_row);
	_g_object_unref0 (editor_scroll);
	return result;
}

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 GtkWidget*
dc_message_details_dialog_build_reactions_section (DcMessageDetailsDialog* self)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp3_;
	GtkListBox* list = NULL;
	GtkListBox* _tmp4_;
	GPtrArray* reactions = NULL;
	GPtrArray* _tmp5_;
	GPtrArray* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	GtkBox* _tmp42_;
	GtkListBox* _tmp43_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = box;
	_tmp2_ = dc_message_details_dialog_heading (self, "Reactions");
	_tmp3_ = _tmp2_;
	gtk_box_append (_tmp1_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = dc_message_details_dialog_boxed_list (self);
	list = _tmp4_;
	_tmp5_ = dc_message_details_dialog_sorted_reactions (self);
	reactions = _tmp5_;
	_tmp6_ = reactions;
	_tmp7_ = vala_g_ptr_array_get_length (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_ == 0) {
		GtkListBox* _tmp9_;
		AdwActionRow* _tmp10_;
		AdwActionRow* _tmp11_;
		_tmp9_ = list;
		_tmp10_ = dc_message_details_dialog_info_row (self, "No reactions", "Nobody has reacted to this message yet.", 2);
		_tmp11_ = _tmp10_;
		gtk_list_box_append (_tmp9_, (GtkWidget*) _tmp11_);
		_g_object_unref0 (_tmp11_);
	} else {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp12_ = FALSE;
				_tmp12_ = TRUE;
				while (TRUE) {
					GPtrArray* _tmp14_;
					gint _tmp15_;
					gint _tmp16_;
					DcMessageReaction* reaction = NULL;
					GPtrArray* _tmp17_;
					gconstpointer _tmp18_;
					DcMessageReaction* _tmp19_;
					DcMessageReaction* _tmp20_;
					GPtrArray* _tmp21_;
					gint _tmp22_;
					gint _tmp23_;
					gint* users = NULL;
					DcMessageReaction* _tmp28_;
					gint _tmp29_ = 0;
					gint* _tmp30_;
					gint users_length1;
					gint _users_size_;
					if (!_tmp12_) {
						gint _tmp13_;
						_tmp13_ = i;
						i = _tmp13_ + 1;
					}
					_tmp12_ = FALSE;
					_tmp14_ = reactions;
					_tmp15_ = vala_g_ptr_array_get_length (_tmp14_);
					_tmp16_ = _tmp15_;
					if (!(i < _tmp16_)) {
						break;
					}
					_tmp17_ = reactions;
					_tmp18_ = g_ptr_array_index (_tmp17_, (guint) i);
					_tmp19_ = _g_object_ref0 ((DcMessageReaction*) _tmp18_);
					reaction = _tmp19_;
					_tmp20_ = reaction;
					_tmp21_ = _tmp20_->users;
					_tmp22_ = vala_g_ptr_array_get_length (_tmp21_);
					_tmp23_ = _tmp22_;
					if (_tmp23_ == 0) {
						GtkListBox* _tmp24_;
						DcMessageReaction* _tmp25_;
						AdwActionRow* _tmp26_;
						AdwActionRow* _tmp27_;
						_tmp24_ = list;
						_tmp25_ = reaction;
						_tmp26_ = dc_message_details_dialog_reaction_count_row (self, _tmp25_);
						_tmp27_ = _tmp26_;
						gtk_list_box_append (_tmp24_, (GtkWidget*) _tmp27_);
						_g_object_unref0 (_tmp27_);
						_g_object_unref0 (reaction);
						continue;
					}
					_tmp28_ = reaction;
					_tmp30_ = dc_message_details_dialog_sorted_reaction_user_ids (self, _tmp28_, &_tmp29_);
					users = _tmp30_;
					users_length1 = _tmp29_;
					_users_size_ = users_length1;
					{
						gint u = 0;
						u = 0;
						{
							gboolean _tmp31_ = FALSE;
							_tmp31_ = TRUE;
							while (TRUE) {
								gint* _tmp33_;
								gint _tmp33__length1;
								GtkListBox* _tmp34_;
								DcMessageReaction* _tmp35_;
								const gchar* _tmp36_;
								const gchar* _tmp37_;
								gint* _tmp38_;
								gint _tmp38__length1;
								gint _tmp39_;
								AdwActionRow* _tmp40_;
								AdwActionRow* _tmp41_;
								if (!_tmp31_) {
									gint _tmp32_;
									_tmp32_ = u;
									u = _tmp32_ + 1;
								}
								_tmp31_ = FALSE;
								_tmp33_ = users;
								_tmp33__length1 = users_length1;
								if (!(u < _tmp33__length1)) {
									break;
								}
								_tmp34_ = list;
								_tmp35_ = reaction;
								_tmp36_ = dc_message_reaction_get_emoji (_tmp35_);
								_tmp37_ = _tmp36_;
								_tmp38_ = users;
								_tmp38__length1 = users_length1;
								_tmp39_ = _tmp38_[u];
								_tmp40_ = dc_message_details_dialog_reaction_user_row (self, _tmp37_, _tmp39_);
								_tmp41_ = _tmp40_;
								gtk_list_box_append (_tmp34_, (GtkWidget*) _tmp41_);
								_g_object_unref0 (_tmp41_);
							}
						}
					}
					users = (g_free (users), NULL);
					_g_object_unref0 (reaction);
				}
			}
		}
	}
	_tmp42_ = box;
	_tmp43_ = list;
	gtk_box_append (_tmp42_, (GtkWidget*) _tmp43_);
	result = (GtkWidget*) box;
	_g_ptr_array_unref0 (reactions);
	_g_object_unref0 (list);
	return result;
}

static GtkWidget*
dc_message_details_dialog_build_message_info_section (DcMessageDetailsDialog* self)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp3_;
	GtkListBox* list = NULL;
	GtkListBox* _tmp4_;
	GtkListBox* _tmp5_;
	DcMessage* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	AdwActionRow* _tmp11_;
	AdwActionRow* _tmp12_;
	GtkListBox* _tmp13_;
	DcMessage* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	AdwActionRow* _tmp19_;
	AdwActionRow* _tmp20_;
	GtkListBox* _tmp21_;
	DcMessage* _tmp22_;
	gint64 _tmp23_;
	gint64 _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	AdwActionRow* _tmp27_;
	AdwActionRow* _tmp28_;
	const gchar* _tmp29_ = NULL;
	DcMessage* _tmp30_;
	gboolean _tmp31_;
	gboolean _tmp32_;
	GtkListBox* _tmp33_;
	AdwActionRow* _tmp34_;
	AdwActionRow* _tmp35_;
	GtkListBox* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	AdwActionRow* _tmp39_;
	AdwActionRow* _tmp40_;
	GtkListBox* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	AdwActionRow* _tmp44_;
	AdwActionRow* _tmp45_;
	GtkListBox* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	AdwActionRow* _tmp49_;
	AdwActionRow* _tmp50_;
	gchar* _tmp51_ = NULL;
	DcMessage* _tmp52_;
	gint _tmp53_;
	gint _tmp54_;
	GtkListBox* _tmp60_;
	AdwActionRow* _tmp61_;
	AdwActionRow* _tmp62_;
	const gchar* _tmp63_ = NULL;
	DcMessage* _tmp64_;
	gboolean _tmp65_;
	gboolean _tmp66_;
	gchar* sender_addr = NULL;
	gchar* _tmp73_;
	const gchar* _tmp74_;
	DcMessage* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	DcMessage* _tmp88_;
	const gchar* _tmp89_;
	const gchar* _tmp90_;
	GtkBox* _tmp97_;
	GtkListBox* _tmp98_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = box;
	_tmp2_ = dc_message_details_dialog_heading (self, "Message");
	_tmp3_ = _tmp2_;
	gtk_box_append (_tmp1_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = dc_message_details_dialog_boxed_list (self);
	list = _tmp4_;
	_tmp5_ = list;
	_tmp6_ = self->priv->msg;
	_tmp7_ = dc_message_get_id (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strdup_printf ("%i", _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = dc_message_details_dialog_info_row (self, "Message ID", _tmp10_, 2);
	_tmp12_ = _tmp11_;
	gtk_list_box_append (_tmp5_, (GtkWidget*) _tmp12_);
	_g_object_unref0 (_tmp12_);
	_g_free0 (_tmp10_);
	_tmp13_ = list;
	_tmp14_ = self->priv->msg;
	_tmp15_ = dc_message_get_chat_id (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strdup_printf ("%i", _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = dc_message_details_dialog_info_row (self, "Chat ID", _tmp18_, 2);
	_tmp20_ = _tmp19_;
	gtk_list_box_append (_tmp13_, (GtkWidget*) _tmp20_);
	_g_object_unref0 (_tmp20_);
	_g_free0 (_tmp18_);
	_tmp21_ = list;
	_tmp22_ = self->priv->msg;
	_tmp23_ = dc_message_get_timestamp (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = dc_message_details_dialog_format_full_timestamp (self, _tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = dc_message_details_dialog_info_row (self, "Sent", _tmp26_, 2);
	_tmp28_ = _tmp27_;
	gtk_list_box_append (_tmp21_, (GtkWidget*) _tmp28_);
	_g_object_unref0 (_tmp28_);
	_g_free0 (_tmp26_);
	_tmp30_ = self->priv->msg;
	_tmp31_ = dc_message_get_is_outgoing (_tmp30_);
	_tmp32_ = _tmp31_;
	if (_tmp32_) {
		_tmp29_ = "Outgoing";
	} else {
		_tmp29_ = "Incoming";
	}
	_tmp33_ = list;
	_tmp34_ = dc_message_details_dialog_info_row (self, "Direction", _tmp29_, 2);
	_tmp35_ = _tmp34_;
	gtk_list_box_append (_tmp33_, (GtkWidget*) _tmp35_);
	_g_object_unref0 (_tmp35_);
	_tmp36_ = list;
	_tmp37_ = dc_message_details_dialog_delivery_state (self);
	_tmp38_ = _tmp37_;
	_tmp39_ = dc_message_details_dialog_info_row (self, "Delivery", _tmp38_, 2);
	_tmp40_ = _tmp39_;
	gtk_list_box_append (_tmp36_, (GtkWidget*) _tmp40_);
	_g_object_unref0 (_tmp40_);
	_g_free0 (_tmp38_);
	_tmp41_ = list;
	_tmp42_ = dc_message_details_dialog_message_type (self);
	_tmp43_ = _tmp42_;
	_tmp44_ = dc_message_details_dialog_info_row (self, "Type", _tmp43_, 2);
	_tmp45_ = _tmp44_;
	gtk_list_box_append (_tmp41_, (GtkWidget*) _tmp45_);
	_g_object_unref0 (_tmp45_);
	_g_free0 (_tmp43_);
	_tmp46_ = list;
	_tmp47_ = dc_message_details_dialog_flags_text (self);
	_tmp48_ = _tmp47_;
	_tmp49_ = dc_message_details_dialog_info_row (self, "Flags", _tmp48_, 2);
	_tmp50_ = _tmp49_;
	gtk_list_box_append (_tmp46_, (GtkWidget*) _tmp50_);
	_g_object_unref0 (_tmp50_);
	_g_free0 (_tmp48_);
	_tmp52_ = self->priv->msg;
	_tmp53_ = dc_message_get_sender_contact_id (_tmp52_);
	_tmp54_ = _tmp53_;
	if (_tmp54_ > 0) {
		DcMessage* _tmp55_;
		gint _tmp56_;
		gint _tmp57_;
		gchar* _tmp58_;
		_tmp55_ = self->priv->msg;
		_tmp56_ = dc_message_get_sender_contact_id (_tmp55_);
		_tmp57_ = _tmp56_;
		_tmp58_ = g_strdup_printf ("%i", _tmp57_);
		_g_free0 (_tmp51_);
		_tmp51_ = _tmp58_;
	} else {
		gchar* _tmp59_;
		_tmp59_ = g_strdup ("Unknown");
		_g_free0 (_tmp51_);
		_tmp51_ = _tmp59_;
	}
	_tmp60_ = list;
	_tmp61_ = dc_message_details_dialog_info_row (self, "Sender contact ID", _tmp51_, 2);
	_tmp62_ = _tmp61_;
	gtk_list_box_append (_tmp60_, (GtkWidget*) _tmp62_);
	_g_object_unref0 (_tmp62_);
	_tmp64_ = self->priv->msg;
	_tmp65_ = dc_message_get_is_outgoing (_tmp64_);
	_tmp66_ = _tmp65_;
	if (_tmp66_) {
		DcRpcClient* _tmp67_;
		const gchar* _tmp68_;
		const gchar* _tmp69_;
		_tmp67_ = self->priv->rpc;
		_tmp68_ = dc_rpc_client_get_self_email (_tmp67_);
		_tmp69_ = _tmp68_;
		_tmp63_ = _tmp69_;
	} else {
		DcMessage* _tmp70_;
		const gchar* _tmp71_;
		const gchar* _tmp72_;
		_tmp70_ = self->priv->msg;
		_tmp71_ = dc_message_get_sender_address (_tmp70_);
		_tmp72_ = _tmp71_;
		_tmp63_ = _tmp72_;
	}
	_tmp73_ = g_strdup (_tmp63_);
	sender_addr = _tmp73_;
	_tmp74_ = sender_addr;
	if (dc_message_details_dialog_has_value (_tmp74_)) {
		GtkListBox* _tmp75_;
		const gchar* _tmp76_;
		AdwActionRow* _tmp77_;
		AdwActionRow* _tmp78_;
		_tmp75_ = list;
		_tmp76_ = sender_addr;
		_tmp77_ = dc_message_details_dialog_info_row (self, "Sender address", _tmp76_, 2);
		_tmp78_ = _tmp77_;
		gtk_list_box_append (_tmp75_, (GtkWidget*) _tmp78_);
		_g_object_unref0 (_tmp78_);
	}
	_tmp79_ = self->priv->msg;
	_tmp80_ = dc_message_get_override_sender_name (_tmp79_);
	_tmp81_ = _tmp80_;
	if (dc_message_details_dialog_has_value (_tmp81_)) {
		GtkListBox* _tmp82_;
		DcMessage* _tmp83_;
		const gchar* _tmp84_;
		const gchar* _tmp85_;
		AdwActionRow* _tmp86_;
		AdwActionRow* _tmp87_;
		_tmp82_ = list;
		_tmp83_ = self->priv->msg;
		_tmp84_ = dc_message_get_override_sender_name (_tmp83_);
		_tmp85_ = _tmp84_;
		_tmp86_ = dc_message_details_dialog_info_row (self, "Override sender", _tmp85_, 2);
		_tmp87_ = _tmp86_;
		gtk_list_box_append (_tmp82_, (GtkWidget*) _tmp87_);
		_g_object_unref0 (_tmp87_);
	}
	_tmp88_ = self->priv->msg;
	_tmp89_ = dc_message_get_download_state (_tmp88_);
	_tmp90_ = _tmp89_;
	if (dc_message_details_dialog_has_value (_tmp90_)) {
		GtkListBox* _tmp91_;
		DcMessage* _tmp92_;
		const gchar* _tmp93_;
		const gchar* _tmp94_;
		AdwActionRow* _tmp95_;
		AdwActionRow* _tmp96_;
		_tmp91_ = list;
		_tmp92_ = self->priv->msg;
		_tmp93_ = dc_message_get_download_state (_tmp92_);
		_tmp94_ = _tmp93_;
		_tmp95_ = dc_message_details_dialog_info_row (self, "Download state", _tmp94_, 2);
		_tmp96_ = _tmp95_;
		gtk_list_box_append (_tmp91_, (GtkWidget*) _tmp96_);
		_g_object_unref0 (_tmp96_);
	}
	_tmp97_ = box;
	_tmp98_ = list;
	gtk_box_append (_tmp97_, (GtkWidget*) _tmp98_);
	result = (GtkWidget*) box;
	_g_free0 (sender_addr);
	_g_free0 (_tmp51_);
	_g_object_unref0 (list);
	return result;
}

static GtkWidget*
dc_message_details_dialog_build_attachment_section (DcMessageDetailsDialog* self)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp3_;
	GtkListBox* list = NULL;
	GtkListBox* _tmp4_;
	DcMessage* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	DcMessage* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	DcMessage* _tmp23_;
	gint _tmp24_;
	gint _tmp25_;
	DcMessage* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	GtkBox* _tmp50_;
	GtkListBox* _tmp51_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = box;
	_tmp2_ = dc_message_details_dialog_heading (self, "Attachment");
	_tmp3_ = _tmp2_;
	gtk_box_append (_tmp1_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = dc_message_details_dialog_boxed_list (self);
	list = _tmp4_;
	_tmp5_ = self->priv->msg;
	_tmp6_ = dc_message_get_file_name (_tmp5_);
	_tmp7_ = _tmp6_;
	if (dc_message_details_dialog_has_value (_tmp7_)) {
		GtkListBox* _tmp8_;
		DcMessage* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		AdwActionRow* _tmp12_;
		AdwActionRow* _tmp13_;
		_tmp8_ = list;
		_tmp9_ = self->priv->msg;
		_tmp10_ = dc_message_get_file_name (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = dc_message_details_dialog_info_row (self, "File name", _tmp11_, 2);
		_tmp13_ = _tmp12_;
		gtk_list_box_append (_tmp8_, (GtkWidget*) _tmp13_);
		_g_object_unref0 (_tmp13_);
	}
	_tmp14_ = self->priv->msg;
	_tmp15_ = dc_message_get_file_mime (_tmp14_);
	_tmp16_ = _tmp15_;
	if (dc_message_details_dialog_has_value (_tmp16_)) {
		GtkListBox* _tmp17_;
		DcMessage* _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		AdwActionRow* _tmp21_;
		AdwActionRow* _tmp22_;
		_tmp17_ = list;
		_tmp18_ = self->priv->msg;
		_tmp19_ = dc_message_get_file_mime (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = dc_message_details_dialog_info_row (self, "MIME type", _tmp20_, 2);
		_tmp22_ = _tmp21_;
		gtk_list_box_append (_tmp17_, (GtkWidget*) _tmp22_);
		_g_object_unref0 (_tmp22_);
	}
	_tmp23_ = self->priv->msg;
	_tmp24_ = dc_message_get_file_bytes (_tmp23_);
	_tmp25_ = _tmp24_;
	if (_tmp25_ > 0) {
		GtkListBox* _tmp26_;
		DcMessage* _tmp27_;
		gint _tmp28_;
		gint _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		AdwActionRow* _tmp32_;
		AdwActionRow* _tmp33_;
		_tmp26_ = list;
		_tmp27_ = self->priv->msg;
		_tmp28_ = dc_message_get_file_bytes (_tmp27_);
		_tmp29_ = _tmp28_;
		_tmp30_ = dc_message_details_dialog_format_bytes ((gint64) _tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = dc_message_details_dialog_info_row (self, "Size", _tmp31_, 2);
		_tmp33_ = _tmp32_;
		gtk_list_box_append (_tmp26_, (GtkWidget*) _tmp33_);
		_g_object_unref0 (_tmp33_);
		_g_free0 (_tmp31_);
	}
	_tmp34_ = self->priv->msg;
	_tmp35_ = dc_message_get_file_path (_tmp34_);
	_tmp36_ = _tmp35_;
	if (dc_message_details_dialog_has_value (_tmp36_)) {
		GtkListBox* _tmp37_;
		DcMessage* _tmp38_;
		const gchar* _tmp39_;
		const gchar* _tmp40_;
		AdwActionRow* _tmp41_;
		AdwActionRow* _tmp42_;
		const gchar* _tmp43_ = NULL;
		DcMessage* _tmp44_;
		gboolean _tmp45_;
		gboolean _tmp46_;
		GtkListBox* _tmp47_;
		AdwActionRow* _tmp48_;
		AdwActionRow* _tmp49_;
		_tmp37_ = list;
		_tmp38_ = self->priv->msg;
		_tmp39_ = dc_message_get_file_path (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp41_ = dc_message_details_dialog_info_row (self, "Local path", _tmp40_, 3);
		_tmp42_ = _tmp41_;
		gtk_list_box_append (_tmp37_, (GtkWidget*) _tmp42_);
		_g_object_unref0 (_tmp42_);
		_tmp44_ = self->priv->msg;
		_tmp45_ = dc_message_get_has_local_file (_tmp44_);
		_tmp46_ = _tmp45_;
		if (_tmp46_) {
			_tmp43_ = "Available";
		} else {
			_tmp43_ = "Not downloaded";
		}
		_tmp47_ = list;
		_tmp48_ = dc_message_details_dialog_info_row (self, "Local copy", _tmp43_, 2);
		_tmp49_ = _tmp48_;
		gtk_list_box_append (_tmp47_, (GtkWidget*) _tmp49_);
		_g_object_unref0 (_tmp49_);
	}
	_tmp50_ = box;
	_tmp51_ = list;
	gtk_box_append (_tmp50_, (GtkWidget*) _tmp51_);
	result = (GtkWidget*) box;
	_g_object_unref0 (list);
	return result;
}

static GtkWidget*
dc_message_details_dialog_build_quote_section (DcMessageDetailsDialog* self)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp3_;
	GtkListBox* list = NULL;
	GtkListBox* _tmp4_;
	DcMessage* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	DcMessage* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	DcMessage* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	GtkBox* _tmp34_;
	GtkListBox* _tmp35_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = box;
	_tmp2_ = dc_message_details_dialog_heading (self, "Reply Context");
	_tmp3_ = _tmp2_;
	gtk_box_append (_tmp1_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = dc_message_details_dialog_boxed_list (self);
	list = _tmp4_;
	_tmp5_ = self->priv->msg;
	_tmp6_ = dc_message_get_quote_msg_id (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_ > 0) {
		GtkListBox* _tmp8_;
		DcMessage* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		AdwActionRow* _tmp14_;
		AdwActionRow* _tmp15_;
		_tmp8_ = list;
		_tmp9_ = self->priv->msg;
		_tmp10_ = dc_message_get_quote_msg_id (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strdup_printf ("%i", _tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = dc_message_details_dialog_info_row (self, "Quoted message ID", _tmp13_, 2);
		_tmp15_ = _tmp14_;
		gtk_list_box_append (_tmp8_, (GtkWidget*) _tmp15_);
		_g_object_unref0 (_tmp15_);
		_g_free0 (_tmp13_);
	}
	_tmp16_ = self->priv->msg;
	_tmp17_ = dc_message_get_quote_sender_name (_tmp16_);
	_tmp18_ = _tmp17_;
	if (dc_message_details_dialog_has_value (_tmp18_)) {
		GtkListBox* _tmp19_;
		DcMessage* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		AdwActionRow* _tmp23_;
		AdwActionRow* _tmp24_;
		_tmp19_ = list;
		_tmp20_ = self->priv->msg;
		_tmp21_ = dc_message_get_quote_sender_name (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = dc_message_details_dialog_info_row (self, "Quoted sender", _tmp22_, 2);
		_tmp24_ = _tmp23_;
		gtk_list_box_append (_tmp19_, (GtkWidget*) _tmp24_);
		_g_object_unref0 (_tmp24_);
	}
	_tmp25_ = self->priv->msg;
	_tmp26_ = dc_message_get_quote_text (_tmp25_);
	_tmp27_ = _tmp26_;
	if (dc_message_details_dialog_has_value (_tmp27_)) {
		GtkListBox* _tmp28_;
		DcMessage* _tmp29_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		AdwActionRow* _tmp32_;
		AdwActionRow* _tmp33_;
		_tmp28_ = list;
		_tmp29_ = self->priv->msg;
		_tmp30_ = dc_message_get_quote_text (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = dc_message_details_dialog_info_row (self, "Quoted text", _tmp31_, 4);
		_tmp33_ = _tmp32_;
		gtk_list_box_append (_tmp28_, (GtkWidget*) _tmp33_);
		_g_object_unref0 (_tmp33_);
	}
	_tmp34_ = box;
	_tmp35_ = list;
	gtk_box_append (_tmp34_, (GtkWidget*) _tmp35_);
	result = (GtkWidget*) box;
	_g_object_unref0 (list);
	return result;
}

static void
__lambda99_ (DcMessageDetailsDialog* self)
{
	dc_message_details_dialog_confirm_delete_message (self, NULL, NULL);
}

static void
___lambda99__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda99_ ((DcMessageDetailsDialog*) self);
}

static void
__lambda100_ (DcMessageDetailsDialog* self)
{
	DcMessageActions* _tmp0_;
	DcMessage* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	adw_dialog_close ((AdwDialog*) self);
	_tmp0_ = self->priv->actions;
	_tmp1_ = self->priv->msg;
	_tmp2_ = dc_message_get_id (_tmp1_);
	_tmp3_ = _tmp2_;
	dc_message_actions_start_forwarding (_tmp0_, _tmp3_);
}

static void
___lambda100__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda100_ ((DcMessageDetailsDialog*) self);
}

static void
__lambda101_ (DcMessageDetailsDialog* self)
{
	DcMessageActions* _tmp0_;
	DcMessage* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	adw_dialog_close ((AdwDialog*) self);
	_tmp0_ = self->priv->actions;
	_tmp1_ = self->priv->msg;
	_tmp2_ = dc_message_get_id (_tmp1_);
	_tmp3_ = _tmp2_;
	dc_message_actions_start_replying (_tmp0_, _tmp3_);
}

static void
___lambda101__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda101_ ((DcMessageDetailsDialog*) self);
}

static GtkWidget*
dc_message_details_dialog_build_actions_section (DcMessageDetailsDialog* self)
{
	GtkBox* row = NULL;
	GtkBox* _tmp0_;
	GtkButton* delete_btn = NULL;
	GtkButton* _tmp1_;
	GtkButton* forward_btn = NULL;
	GtkButton* _tmp2_;
	GtkButton* reply_btn = NULL;
	GtkButton* _tmp3_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	gtk_widget_set_halign ((GtkWidget*) row, GTK_ALIGN_END);
	_tmp1_ = (GtkButton*) gtk_button_new_with_label ("Delete…");
	g_object_ref_sink (_tmp1_);
	delete_btn = _tmp1_;
	gtk_widget_add_css_class ((GtkWidget*) delete_btn, "destructive-action");
	g_signal_connect_object (delete_btn, "clicked", (GCallback) ___lambda99__gtk_button_clicked, self, 0);
	gtk_box_append (row, (GtkWidget*) delete_btn);
	_tmp2_ = (GtkButton*) gtk_button_new_with_label ("Forward…");
	g_object_ref_sink (_tmp2_);
	forward_btn = _tmp2_;
	g_signal_connect_object (forward_btn, "clicked", (GCallback) ___lambda100__gtk_button_clicked, self, 0);
	gtk_box_append (row, (GtkWidget*) forward_btn);
	_tmp3_ = (GtkButton*) gtk_button_new_with_label ("Reply");
	g_object_ref_sink (_tmp3_);
	reply_btn = _tmp3_;
	gtk_widget_add_css_class ((GtkWidget*) reply_btn, "suggested-action");
	g_signal_connect_object (reply_btn, "clicked", (GCallback) ___lambda101__gtk_button_clicked, self, 0);
	gtk_box_append (row, (GtkWidget*) reply_btn);
	result = (GtkWidget*) row;
	_g_object_unref0 (reply_btn);
	_g_object_unref0 (forward_btn);
	_g_object_unref0 (delete_btn);
	return result;
}

static GtkListBox*
dc_message_details_dialog_boxed_list (DcMessageDetailsDialog* self)
{
	GtkListBox* list = NULL;
	GtkListBox* _tmp0_;
	GtkListBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp0_);
	list = _tmp0_;
	gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) list, "boxed-list");
	result = list;
	return result;
}

static GtkLabel*
dc_message_details_dialog_heading (DcMessageDetailsDialog* self,
                                   const gchar* text)
{
	GtkLabel* label = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (text);
	g_object_ref_sink (_tmp0_);
	label = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) label, "heading");
	gtk_widget_set_halign ((GtkWidget*) label, GTK_ALIGN_START);
	gtk_label_set_xalign (label, (gfloat) 0);
	result = label;
	return result;
}

static GtkLabel*
dc_message_details_dialog_dim (DcMessageDetailsDialog* self,
                               const gchar* text)
{
	GtkLabel* label = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (text);
	g_object_ref_sink (_tmp0_);
	label = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) label, "dim-label");
	gtk_widget_set_halign ((GtkWidget*) label, GTK_ALIGN_START);
	gtk_label_set_xalign (label, (gfloat) 0);
	gtk_label_set_wrap (label, TRUE);
	result = label;
	return result;
}

static AdwActionRow*
dc_message_details_dialog_info_row (DcMessageDetailsDialog* self,
                                    const gchar* title,
                                    const gchar* subtitle,
                                    gint subtitle_lines)
{
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp0_;
	AdwActionRow* _tmp1_;
	AdwActionRow* _tmp2_;
	const gchar* _tmp3_ = NULL;
	AdwActionRow* _tmp4_;
	AdwActionRow* _tmp5_;
	AdwActionRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (subtitle != NULL, NULL);
	_tmp0_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	_tmp1_ = row;
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp1_, FALSE);
	_tmp2_ = row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp2_, title);
	if (dc_message_details_dialog_has_value (subtitle)) {
		_tmp3_ = subtitle;
	} else {
		_tmp3_ = "None";
	}
	_tmp4_ = row;
	adw_action_row_set_subtitle (_tmp4_, _tmp3_);
	_tmp5_ = row;
	adw_action_row_set_subtitle_lines (_tmp5_, subtitle_lines);
	result = row;
	return result;
}

static AdwActionRow*
dc_message_details_dialog_reaction_count_row (DcMessageDetailsDialog* self,
                                              DcMessageReaction* reaction)
{
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp0_;
	AdwActionRow* _tmp1_;
	gchar* _tmp2_ = NULL;
	gint _tmp3_;
	gint _tmp4_;
	AdwActionRow* _tmp9_;
	GtkLabel* emoji = NULL;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	GtkLabel* _tmp12_;
	AdwActionRow* _tmp13_;
	AdwActionRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (reaction != NULL, NULL);
	_tmp0_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	_tmp1_ = row;
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp1_, FALSE);
	_tmp3_ = dc_message_reaction_get_count (reaction);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == 1) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup ("Unknown user");
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp5_;
	} else {
		gint _tmp6_;
		gint _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = dc_message_reaction_get_count (reaction);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_strdup_printf ("%d reactions", _tmp7_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp8_;
	}
	_tmp9_ = row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp9_, _tmp2_);
	_tmp10_ = dc_message_reaction_get_emoji (reaction);
	_tmp11_ = _tmp10_;
	_tmp12_ = (GtkLabel*) gtk_label_new (_tmp11_);
	g_object_ref_sink (_tmp12_);
	emoji = _tmp12_;
	gtk_widget_add_css_class ((GtkWidget*) emoji, "message-details-reaction-emoji");
	_tmp13_ = row;
	adw_action_row_add_prefix (_tmp13_, (GtkWidget*) emoji);
	result = row;
	_g_object_unref0 (emoji);
	_g_free0 (_tmp2_);
	return result;
}

static Block92Data*
block92_data_ref (Block92Data* _data92_)
{
	g_atomic_int_inc (&_data92_->_ref_count_);
	return _data92_;
}

static void
block92_data_unref (void * _userdata_)
{
	Block92Data* _data92_;
	_data92_ = (Block92Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data92_->_ref_count_)) {
		DcMessageDetailsDialog* self;
		self = _data92_->self;
		_g_object_unref0 (self);
		g_slice_free (Block92Data, _data92_);
	}
}

static void
___lambda98_ (Block92Data* _data92_)
{
	DcMessageDetailsDialog* self;
	self = _data92_->self;
	adw_dialog_close ((AdwDialog*) self);
	dc_message_details_dialog_open_reaction_user_chat (self, _data92_->contact_id, NULL, NULL);
}

static void
____lambda98__adw_action_row_activated (AdwActionRow* _sender,
                                        gpointer self)
{
	___lambda98_ (self);
}

static AdwActionRow*
dc_message_details_dialog_reaction_user_row (DcMessageDetailsDialog* self,
                                             const gchar* emoji,
                                             gint contact_id)
{
	Block92Data* _data92_;
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp0_;
	AdwActionRow* _tmp1_;
	AdwActionRow* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	AdwActionRow* _tmp5_;
	GtkLabel* emoji_lbl = NULL;
	GtkLabel* _tmp6_;
	GtkLabel* _tmp7_;
	AdwActionRow* _tmp8_;
	GtkLabel* _tmp9_;
	AdwActionRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (emoji != NULL, NULL);
	_data92_ = g_slice_new0 (Block92Data);
	_data92_->_ref_count_ = 1;
	_data92_->self = g_object_ref (self);
	_data92_->contact_id = contact_id;
	_tmp0_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	_tmp1_ = row;
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp1_, FALSE);
	_tmp2_ = row;
	_tmp3_ = dc_message_details_dialog_reaction_user_name (self, _data92_->contact_id);
	_tmp4_ = _tmp3_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp2_, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = row;
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp5_, _data92_->contact_id > 0);
	_tmp6_ = (GtkLabel*) gtk_label_new (emoji);
	g_object_ref_sink (_tmp6_);
	emoji_lbl = _tmp6_;
	_tmp7_ = emoji_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp7_, "message-details-reaction-emoji");
	_tmp8_ = row;
	_tmp9_ = emoji_lbl;
	adw_action_row_add_prefix (_tmp8_, (GtkWidget*) _tmp9_);
	if (_data92_->contact_id > 0) {
		AdwActionRow* _tmp10_;
		GtkImage* _tmp11_;
		GtkImage* _tmp12_;
		AdwActionRow* _tmp13_;
		_tmp10_ = row;
		_tmp11_ = (GtkImage*) gtk_image_new_from_icon_name ("go-next-symbolic");
		g_object_ref_sink (_tmp11_);
		_tmp12_ = _tmp11_;
		adw_action_row_add_suffix (_tmp10_, (GtkWidget*) _tmp12_);
		_g_object_unref0 (_tmp12_);
		_tmp13_ = row;
		g_signal_connect_data (_tmp13_, "activated", (GCallback) ____lambda98__adw_action_row_activated, block92_data_ref (_data92_), (GClosureNotify) block92_data_unref, 0);
	}
	result = row;
	_g_object_unref0 (emoji_lbl);
	block92_data_unref (_data92_);
	_data92_ = NULL;
	return result;
}

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

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		GPtrArray* self;
		self = _data21_->self;
		_g_ptr_array_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

static gint
__lambda0_ (Block21Data* _data21_,
            gconstpointer** a,
            gconstpointer** b)
{
	GPtrArray* self;
	gint result;
	self = _data21_->self;
	result = _data21_->compare_func ((gconstpointer**) (*a), (gconstpointer**) (*b));
	return result;
}

static gint
___lambda0__gcompare_data_func (gconstpointer a,
                                gconstpointer b,
                                gpointer self)
{
	gint result;
	result = __lambda0_ (self, a, b);
	return result;
}

static void
vala_g_ptr_array_sort (GPtrArray* self,
                       GCompareFunc compare_func)
{
	Block21Data* _data21_;
	g_return_if_fail (self != NULL);
	_data21_ = g_slice_new0 (Block21Data);
	_data21_->_ref_count_ = 1;
	_data21_->self = g_ptr_array_ref (self);
	_data21_->compare_func = compare_func;
	g_ptr_array_sort_with_data (self, ___lambda0__gcompare_data_func, _data21_);
	block21_data_unref (_data21_);
	_data21_ = NULL;
}

static gint
__lambda97_ (DcMessageReaction* a,
             DcMessageReaction* b)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = dc_message_reaction_get_emoji (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_message_reaction_get_emoji (b);
	_tmp3_ = _tmp2_;
	result = g_utf8_collate (_tmp1_, _tmp3_);
	return result;
}

static gint
___lambda97__gcompare_func (gconstpointer a,
                            gconstpointer b)
{
	gint result;
	result = __lambda97_ ((DcMessageReaction*) a, (DcMessageReaction*) b);
	return result;
}

static GPtrArray*
dc_message_details_dialog_sorted_reactions (DcMessageDetailsDialog* self)
{
	GPtrArray* sorted = NULL;
	GPtrArray* _tmp0_;
	gboolean _tmp1_ = FALSE;
	DcMessage* _tmp2_;
	GPtrArray* _tmp3_;
	GPtrArray* _tmp41_;
	GPtrArray* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	sorted = _tmp0_;
	_tmp2_ = self->priv->msg;
	_tmp3_ = _tmp2_->reaction_details;
	if (_tmp3_ != NULL) {
		DcMessage* _tmp4_;
		GPtrArray* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp4_ = self->priv->msg;
		_tmp5_ = _tmp4_->reaction_details;
		_tmp6_ = vala_g_ptr_array_get_length (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp1_ = _tmp7_ > 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp8_ = FALSE;
				_tmp8_ = TRUE;
				while (TRUE) {
					DcMessage* _tmp10_;
					GPtrArray* _tmp11_;
					gint _tmp12_;
					gint _tmp13_;
					GPtrArray* _tmp14_;
					DcMessage* _tmp15_;
					GPtrArray* _tmp16_;
					gconstpointer _tmp17_;
					DcMessageReaction* _tmp18_;
					if (!_tmp8_) {
						gint _tmp9_;
						_tmp9_ = i;
						i = _tmp9_ + 1;
					}
					_tmp8_ = FALSE;
					_tmp10_ = self->priv->msg;
					_tmp11_ = _tmp10_->reaction_details;
					_tmp12_ = vala_g_ptr_array_get_length (_tmp11_);
					_tmp13_ = _tmp12_;
					if (!(i < _tmp13_)) {
						break;
					}
					_tmp14_ = sorted;
					_tmp15_ = self->priv->msg;
					_tmp16_ = _tmp15_->reaction_details;
					_tmp17_ = g_ptr_array_index (_tmp16_, (guint) i);
					_tmp18_ = _g_object_ref0 ((DcMessageReaction*) _tmp17_);
					g_ptr_array_add (_tmp14_, _tmp18_);
				}
			}
		}
	} else {
		DcMessage* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		_tmp19_ = self->priv->msg;
		_tmp20_ = dc_message_get_reactions (_tmp19_);
		_tmp21_ = _tmp20_;
		if (dc_message_details_dialog_has_value (_tmp21_)) {
			DcMessage* _tmp22_;
			const gchar* _tmp23_;
			const gchar* _tmp24_;
			gchar** _tmp25_;
			gchar** _tmp26_;
			_tmp22_ = self->priv->msg;
			_tmp23_ = dc_message_get_reactions (_tmp22_);
			_tmp24_ = _tmp23_;
			_tmp26_ = _tmp25_ = g_strsplit (_tmp24_, ",", 0);
			{
				gchar** part_collection = NULL;
				gint part_collection_length1 = 0;
				gint _part_collection_size_ = 0;
				gint part_it = 0;
				part_collection = _tmp26_;
				part_collection_length1 = _vala_array_length (_tmp25_);
				for (part_it = 0; part_it < part_collection_length1; part_it = part_it + 1) {
					gchar* _tmp27_;
					gchar* part = NULL;
					_tmp27_ = g_strdup (part_collection[part_it]);
					part = _tmp27_;
					{
						gchar** kv = NULL;
						const gchar* _tmp28_;
						gchar** _tmp29_;
						gchar** _tmp30_;
						gint kv_length1;
						gint _kv_size_;
						gchar** _tmp31_;
						gint _tmp31__length1;
						DcMessageReaction* reaction = NULL;
						gchar** _tmp32_;
						gint _tmp32__length1;
						const gchar* _tmp33_;
						DcMessageReaction* _tmp34_;
						DcMessageReaction* _tmp35_;
						gchar** _tmp36_;
						gint _tmp36__length1;
						const gchar* _tmp37_;
						GPtrArray* _tmp38_;
						DcMessageReaction* _tmp39_;
						DcMessageReaction* _tmp40_;
						_tmp28_ = part;
						_tmp30_ = _tmp29_ = g_strsplit (_tmp28_, ":", 2);
						kv = _tmp30_;
						kv_length1 = _vala_array_length (_tmp29_);
						_kv_size_ = kv_length1;
						_tmp31_ = kv;
						_tmp31__length1 = kv_length1;
						if (_tmp31__length1 < 2) {
							kv = (_vala_array_free (kv, kv_length1, (GDestroyNotify) g_free), NULL);
							_g_free0 (part);
							continue;
						}
						_tmp32_ = kv;
						_tmp32__length1 = kv_length1;
						_tmp33_ = _tmp32_[0];
						_tmp34_ = dc_message_reaction_new (_tmp33_);
						reaction = _tmp34_;
						_tmp35_ = reaction;
						_tmp36_ = kv;
						_tmp36__length1 = kv_length1;
						_tmp37_ = _tmp36_[1];
						dc_message_reaction_set_count (_tmp35_, atoi (_tmp37_));
						_tmp38_ = sorted;
						_tmp39_ = reaction;
						_tmp40_ = _g_object_ref0 (_tmp39_);
						g_ptr_array_add (_tmp38_, _tmp40_);
						_g_object_unref0 (reaction);
						kv = (_vala_array_free (kv, kv_length1, (GDestroyNotify) g_free), NULL);
						_g_free0 (part);
					}
				}
				part_collection = (_vala_array_free (part_collection, part_collection_length1, (GDestroyNotify) g_free), NULL);
			}
		}
	}
	_tmp41_ = sorted;
	vala_g_ptr_array_sort (_tmp41_, ___lambda97__gcompare_func);
	result = sorted;
	return result;
}

static void
_vala_array_add54 (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_message_details_dialog_sorted_reaction_user_ids (DcMessageDetailsDialog* self,
                                                    DcMessageReaction* reaction,
                                                    gint* result_length1)
{
	gint* users = NULL;
	gint* _tmp0_;
	gint users_length1;
	gint _users_size_;
	gint* _tmp27_;
	gint _tmp27__length1;
	gint* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (reaction != NULL, NULL);
	_tmp0_ = g_new0 (gint, 0);
	users = _tmp0_;
	users_length1 = 0;
	_users_size_ = users_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GPtrArray* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				GPtrArray* _tmp6_;
				gconstpointer _tmp7_;
				gint _tmp8_;
				gint _tmp9_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = reaction->users;
				_tmp4_ = vala_g_ptr_array_get_length (_tmp3_);
				_tmp5_ = _tmp4_;
				if (!(i < _tmp5_)) {
					break;
				}
				_tmp6_ = reaction->users;
				_tmp7_ = g_ptr_array_index (_tmp6_, (guint) i);
				_tmp8_ = dc_message_reaction_user_get_contact_id ((DcMessageReactionUser*) _tmp7_);
				_tmp9_ = _tmp8_;
				_vala_array_add54 (&users, &users_length1, &_users_size_, _tmp9_);
			}
		}
	}
	{
		gint i = 0;
		i = 1;
		{
			gboolean _tmp10_ = FALSE;
			_tmp10_ = TRUE;
			while (TRUE) {
				gint* _tmp12_;
				gint _tmp12__length1;
				gint key = 0;
				gint* _tmp13_;
				gint _tmp13__length1;
				gint _tmp14_;
				gchar* key_name = NULL;
				gchar* _tmp15_;
				gint j = 0;
				gint* _tmp26_;
				gint _tmp26__length1;
				if (!_tmp10_) {
					gint _tmp11_;
					_tmp11_ = i;
					i = _tmp11_ + 1;
				}
				_tmp10_ = FALSE;
				_tmp12_ = users;
				_tmp12__length1 = users_length1;
				if (!(i < _tmp12__length1)) {
					break;
				}
				_tmp13_ = users;
				_tmp13__length1 = users_length1;
				_tmp14_ = _tmp13_[i];
				key = _tmp14_;
				_tmp15_ = dc_message_details_dialog_reaction_user_name (self, key);
				key_name = _tmp15_;
				j = i - 1;
				while (TRUE) {
					gboolean _tmp16_ = FALSE;
					gint* _tmp22_;
					gint _tmp22__length1;
					gint* _tmp23_;
					gint _tmp23__length1;
					gint _tmp24_;
					gint _tmp25_;
					if (j >= 0) {
						const gchar* _tmp17_;
						gint* _tmp18_;
						gint _tmp18__length1;
						gint _tmp19_;
						gchar* _tmp20_;
						gchar* _tmp21_;
						_tmp17_ = key_name;
						_tmp18_ = users;
						_tmp18__length1 = users_length1;
						_tmp19_ = _tmp18_[j];
						_tmp20_ = dc_message_details_dialog_reaction_user_name (self, _tmp19_);
						_tmp21_ = _tmp20_;
						_tmp16_ = g_utf8_collate (_tmp17_, _tmp21_) < 0;
						_g_free0 (_tmp21_);
					} else {
						_tmp16_ = FALSE;
					}
					if (!_tmp16_) {
						break;
					}
					_tmp22_ = users;
					_tmp22__length1 = users_length1;
					_tmp23_ = users;
					_tmp23__length1 = users_length1;
					_tmp24_ = _tmp23_[j];
					_tmp22_[j + 1] = _tmp24_;
					_tmp25_ = j;
					j = _tmp25_ - 1;
				}
				_tmp26_ = users;
				_tmp26__length1 = users_length1;
				_tmp26_[j + 1] = key;
				_g_free0 (key_name);
			}
		}
	}
	_tmp27_ = users;
	_tmp27__length1 = users_length1;
	if (result_length1) {
		*result_length1 = _tmp27__length1;
	}
	result = _tmp27_;
	return result;
}

static gchar*
dc_message_details_dialog_reaction_user_name (DcMessageDetailsDialog* self,
                                              gint contact_id)
{
	DcMentionMember* _tmp8_ = NULL;
	DcMentionRoster* _tmp9_;
	DcMentionMember* member = NULL;
	DcMentionMember* _tmp12_;
	DcMentionMember* _tmp13_;
	gboolean _tmp32_ = FALSE;
	gboolean _tmp33_ = FALSE;
	DcMessage* _tmp34_;
	gboolean _tmp35_;
	gboolean _tmp36_;
	gchar* _tmp43_ = NULL;
	gchar* _tmp46_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (contact_id == 1) {
		const gchar* _tmp0_ = NULL;
		gboolean _tmp1_ = FALSE;
		const gchar* _tmp2_;
		gchar* _tmp7_;
		_tmp2_ = dc_message_row_self_display_name;
		if (_tmp2_ != NULL) {
			const gchar* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			_tmp3_ = dc_message_row_self_display_name;
			_tmp4_ = strlen (_tmp3_);
			_tmp5_ = _tmp4_;
			_tmp1_ = _tmp5_ > 0;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			const gchar* _tmp6_;
			_tmp6_ = dc_message_row_self_display_name;
			_tmp0_ = _tmp6_;
		} else {
			_tmp0_ = "You";
		}
		_tmp7_ = g_strdup (_tmp0_);
		result = _tmp7_;
		return result;
	}
	_tmp9_ = self->priv->reaction_roster;
	if (_tmp9_ != NULL) {
		DcMentionRoster* _tmp10_;
		DcMentionMember* _tmp11_;
		_tmp10_ = self->priv->reaction_roster;
		_tmp11_ = dc_mention_roster_lookup_contact (_tmp10_, contact_id);
		_g_object_unref0 (_tmp8_);
		_tmp8_ = _tmp11_;
	} else {
		_g_object_unref0 (_tmp8_);
		_tmp8_ = NULL;
	}
	_tmp12_ = _tmp8_;
	_tmp8_ = NULL;
	member = _tmp12_;
	_tmp13_ = member;
	if (_tmp13_ != NULL) {
		DcMentionMember* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		DcMentionMember* _tmp23_;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		_tmp14_ = member;
		_tmp15_ = dc_mention_member_get_display_name (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = strlen (_tmp16_);
		_tmp18_ = _tmp17_;
		if (_tmp18_ > 0) {
			DcMentionMember* _tmp19_;
			const gchar* _tmp20_;
			const gchar* _tmp21_;
			gchar* _tmp22_;
			_tmp19_ = member;
			_tmp20_ = dc_mention_member_get_display_name (_tmp19_);
			_tmp21_ = _tmp20_;
			_tmp22_ = g_strdup (_tmp21_);
			result = _tmp22_;
			_g_object_unref0 (member);
			_g_object_unref0 (_tmp8_);
			return result;
		}
		_tmp23_ = member;
		_tmp24_ = dc_mention_member_get_address (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = strlen (_tmp25_);
		_tmp27_ = _tmp26_;
		if (_tmp27_ > 0) {
			DcMentionMember* _tmp28_;
			const gchar* _tmp29_;
			const gchar* _tmp30_;
			gchar* _tmp31_;
			_tmp28_ = member;
			_tmp29_ = dc_mention_member_get_address (_tmp28_);
			_tmp30_ = _tmp29_;
			_tmp31_ = g_strdup (_tmp30_);
			result = _tmp31_;
			_g_object_unref0 (member);
			_g_object_unref0 (_tmp8_);
			return result;
		}
	}
	_tmp34_ = self->priv->msg;
	_tmp35_ = dc_message_get_is_outgoing (_tmp34_);
	_tmp36_ = _tmp35_;
	if (!_tmp36_) {
		_tmp33_ = contact_id > 0;
	} else {
		_tmp33_ = FALSE;
	}
	if (_tmp33_) {
		DcMessage* _tmp37_;
		gint _tmp38_;
		gint _tmp39_;
		_tmp37_ = self->priv->msg;
		_tmp38_ = dc_message_get_sender_contact_id (_tmp37_);
		_tmp39_ = _tmp38_;
		_tmp32_ = contact_id == _tmp39_;
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		gchar* name = NULL;
		gchar* address = NULL;
		gchar* avatar_path = NULL;
		gchar* _tmp40_ = NULL;
		gchar* _tmp41_ = NULL;
		gchar* _tmp42_ = NULL;
		dc_message_details_dialog_sender_identity (self, &_tmp40_, &_tmp41_, &_tmp42_);
		_g_free0 (name);
		name = _tmp40_;
		_g_free0 (address);
		address = _tmp41_;
		_g_free0 (avatar_path);
		avatar_path = _tmp42_;
		result = name;
		_g_free0 (avatar_path);
		_g_free0 (address);
		_g_object_unref0 (member);
		_g_object_unref0 (_tmp8_);
		return result;
	}
	if (contact_id > 0) {
		gchar* _tmp44_;
		_tmp44_ = g_strdup_printf ("Contact %d", contact_id);
		_g_free0 (_tmp43_);
		_tmp43_ = _tmp44_;
	} else {
		gchar* _tmp45_;
		_tmp45_ = g_strdup ("Unknown user");
		_g_free0 (_tmp43_);
		_tmp43_ = _tmp45_;
	}
	_tmp46_ = _tmp43_;
	_tmp43_ = NULL;
	result = _tmp46_;
	_g_free0 (_tmp43_);
	_g_object_unref0 (member);
	_g_object_unref0 (_tmp8_);
	return result;
}

static void
dc_message_details_dialog_sender_identity (DcMessageDetailsDialog* self,
                                           gchar** name,
                                           gchar** address,
                                           gchar** avatar_path)
{
	gchar* _vala_name = NULL;
	gchar* _vala_address = NULL;
	gchar* _vala_avatar_path = NULL;
	DcMessage* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcMessage* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	DcMessage* _tmp39_;
	const gchar* _tmp40_;
	const gchar* _tmp41_;
	gchar* _tmp42_;
	DcMessage* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->msg;
	_tmp1_ = dc_message_get_is_outgoing (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		const gchar* _tmp3_ = NULL;
		gboolean _tmp4_ = FALSE;
		const gchar* _tmp5_;
		gchar* _tmp10_;
		DcRpcClient* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp5_ = dc_message_row_self_display_name;
		if (_tmp5_ != NULL) {
			const gchar* _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			_tmp6_ = dc_message_row_self_display_name;
			_tmp7_ = strlen (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp4_ = _tmp8_ > 0;
		} else {
			_tmp4_ = FALSE;
		}
		if (_tmp4_) {
			const gchar* _tmp9_;
			_tmp9_ = dc_message_row_self_display_name;
			_tmp3_ = _tmp9_;
		} else {
			_tmp3_ = "You";
		}
		_tmp10_ = g_strdup (_tmp3_);
		_g_free0 (_vala_name);
		_vala_name = _tmp10_;
		_tmp11_ = self->priv->rpc;
		_tmp12_ = dc_rpc_client_get_self_email (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_strdup (_tmp13_);
		_g_free0 (_vala_address);
		_vala_address = _tmp14_;
		_tmp15_ = dc_message_row_self_avatar_path;
		_tmp16_ = g_strdup (_tmp15_);
		_g_free0 (_vala_avatar_path);
		_vala_avatar_path = _tmp16_;
		if (name) {
			*name = _vala_name;
		} else {
			_g_free0 (_vala_name);
		}
		if (address) {
			*address = _vala_address;
		} else {
			_g_free0 (_vala_address);
		}
		if (avatar_path) {
			*avatar_path = _vala_avatar_path;
		} else {
			_g_free0 (_vala_avatar_path);
		}
		return;
	}
	_tmp17_ = self->priv->msg;
	_tmp18_ = dc_message_get_override_sender_name (_tmp17_);
	_tmp19_ = _tmp18_;
	if (dc_message_details_dialog_has_value (_tmp19_)) {
		DcMessage* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		gchar* _tmp23_;
		_tmp20_ = self->priv->msg;
		_tmp21_ = dc_message_get_override_sender_name (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = g_strconcat ("~", _tmp22_, NULL);
		_g_free0 (_vala_name);
		_vala_name = _tmp23_;
	} else {
		DcMessage* _tmp24_;
		const gchar* _tmp25_;
		const gchar* _tmp26_;
		_tmp24_ = self->priv->msg;
		_tmp25_ = dc_message_get_sender_name (_tmp24_);
		_tmp26_ = _tmp25_;
		if (dc_message_details_dialog_has_value (_tmp26_)) {
			DcMessage* _tmp27_;
			const gchar* _tmp28_;
			const gchar* _tmp29_;
			gchar* _tmp30_;
			_tmp27_ = self->priv->msg;
			_tmp28_ = dc_message_get_sender_name (_tmp27_);
			_tmp29_ = _tmp28_;
			_tmp30_ = g_strdup (_tmp29_);
			_g_free0 (_vala_name);
			_vala_name = _tmp30_;
		} else {
			DcMessage* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			_tmp31_ = self->priv->msg;
			_tmp32_ = dc_message_get_sender_address (_tmp31_);
			_tmp33_ = _tmp32_;
			if (dc_message_details_dialog_has_value (_tmp33_)) {
				DcMessage* _tmp34_;
				const gchar* _tmp35_;
				const gchar* _tmp36_;
				gchar* _tmp37_;
				_tmp34_ = self->priv->msg;
				_tmp35_ = dc_message_get_sender_address (_tmp34_);
				_tmp36_ = _tmp35_;
				_tmp37_ = g_strdup (_tmp36_);
				_g_free0 (_vala_name);
				_vala_name = _tmp37_;
			} else {
				gchar* _tmp38_;
				_tmp38_ = g_strdup ("Unknown sender");
				_g_free0 (_vala_name);
				_vala_name = _tmp38_;
			}
		}
	}
	_tmp39_ = self->priv->msg;
	_tmp40_ = dc_message_get_sender_address (_tmp39_);
	_tmp41_ = _tmp40_;
	_tmp42_ = g_strdup (_tmp41_);
	_g_free0 (_vala_address);
	_vala_address = _tmp42_;
	_tmp43_ = self->priv->msg;
	_tmp44_ = dc_message_get_sender_avatar_path (_tmp43_);
	_tmp45_ = _tmp44_;
	_tmp46_ = g_strdup (_tmp45_);
	_g_free0 (_vala_avatar_path);
	_vala_avatar_path = _tmp46_;
	if (name) {
		*name = _vala_name;
	} else {
		_g_free0 (_vala_name);
	}
	if (address) {
		*address = _vala_address;
	} else {
		_g_free0 (_vala_address);
	}
	if (avatar_path) {
		*avatar_path = _vala_avatar_path;
	} else {
		_g_free0 (_vala_avatar_path);
	}
}

static gboolean
dc_message_details_dialog_sender_chat_available (DcMessageDetailsDialog* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	DcMessage* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp2_ = self->priv->msg;
	_tmp3_ = dc_message_get_sender_contact_id (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ > 0) {
		_tmp1_ = TRUE;
	} else {
		DcMessage* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp5_ = self->priv->msg;
		_tmp6_ = dc_message_get_sender_address (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp1_ = dc_message_details_dialog_has_value (_tmp7_);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp8_ = FALSE;
		DcMessage* _tmp9_;
		gboolean _tmp10_;
		gboolean _tmp11_;
		_tmp9_ = self->priv->msg;
		_tmp10_ = dc_message_get_is_outgoing (_tmp9_);
		_tmp11_ = _tmp10_;
		if (_tmp11_) {
			DcRpcClient* _tmp12_;
			const gchar* _tmp13_;
			const gchar* _tmp14_;
			_tmp12_ = self->priv->rpc;
			_tmp13_ = dc_rpc_client_get_self_email (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp8_ = dc_message_details_dialog_has_value (_tmp14_);
		} else {
			_tmp8_ = FALSE;
		}
		_tmp0_ = _tmp8_;
	}
	result = _tmp0_;
	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 void
dc_message_details_dialog_update_edit_button (DcMessageDetailsDialog* self)
{
	gboolean _tmp0_ = FALSE;
	GtkTextView* _tmp1_;
	gchar* text = NULL;
	GtkTextView* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GtkTextBuffer* _tmp5_;
	gchar* _tmp6_;
	gboolean _tmp7_ = FALSE;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	GtkButton* _tmp15_;
	gboolean _tmp16_ = FALSE;
	GtkLabel* _tmp17_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->edit_view;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		GtkButton* _tmp2_;
		_tmp2_ = self->priv->save_edit_btn;
		_tmp0_ = _tmp2_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->priv->edit_view;
	_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = dc_message_details_dialog_text_buffer_text (_tmp5_);
	text = _tmp6_;
	_tmp8_ = text;
	_tmp9_ = self->priv->edit_original_text;
	if (g_strcmp0 (_tmp8_, _tmp9_) != 0) {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		_tmp10_ = text;
		_tmp11_ = string_strip (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = strlen (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp7_ = _tmp14_ > 0;
		_g_free0 (_tmp12_);
	} else {
		_tmp7_ = FALSE;
	}
	_tmp15_ = self->priv->save_edit_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, _tmp7_);
	_tmp17_ = self->priv->edit_status_lbl;
	if (_tmp17_ != NULL) {
		GtkButton* _tmp18_;
		gboolean _tmp19_;
		gboolean _tmp20_;
		_tmp18_ = self->priv->save_edit_btn;
		_tmp19_ = gtk_widget_get_sensitive ((GtkWidget*) _tmp18_);
		_tmp20_ = _tmp19_;
		_tmp16_ = _tmp20_;
	} else {
		_tmp16_ = FALSE;
	}
	if (_tmp16_) {
		GtkLabel* _tmp21_;
		_tmp21_ = self->priv->edit_status_lbl;
		gtk_label_set_label (_tmp21_, "");
	}
	_g_free0 (text);
}

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

static void
dc_message_details_dialog_save_edit (DcMessageDetailsDialog* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcMessageDetailsDialogSaveEditData* _data_;
	DcMessageDetailsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcMessageDetailsDialogSaveEditData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_details_dialog_save_edit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_message_details_dialog_save_edit_co (_data_);
}

static void
dc_message_details_dialog_save_edit_finish (DcMessageDetailsDialog* self,
                                            GAsyncResult* _res_)
{
	DcMessageDetailsDialogSaveEditData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_details_dialog_save_edit_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcMessageDetailsDialogSaveEditData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_details_dialog_save_edit_co (_data_);
}

static gboolean
dc_message_details_dialog_save_edit_co (DcMessageDetailsDialogSaveEditData* _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_->self->priv->edit_view;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->save_edit_btn;
		_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_->_tmp3_ = _data_->self->priv->edit_view;
	_data_->_tmp4_ = gtk_text_view_get_buffer (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = dc_message_details_dialog_text_buffer_text (_data_->_tmp5_);
	_data_->text = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->text;
	_data_->_tmp9_ = string_strip (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = strlen (_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = _data_->_tmp12_ == 0;
	_g_free0 (_data_->_tmp10_);
	if (_data_->_tmp13_) {
		_data_->_tmp7_ = TRUE;
	} else {
		_data_->_tmp14_ = _data_->text;
		_data_->_tmp15_ = _data_->self->priv->edit_original_text;
		_data_->_tmp7_ = g_strcmp0 (_data_->_tmp14_, _data_->_tmp15_) == 0;
	}
	if (_data_->_tmp7_) {
		_g_free0 (_data_->text);
		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->save_edit_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp16_, FALSE);
	_data_->_tmp17_ = _data_->self->priv->edit_status_lbl;
	if (_data_->_tmp17_ != NULL) {
		_data_->_tmp18_ = _data_->self->priv->edit_status_lbl;
		gtk_label_set_label (_data_->_tmp18_, "Saving…");
	}
	{
		_data_->_tmp19_ = _data_->self->priv->rpc;
		_data_->_tmp20_ = _data_->self->priv->msg;
		_data_->_tmp21_ = dc_message_get_id (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = _data_->text;
		_data_->_state_ = 1;
		dc_rpc_client_send_edit_request (_data_->_tmp19_, _data_->_tmp22_, _data_->_tmp23_, dc_message_details_dialog_save_edit_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_send_edit_request_finish (_data_->_tmp19_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp24_ = _data_->self->priv->msg;
		_data_->_tmp25_ = _data_->text;
		dc_message_set_text (_data_->_tmp24_, _data_->_tmp25_);
		_data_->_tmp26_ = _data_->self->priv->msg;
		dc_message_set_is_edited (_data_->_tmp26_, TRUE);
		_data_->_tmp27_ = _data_->self->priv->actions;
		_data_->_tmp28_ = _data_->self->priv->msg;
		_data_->_tmp29_ = dc_message_get_id (_data_->_tmp28_);
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_state_ = 2;
		dc_message_actions_update_row (_data_->_tmp27_, _data_->_tmp30_, dc_message_details_dialog_save_edit_ready, _data_);
		return FALSE;
		_state_2:
		dc_message_actions_update_row_finish (_data_->_tmp27_, _data_->_res_);
		_data_->_tmp31_ = _data_->text;
		_data_->_tmp32_ = g_strdup (_data_->_tmp31_);
		_g_free0 (_data_->self->priv->edit_original_text);
		_data_->self->priv->edit_original_text = _data_->_tmp32_;
		_data_->_tmp33_ = _data_->self->priv->edit_status_lbl;
		if (_data_->_tmp33_ != NULL) {
			_data_->_tmp34_ = _data_->self->priv->edit_status_lbl;
			gtk_label_set_label (_data_->_tmp34_, "Saved");
		}
		dc_message_details_dialog_update_edit_button (_data_->self);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp35_ = _data_->self->priv->edit_status_lbl;
		if (_data_->_tmp35_ != NULL) {
			_data_->_tmp36_ = _data_->self->priv->edit_status_lbl;
			_data_->_tmp37_ = _data_->e;
			_data_->_tmp38_ = _data_->_tmp37_->message;
			_data_->_tmp39_ = g_strconcat ("Edit failed: ", _data_->_tmp38_, NULL);
			_data_->_tmp40_ = _data_->_tmp39_;
			gtk_label_set_label (_data_->_tmp36_, _data_->_tmp40_);
			_g_free0 (_data_->_tmp40_);
		}
		_data_->_tmp41_ = _data_->self->priv->window;
		_data_->_tmp42_ = _data_->e;
		_data_->_tmp43_ = _data_->_tmp42_->message;
		_data_->_tmp44_ = g_strconcat ("Edit failed: ", _data_->_tmp43_, NULL);
		_data_->_tmp45_ = _data_->_tmp44_;
		dc_window_show_toast (_data_->_tmp41_, _data_->_tmp45_);
		_g_free0 (_data_->_tmp45_);
		dc_message_details_dialog_update_edit_button (_data_->self);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->text);
		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_free0 (_data_->text);
	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_message_details_dialog_open_reaction_user_chat_data_free (gpointer _data)
{
	DcMessageDetailsDialogOpenReactionUserChatData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcMessageDetailsDialogOpenReactionUserChatData, _data_);
}

static void
dc_message_details_dialog_open_reaction_user_chat (DcMessageDetailsDialog* self,
                                                   gint contact_id,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	DcMessageDetailsDialogOpenReactionUserChatData* _data_;
	DcMessageDetailsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcMessageDetailsDialogOpenReactionUserChatData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_details_dialog_open_reaction_user_chat_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->contact_id = contact_id;
	dc_message_details_dialog_open_reaction_user_chat_co (_data_);
}

static void
dc_message_details_dialog_open_reaction_user_chat_finish (DcMessageDetailsDialog* self,
                                                          GAsyncResult* _res_)
{
	DcMessageDetailsDialogOpenReactionUserChatData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_details_dialog_open_reaction_user_chat_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	DcMessageDetailsDialogOpenReactionUserChatData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_details_dialog_open_reaction_user_chat_co (_data_);
}

static gboolean
dc_message_details_dialog_open_reaction_user_chat_co (DcMessageDetailsDialogOpenReactionUserChatData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->contact_id <= 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_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_or_create_chat_by_contact (_data_->_tmp0_, _data_->contact_id, dc_message_details_dialog_open_reaction_user_chat_ready, _data_);
		return FALSE;
		_state_1:
		_data_->chat_id = dc_rpc_client_get_or_create_chat_by_contact_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->chat_id > 0) {
			_data_->_tmp1_ = _data_->self->priv->window;
			dc_window_request_reload_chats (_data_->_tmp1_);
			_data_->_tmp2_ = _data_->self->priv->window;
			dc_window_select_chat_by_id (_data_->_tmp2_, _data_->chat_id);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp3_ = _data_->self->priv->window;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		_data_->_tmp6_ = g_strconcat ("Could not open chat: ", _data_->_tmp5_, NULL);
		_data_->_tmp7_ = _data_->_tmp6_;
		dc_window_show_toast (_data_->_tmp3_, _data_->_tmp7_);
		_g_free0 (_data_->_tmp7_);
		_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 gchar*
dc_message_details_dialog_text_buffer_text (GtkTextBuffer* buffer)
{
	GtkTextIter start = {0};
	GtkTextIter end = {0};
	GtkTextIter _tmp0_ = {0};
	GtkTextIter _tmp1_ = {0};
	GtkTextIter _tmp2_;
	GtkTextIter _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (buffer != NULL, NULL);
	gtk_text_buffer_get_start_iter (buffer, &_tmp0_);
	start = _tmp0_;
	gtk_text_buffer_get_end_iter (buffer, &_tmp1_);
	end = _tmp1_;
	_tmp2_ = start;
	_tmp3_ = end;
	_tmp4_ = gtk_text_buffer_get_text (buffer, &_tmp2_, &_tmp3_, FALSE);
	result = _tmp4_;
	return result;
}

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

static void
dc_message_details_dialog_confirm_delete_message (DcMessageDetailsDialog* self,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	DcMessageDetailsDialogConfirmDeleteMessageData* _data_;
	DcMessageDetailsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcMessageDetailsDialogConfirmDeleteMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_details_dialog_confirm_delete_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_message_details_dialog_confirm_delete_message_co (_data_);
}

static void
dc_message_details_dialog_confirm_delete_message_finish (DcMessageDetailsDialog* self,
                                                         GAsyncResult* _res_)
{
	DcMessageDetailsDialogConfirmDeleteMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_details_dialog_confirm_delete_message_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	DcMessageDetailsDialogConfirmDeleteMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_details_dialog_confirm_delete_message_co (_data_);
}

static gboolean
dc_message_details_dialog_confirm_delete_message_co (DcMessageDetailsDialogConfirmDeleteMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->msg;
	_data_->_tmp2_ = dc_message_get_is_outgoing (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (_data_->_tmp3_) {
		_data_->_tmp0_ = "Delete this message from your device only, or from all participants? T" \
"his cannot be undone.";
	} else {
		_data_->_tmp0_ = "Delete this message from your device? This cannot be undone.";
	}
	_data_->_tmp4_ = g_strdup (_data_->_tmp0_);
	_data_->body = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->body;
	_data_->_tmp6_ = _data_->self->priv->msg;
	_data_->_tmp7_ = dc_message_get_is_outgoing (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_state_ = 1;
	dc_confirm_delete_options ((GtkWidget*) _data_->self, "Delete Message?", _data_->_tmp5_, _data_->_tmp8_, dc_message_details_dialog_confirm_delete_message_ready, _data_);
	return FALSE;
	_state_1:
	_data_->choice = dc_confirm_delete_options_finish (_data_->_res_);
	if (_data_->choice == DC_DELETE_CHOICE_CANCEL) {
		_g_free0 (_data_->body);
		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_->_tmp9_ = _data_->self->priv->actions;
	_data_->_tmp10_ = _data_->self->priv->msg;
	_data_->_tmp11_ = dc_message_get_id (_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	dc_message_actions_delete_message (_data_->_tmp9_, _data_->_tmp12_, _data_->choice == DC_DELETE_CHOICE_FOR_EVERYONE, NULL, NULL);
	adw_dialog_close ((AdwDialog*) _data_->self);
	_g_free0 (_data_->body);
	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 gchar*
dc_message_details_dialog_format_full_timestamp (DcMessageDetailsDialog* self,
                                                 gint64 ts)
{
	GDateTime* dt = NULL;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (ts <= ((gint64) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("Unknown");
		result = _tmp0_;
		return result;
	}
	_tmp1_ = g_date_time_new_from_unix_local (ts);
	dt = _tmp1_;
	_tmp2_ = dt;
	_tmp3_ = g_date_time_format (_tmp2_, "%Y-%m-%d %H:%M:%S");
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup_printf ("%" G_GINT64_FORMAT, ts);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strdup_printf ("%s (%s)", _tmp4_, _tmp6_);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	result = _tmp8_;
	_g_date_time_unref0 (dt);
	return result;
}

static gchar*
dc_message_details_dialog_delivery_state (DcMessageDetailsDialog* self)
{
	DcMessage* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcMessage* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	DcMessage* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	DcMessage* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	DcMessage* _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	DcMessage* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	gchar* _tmp24_ = NULL;
	DcMessage* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	gchar* _tmp33_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->msg;
	_tmp1_ = dc_message_get_is_outgoing (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("Received");
		result = _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->msg;
	_tmp5_ = dc_message_get_is_failed (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		gchar* _tmp7_;
		_tmp7_ = g_strdup ("Failed");
		result = _tmp7_;
		return result;
	}
	_tmp8_ = self->priv->msg;
	_tmp9_ = dc_message_get_is_read (_tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_) {
		gchar* _tmp11_;
		_tmp11_ = g_strdup ("Read");
		result = _tmp11_;
		return result;
	}
	_tmp12_ = self->priv->msg;
	_tmp13_ = dc_message_get_is_delivered (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_) {
		gchar* _tmp15_;
		_tmp15_ = g_strdup ("Delivered");
		result = _tmp15_;
		return result;
	}
	_tmp16_ = self->priv->msg;
	_tmp17_ = dc_message_get_is_pending (_tmp16_);
	_tmp18_ = _tmp17_;
	if (_tmp18_) {
		gchar* _tmp19_;
		_tmp19_ = g_strdup ("Pending");
		result = _tmp19_;
		return result;
	}
	_tmp20_ = self->priv->msg;
	_tmp21_ = dc_message_get_state (_tmp20_);
	_tmp22_ = _tmp21_;
	if (_tmp22_ == ((gint) DC_MESSAGE_STATE_OUT_DRAFT)) {
		gchar* _tmp23_;
		_tmp23_ = g_strdup ("Draft");
		result = _tmp23_;
		return result;
	}
	_tmp25_ = self->priv->msg;
	_tmp26_ = dc_message_get_state (_tmp25_);
	_tmp27_ = _tmp26_;
	if (_tmp27_ > 0) {
		DcMessage* _tmp28_;
		gint _tmp29_;
		gint _tmp30_;
		gchar* _tmp31_;
		_tmp28_ = self->priv->msg;
		_tmp29_ = dc_message_get_state (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = g_strdup_printf ("State %d", _tmp30_);
		_g_free0 (_tmp24_);
		_tmp24_ = _tmp31_;
	} else {
		gchar* _tmp32_;
		_tmp32_ = g_strdup ("Unknown");
		_g_free0 (_tmp24_);
		_tmp24_ = _tmp32_;
	}
	_tmp33_ = _tmp24_;
	_tmp24_ = NULL;
	result = _tmp33_;
	_g_free0 (_tmp24_);
	return result;
}

static gchar*
dc_message_details_dialog_message_type (DcMessageDetailsDialog* self)
{
	DcMessage* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcMessage* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	DcMessage* _tmp11_;
	DcMessage* _tmp13_;
	DcMessage* _tmp15_;
	DcMessage* _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp19_;
	gchar* _tmp21_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->msg;
	_tmp1_ = dc_message_get_is_info (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("Info");
		result = _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->msg;
	_tmp5_ = dc_message_get_view_type (_tmp4_);
	_tmp6_ = _tmp5_;
	if (dc_message_details_dialog_has_value (_tmp6_)) {
		DcMessage* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp7_ = self->priv->msg;
		_tmp8_ = dc_message_get_view_type (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_strdup (_tmp9_);
		result = _tmp10_;
		return result;
	}
	_tmp11_ = self->priv->msg;
	if (dc_message_is_image_file (_tmp11_)) {
		gchar* _tmp12_;
		_tmp12_ = g_strdup ("Image");
		result = _tmp12_;
		return result;
	}
	_tmp13_ = self->priv->msg;
	if (dc_message_is_video_file (_tmp13_)) {
		gchar* _tmp14_;
		_tmp14_ = g_strdup ("Video");
		result = _tmp14_;
		return result;
	}
	_tmp15_ = self->priv->msg;
	if (dc_message_is_audio_file (_tmp15_)) {
		gchar* _tmp16_;
		_tmp16_ = g_strdup ("Audio");
		result = _tmp16_;
		return result;
	}
	_tmp17_ = self->priv->msg;
	_tmp18_ = dc_message_get_has_file (_tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_) {
		gchar* _tmp20_;
		_tmp20_ = g_strdup ("File");
		result = _tmp20_;
		return result;
	}
	_tmp21_ = g_strdup ("Text");
	result = _tmp21_;
	return result;
}

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

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

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

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

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

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

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gchar*
dc_message_details_dialog_flags_text (DcMessageDetailsDialog* self)
{
	gchar** flags = NULL;
	gchar** _tmp0_;
	gint flags_length1;
	gint _flags_size_;
	DcMessage* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	DcMessage* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	DcMessage* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	DcMessage* _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	DcMessage* _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp19_;
	DcMessage* _tmp21_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	gchar* _tmp25_ = NULL;
	gchar** _tmp26_;
	gint _tmp26__length1;
	gchar* _tmp30_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	flags = _tmp0_;
	flags_length1 = 0;
	_flags_size_ = flags_length1;
	_tmp1_ = self->priv->msg;
	_tmp2_ = dc_message_get_is_forwarded (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("Forwarded");
		_vala_array_add55 (&flags, &flags_length1, &_flags_size_, _tmp4_);
	}
	_tmp5_ = self->priv->msg;
	_tmp6_ = dc_message_get_is_edited (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		gchar* _tmp8_;
		_tmp8_ = g_strdup ("Edited");
		_vala_array_add56 (&flags, &flags_length1, &_flags_size_, _tmp8_);
	}
	_tmp9_ = self->priv->msg;
	_tmp10_ = dc_message_get_is_pinned (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_) {
		gchar* _tmp12_;
		_tmp12_ = g_strdup ("Pinned");
		_vala_array_add57 (&flags, &flags_length1, &_flags_size_, _tmp12_);
	}
	_tmp13_ = self->priv->msg;
	_tmp14_ = dc_message_get_is_info (_tmp13_);
	_tmp15_ = _tmp14_;
	if (_tmp15_) {
		gchar* _tmp16_;
		_tmp16_ = g_strdup ("Info");
		_vala_array_add58 (&flags, &flags_length1, &_flags_size_, _tmp16_);
	}
	_tmp17_ = self->priv->msg;
	_tmp18_ = dc_message_get_has_html (_tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_) {
		gchar* _tmp20_;
		_tmp20_ = g_strdup ("HTML");
		_vala_array_add59 (&flags, &flags_length1, &_flags_size_, _tmp20_);
	}
	_tmp21_ = self->priv->msg;
	_tmp22_ = dc_message_get_has_full_message_action (_tmp21_);
	_tmp23_ = _tmp22_;
	if (_tmp23_) {
		gchar* _tmp24_;
		_tmp24_ = g_strdup ("Full message action");
		_vala_array_add60 (&flags, &flags_length1, &_flags_size_, _tmp24_);
	}
	_tmp26_ = flags;
	_tmp26__length1 = flags_length1;
	if (_tmp26__length1 == 0) {
		gchar* _tmp27_;
		_tmp27_ = g_strdup ("None");
		_g_free0 (_tmp25_);
		_tmp25_ = _tmp27_;
	} else {
		gchar** _tmp28_;
		gint _tmp28__length1;
		gchar* _tmp29_;
		_tmp28_ = flags;
		_tmp28__length1 = flags_length1;
		_tmp29_ = _vala_g_strjoinv (", ", _tmp28_, (gint) _tmp28__length1);
		_g_free0 (_tmp25_);
		_tmp25_ = _tmp29_;
	}
	_tmp30_ = _tmp25_;
	_tmp25_ = NULL;
	result = _tmp30_;
	_g_free0 (_tmp25_);
	flags = (_vala_array_free (flags, flags_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static gchar*
dc_message_details_dialog_format_bytes (gint64 bytes)
{
	gdouble kb = 0.0;
	gdouble mb = 0.0;
	gchar* _tmp6_;
	gchar* result;
	if (bytes < ((gint64) 1024)) {
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp0_ = g_strdup_printf ("%" G_GINT64_FORMAT, bytes);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_strconcat (_tmp1_, " B", NULL);
		_tmp3_ = _tmp2_;
		_g_free0 (_tmp1_);
		result = _tmp3_;
		return result;
	}
	kb = ((gdouble) bytes) / 1024.0;
	if (kb < 1024.0) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup_printf ("%.1f KB", kb);
		result = _tmp4_;
		return result;
	}
	mb = kb / 1024.0;
	if (mb < 1024.0) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup_printf ("%.1f MB", mb);
		result = _tmp5_;
		return result;
	}
	_tmp6_ = g_strdup_printf ("%.1f GB", mb / 1024.0);
	result = _tmp6_;
	return result;
}

static gboolean
dc_message_details_dialog_has_value (const gchar* value)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	if (value != NULL) {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (value);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
dc_message_details_dialog_class_init (DcMessageDetailsDialogClass * klass,
                                      gpointer klass_data)
{
	dc_message_details_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcMessageDetailsDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dc_message_details_dialog_finalize;
}

static void
dc_message_details_dialog_instance_init (DcMessageDetailsDialog * self,
                                         gpointer klass)
{
	gchar* _tmp0_;
	self->priv = dc_message_details_dialog_get_instance_private (self);
	self->priv->edit_view = NULL;
	self->priv->save_edit_btn = NULL;
	self->priv->edit_status_lbl = NULL;
	_tmp0_ = g_strdup ("");
	self->priv->edit_original_text = _tmp0_;
}

static void
dc_message_details_dialog_finalize (GObject * obj)
{
	DcMessageDetailsDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_MESSAGE_DETAILS_DIALOG, DcMessageDetailsDialog);
	_g_object_unref0 (self->priv->actions);
	_g_object_unref0 (self->priv->msg);
	_g_object_unref0 (self->priv->reaction_roster);
	_g_object_unref0 (self->priv->edit_view);
	_g_object_unref0 (self->priv->save_edit_btn);
	_g_object_unref0 (self->priv->edit_status_lbl);
	_g_free0 (self->priv->edit_original_text);
	G_OBJECT_CLASS (dc_message_details_dialog_parent_class)->finalize (obj);
}

static GType
dc_message_details_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcMessageDetailsDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_message_details_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcMessageDetailsDialog), 0, (GInstanceInitFunc) dc_message_details_dialog_instance_init, NULL };
	GType dc_message_details_dialog_type_id;
	dc_message_details_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "DcMessageDetailsDialog", &g_define_type_info, 0);
	DcMessageDetailsDialog_private_offset = g_type_add_instance_private (dc_message_details_dialog_type_id, sizeof (DcMessageDetailsDialogPrivate));
	return dc_message_details_dialog_type_id;
}

GType
dc_message_details_dialog_get_type (void)
{
	static volatile gsize dc_message_details_dialog_type_id__once = 0;
	if (g_once_init_enter (&dc_message_details_dialog_type_id__once)) {
		GType dc_message_details_dialog_type_id;
		dc_message_details_dialog_type_id = dc_message_details_dialog_get_type_once ();
		g_once_init_leave (&dc_message_details_dialog_type_id__once, dc_message_details_dialog_type_id);
	}
	return dc_message_details_dialog_type_id__once;
}

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

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

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

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

