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

/**
         * Inline player for an audio attachment: a play/pause button and the
         * file name. Playback is self-contained — the captured media stream is
         * created lazily on first press and lives as long as the row.
         */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <pango/pango.h>
#include <glib/gstdio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include <stdio.h>
#include <adwaita.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_ROW (dc_message_row_get_type ())
#define DC_MESSAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE_ROW, DcMessageRow))
#define DC_MESSAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE_ROW, DcMessageRowClass))
#define DC_IS_MESSAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE_ROW))
#define DC_IS_MESSAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE_ROW))
#define DC_MESSAGE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE_ROW, DcMessageRowClass))

typedef struct _DcMessageRow DcMessageRow;
typedef struct _DcMessageRowClass DcMessageRowClass;
typedef struct _DcMessageRowPrivate DcMessageRowPrivate;
enum  {
	DC_MESSAGE_ROW_0_PROPERTY,
	DC_MESSAGE_ROW_MESSAGE_ID_PROPERTY,
	DC_MESSAGE_ROW_TIMESTAMP_PROPERTY,
	DC_MESSAGE_ROW_IS_OUTGOING_PROPERTY,
	DC_MESSAGE_ROW_FILE_PATH_PROPERTY,
	DC_MESSAGE_ROW_FILE_NAME_PROPERTY,
	DC_MESSAGE_ROW_MESSAGE_TEXT_PROPERTY,
	DC_MESSAGE_ROW_QUOTE_MSG_ID_PROPERTY,
	DC_MESSAGE_ROW_IS_IMAGE_PROPERTY,
	DC_MESSAGE_ROW_NUM_PROPERTIES
};
static GParamSpec* dc_message_row_properties[DC_MESSAGE_ROW_NUM_PROPERTIES];
typedef enum  {
	DC_MESSAGE_STYLE_BUBBLES = 0,
	DC_MESSAGE_STYLE_IRC = 1
} DcMessageStyle;

#define DC_TYPE_MESSAGE_STYLE (dc_message_style_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))

#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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

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

typedef struct _DcAudioPlayer DcAudioPlayer;
typedef struct _DcAudioPlayerClass DcAudioPlayerClass;
typedef struct _Block17Data Block17Data;
typedef struct _Block18Data Block18Data;
#define _pango_attr_list_unref0(var) ((var == NULL) ? NULL : (var = (pango_attr_list_unref (var), NULL)))

#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 _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
enum  {
	DC_MESSAGE_ROW_QUOTE_CLICKED_SIGNAL,
	DC_MESSAGE_ROW_NUM_SIGNALS
};
static guint dc_message_row_signals[DC_MESSAGE_ROW_NUM_SIGNALS] = {0};

struct _DcMessageRow {
	GtkBox parent_instance;
	DcMessageRowPrivate * priv;
};

struct _DcMessageRowClass {
	GtkBoxClass parent_class;
};

struct _DcMessageRowPrivate {
	gint _message_id;
	gint64 _timestamp;
	gboolean _is_outgoing;
	gchar* _file_path;
	gchar* _file_name;
	gchar* _message_text;
	gint _quote_msg_id;
	gboolean _is_image;
};

struct _Block17Data {
	int _ref_count_;
	DcMessageRow* self;
	gint qid;
};

struct _Block18Data {
	int _ref_count_;
	GtkLabel* text;
};

static gint DcMessageRow_private_offset;
static gpointer dc_message_row_parent_class = NULL;
VALA_EXTERN DcMessageStyle dc_message_row_style;
DcMessageStyle dc_message_row_style = DC_MESSAGE_STYLE_BUBBLES;
VALA_EXTERN gchar* dc_message_row_self_display_name;
gchar* dc_message_row_self_display_name = NULL;

VALA_EXTERN GType dc_message_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageRow, g_object_unref)
VALA_EXTERN GType dc_message_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void dc_message_row_highlight (DcMessageRow* self);
static gboolean __lambda70_ (DcMessageRow* self);
static gboolean ___lambda70__gsource_func (gpointer self);
VALA_EXTERN GType dc_message_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessage, g_object_unref)
VALA_EXTERN DcMessageRow* dc_message_row_new (DcMessage* msg,
                                  DcMessage* prev,
                                  GPtrArray* trailing_images,
                                  gboolean is_image_continuation);
VALA_EXTERN DcMessageRow* dc_message_row_construct (GType object_type,
                                        DcMessage* msg,
                                        DcMessage* prev,
                                        GPtrArray* trailing_images,
                                        gboolean is_image_continuation);
VALA_EXTERN gint dc_message_get_id (DcMessage* self);
static void dc_message_row_set_message_id (DcMessageRow* self,
                                    gint value);
VALA_EXTERN gint64 dc_message_get_timestamp (DcMessage* self);
static void dc_message_row_set_timestamp (DcMessageRow* self,
                                   gint64 value);
VALA_EXTERN gboolean dc_message_get_is_outgoing (DcMessage* self);
static void dc_message_row_set_is_outgoing (DcMessageRow* self,
                                     gboolean value);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
static void dc_message_row_set_file_path (DcMessageRow* self,
                                   const gchar* value);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
static void dc_message_row_set_file_name (DcMessageRow* self,
                                   const gchar* value);
VALA_EXTERN const gchar* dc_message_get_text (DcMessage* self);
static void dc_message_row_set_message_text (DcMessageRow* self,
                                      const gchar* value);
VALA_EXTERN gint dc_message_get_quote_msg_id (DcMessage* self);
static void dc_message_row_set_quote_msg_id (DcMessageRow* self,
                                      gint value);
VALA_EXTERN gboolean dc_message_get_is_info (DcMessage* self);
static void dc_message_row_build_info_row (DcMessageRow* self,
                                    DcMessage* msg);
static void dc_message_row_build_irc_row (DcMessageRow* self,
                                   DcMessage* msg,
                                   DcMessage* prev,
                                   GPtrArray* trailing_images,
                                   gboolean is_image_continuation);
VALA_EXTERN gboolean dc_message_get_is_forwarded (DcMessage* self);
static GtkLabel* dc_message_row_build_forwarded_indicator (DcMessage* msg);
static gchar* dc_message_row_effective_author_name (DcMessage* msg);
VALA_EXTERN const gchar* dc_message_get_sender_address (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_quote_text (DcMessage* self);
static GtkButton* dc_message_row_build_quote_block (DcMessageRow* self,
                                             DcMessage* msg,
                                             gint max_width_chars,
                                             gint lines);
VALA_EXTERN gboolean dc_message_row_is_image_file (DcMessage* msg);
static void dc_message_row_set_is_image (DcMessageRow* self,
                                  gboolean value);
static GtkPicture* dc_message_row_load_picture (const gchar* path,
                                         gint max_w,
                                         gint max_h,
                                         gint min_w,
                                         gint min_h);
static GtkBox* dc_message_row_build_file_indicator (DcMessage* msg);
VALA_EXTERN gboolean dc_message_row_is_video_file (DcMessage* msg);
static GtkWidget* dc_message_row_build_video_preview (DcMessage* msg);
VALA_EXTERN gboolean dc_message_row_is_audio_file (DcMessage* msg);
static GtkWidget* dc_message_row_build_audio_player (DcMessage* msg);
static GtkLabel* dc_message_row_build_text_label (DcMessage* msg,
                                           gint max_width_chars);
VALA_EXTERN gboolean dc_message_get_is_pinned (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_is_edited (DcMessage* self);
static GtkLabel* dc_message_row_build_edited_indicator (const gchar* text);
static gchar* dc_message_row_format_timestamp (gint64 ts);
static GtkLabel* dc_message_row_build_tick_indicator (DcMessage* msg);
static GtkBox* dc_message_row_build_reactions_box (DcMessage* msg);
static gchar* dc_message_row_effective_sender_name (DcMessage* msg);
static void dc_message_row_append_irc_image (GtkBox* strip,
                                      DcMessage* m);
VALA_EXTERN gboolean dc_message_row_is_image_only_message (DcMessage* m);
VALA_EXTERN gboolean dc_message_row_same_irc_sender (DcMessage* a,
                                         DcMessage* b);
VALA_EXTERN const gchar* dc_message_get_sender_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_override_sender_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_file_mime (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_view_type (DcMessage* self);
VALA_EXTERN DcAudioPlayer* dc_audio_player_new (const gchar* path,
                                    const gchar* name);
VALA_EXTERN DcAudioPlayer* dc_audio_player_construct (GType object_type,
                                          const gchar* path,
                                          const gchar* name);
VALA_EXTERN GType dc_audio_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlayer, g_object_unref)
VALA_EXTERN gboolean dc_message_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);
static Block17Data* block17_data_ref (Block17Data* _data17_);
static void block17_data_unref (void * _userdata_);
static void ___lambda71_ (Block17Data* _data17_);
static void ____lambda71__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN const gchar* dc_message_get_quote_sender_name (DcMessage* self);
static Block18Data* block18_data_ref (Block18Data* _data18_);
static void block18_data_unref (void * _userdata_);
static gboolean dc_message_row_is_single_emoji_text (const gchar* raw);
VALA_EXTERN gchar* dc_markdown_format (const gchar* input);
static gboolean __lambda73_ (Block18Data* _data18_,
                      const gchar* uri);
VALA_EXTERN gboolean dc_is_delta_invite_uri (const gchar* uri);
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
VALA_EXTERN void dc_window_handle_invite_uri (DcWindow* self,
                                  const gchar* uri);
static gboolean ___lambda73__gtk_label_activate_link (GtkLabel* _sender,
                                               const gchar* uri,
                                               gpointer self);
static gboolean dc_message_row_consume_emoji_sequence (const gchar* text,
                                                gint* index);
static gboolean dc_message_row_is_keycap_base (gunichar c);
static gboolean dc_message_row_consume_variation_selectors (const gchar* text,
                                                     gint* index);
static gboolean dc_message_row_consume_char (const gchar* text,
                                      gint* index,
                                      gunichar expected);
static gboolean dc_message_row_is_regional_indicator (gunichar c);
static gboolean dc_message_row_is_emoji_base (gunichar c);
static void dc_message_row_consume_emoji_modifiers (const gchar* text,
                                             gint* index);
static gboolean dc_message_row_consume_emoji_modifier (const gchar* text,
                                                gint* index);
static void dc_message_row_consume_tag_sequence (const gchar* text,
                                          gint* index);
VALA_EXTERN const gchar* dc_message_get_reactions (DcMessage* self);
VALA_EXTERN gint dc_message_row_get_message_id (DcMessageRow* self);
VALA_EXTERN gint64 dc_message_row_get_timestamp (DcMessageRow* self);
VALA_EXTERN gboolean dc_message_row_get_is_outgoing (DcMessageRow* self);
VALA_EXTERN const gchar* dc_message_row_get_file_path (DcMessageRow* self);
VALA_EXTERN const gchar* dc_message_row_get_file_name (DcMessageRow* self);
VALA_EXTERN const gchar* dc_message_row_get_message_text (DcMessageRow* self);
VALA_EXTERN gint dc_message_row_get_quote_msg_id (DcMessageRow* self);
VALA_EXTERN gboolean dc_message_row_get_is_image (DcMessageRow* self);
static void dc_message_row_finalize (GObject * obj);
static GType dc_message_row_get_type_once (void);
static void _vala_dc_message_row_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_dc_message_row_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static GRegex* _tmp_regex_0 = NULL;

static inline gpointer
dc_message_row_get_instance_private (DcMessageRow* self)
{
	return G_STRUCT_MEMBER_P (self, DcMessageRow_private_offset);
}

static gboolean
__lambda70_ (DcMessageRow* self)
{
	gboolean result;
	gtk_widget_remove_css_class ((GtkWidget*) self, "message-new");
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda70__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda70_ ((DcMessageRow*) self);
	return result;
}

void
dc_message_row_highlight (DcMessageRow* self)
{
	g_return_if_fail (self != NULL);
	gtk_widget_add_css_class ((GtkWidget*) self, "message-new");
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 2000, ___lambda70__gsource_func, g_object_ref (self), g_object_unref);
}

DcMessageRow*
dc_message_row_construct (GType object_type,
                          DcMessage* msg,
                          DcMessage* prev,
                          GPtrArray* trailing_images,
                          gboolean is_image_continuation)
{
	DcMessageRow * self = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gint64 _tmp2_;
	gint64 _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	gboolean outgoing = FALSE;
	gboolean _tmp16_;
	gboolean _tmp17_;
	GtkBox* bubble = NULL;
	GtkBox* _tmp18_;
	GtkBox* _tmp19_;
	const gchar* _tmp20_ = NULL;
	GtkBox* _tmp21_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	gboolean _tmp47_ = FALSE;
	const gchar* _tmp48_;
	const gchar* _tmp49_;
	gboolean _tmp57_ = FALSE;
	gboolean _tmp58_ = FALSE;
	const gchar* _tmp59_;
	const gchar* _tmp60_;
	gboolean has_file = FALSE;
	gboolean _tmp96_ = FALSE;
	const gchar* _tmp97_;
	const gchar* _tmp98_;
	GtkBox* footer = NULL;
	GtkBox* _tmp106_;
	GtkBox* _tmp107_;
	gboolean _tmp108_;
	gboolean _tmp109_;
	gboolean _tmp114_;
	gboolean _tmp115_;
	gchar* time_str = NULL;
	gint64 _tmp119_;
	gint64 _tmp120_;
	gchar* _tmp121_;
	GtkLabel* time_lbl = NULL;
	const gchar* _tmp122_;
	GtkLabel* _tmp123_;
	GtkLabel* _tmp124_;
	GtkBox* _tmp125_;
	GtkLabel* _tmp126_;
	GtkBox* _tmp131_;
	GtkBox* _tmp132_;
	GtkBox* reactions_box = NULL;
	GtkBox* _tmp133_;
	GtkBox* _tmp134_;
	GtkBox* _tmp140_;
	g_return_val_if_fail (msg != NULL, NULL);
	self = (DcMessageRow*) g_object_new (object_type, "orientation", GTK_ORIENTATION_HORIZONTAL, "spacing", 0, NULL);
	_tmp0_ = dc_message_get_id (msg);
	_tmp1_ = _tmp0_;
	dc_message_row_set_message_id (self, _tmp1_);
	_tmp2_ = dc_message_get_timestamp (msg);
	_tmp3_ = _tmp2_;
	dc_message_row_set_timestamp (self, _tmp3_);
	_tmp4_ = dc_message_get_is_outgoing (msg);
	_tmp5_ = _tmp4_;
	dc_message_row_set_is_outgoing (self, _tmp5_);
	_tmp6_ = dc_message_get_file_path (msg);
	_tmp7_ = _tmp6_;
	dc_message_row_set_file_path (self, _tmp7_);
	_tmp8_ = dc_message_get_file_name (msg);
	_tmp9_ = _tmp8_;
	dc_message_row_set_file_name (self, _tmp9_);
	_tmp10_ = dc_message_get_text (msg);
	_tmp11_ = _tmp10_;
	dc_message_row_set_message_text (self, _tmp11_);
	_tmp12_ = dc_message_get_quote_msg_id (msg);
	_tmp13_ = _tmp12_;
	dc_message_row_set_quote_msg_id (self, _tmp13_);
	_tmp14_ = dc_message_get_is_info (msg);
	_tmp15_ = _tmp14_;
	if (_tmp15_) {
		dc_message_row_build_info_row (self, msg);
		return self;
	}
	if (dc_message_row_style == DC_MESSAGE_STYLE_IRC) {
		dc_message_row_build_irc_row (self, msg, prev, trailing_images, is_image_continuation);
		return self;
	}
	_tmp16_ = dc_message_get_is_outgoing (msg);
	_tmp17_ = _tmp16_;
	outgoing = _tmp17_;
	gtk_widget_set_margin_start ((GtkWidget*) self, 8);
	gtk_widget_set_margin_end ((GtkWidget*) self, 8);
	gtk_widget_set_margin_top ((GtkWidget*) self, 2);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 2);
	_tmp18_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	g_object_ref_sink (_tmp18_);
	bubble = _tmp18_;
	_tmp19_ = bubble;
	gtk_widget_add_css_class ((GtkWidget*) _tmp19_, "message-bubble");
	if (outgoing) {
		_tmp20_ = "outgoing";
	} else {
		_tmp20_ = "incoming";
	}
	_tmp21_ = bubble;
	gtk_widget_add_css_class ((GtkWidget*) _tmp21_, _tmp20_);
	_tmp22_ = dc_message_get_is_forwarded (msg);
	_tmp23_ = _tmp22_;
	if (_tmp23_) {
		GtkBox* _tmp24_;
		GtkLabel* _tmp25_;
		GtkLabel* _tmp26_;
		_tmp24_ = bubble;
		_tmp25_ = dc_message_row_build_forwarded_indicator (msg);
		_tmp26_ = _tmp25_;
		gtk_box_append (_tmp24_, (GtkWidget*) _tmp26_);
		_g_object_unref0 (_tmp26_);
	} else {
		if (!outgoing) {
			gchar* author = NULL;
			gchar* _tmp27_;
			const gchar* _tmp28_;
			_tmp27_ = dc_message_row_effective_author_name (msg);
			author = _tmp27_;
			_tmp28_ = author;
			if (_tmp28_ != NULL) {
				GtkLabel* sender = NULL;
				const gchar* _tmp29_;
				GtkLabel* _tmp30_;
				GtkLabel* _tmp31_;
				GtkLabel* _tmp32_;
				GtkLabel* _tmp33_;
				GtkLabel* _tmp34_;
				gboolean _tmp35_ = FALSE;
				const gchar* _tmp36_;
				const gchar* _tmp37_;
				GtkBox* _tmp45_;
				GtkLabel* _tmp46_;
				_tmp29_ = author;
				_tmp30_ = (GtkLabel*) gtk_label_new (_tmp29_);
				g_object_ref_sink (_tmp30_);
				sender = _tmp30_;
				_tmp31_ = sender;
				gtk_widget_add_css_class ((GtkWidget*) _tmp31_, "message-sender");
				_tmp32_ = sender;
				gtk_widget_set_halign ((GtkWidget*) _tmp32_, GTK_ALIGN_START);
				_tmp33_ = sender;
				gtk_label_set_xalign (_tmp33_, (gfloat) 0);
				_tmp34_ = sender;
				gtk_label_set_ellipsize (_tmp34_, PANGO_ELLIPSIZE_END);
				_tmp36_ = dc_message_get_sender_address (msg);
				_tmp37_ = _tmp36_;
				if (_tmp37_ != NULL) {
					const gchar* _tmp38_;
					const gchar* _tmp39_;
					gint _tmp40_;
					gint _tmp41_;
					_tmp38_ = dc_message_get_sender_address (msg);
					_tmp39_ = _tmp38_;
					_tmp40_ = strlen (_tmp39_);
					_tmp41_ = _tmp40_;
					_tmp35_ = _tmp41_ > 0;
				} else {
					_tmp35_ = FALSE;
				}
				if (_tmp35_) {
					GtkLabel* _tmp42_;
					const gchar* _tmp43_;
					const gchar* _tmp44_;
					_tmp42_ = sender;
					_tmp43_ = dc_message_get_sender_address (msg);
					_tmp44_ = _tmp43_;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp42_, _tmp44_);
				}
				_tmp45_ = bubble;
				_tmp46_ = sender;
				gtk_box_append (_tmp45_, (GtkWidget*) _tmp46_);
				_g_object_unref0 (sender);
			}
			_g_free0 (author);
		}
	}
	_tmp48_ = dc_message_get_quote_text (msg);
	_tmp49_ = _tmp48_;
	if (_tmp49_ != NULL) {
		const gchar* _tmp50_;
		const gchar* _tmp51_;
		gint _tmp52_;
		gint _tmp53_;
		_tmp50_ = dc_message_get_quote_text (msg);
		_tmp51_ = _tmp50_;
		_tmp52_ = strlen (_tmp51_);
		_tmp53_ = _tmp52_;
		_tmp47_ = _tmp53_ > 0;
	} else {
		_tmp47_ = FALSE;
	}
	if (_tmp47_) {
		GtkBox* _tmp54_;
		GtkButton* _tmp55_;
		GtkButton* _tmp56_;
		_tmp54_ = bubble;
		_tmp55_ = dc_message_row_build_quote_block (self, msg, 40, 2);
		_tmp56_ = _tmp55_;
		gtk_box_append (_tmp54_, (GtkWidget*) _tmp56_);
		_g_object_unref0 (_tmp56_);
	}
	_tmp59_ = dc_message_get_file_name (msg);
	_tmp60_ = _tmp59_;
	if (_tmp60_ != NULL) {
		const gchar* _tmp61_;
		const gchar* _tmp62_;
		gint _tmp63_;
		gint _tmp64_;
		_tmp61_ = dc_message_get_file_name (msg);
		_tmp62_ = _tmp61_;
		_tmp63_ = strlen (_tmp62_);
		_tmp64_ = _tmp63_;
		_tmp58_ = _tmp64_ > 0;
	} else {
		_tmp58_ = FALSE;
	}
	if (_tmp58_) {
		_tmp57_ = TRUE;
	} else {
		gboolean _tmp65_ = FALSE;
		const gchar* _tmp66_;
		const gchar* _tmp67_;
		_tmp66_ = dc_message_get_file_path (msg);
		_tmp67_ = _tmp66_;
		if (_tmp67_ != NULL) {
			const gchar* _tmp68_;
			const gchar* _tmp69_;
			gint _tmp70_;
			gint _tmp71_;
			_tmp68_ = dc_message_get_file_path (msg);
			_tmp69_ = _tmp68_;
			_tmp70_ = strlen (_tmp69_);
			_tmp71_ = _tmp70_;
			_tmp65_ = _tmp71_ > 0;
		} else {
			_tmp65_ = FALSE;
		}
		_tmp57_ = _tmp65_;
	}
	has_file = _tmp57_;
	if (has_file) {
		gboolean _tmp72_ = FALSE;
		gboolean _tmp73_ = FALSE;
		const gchar* _tmp74_;
		const gchar* _tmp75_;
		_tmp74_ = dc_message_get_file_path (msg);
		_tmp75_ = _tmp74_;
		if (_tmp75_ != NULL) {
			const gchar* _tmp76_;
			const gchar* _tmp77_;
			_tmp76_ = dc_message_get_file_path (msg);
			_tmp77_ = _tmp76_;
			_tmp73_ = g_file_test (_tmp77_, G_FILE_TEST_EXISTS);
		} else {
			_tmp73_ = FALSE;
		}
		if (_tmp73_) {
			_tmp72_ = dc_message_row_is_image_file (msg);
		} else {
			_tmp72_ = FALSE;
		}
		if (_tmp72_) {
			GtkPicture* image = NULL;
			const gchar* _tmp78_;
			const gchar* _tmp79_;
			GtkPicture* _tmp80_;
			GtkPicture* _tmp81_;
			dc_message_row_set_is_image (self, TRUE);
			_tmp78_ = dc_message_get_file_path (msg);
			_tmp79_ = _tmp78_;
			_tmp80_ = dc_message_row_load_picture (_tmp79_, 400, 400, 260, 0);
			image = _tmp80_;
			_tmp81_ = image;
			if (_tmp81_ == NULL) {
				GtkBox* _tmp82_;
				GtkBox* _tmp83_;
				GtkBox* _tmp84_;
				_tmp82_ = bubble;
				_tmp83_ = dc_message_row_build_file_indicator (msg);
				_tmp84_ = _tmp83_;
				gtk_box_append (_tmp82_, (GtkWidget*) _tmp84_);
				_g_object_unref0 (_tmp84_);
			} else {
				GtkBox* _tmp85_;
				GtkPicture* _tmp86_;
				_tmp85_ = bubble;
				_tmp86_ = image;
				gtk_box_append (_tmp85_, (GtkWidget*) _tmp86_);
			}
			_g_object_unref0 (image);
		} else {
			if (dc_message_row_is_video_file (msg)) {
				GtkBox* _tmp87_;
				GtkWidget* _tmp88_;
				GtkWidget* _tmp89_;
				_tmp87_ = bubble;
				_tmp88_ = dc_message_row_build_video_preview (msg);
				_tmp89_ = _tmp88_;
				gtk_box_append (_tmp87_, _tmp89_);
				_g_object_unref0 (_tmp89_);
			} else {
				if (dc_message_row_is_audio_file (msg)) {
					GtkBox* _tmp90_;
					GtkWidget* _tmp91_;
					GtkWidget* _tmp92_;
					_tmp90_ = bubble;
					_tmp91_ = dc_message_row_build_audio_player (msg);
					_tmp92_ = _tmp91_;
					gtk_box_append (_tmp90_, _tmp92_);
					_g_object_unref0 (_tmp92_);
				} else {
					GtkBox* _tmp93_;
					GtkBox* _tmp94_;
					GtkBox* _tmp95_;
					_tmp93_ = bubble;
					_tmp94_ = dc_message_row_build_file_indicator (msg);
					_tmp95_ = _tmp94_;
					gtk_box_append (_tmp93_, (GtkWidget*) _tmp95_);
					_g_object_unref0 (_tmp95_);
				}
			}
		}
	}
	_tmp97_ = dc_message_get_text (msg);
	_tmp98_ = _tmp97_;
	if (_tmp98_ != NULL) {
		const gchar* _tmp99_;
		const gchar* _tmp100_;
		gint _tmp101_;
		gint _tmp102_;
		_tmp99_ = dc_message_get_text (msg);
		_tmp100_ = _tmp99_;
		_tmp101_ = strlen (_tmp100_);
		_tmp102_ = _tmp101_;
		_tmp96_ = _tmp102_ > 0;
	} else {
		_tmp96_ = FALSE;
	}
	if (_tmp96_) {
		GtkBox* _tmp103_;
		GtkLabel* _tmp104_;
		GtkLabel* _tmp105_;
		_tmp103_ = bubble;
		_tmp104_ = dc_message_row_build_text_label (msg, 50);
		_tmp105_ = _tmp104_;
		gtk_box_append (_tmp103_, (GtkWidget*) _tmp105_);
		_g_object_unref0 (_tmp105_);
	}
	_tmp106_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
	g_object_ref_sink (_tmp106_);
	footer = _tmp106_;
	_tmp107_ = footer;
	gtk_widget_set_halign ((GtkWidget*) _tmp107_, GTK_ALIGN_END);
	_tmp108_ = dc_message_get_is_pinned (msg);
	_tmp109_ = _tmp108_;
	if (_tmp109_) {
		GtkLabel* pin_icon = NULL;
		GtkLabel* _tmp110_;
		GtkLabel* _tmp111_;
		GtkBox* _tmp112_;
		GtkLabel* _tmp113_;
		_tmp110_ = (GtkLabel*) gtk_label_new ("📌");
		g_object_ref_sink (_tmp110_);
		pin_icon = _tmp110_;
		_tmp111_ = pin_icon;
		gtk_widget_add_css_class ((GtkWidget*) _tmp111_, "message-time");
		_tmp112_ = footer;
		_tmp113_ = pin_icon;
		gtk_box_append (_tmp112_, (GtkWidget*) _tmp113_);
		_g_object_unref0 (pin_icon);
	}
	_tmp114_ = dc_message_get_is_edited (msg);
	_tmp115_ = _tmp114_;
	if (_tmp115_) {
		GtkBox* _tmp116_;
		GtkLabel* _tmp117_;
		GtkLabel* _tmp118_;
		_tmp116_ = footer;
		_tmp117_ = dc_message_row_build_edited_indicator ("Edited");
		_tmp118_ = _tmp117_;
		gtk_box_append (_tmp116_, (GtkWidget*) _tmp118_);
		_g_object_unref0 (_tmp118_);
	}
	_tmp119_ = dc_message_get_timestamp (msg);
	_tmp120_ = _tmp119_;
	_tmp121_ = dc_message_row_format_timestamp (_tmp120_);
	time_str = _tmp121_;
	_tmp122_ = time_str;
	_tmp123_ = (GtkLabel*) gtk_label_new (_tmp122_);
	g_object_ref_sink (_tmp123_);
	time_lbl = _tmp123_;
	_tmp124_ = time_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp124_, "message-time");
	_tmp125_ = footer;
	_tmp126_ = time_lbl;
	gtk_box_append (_tmp125_, (GtkWidget*) _tmp126_);
	if (outgoing) {
		GtkLabel* tick = NULL;
		GtkLabel* _tmp127_;
		GtkLabel* _tmp128_;
		_tmp127_ = dc_message_row_build_tick_indicator (msg);
		tick = _tmp127_;
		_tmp128_ = tick;
		if (_tmp128_ != NULL) {
			GtkBox* _tmp129_;
			GtkLabel* _tmp130_;
			_tmp129_ = footer;
			_tmp130_ = tick;
			gtk_box_append (_tmp129_, (GtkWidget*) _tmp130_);
		}
		_g_object_unref0 (tick);
	}
	_tmp131_ = bubble;
	_tmp132_ = footer;
	gtk_box_append (_tmp131_, (GtkWidget*) _tmp132_);
	_tmp133_ = dc_message_row_build_reactions_box (msg);
	reactions_box = _tmp133_;
	_tmp134_ = reactions_box;
	if (_tmp134_ != NULL) {
		GtkBox* _tmp135_;
		GtkBox* _tmp136_;
		_tmp135_ = bubble;
		_tmp136_ = reactions_box;
		gtk_box_append (_tmp135_, (GtkWidget*) _tmp136_);
	}
	if (outgoing) {
		GtkBox* spacer = NULL;
		GtkBox* _tmp137_;
		GtkBox* _tmp138_;
		GtkBox* _tmp139_;
		_tmp137_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
		g_object_ref_sink (_tmp137_);
		spacer = _tmp137_;
		_tmp138_ = spacer;
		gtk_widget_set_hexpand ((GtkWidget*) _tmp138_, TRUE);
		_tmp139_ = spacer;
		gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp139_);
		_g_object_unref0 (spacer);
	}
	_tmp140_ = bubble;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp140_);
	if (!outgoing) {
		GtkBox* spacer = NULL;
		GtkBox* _tmp141_;
		GtkBox* _tmp142_;
		GtkBox* _tmp143_;
		_tmp141_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
		g_object_ref_sink (_tmp141_);
		spacer = _tmp141_;
		_tmp142_ = spacer;
		gtk_widget_set_hexpand ((GtkWidget*) _tmp142_, TRUE);
		_tmp143_ = spacer;
		gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp143_);
		_g_object_unref0 (spacer);
	}
	_g_object_unref0 (reactions_box);
	_g_object_unref0 (time_lbl);
	_g_free0 (time_str);
	_g_object_unref0 (footer);
	_g_object_unref0 (bubble);
	return self;
}

DcMessageRow*
dc_message_row_new (DcMessage* msg,
                    DcMessage* prev,
                    GPtrArray* trailing_images,
                    gboolean is_image_continuation)
{
	return dc_message_row_construct (DC_TYPE_MESSAGE_ROW, msg, prev, trailing_images, is_image_continuation);
}

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 void
dc_message_row_build_irc_row (DcMessageRow* self,
                              DcMessage* msg,
                              DcMessage* prev,
                              GPtrArray* trailing_images,
                              gboolean is_image_continuation)
{
	gchar* time_str = NULL;
	gint64 _tmp0_;
	gint64 _tmp1_;
	gchar* _tmp2_;
	GtkLabel* time_lbl = NULL;
	const gchar* _tmp3_;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkLabel* _tmp6_;
	GtkLabel* _tmp7_;
	GtkLabel* _tmp8_;
	GtkLabel* _tmp9_;
	const gchar* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	GtkLabel* _tmp13_;
	gchar* sender = NULL;
	gchar* _tmp14_;
	GtkLabel* sender_lbl = NULL;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	GtkLabel* _tmp20_;
	GtkLabel* _tmp21_;
	GtkLabel* _tmp22_;
	const gchar* _tmp23_ = NULL;
	gboolean _tmp24_;
	gboolean _tmp25_;
	GtkLabel* _tmp26_;
	GtkLabel* _tmp27_;
	GtkLabel* _tmp28_;
	GtkLabel* _tmp29_;
	GtkLabel* _tmp30_;
	GtkBox* body = NULL;
	GtkBox* _tmp31_;
	GtkBox* _tmp32_;
	gboolean _tmp33_;
	gboolean _tmp34_;
	gboolean _tmp51_ = FALSE;
	const gchar* _tmp52_;
	const gchar* _tmp53_;
	gboolean _tmp61_ = FALSE;
	gboolean _tmp62_ = FALSE;
	const gchar* _tmp63_;
	const gchar* _tmp64_;
	gboolean has_file = FALSE;
	gboolean image_shown = FALSE;
	gboolean _tmp76_ = FALSE;
	gboolean _tmp77_ = FALSE;
	gboolean _tmp78_ = FALSE;
	gboolean is_img = FALSE;
	gboolean _tmp83_ = FALSE;
	gboolean _tmp84_ = FALSE;
	gboolean _tmp111_ = FALSE;
	gboolean _tmp116_ = FALSE;
	const gchar* _tmp117_;
	const gchar* _tmp118_;
	GtkBox* reactions_box = NULL;
	GtkBox* _tmp126_;
	GtkBox* _tmp127_;
	GtkBox* _tmp130_;
	gboolean _tmp131_;
	gboolean _tmp132_;
	gboolean _tmp136_;
	gboolean _tmp137_;
	gboolean _tmp142_;
	gboolean _tmp143_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (msg != NULL);
	if (is_image_continuation) {
		gtk_widget_add_css_class ((GtkWidget*) self, "message-irc");
		gtk_widget_add_css_class ((GtkWidget*) self, "message-irc-continuation");
		g_object_set ((GtkWidget*) self, "height-request", 0, NULL);
		gtk_widget_set_visible ((GtkWidget*) self, FALSE);
		return;
	}
	gtk_widget_set_margin_start ((GtkWidget*) self, 8);
	gtk_widget_set_margin_end ((GtkWidget*) self, 8);
	gtk_widget_set_margin_top ((GtkWidget*) self, 0);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 0);
	gtk_box_set_spacing ((GtkBox*) self, 6);
	gtk_widget_add_css_class ((GtkWidget*) self, "message-irc");
	_tmp0_ = dc_message_get_timestamp (msg);
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_message_row_format_timestamp (_tmp1_);
	time_str = _tmp2_;
	_tmp3_ = time_str;
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	g_object_ref_sink (_tmp4_);
	time_lbl = _tmp4_;
	_tmp5_ = time_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "message-time");
	_tmp6_ = time_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp6_, "irc-time");
	_tmp7_ = time_lbl;
	gtk_widget_set_valign ((GtkWidget*) _tmp7_, GTK_ALIGN_START);
	_tmp8_ = time_lbl;
	gtk_label_set_xalign (_tmp8_, (gfloat) 1);
	_tmp9_ = time_lbl;
	_tmp10_ = time_str;
	_tmp11_ = strlen (_tmp10_);
	_tmp12_ = _tmp11_;
	gtk_widget_set_visible ((GtkWidget*) _tmp9_, _tmp12_ > 0);
	_tmp13_ = time_lbl;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp13_);
	_tmp14_ = dc_message_row_effective_sender_name (msg);
	sender = _tmp14_;
	_tmp15_ = sender;
	_tmp16_ = g_strconcat ("<", _tmp15_, NULL);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strconcat (_tmp17_, ">", NULL);
	_tmp19_ = _tmp18_;
	_tmp20_ = (GtkLabel*) gtk_label_new (_tmp19_);
	g_object_ref_sink (_tmp20_);
	_tmp21_ = _tmp20_;
	_g_free0 (_tmp19_);
	_g_free0 (_tmp17_);
	sender_lbl = _tmp21_;
	_tmp22_ = sender_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp22_, "message-sender");
	_tmp24_ = dc_message_get_is_outgoing (msg);
	_tmp25_ = _tmp24_;
	if (_tmp25_) {
		_tmp23_ = "message-sender-self";
	} else {
		_tmp23_ = "message-sender-other";
	}
	_tmp26_ = sender_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp26_, _tmp23_);
	_tmp27_ = sender_lbl;
	gtk_widget_set_valign ((GtkWidget*) _tmp27_, GTK_ALIGN_START);
	_tmp28_ = sender_lbl;
	gtk_label_set_xalign (_tmp28_, (gfloat) 0);
	_tmp29_ = sender_lbl;
	gtk_label_set_ellipsize (_tmp29_, PANGO_ELLIPSIZE_END);
	_tmp30_ = sender_lbl;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp30_);
	_tmp31_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
	g_object_ref_sink (_tmp31_);
	body = _tmp31_;
	_tmp32_ = body;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp32_, TRUE);
	_tmp33_ = dc_message_get_is_forwarded (msg);
	_tmp34_ = _tmp33_;
	if (_tmp34_) {
		GtkLabel* fwd = NULL;
		GtkLabel* _tmp35_;
		GtkLabel* _tmp36_;
		GtkLabel* _tmp37_;
		GtkLabel* _tmp38_;
		gboolean _tmp39_ = FALSE;
		const gchar* _tmp40_;
		const gchar* _tmp41_;
		GtkBox* _tmp49_;
		GtkLabel* _tmp50_;
		_tmp35_ = (GtkLabel*) gtk_label_new ("↪ forwarded");
		g_object_ref_sink (_tmp35_);
		fwd = _tmp35_;
		_tmp36_ = fwd;
		gtk_widget_add_css_class ((GtkWidget*) _tmp36_, "message-forwarded");
		_tmp37_ = fwd;
		gtk_widget_set_halign ((GtkWidget*) _tmp37_, GTK_ALIGN_START);
		_tmp38_ = fwd;
		gtk_label_set_xalign (_tmp38_, (gfloat) 0);
		_tmp40_ = dc_message_get_sender_address (msg);
		_tmp41_ = _tmp40_;
		if (_tmp41_ != NULL) {
			const gchar* _tmp42_;
			const gchar* _tmp43_;
			gint _tmp44_;
			gint _tmp45_;
			_tmp42_ = dc_message_get_sender_address (msg);
			_tmp43_ = _tmp42_;
			_tmp44_ = strlen (_tmp43_);
			_tmp45_ = _tmp44_;
			_tmp39_ = _tmp45_ > 0;
		} else {
			_tmp39_ = FALSE;
		}
		if (_tmp39_) {
			GtkLabel* _tmp46_;
			const gchar* _tmp47_;
			const gchar* _tmp48_;
			_tmp46_ = fwd;
			_tmp47_ = dc_message_get_sender_address (msg);
			_tmp48_ = _tmp47_;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp46_, _tmp48_);
		}
		_tmp49_ = body;
		_tmp50_ = fwd;
		gtk_box_append (_tmp49_, (GtkWidget*) _tmp50_);
		_g_object_unref0 (fwd);
	}
	_tmp52_ = dc_message_get_quote_text (msg);
	_tmp53_ = _tmp52_;
	if (_tmp53_ != NULL) {
		const gchar* _tmp54_;
		const gchar* _tmp55_;
		gint _tmp56_;
		gint _tmp57_;
		_tmp54_ = dc_message_get_quote_text (msg);
		_tmp55_ = _tmp54_;
		_tmp56_ = strlen (_tmp55_);
		_tmp57_ = _tmp56_;
		_tmp51_ = _tmp57_ > 0;
	} else {
		_tmp51_ = FALSE;
	}
	if (_tmp51_) {
		GtkBox* _tmp58_;
		GtkButton* _tmp59_;
		GtkButton* _tmp60_;
		_tmp58_ = body;
		_tmp59_ = dc_message_row_build_quote_block (self, msg, 60, 1);
		_tmp60_ = _tmp59_;
		gtk_box_append (_tmp58_, (GtkWidget*) _tmp60_);
		_g_object_unref0 (_tmp60_);
	}
	_tmp63_ = dc_message_get_file_name (msg);
	_tmp64_ = _tmp63_;
	if (_tmp64_ != NULL) {
		const gchar* _tmp65_;
		const gchar* _tmp66_;
		gint _tmp67_;
		gint _tmp68_;
		_tmp65_ = dc_message_get_file_name (msg);
		_tmp66_ = _tmp65_;
		_tmp67_ = strlen (_tmp66_);
		_tmp68_ = _tmp67_;
		_tmp62_ = _tmp68_ > 0;
	} else {
		_tmp62_ = FALSE;
	}
	if (_tmp62_) {
		_tmp61_ = TRUE;
	} else {
		gboolean _tmp69_ = FALSE;
		const gchar* _tmp70_;
		const gchar* _tmp71_;
		_tmp70_ = dc_message_get_file_path (msg);
		_tmp71_ = _tmp70_;
		if (_tmp71_ != NULL) {
			const gchar* _tmp72_;
			const gchar* _tmp73_;
			gint _tmp74_;
			gint _tmp75_;
			_tmp72_ = dc_message_get_file_path (msg);
			_tmp73_ = _tmp72_;
			_tmp74_ = strlen (_tmp73_);
			_tmp75_ = _tmp74_;
			_tmp69_ = _tmp75_ > 0;
		} else {
			_tmp69_ = FALSE;
		}
		_tmp61_ = _tmp69_;
	}
	has_file = _tmp61_;
	image_shown = FALSE;
	if (has_file) {
		const gchar* _tmp79_;
		const gchar* _tmp80_;
		_tmp79_ = dc_message_get_file_path (msg);
		_tmp80_ = _tmp79_;
		_tmp78_ = _tmp80_ != NULL;
	} else {
		_tmp78_ = FALSE;
	}
	if (_tmp78_) {
		const gchar* _tmp81_;
		const gchar* _tmp82_;
		_tmp81_ = dc_message_get_file_path (msg);
		_tmp82_ = _tmp81_;
		_tmp77_ = g_file_test (_tmp82_, G_FILE_TEST_EXISTS);
	} else {
		_tmp77_ = FALSE;
	}
	if (_tmp77_) {
		_tmp76_ = dc_message_row_is_image_file (msg);
	} else {
		_tmp76_ = FALSE;
	}
	is_img = _tmp76_;
	if (is_img) {
		_tmp84_ = trailing_images != NULL;
	} else {
		_tmp84_ = FALSE;
	}
	if (_tmp84_) {
		gint _tmp85_;
		gint _tmp86_;
		_tmp85_ = vala_g_ptr_array_get_length (trailing_images);
		_tmp86_ = _tmp85_;
		_tmp83_ = _tmp86_ > 0;
	} else {
		_tmp83_ = FALSE;
	}
	if (_tmp83_) {
		GtkBox* strip = NULL;
		GtkBox* _tmp87_;
		GtkBox* _tmp88_;
		GtkBox* _tmp89_;
		GtkBox* _tmp96_;
		GtkBox* _tmp97_;
		dc_message_row_set_is_image (self, TRUE);
		_tmp87_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
		g_object_ref_sink (_tmp87_);
		strip = _tmp87_;
		_tmp88_ = strip;
		gtk_widget_set_halign ((GtkWidget*) _tmp88_, GTK_ALIGN_START);
		_tmp89_ = strip;
		dc_message_row_append_irc_image (_tmp89_, msg);
		{
			guint i = 0U;
			i = (guint) 0;
			{
				gboolean _tmp90_ = FALSE;
				_tmp90_ = TRUE;
				while (TRUE) {
					gint _tmp92_;
					gint _tmp93_;
					GtkBox* _tmp94_;
					gconstpointer _tmp95_;
					if (!_tmp90_) {
						guint _tmp91_;
						_tmp91_ = i;
						i = _tmp91_ + 1;
					}
					_tmp90_ = FALSE;
					_tmp92_ = vala_g_ptr_array_get_length (trailing_images);
					_tmp93_ = _tmp92_;
					if (!(i < ((guint) _tmp93_))) {
						break;
					}
					_tmp94_ = strip;
					_tmp95_ = g_ptr_array_index (trailing_images, i);
					dc_message_row_append_irc_image (_tmp94_, (DcMessage*) _tmp95_);
				}
			}
		}
		_tmp96_ = body;
		_tmp97_ = strip;
		gtk_box_append (_tmp96_, (GtkWidget*) _tmp97_);
		image_shown = TRUE;
		_g_object_unref0 (strip);
	} else {
		if (is_img) {
			GtkBox* single = NULL;
			GtkBox* _tmp98_;
			GtkBox* _tmp99_;
			GtkBox* _tmp100_;
			GtkBox* _tmp101_;
			GtkBox* _tmp102_;
			dc_message_row_set_is_image (self, TRUE);
			_tmp98_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
			g_object_ref_sink (_tmp98_);
			single = _tmp98_;
			_tmp99_ = single;
			gtk_widget_set_halign ((GtkWidget*) _tmp99_, GTK_ALIGN_START);
			_tmp100_ = single;
			dc_message_row_append_irc_image (_tmp100_, msg);
			_tmp101_ = body;
			_tmp102_ = single;
			gtk_box_append (_tmp101_, (GtkWidget*) _tmp102_);
			image_shown = TRUE;
			_g_object_unref0 (single);
		} else {
			gboolean _tmp103_ = FALSE;
			if (has_file) {
				_tmp103_ = dc_message_row_is_video_file (msg);
			} else {
				_tmp103_ = FALSE;
			}
			if (_tmp103_) {
				GtkBox* _tmp104_;
				GtkWidget* _tmp105_;
				GtkWidget* _tmp106_;
				_tmp104_ = body;
				_tmp105_ = dc_message_row_build_video_preview (msg);
				_tmp106_ = _tmp105_;
				gtk_box_append (_tmp104_, _tmp106_);
				_g_object_unref0 (_tmp106_);
				image_shown = TRUE;
			} else {
				gboolean _tmp107_ = FALSE;
				if (has_file) {
					_tmp107_ = dc_message_row_is_audio_file (msg);
				} else {
					_tmp107_ = FALSE;
				}
				if (_tmp107_) {
					GtkBox* _tmp108_;
					GtkWidget* _tmp109_;
					GtkWidget* _tmp110_;
					_tmp108_ = body;
					_tmp109_ = dc_message_row_build_audio_player (msg);
					_tmp110_ = _tmp109_;
					gtk_box_append (_tmp108_, _tmp110_);
					_g_object_unref0 (_tmp110_);
					image_shown = TRUE;
				}
			}
		}
	}
	if (has_file) {
		_tmp111_ = !image_shown;
	} else {
		_tmp111_ = FALSE;
	}
	if (_tmp111_) {
		GtkBox* fi = NULL;
		GtkBox* _tmp112_;
		GtkBox* _tmp113_;
		GtkBox* _tmp114_;
		GtkBox* _tmp115_;
		_tmp112_ = dc_message_row_build_file_indicator (msg);
		fi = _tmp112_;
		_tmp113_ = fi;
		gtk_widget_set_halign ((GtkWidget*) _tmp113_, GTK_ALIGN_START);
		_tmp114_ = body;
		_tmp115_ = fi;
		gtk_box_append (_tmp114_, (GtkWidget*) _tmp115_);
		_g_object_unref0 (fi);
	}
	_tmp117_ = dc_message_get_text (msg);
	_tmp118_ = _tmp117_;
	if (_tmp118_ != NULL) {
		const gchar* _tmp119_;
		const gchar* _tmp120_;
		gint _tmp121_;
		gint _tmp122_;
		_tmp119_ = dc_message_get_text (msg);
		_tmp120_ = _tmp119_;
		_tmp121_ = strlen (_tmp120_);
		_tmp122_ = _tmp121_;
		_tmp116_ = _tmp122_ > 0;
	} else {
		_tmp116_ = FALSE;
	}
	if (_tmp116_) {
		GtkBox* _tmp123_;
		GtkLabel* _tmp124_;
		GtkLabel* _tmp125_;
		_tmp123_ = body;
		_tmp124_ = dc_message_row_build_text_label (msg, -1);
		_tmp125_ = _tmp124_;
		gtk_box_append (_tmp123_, (GtkWidget*) _tmp125_);
		_g_object_unref0 (_tmp125_);
	}
	_tmp126_ = dc_message_row_build_reactions_box (msg);
	reactions_box = _tmp126_;
	_tmp127_ = reactions_box;
	if (_tmp127_ != NULL) {
		GtkBox* _tmp128_;
		GtkBox* _tmp129_;
		_tmp128_ = body;
		_tmp129_ = reactions_box;
		gtk_box_append (_tmp128_, (GtkWidget*) _tmp129_);
	}
	_tmp130_ = body;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp130_);
	_tmp131_ = dc_message_get_is_edited (msg);
	_tmp132_ = _tmp131_;
	if (_tmp132_) {
		GtkLabel* edited = NULL;
		GtkLabel* _tmp133_;
		GtkLabel* _tmp134_;
		GtkLabel* _tmp135_;
		_tmp133_ = dc_message_row_build_edited_indicator ("(edited)");
		edited = _tmp133_;
		_tmp134_ = edited;
		gtk_widget_set_valign ((GtkWidget*) _tmp134_, GTK_ALIGN_START);
		_tmp135_ = edited;
		gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp135_);
		_g_object_unref0 (edited);
	}
	_tmp136_ = dc_message_get_is_outgoing (msg);
	_tmp137_ = _tmp136_;
	if (_tmp137_) {
		GtkLabel* tick = NULL;
		GtkLabel* _tmp138_;
		GtkLabel* _tmp139_;
		_tmp138_ = dc_message_row_build_tick_indicator (msg);
		tick = _tmp138_;
		_tmp139_ = tick;
		if (_tmp139_ != NULL) {
			GtkLabel* _tmp140_;
			GtkLabel* _tmp141_;
			_tmp140_ = tick;
			gtk_widget_set_valign ((GtkWidget*) _tmp140_, GTK_ALIGN_START);
			_tmp141_ = tick;
			gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp141_);
		}
		_g_object_unref0 (tick);
	}
	_tmp142_ = dc_message_get_is_pinned (msg);
	_tmp143_ = _tmp142_;
	if (_tmp143_) {
		GtkLabel* pin_icon = NULL;
		GtkLabel* _tmp144_;
		GtkLabel* _tmp145_;
		GtkLabel* _tmp146_;
		GtkLabel* _tmp147_;
		_tmp144_ = (GtkLabel*) gtk_label_new ("📌");
		g_object_ref_sink (_tmp144_);
		pin_icon = _tmp144_;
		_tmp145_ = pin_icon;
		gtk_widget_add_css_class ((GtkWidget*) _tmp145_, "message-time");
		_tmp146_ = pin_icon;
		gtk_widget_set_valign ((GtkWidget*) _tmp146_, GTK_ALIGN_START);
		_tmp147_ = pin_icon;
		gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp147_);
		_g_object_unref0 (pin_icon);
	}
	_g_object_unref0 (reactions_box);
	_g_object_unref0 (body);
	_g_object_unref0 (sender_lbl);
	_g_free0 (sender);
	_g_object_unref0 (time_lbl);
	_g_free0 (time_str);
}

static void
dc_message_row_append_irc_image (GtkBox* strip,
                                 DcMessage* m)
{
	GtkPicture* picture = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GtkPicture* _tmp2_;
	GtkPicture* _tmp3_;
	g_return_if_fail (strip != NULL);
	g_return_if_fail (m != NULL);
	_tmp0_ = dc_message_get_file_path (m);
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_message_row_load_picture (_tmp1_, 260, 200, 0, 180);
	picture = _tmp2_;
	_tmp3_ = picture;
	if (_tmp3_ != NULL) {
		GtkPicture* _tmp4_;
		GtkPicture* _tmp5_;
		GtkPicture* _tmp6_;
		GtkPicture* _tmp7_;
		_tmp4_ = picture;
		gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "message-image-irc");
		_tmp5_ = picture;
		gtk_widget_set_halign ((GtkWidget*) _tmp5_, GTK_ALIGN_START);
		_tmp6_ = picture;
		gtk_widget_set_valign ((GtkWidget*) _tmp6_, GTK_ALIGN_START);
		_tmp7_ = picture;
		gtk_box_append (strip, (GtkWidget*) _tmp7_);
	} else {
		const gchar* _tmp8_ = NULL;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		GtkLabel* fi = NULL;
		GtkLabel* _tmp11_;
		GtkLabel* _tmp12_;
		GtkLabel* _tmp13_;
		_tmp9_ = dc_message_get_file_name (m);
		_tmp10_ = _tmp9_;
		_tmp8_ = _tmp10_;
		if (_tmp8_ == NULL) {
			_tmp8_ = "image";
		}
		_tmp11_ = (GtkLabel*) gtk_label_new (_tmp8_);
		g_object_ref_sink (_tmp11_);
		fi = _tmp11_;
		_tmp12_ = fi;
		gtk_widget_add_css_class ((GtkWidget*) _tmp12_, "dim-label");
		_tmp13_ = fi;
		gtk_box_append (strip, (GtkWidget*) _tmp13_);
		_g_object_unref0 (fi);
	}
	_g_object_unref0 (picture);
}

/**
         * Load a file into a Gtk.Picture sized to fit within (max_w, max_h)
         * preserving aspect, then optionally upscaled to (min_w, min_h).
         * Returns null on read failure (and logs to stderr).
         */
static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static GtkPicture*
dc_message_row_load_picture (const gchar* path,
                             gint max_w,
                             gint max_h,
                             gint min_w,
                             gint min_h)
{
	GError* _inner_error0_ = NULL;
	GtkPicture* result;
	g_return_val_if_fail (path != NULL, NULL);
	{
		GdkPixbuf* pixbuf = NULL;
		GdkPixbuf* _tmp0_;
		gint dw = 0;
		GdkPixbuf* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint dh = 0;
		GdkPixbuf* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gboolean _tmp7_ = FALSE;
		gboolean _tmp9_ = FALSE;
		gboolean _tmp10_ = FALSE;
		GdkPixbuf* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		GdkTexture* texture = NULL;
		GdkPixbuf* _tmp22_;
		GdkTexture* _tmp23_;
		GtkPicture* picture = NULL;
		GdkTexture* _tmp24_;
		GtkPicture* _tmp25_;
		GtkPicture* _tmp26_;
		GtkPicture* _tmp27_;
		GtkPicture* _tmp29_;
		GtkPicture* _tmp30_;
		_tmp0_ = gdk_pixbuf_new_from_file_at_scale (path, max_w, max_h, TRUE, &_inner_error0_);
		pixbuf = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = pixbuf;
		_tmp2_ = gdk_pixbuf_get_width (_tmp1_);
		_tmp3_ = _tmp2_;
		dw = _tmp3_;
		_tmp4_ = pixbuf;
		_tmp5_ = gdk_pixbuf_get_height (_tmp4_);
		_tmp6_ = _tmp5_;
		dh = _tmp6_;
		if (min_w > 0) {
			_tmp7_ = dw < min_w;
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			dh = (gint) ((((gdouble) dh) * min_w) / dw);
			dw = min_w;
		} else {
			gboolean _tmp8_ = FALSE;
			if (max_w > 0) {
				_tmp8_ = dw > max_w;
			} else {
				_tmp8_ = FALSE;
			}
			if (_tmp8_) {
				dh = (gint) ((((gdouble) dh) * max_w) / dw);
				dw = max_w;
			}
		}
		if (min_h > 0) {
			_tmp9_ = dh < min_h;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			dw = (gint) ((((gdouble) dw) * min_h) / dh);
			dh = min_h;
		}
		_tmp11_ = pixbuf;
		_tmp12_ = gdk_pixbuf_get_width (_tmp11_);
		_tmp13_ = _tmp12_;
		if (dw != _tmp13_) {
			_tmp10_ = TRUE;
		} else {
			GdkPixbuf* _tmp14_;
			gint _tmp15_;
			gint _tmp16_;
			_tmp14_ = pixbuf;
			_tmp15_ = gdk_pixbuf_get_height (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp10_ = dh != _tmp16_;
		}
		if (_tmp10_) {
			GdkPixbuf* scaled = NULL;
			GdkPixbuf* _tmp17_;
			GdkPixbuf* _tmp18_;
			GdkPixbuf* _tmp19_;
			_tmp17_ = pixbuf;
			_tmp18_ = gdk_pixbuf_scale_simple (_tmp17_, dw, dh, GDK_INTERP_BILINEAR);
			scaled = _tmp18_;
			_tmp19_ = scaled;
			if (_tmp19_ != NULL) {
				GdkPixbuf* _tmp20_;
				GdkPixbuf* _tmp21_;
				_tmp20_ = scaled;
				_tmp21_ = _g_object_ref0 (_tmp20_);
				_g_object_unref0 (pixbuf);
				pixbuf = _tmp21_;
			}
			_g_object_unref0 (scaled);
		}
		_tmp22_ = pixbuf;
		_tmp23_ = gdk_texture_new_for_pixbuf (_tmp22_);
		texture = _tmp23_;
		_tmp24_ = texture;
		_tmp25_ = (GtkPicture*) gtk_picture_new_for_paintable ((GdkPaintable*) _tmp24_);
		g_object_ref_sink (_tmp25_);
		picture = _tmp25_;
		_tmp26_ = picture;
		gtk_picture_set_content_fit (_tmp26_, GTK_CONTENT_FIT_CONTAIN);
		_tmp27_ = picture;
		gtk_picture_set_can_shrink (_tmp27_, TRUE);
		if (min_w > 0) {
			gint req_w = 0;
			gint req_h = 0;
			GtkPicture* _tmp28_;
			req_w = MIN (dw, min_w);
			req_h = MAX (1, (gint) (((((gint64) dh) * req_w) + (dw / 2)) / dw));
			_tmp28_ = picture;
			gtk_widget_set_size_request ((GtkWidget*) _tmp28_, MAX (1, req_w), req_h);
		}
		_tmp29_ = picture;
		gtk_widget_set_halign ((GtkWidget*) _tmp29_, GTK_ALIGN_START);
		_tmp30_ = picture;
		gtk_widget_add_css_class ((GtkWidget*) _tmp30_, "message-image");
		result = picture;
		_g_object_unref0 (texture);
		_g_object_unref0 (pixbuf);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FILE* _tmp31_;
		GError* _tmp32_;
		const gchar* _tmp33_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp31_ = stderr;
		_tmp32_ = e;
		_tmp33_ = _tmp32_->message;
		fprintf (_tmp31_, "  -> Image load failed: %s\n", _tmp33_);
		result = NULL;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gchar*
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;
}

gboolean
dc_message_row_is_image_only_message (DcMessage* m)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gboolean _tmp12_ = FALSE;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gboolean result;
	g_return_val_if_fail (m != NULL, FALSE);
	if (m == NULL) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp1_;
		gboolean _tmp2_;
		_tmp1_ = dc_message_get_is_info (m);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp4_ = dc_message_get_text (m);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != NULL) {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		_tmp6_ = dc_message_get_text (m);
		_tmp7_ = _tmp6_;
		_tmp8_ = string_strip (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = strlen (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp3_ = _tmp11_ > 0;
		_g_free0 (_tmp9_);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		result = FALSE;
		return result;
	}
	_tmp13_ = dc_message_get_file_path (m);
	_tmp14_ = _tmp13_;
	if (_tmp14_ == NULL) {
		_tmp12_ = TRUE;
	} else {
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		_tmp15_ = dc_message_get_file_path (m);
		_tmp16_ = _tmp15_;
		_tmp17_ = strlen (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp12_ = _tmp18_ == 0;
	}
	if (_tmp12_) {
		result = FALSE;
		return result;
	}
	result = dc_message_row_is_image_file (m);
	return result;
}

gboolean
dc_message_row_same_irc_sender (DcMessage* a,
                                DcMessage* b)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	const gchar* _tmp11_ = NULL;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* an = NULL;
	gchar* _tmp14_;
	const gchar* _tmp15_ = NULL;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* bn = NULL;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gboolean result;
	g_return_val_if_fail (a != NULL, FALSE);
	g_return_val_if_fail (b != NULL, FALSE);
	_tmp1_ = dc_message_get_is_info (a);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = dc_message_get_is_info (b);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp5_ = dc_message_get_is_outgoing (a);
	_tmp6_ = _tmp5_;
	_tmp7_ = dc_message_get_is_outgoing (b);
	_tmp8_ = _tmp7_;
	if (_tmp6_ != _tmp8_) {
		result = FALSE;
		return result;
	}
	_tmp9_ = dc_message_get_is_outgoing (a);
	_tmp10_ = _tmp9_;
	if (_tmp10_) {
		result = TRUE;
		return result;
	}
	_tmp12_ = dc_message_get_sender_name (a);
	_tmp13_ = _tmp12_;
	_tmp11_ = _tmp13_;
	if (_tmp11_ == NULL) {
		_tmp11_ = "";
	}
	_tmp14_ = g_strdup (_tmp11_);
	an = _tmp14_;
	_tmp16_ = dc_message_get_sender_name (b);
	_tmp17_ = _tmp16_;
	_tmp15_ = _tmp17_;
	if (_tmp15_ == NULL) {
		_tmp15_ = "";
	}
	_tmp18_ = g_strdup (_tmp15_);
	bn = _tmp18_;
	_tmp19_ = an;
	_tmp20_ = bn;
	result = g_strcmp0 (_tmp19_, _tmp20_) == 0;
	_g_free0 (bn);
	_g_free0 (an);
	return result;
}

static gchar*
dc_message_row_effective_sender_name (DcMessage* msg)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gchar* author = NULL;
	gchar* _tmp10_;
	const gchar* _tmp11_ = NULL;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp0_ = dc_message_get_is_outgoing (msg);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		gboolean _tmp2_ = FALSE;
		const gchar* _tmp3_;
		gchar* _tmp9_;
		_tmp3_ = dc_message_row_self_display_name;
		if (_tmp3_ != NULL) {
			const gchar* _tmp4_;
			gint _tmp5_;
			gint _tmp6_;
			_tmp4_ = dc_message_row_self_display_name;
			_tmp5_ = strlen (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp2_ = _tmp6_ > 0;
		} else {
			_tmp2_ = FALSE;
		}
		if (_tmp2_) {
			const gchar* _tmp7_;
			gchar* _tmp8_;
			_tmp7_ = dc_message_row_self_display_name;
			_tmp8_ = g_strdup (_tmp7_);
			result = _tmp8_;
			return result;
		}
		_tmp9_ = g_strdup ("me");
		result = _tmp9_;
		return result;
	}
	_tmp10_ = dc_message_row_effective_author_name (msg);
	author = _tmp10_;
	_tmp12_ = author;
	_tmp11_ = _tmp12_;
	if (_tmp11_ == NULL) {
		_tmp11_ = "?";
	}
	_tmp13_ = g_strdup (_tmp11_);
	result = _tmp13_;
	_g_free0 (author);
	return result;
}

/**
         * Display name for an incoming message's author. Prefers the overridden
         * sender name (mailing lists, bots, senders not in the group), shown
         * with a leading "~" per Delta Chat convention; otherwise the contact's
         * display name. Returns null when neither is known.
         */
static gchar*
dc_message_row_effective_author_name (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp10_ = FALSE;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp1_ = dc_message_get_override_sender_name (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		_tmp3_ = dc_message_get_override_sender_name (msg);
		_tmp4_ = _tmp3_;
		_tmp5_ = strlen (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp7_ = dc_message_get_override_sender_name (msg);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strconcat ("~", _tmp8_, NULL);
		result = _tmp9_;
		return result;
	}
	_tmp11_ = dc_message_get_sender_name (msg);
	_tmp12_ = _tmp11_;
	if (_tmp12_ != NULL) {
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		_tmp13_ = dc_message_get_sender_name (msg);
		_tmp14_ = _tmp13_;
		_tmp15_ = strlen (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp10_ = _tmp16_ > 0;
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		gchar* _tmp19_;
		_tmp17_ = dc_message_get_sender_name (msg);
		_tmp18_ = _tmp17_;
		_tmp19_ = g_strdup (_tmp18_);
		result = _tmp19_;
		return result;
	}
	result = NULL;
	return result;
}

/**
         * "Forwarded by <author>" for incoming messages where the forwarder is
         * known, otherwise a plain "Forwarded" marker. Delta Chat does not
         * preserve the original author of forwarded content, so the recoverable
         * identity is the forwarder (sender), exposed as the tooltip address.
         */
static GtkLabel*
dc_message_row_build_forwarded_indicator (DcMessage* msg)
{
	gchar* _tmp0_ = NULL;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gchar* author = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_ = NULL;
	const gchar* _tmp6_;
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp10_;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkLabel* _tmp13_;
	GtkLabel* _tmp14_;
	gboolean _tmp15_ = FALSE;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_;
	gboolean _tmp18_;
	GtkLabel* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp1_ = dc_message_get_is_outgoing (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		_g_free0 (_tmp0_);
		_tmp0_ = NULL;
	} else {
		gchar* _tmp3_;
		_tmp3_ = dc_message_row_effective_author_name (msg);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp3_;
	}
	_tmp4_ = _tmp0_;
	_tmp0_ = NULL;
	author = _tmp4_;
	_tmp6_ = author;
	if (_tmp6_ != NULL) {
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp7_ = author;
		_tmp8_ = g_strconcat ("↪ Forwarded by ", _tmp7_, NULL);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp8_;
	} else {
		gchar* _tmp9_;
		_tmp9_ = g_strdup ("↪ Forwarded");
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp9_;
	}
	_tmp10_ = (GtkLabel*) gtk_label_new (_tmp5_);
	g_object_ref_sink (_tmp10_);
	lbl = _tmp10_;
	_tmp11_ = lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp11_, "message-forwarded");
	_tmp12_ = lbl;
	gtk_widget_set_halign ((GtkWidget*) _tmp12_, GTK_ALIGN_START);
	_tmp13_ = lbl;
	gtk_label_set_xalign (_tmp13_, (gfloat) 0);
	_tmp14_ = lbl;
	gtk_label_set_ellipsize (_tmp14_, PANGO_ELLIPSIZE_END);
	_tmp17_ = dc_message_get_is_outgoing (msg);
	_tmp18_ = _tmp17_;
	if (!_tmp18_) {
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		_tmp19_ = dc_message_get_sender_address (msg);
		_tmp20_ = _tmp19_;
		_tmp16_ = _tmp20_ != NULL;
	} else {
		_tmp16_ = FALSE;
	}
	if (_tmp16_) {
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		_tmp21_ = dc_message_get_sender_address (msg);
		_tmp22_ = _tmp21_;
		_tmp23_ = strlen (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp15_ = _tmp24_ > 0;
	} else {
		_tmp15_ = FALSE;
	}
	if (_tmp15_) {
		GtkLabel* _tmp25_;
		const gchar* _tmp26_;
		const gchar* _tmp27_;
		_tmp25_ = lbl;
		_tmp26_ = dc_message_get_sender_address (msg);
		_tmp27_ = _tmp26_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp25_, _tmp27_);
	}
	result = lbl;
	_g_free0 (_tmp5_);
	_g_free0 (author);
	_g_free0 (_tmp0_);
	return result;
}

static GtkLabel*
dc_message_row_build_edited_indicator (const gchar* text)
{
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* result;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (text);
	g_object_ref_sink (_tmp0_);
	lbl = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) lbl, "message-edited");
	gtk_widget_set_tooltip_text ((GtkWidget*) lbl, "This message was edited");
	result = lbl;
	return result;
}

static void
dc_message_row_build_info_row (DcMessageRow* self,
                               DcMessage* msg)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (msg != NULL);
	_tmp1_ = dc_message_get_text (msg);
	_tmp2_ = _tmp1_;
	_tmp0_ = _tmp2_;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp3_ = (GtkLabel*) gtk_label_new (_tmp0_);
	g_object_ref_sink (_tmp3_);
	label = _tmp3_;
	gtk_widget_add_css_class ((GtkWidget*) label, "dim-label");
	gtk_widget_add_css_class ((GtkWidget*) label, "caption");
	gtk_widget_set_hexpand ((GtkWidget*) label, TRUE);
	gtk_widget_set_halign ((GtkWidget*) label, GTK_ALIGN_CENTER);
	gtk_label_set_justify (label, GTK_JUSTIFY_CENTER);
	gtk_widget_set_margin_top ((GtkWidget*) label, 4);
	gtk_widget_set_margin_bottom ((GtkWidget*) label, 4);
	gtk_label_set_wrap (label, TRUE);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) label);
	_g_object_unref0 (label);
}

gboolean
dc_message_row_is_image_file (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gboolean result;
	g_return_val_if_fail (msg != NULL, FALSE);
	_tmp1_ = dc_message_get_file_mime (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = dc_message_get_file_mime (msg);
		_tmp4_ = _tmp3_;
		_tmp0_ = g_str_has_prefix (_tmp4_, "image/");
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	_tmp5_ = dc_message_get_view_type (msg);
	_tmp6_ = _tmp5_;
	if (_tmp6_ != NULL) {
		gchar* vt = NULL;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gboolean _tmp10_ = FALSE;
		gboolean _tmp11_ = FALSE;
		const gchar* _tmp12_;
		_tmp7_ = dc_message_get_view_type (msg);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_utf8_strdown (_tmp8_, (gssize) -1);
		vt = _tmp9_;
		_tmp12_ = vt;
		if (g_strcmp0 (_tmp12_, "image") == 0) {
			_tmp11_ = TRUE;
		} else {
			const gchar* _tmp13_;
			_tmp13_ = vt;
			_tmp11_ = g_strcmp0 (_tmp13_, "gif") == 0;
		}
		if (_tmp11_) {
			_tmp10_ = TRUE;
		} else {
			const gchar* _tmp14_;
			_tmp14_ = vt;
			_tmp10_ = g_strcmp0 (_tmp14_, "sticker") == 0;
		}
		if (_tmp10_) {
			result = TRUE;
			_g_free0 (vt);
			return result;
		}
		_g_free0 (vt);
	}
	_tmp15_ = dc_message_get_file_path (msg);
	_tmp16_ = _tmp15_;
	if (_tmp16_ != NULL) {
		gchar* lower = NULL;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		gchar* _tmp19_;
		gboolean _tmp20_ = FALSE;
		gboolean _tmp21_ = FALSE;
		gboolean _tmp22_ = FALSE;
		gboolean _tmp23_ = FALSE;
		gboolean _tmp24_ = FALSE;
		gboolean _tmp25_ = FALSE;
		const gchar* _tmp26_;
		_tmp17_ = dc_message_get_file_path (msg);
		_tmp18_ = _tmp17_;
		_tmp19_ = g_utf8_strdown (_tmp18_, (gssize) -1);
		lower = _tmp19_;
		_tmp26_ = lower;
		if (g_str_has_suffix (_tmp26_, ".jpg")) {
			_tmp25_ = TRUE;
		} else {
			const gchar* _tmp27_;
			_tmp27_ = lower;
			_tmp25_ = g_str_has_suffix (_tmp27_, ".jpeg");
		}
		if (_tmp25_) {
			_tmp24_ = TRUE;
		} else {
			const gchar* _tmp28_;
			_tmp28_ = lower;
			_tmp24_ = g_str_has_suffix (_tmp28_, ".png");
		}
		if (_tmp24_) {
			_tmp23_ = TRUE;
		} else {
			const gchar* _tmp29_;
			_tmp29_ = lower;
			_tmp23_ = g_str_has_suffix (_tmp29_, ".webp");
		}
		if (_tmp23_) {
			_tmp22_ = TRUE;
		} else {
			const gchar* _tmp30_;
			_tmp30_ = lower;
			_tmp22_ = g_str_has_suffix (_tmp30_, ".gif");
		}
		if (_tmp22_) {
			_tmp21_ = TRUE;
		} else {
			const gchar* _tmp31_;
			_tmp31_ = lower;
			_tmp21_ = g_str_has_suffix (_tmp31_, ".bmp");
		}
		if (_tmp21_) {
			_tmp20_ = TRUE;
		} else {
			const gchar* _tmp32_;
			_tmp32_ = lower;
			_tmp20_ = g_str_has_suffix (_tmp32_, ".svg");
		}
		if (_tmp20_) {
			result = TRUE;
			_g_free0 (lower);
			return result;
		}
		_g_free0 (lower);
	}
	result = FALSE;
	return result;
}

gboolean
dc_message_row_is_video_file (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gboolean result;
	g_return_val_if_fail (msg != NULL, FALSE);
	_tmp1_ = dc_message_get_file_mime (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = dc_message_get_file_mime (msg);
		_tmp4_ = _tmp3_;
		_tmp0_ = g_str_has_prefix (_tmp4_, "video/");
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	_tmp6_ = dc_message_get_view_type (msg);
	_tmp7_ = _tmp6_;
	if (_tmp7_ != NULL) {
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp8_ = dc_message_get_view_type (msg);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_utf8_strdown (_tmp9_, (gssize) -1);
		_tmp11_ = _tmp10_;
		_tmp5_ = g_strcmp0 (_tmp11_, "video") == 0;
		_g_free0 (_tmp11_);
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		result = TRUE;
		return result;
	}
	_tmp12_ = dc_message_get_file_path (msg);
	_tmp13_ = _tmp12_;
	if (_tmp13_ != NULL) {
		gchar* lower = NULL;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_ = FALSE;
		gboolean _tmp19_ = FALSE;
		gboolean _tmp20_ = FALSE;
		gboolean _tmp21_ = FALSE;
		gboolean _tmp22_ = FALSE;
		gboolean _tmp23_ = FALSE;
		gboolean _tmp24_ = FALSE;
		gboolean _tmp25_ = FALSE;
		const gchar* _tmp26_;
		_tmp14_ = dc_message_get_file_path (msg);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_utf8_strdown (_tmp15_, (gssize) -1);
		lower = _tmp16_;
		_tmp26_ = lower;
		if (g_str_has_suffix (_tmp26_, ".mp4")) {
			_tmp25_ = TRUE;
		} else {
			const gchar* _tmp27_;
			_tmp27_ = lower;
			_tmp25_ = g_str_has_suffix (_tmp27_, ".m4v");
		}
		if (_tmp25_) {
			_tmp24_ = TRUE;
		} else {
			const gchar* _tmp28_;
			_tmp28_ = lower;
			_tmp24_ = g_str_has_suffix (_tmp28_, ".webm");
		}
		if (_tmp24_) {
			_tmp23_ = TRUE;
		} else {
			const gchar* _tmp29_;
			_tmp29_ = lower;
			_tmp23_ = g_str_has_suffix (_tmp29_, ".mkv");
		}
		if (_tmp23_) {
			_tmp22_ = TRUE;
		} else {
			const gchar* _tmp30_;
			_tmp30_ = lower;
			_tmp22_ = g_str_has_suffix (_tmp30_, ".mov");
		}
		if (_tmp22_) {
			_tmp21_ = TRUE;
		} else {
			const gchar* _tmp31_;
			_tmp31_ = lower;
			_tmp21_ = g_str_has_suffix (_tmp31_, ".avi");
		}
		if (_tmp21_) {
			_tmp20_ = TRUE;
		} else {
			const gchar* _tmp32_;
			_tmp32_ = lower;
			_tmp20_ = g_str_has_suffix (_tmp32_, ".ogv");
		}
		if (_tmp20_) {
			_tmp19_ = TRUE;
		} else {
			const gchar* _tmp33_;
			_tmp33_ = lower;
			_tmp19_ = g_str_has_suffix (_tmp33_, ".3gp");
		}
		if (_tmp19_) {
			_tmp18_ = TRUE;
		} else {
			const gchar* _tmp34_;
			_tmp34_ = lower;
			_tmp18_ = g_str_has_suffix (_tmp34_, ".wmv");
		}
		if (_tmp18_) {
			_tmp17_ = TRUE;
		} else {
			const gchar* _tmp35_;
			_tmp35_ = lower;
			_tmp17_ = g_str_has_suffix (_tmp35_, ".flv");
		}
		if (_tmp17_) {
			result = TRUE;
			_g_free0 (lower);
			return result;
		}
		_g_free0 (lower);
	}
	result = FALSE;
	return result;
}

gboolean
dc_message_row_is_audio_file (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gboolean result;
	g_return_val_if_fail (msg != NULL, FALSE);
	_tmp1_ = dc_message_get_file_mime (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = dc_message_get_file_mime (msg);
		_tmp4_ = _tmp3_;
		_tmp0_ = g_str_has_prefix (_tmp4_, "audio/");
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	_tmp5_ = dc_message_get_view_type (msg);
	_tmp6_ = _tmp5_;
	if (_tmp6_ != NULL) {
		gchar* vt = NULL;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gboolean _tmp10_ = FALSE;
		const gchar* _tmp11_;
		_tmp7_ = dc_message_get_view_type (msg);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_utf8_strdown (_tmp8_, (gssize) -1);
		vt = _tmp9_;
		_tmp11_ = vt;
		if (g_strcmp0 (_tmp11_, "audio") == 0) {
			_tmp10_ = TRUE;
		} else {
			const gchar* _tmp12_;
			_tmp12_ = vt;
			_tmp10_ = g_strcmp0 (_tmp12_, "voice") == 0;
		}
		if (_tmp10_) {
			result = TRUE;
			_g_free0 (vt);
			return result;
		}
		_g_free0 (vt);
	}
	_tmp13_ = dc_message_get_file_path (msg);
	_tmp14_ = _tmp13_;
	if (_tmp14_ != NULL) {
		gchar* lower = NULL;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		gchar* _tmp17_;
		gboolean _tmp18_ = FALSE;
		gboolean _tmp19_ = FALSE;
		gboolean _tmp20_ = FALSE;
		gboolean _tmp21_ = FALSE;
		gboolean _tmp22_ = FALSE;
		gboolean _tmp23_ = FALSE;
		gboolean _tmp24_ = FALSE;
		gboolean _tmp25_ = FALSE;
		gboolean _tmp26_ = FALSE;
		const gchar* _tmp27_;
		_tmp15_ = dc_message_get_file_path (msg);
		_tmp16_ = _tmp15_;
		_tmp17_ = g_utf8_strdown (_tmp16_, (gssize) -1);
		lower = _tmp17_;
		_tmp27_ = lower;
		if (g_str_has_suffix (_tmp27_, ".mp3")) {
			_tmp26_ = TRUE;
		} else {
			const gchar* _tmp28_;
			_tmp28_ = lower;
			_tmp26_ = g_str_has_suffix (_tmp28_, ".ogg");
		}
		if (_tmp26_) {
			_tmp25_ = TRUE;
		} else {
			const gchar* _tmp29_;
			_tmp29_ = lower;
			_tmp25_ = g_str_has_suffix (_tmp29_, ".oga");
		}
		if (_tmp25_) {
			_tmp24_ = TRUE;
		} else {
			const gchar* _tmp30_;
			_tmp30_ = lower;
			_tmp24_ = g_str_has_suffix (_tmp30_, ".opus");
		}
		if (_tmp24_) {
			_tmp23_ = TRUE;
		} else {
			const gchar* _tmp31_;
			_tmp31_ = lower;
			_tmp23_ = g_str_has_suffix (_tmp31_, ".wav");
		}
		if (_tmp23_) {
			_tmp22_ = TRUE;
		} else {
			const gchar* _tmp32_;
			_tmp32_ = lower;
			_tmp22_ = g_str_has_suffix (_tmp32_, ".m4a");
		}
		if (_tmp22_) {
			_tmp21_ = TRUE;
		} else {
			const gchar* _tmp33_;
			_tmp33_ = lower;
			_tmp21_ = g_str_has_suffix (_tmp33_, ".aac");
		}
		if (_tmp21_) {
			_tmp20_ = TRUE;
		} else {
			const gchar* _tmp34_;
			_tmp34_ = lower;
			_tmp20_ = g_str_has_suffix (_tmp34_, ".flac");
		}
		if (_tmp20_) {
			_tmp19_ = TRUE;
		} else {
			const gchar* _tmp35_;
			_tmp35_ = lower;
			_tmp19_ = g_str_has_suffix (_tmp35_, ".weba");
		}
		if (_tmp19_) {
			_tmp18_ = TRUE;
		} else {
			const gchar* _tmp36_;
			_tmp36_ = lower;
			_tmp18_ = g_str_has_suffix (_tmp36_, ".amr");
		}
		if (_tmp18_) {
			result = TRUE;
			_g_free0 (lower);
			return result;
		}
		_g_free0 (lower);
	}
	result = FALSE;
	return result;
}

/**
         * Inline preview for a video attachment: a dark thumbnail-sized card
         * with a centered play glyph and the file name. Purely visual — the
         * click is handled by the conversation view, which opens the
         * fullscreen player (mirrors how images open the image viewer).
         */
static GtkWidget*
dc_message_row_build_video_preview (DcMessage* msg)
{
	GtkOverlay* overlay = NULL;
	GtkOverlay* _tmp0_;
	GtkOverlay* _tmp1_;
	GtkPicture* bg = NULL;
	GdkPaintable* _tmp2_;
	GdkPaintable* _tmp3_;
	GtkPicture* _tmp4_;
	GtkPicture* _tmp5_;
	GtkPicture* _tmp6_;
	GtkPicture* _tmp7_;
	GtkOverlay* _tmp8_;
	GtkPicture* _tmp9_;
	GtkImage* play = NULL;
	GtkImage* _tmp10_;
	GtkImage* _tmp11_;
	GtkImage* _tmp12_;
	GtkImage* _tmp13_;
	GtkImage* _tmp14_;
	GtkOverlay* _tmp15_;
	GtkImage* _tmp16_;
	gboolean _tmp17_ = FALSE;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	GtkWidget* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp0_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp0_);
	overlay = _tmp0_;
	_tmp1_ = overlay;
	gtk_widget_set_halign ((GtkWidget*) _tmp1_, GTK_ALIGN_START);
	_tmp2_ = gdk_paintable_new_empty (260, 150);
	_tmp3_ = _tmp2_;
	_tmp4_ = (GtkPicture*) gtk_picture_new_for_paintable (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	bg = _tmp5_;
	_tmp6_ = bg;
	gtk_picture_set_can_shrink (_tmp6_, TRUE);
	_tmp7_ = bg;
	gtk_widget_add_css_class ((GtkWidget*) _tmp7_, "message-video-bg");
	_tmp8_ = overlay;
	_tmp9_ = bg;
	gtk_overlay_set_child (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = (GtkImage*) gtk_image_new_from_icon_name ("media-playback-start-symbolic");
	g_object_ref_sink (_tmp10_);
	play = _tmp10_;
	_tmp11_ = play;
	gtk_widget_add_css_class ((GtkWidget*) _tmp11_, "message-video-play");
	_tmp12_ = play;
	gtk_image_set_pixel_size (_tmp12_, 48);
	_tmp13_ = play;
	gtk_widget_set_halign ((GtkWidget*) _tmp13_, GTK_ALIGN_CENTER);
	_tmp14_ = play;
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	_tmp15_ = overlay;
	_tmp16_ = play;
	gtk_overlay_add_overlay (_tmp15_, (GtkWidget*) _tmp16_);
	_tmp18_ = dc_message_get_file_name (msg);
	_tmp19_ = _tmp18_;
	if (_tmp19_ != NULL) {
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		gint _tmp22_;
		gint _tmp23_;
		_tmp20_ = dc_message_get_file_name (msg);
		_tmp21_ = _tmp20_;
		_tmp22_ = strlen (_tmp21_);
		_tmp23_ = _tmp22_;
		_tmp17_ = _tmp23_ > 0;
	} else {
		_tmp17_ = FALSE;
	}
	if (_tmp17_) {
		GtkLabel* name = NULL;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		GtkLabel* _tmp26_;
		GtkLabel* _tmp27_;
		GtkLabel* _tmp28_;
		GtkLabel* _tmp29_;
		GtkLabel* _tmp30_;
		GtkLabel* _tmp31_;
		GtkLabel* _tmp32_;
		GtkLabel* _tmp33_;
		GtkLabel* _tmp34_;
		GtkLabel* _tmp35_;
		GtkOverlay* _tmp36_;
		GtkLabel* _tmp37_;
		_tmp24_ = dc_message_get_file_name (msg);
		_tmp25_ = _tmp24_;
		_tmp26_ = (GtkLabel*) gtk_label_new (_tmp25_);
		g_object_ref_sink (_tmp26_);
		name = _tmp26_;
		_tmp27_ = name;
		gtk_widget_add_css_class ((GtkWidget*) _tmp27_, "message-video-name");
		_tmp28_ = name;
		gtk_label_set_ellipsize (_tmp28_, PANGO_ELLIPSIZE_MIDDLE);
		_tmp29_ = name;
		gtk_label_set_max_width_chars (_tmp29_, 30);
		_tmp30_ = name;
		gtk_widget_set_halign ((GtkWidget*) _tmp30_, GTK_ALIGN_START);
		_tmp31_ = name;
		gtk_widget_set_valign ((GtkWidget*) _tmp31_, GTK_ALIGN_END);
		_tmp32_ = name;
		gtk_label_set_xalign (_tmp32_, (gfloat) 0);
		_tmp33_ = name;
		gtk_widget_set_margin_start ((GtkWidget*) _tmp33_, 8);
		_tmp34_ = name;
		gtk_widget_set_margin_end ((GtkWidget*) _tmp34_, 8);
		_tmp35_ = name;
		gtk_widget_set_margin_bottom ((GtkWidget*) _tmp35_, 6);
		_tmp36_ = overlay;
		_tmp37_ = name;
		gtk_overlay_add_overlay (_tmp36_, (GtkWidget*) _tmp37_);
		_g_object_unref0 (name);
	}
	result = (GtkWidget*) overlay;
	_g_object_unref0 (play);
	_g_object_unref0 (bg);
	return result;
}

/**
         * Inline player for an audio attachment: a compact play/stop button
         * (see AudioPlayer). Falls back to a plain attachment row when the
         * file hasn't been downloaded yet.
         */
static GtkWidget*
dc_message_row_build_audio_player (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	DcAudioPlayer* _tmp10_;
	GtkWidget* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp1_ = dc_message_get_file_path (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = dc_message_get_file_path (msg);
		_tmp4_ = _tmp3_;
		_tmp0_ = !g_file_test (_tmp4_, G_FILE_TEST_EXISTS);
	}
	if (_tmp0_) {
		GtkBox* _tmp5_;
		_tmp5_ = dc_message_row_build_file_indicator (msg);
		result = (GtkWidget*) _tmp5_;
		return result;
	}
	_tmp6_ = dc_message_get_file_path (msg);
	_tmp7_ = _tmp6_;
	_tmp8_ = dc_message_get_file_name (msg);
	_tmp9_ = _tmp8_;
	_tmp10_ = dc_audio_player_new (_tmp7_, _tmp9_);
	g_object_ref_sink (_tmp10_);
	result = (GtkWidget*) _tmp10_;
	return result;
}

static GtkBox*
dc_message_row_build_file_indicator (DcMessage* msg)
{
	GtkBox* file_box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkImage* icon = NULL;
	GtkImage* _tmp2_;
	GtkImage* _tmp3_;
	GtkBox* _tmp4_;
	GtkImage* _tmp5_;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	GtkLabel* fname = NULL;
	GtkLabel* _tmp9_;
	GtkBox* _tmp10_;
	GtkBox* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp0_);
	file_box = _tmp0_;
	_tmp1_ = file_box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "message-attachment");
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("mail-attachment-symbolic");
	g_object_ref_sink (_tmp2_);
	icon = _tmp2_;
	_tmp3_ = icon;
	gtk_image_set_pixel_size (_tmp3_, 16);
	_tmp4_ = file_box;
	_tmp5_ = icon;
	gtk_box_append (_tmp4_, (GtkWidget*) _tmp5_);
	_tmp7_ = dc_message_get_file_name (msg);
	_tmp8_ = _tmp7_;
	_tmp6_ = _tmp8_;
	if (_tmp6_ == NULL) {
		_tmp6_ = "file";
	}
	_tmp9_ = (GtkLabel*) gtk_label_new (_tmp6_);
	g_object_ref_sink (_tmp9_);
	fname = _tmp9_;
	gtk_widget_add_css_class ((GtkWidget*) fname, "dim-label");
	gtk_label_set_ellipsize (fname, PANGO_ELLIPSIZE_MIDDLE);
	gtk_label_set_max_width_chars (fname, 28);
	_tmp10_ = file_box;
	gtk_box_append (_tmp10_, (GtkWidget*) fname);
	result = file_box;
	_g_object_unref0 (fname);
	_g_object_unref0 (icon);
	return result;
}

static GtkLabel*
dc_message_row_build_tick_indicator (DcMessage* msg)
{
	gchar* glyph = NULL;
	gchar* extra_class = NULL;
	gchar* tooltip = NULL;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GtkLabel* lbl = NULL;
	const gchar* _tmp20_;
	GtkLabel* _tmp21_;
	GtkLabel* _tmp22_;
	GtkLabel* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	GtkLabel* result;
	g_return_val_if_fail (msg != NULL, NULL);
	tooltip = NULL;
	_tmp0_ = dc_message_get_is_failed (msg);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp2_ = g_strdup ("⚠");
		_g_free0 (glyph);
		glyph = _tmp2_;
		_tmp3_ = g_strdup ("message-tick-failed");
		_g_free0 (extra_class);
		extra_class = _tmp3_;
		_tmp4_ = g_strdup ("Sending failed");
		_g_free0 (tooltip);
		tooltip = _tmp4_;
	} else {
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp5_ = dc_message_get_is_read (msg);
		_tmp6_ = _tmp5_;
		if (_tmp6_) {
			gchar* _tmp7_;
			gchar* _tmp8_;
			gchar* _tmp9_;
			_tmp7_ = g_strdup ("✓✓");
			_g_free0 (glyph);
			glyph = _tmp7_;
			_tmp8_ = g_strdup ("message-tick-read");
			_g_free0 (extra_class);
			extra_class = _tmp8_;
			_tmp9_ = g_strdup ("Read");
			_g_free0 (tooltip);
			tooltip = _tmp9_;
		} else {
			gboolean _tmp10_;
			gboolean _tmp11_;
			_tmp10_ = dc_message_get_is_delivered (msg);
			_tmp11_ = _tmp10_;
			if (_tmp11_) {
				gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				_tmp12_ = g_strdup ("✓");
				_g_free0 (glyph);
				glyph = _tmp12_;
				_tmp13_ = g_strdup ("message-tick");
				_g_free0 (extra_class);
				extra_class = _tmp13_;
				_tmp14_ = g_strdup ("Delivered");
				_g_free0 (tooltip);
				tooltip = _tmp14_;
			} else {
				gboolean _tmp15_;
				gboolean _tmp16_;
				_tmp15_ = dc_message_get_is_pending (msg);
				_tmp16_ = _tmp15_;
				if (_tmp16_) {
					gchar* _tmp17_;
					gchar* _tmp18_;
					gchar* _tmp19_;
					_tmp17_ = g_strdup ("⧖");
					_g_free0 (glyph);
					glyph = _tmp17_;
					_tmp18_ = g_strdup ("message-tick");
					_g_free0 (extra_class);
					extra_class = _tmp18_;
					_tmp19_ = g_strdup ("Sending…");
					_g_free0 (tooltip);
					tooltip = _tmp19_;
				} else {
					result = NULL;
					_g_free0 (tooltip);
					_g_free0 (extra_class);
					_g_free0 (glyph);
					return result;
				}
			}
		}
	}
	_tmp20_ = glyph;
	_tmp21_ = (GtkLabel*) gtk_label_new (_tmp20_);
	g_object_ref_sink (_tmp21_);
	lbl = _tmp21_;
	_tmp22_ = lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp22_, "message-time");
	_tmp23_ = lbl;
	_tmp24_ = extra_class;
	gtk_widget_add_css_class ((GtkWidget*) _tmp23_, _tmp24_);
	_tmp25_ = tooltip;
	if (_tmp25_ != NULL) {
		GtkLabel* _tmp26_;
		const gchar* _tmp27_;
		_tmp26_ = lbl;
		_tmp27_ = tooltip;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp26_, _tmp27_);
	}
	result = lbl;
	_g_free0 (tooltip);
	_g_free0 (extra_class);
	_g_free0 (glyph);
	return result;
}

static Block17Data*
block17_data_ref (Block17Data* _data17_)
{
	g_atomic_int_inc (&_data17_->_ref_count_);
	return _data17_;
}

static void
block17_data_unref (void * _userdata_)
{
	Block17Data* _data17_;
	_data17_ = (Block17Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
		DcMessageRow* self;
		self = _data17_->self;
		_g_object_unref0 (self);
		g_slice_free (Block17Data, _data17_);
	}
}

static void
___lambda71_ (Block17Data* _data17_)
{
	DcMessageRow* self;
	self = _data17_->self;
	g_signal_emit (self, dc_message_row_signals[DC_MESSAGE_ROW_QUOTE_CLICKED_SIGNAL], 0, _data17_->qid);
}

static void
____lambda71__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda71_ (self);
}

static GtkButton*
dc_message_row_build_quote_block (DcMessageRow* self,
                                  DcMessage* msg,
                                  gint max_width_chars,
                                  gint lines)
{
	GtkButton* btn = NULL;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean stacked = FALSE;
	GtkButton* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp0_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp0_);
	btn = _tmp0_;
	_tmp1_ = btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "flat");
	_tmp2_ = btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "quote-block");
	_tmp3_ = dc_message_get_quote_msg_id (msg);
	_tmp4_ = _tmp3_;
	if (_tmp4_ > 0) {
		Block17Data* _data17_;
		gint _tmp5_;
		gint _tmp6_;
		GtkButton* _tmp7_;
		_data17_ = g_slice_new0 (Block17Data);
		_data17_->_ref_count_ = 1;
		_data17_->self = g_object_ref (self);
		_tmp5_ = dc_message_get_quote_msg_id (msg);
		_tmp6_ = _tmp5_;
		_data17_->qid = _tmp6_;
		_tmp7_ = btn;
		g_signal_connect_data (_tmp7_, "clicked", (GCallback) ____lambda71__gtk_button_clicked, block17_data_ref (_data17_), (GClosureNotify) block17_data_unref, 0);
		block17_data_unref (_data17_);
		_data17_ = NULL;
	}
	if (lines > 1) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp10_ = dc_message_get_quote_sender_name (msg);
		_tmp11_ = _tmp10_;
		_tmp9_ = _tmp11_ != NULL;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		gint _tmp14_;
		gint _tmp15_;
		_tmp12_ = dc_message_get_quote_sender_name (msg);
		_tmp13_ = _tmp12_;
		_tmp14_ = strlen (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp8_ = _tmp15_ > 0;
	} else {
		_tmp8_ = FALSE;
	}
	stacked = _tmp8_;
	if (stacked) {
		GtkBox* box = NULL;
		GtkBox* _tmp16_;
		GtkLabel* s = NULL;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		GtkLabel* _tmp19_;
		GtkLabel* _tmp20_;
		GtkLabel* _tmp21_;
		GtkLabel* _tmp22_;
		GtkBox* _tmp23_;
		GtkLabel* _tmp24_;
		GtkLabel* t = NULL;
		const gchar* _tmp25_;
		const gchar* _tmp26_;
		GtkLabel* _tmp27_;
		GtkLabel* _tmp28_;
		GtkLabel* _tmp29_;
		GtkLabel* _tmp30_;
		GtkLabel* _tmp31_;
		GtkLabel* _tmp32_;
		GtkLabel* _tmp33_;
		GtkBox* _tmp34_;
		GtkLabel* _tmp35_;
		GtkButton* _tmp36_;
		GtkBox* _tmp37_;
		_tmp16_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
		g_object_ref_sink (_tmp16_);
		box = _tmp16_;
		_tmp17_ = dc_message_get_quote_sender_name (msg);
		_tmp18_ = _tmp17_;
		_tmp19_ = (GtkLabel*) gtk_label_new (_tmp18_);
		g_object_ref_sink (_tmp19_);
		s = _tmp19_;
		_tmp20_ = s;
		gtk_widget_add_css_class ((GtkWidget*) _tmp20_, "quote-sender");
		_tmp21_ = s;
		gtk_widget_set_halign ((GtkWidget*) _tmp21_, GTK_ALIGN_START);
		_tmp22_ = s;
		gtk_label_set_xalign (_tmp22_, (gfloat) 0);
		_tmp23_ = box;
		_tmp24_ = s;
		gtk_box_append (_tmp23_, (GtkWidget*) _tmp24_);
		_tmp25_ = dc_message_get_quote_text (msg);
		_tmp26_ = _tmp25_;
		_tmp27_ = (GtkLabel*) gtk_label_new (_tmp26_);
		g_object_ref_sink (_tmp27_);
		t = _tmp27_;
		_tmp28_ = t;
		gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "quote-text");
		_tmp29_ = t;
		gtk_widget_set_halign ((GtkWidget*) _tmp29_, GTK_ALIGN_START);
		_tmp30_ = t;
		gtk_label_set_xalign (_tmp30_, (gfloat) 0);
		_tmp31_ = t;
		gtk_label_set_ellipsize (_tmp31_, PANGO_ELLIPSIZE_END);
		_tmp32_ = t;
		gtk_label_set_max_width_chars (_tmp32_, max_width_chars);
		_tmp33_ = t;
		gtk_label_set_lines (_tmp33_, lines);
		_tmp34_ = box;
		_tmp35_ = t;
		gtk_box_append (_tmp34_, (GtkWidget*) _tmp35_);
		_tmp36_ = btn;
		_tmp37_ = box;
		gtk_button_set_child (_tmp36_, (GtkWidget*) _tmp37_);
		_g_object_unref0 (t);
		_g_object_unref0 (s);
		_g_object_unref0 (box);
	} else {
		gchar* _tmp38_ = NULL;
		gboolean _tmp39_ = FALSE;
		const gchar* _tmp40_;
		const gchar* _tmp41_;
		gchar* prefix = NULL;
		gchar* _tmp50_;
		GtkLabel* t = NULL;
		const gchar* _tmp51_;
		const gchar* _tmp52_;
		const gchar* _tmp53_;
		gchar* _tmp54_;
		gchar* _tmp55_;
		GtkLabel* _tmp56_;
		GtkLabel* _tmp57_;
		GtkLabel* _tmp58_;
		GtkLabel* _tmp59_;
		GtkLabel* _tmp60_;
		GtkLabel* _tmp61_;
		GtkLabel* _tmp62_;
		GtkLabel* _tmp63_;
		GtkButton* _tmp64_;
		GtkLabel* _tmp65_;
		_tmp40_ = dc_message_get_quote_sender_name (msg);
		_tmp41_ = _tmp40_;
		if (_tmp41_ != NULL) {
			const gchar* _tmp42_;
			const gchar* _tmp43_;
			gint _tmp44_;
			gint _tmp45_;
			_tmp42_ = dc_message_get_quote_sender_name (msg);
			_tmp43_ = _tmp42_;
			_tmp44_ = strlen (_tmp43_);
			_tmp45_ = _tmp44_;
			_tmp39_ = _tmp45_ > 0;
		} else {
			_tmp39_ = FALSE;
		}
		if (_tmp39_) {
			const gchar* _tmp46_;
			const gchar* _tmp47_;
			gchar* _tmp48_;
			_tmp46_ = dc_message_get_quote_sender_name (msg);
			_tmp47_ = _tmp46_;
			_tmp48_ = g_strconcat (_tmp47_, ": ", NULL);
			_g_free0 (_tmp38_);
			_tmp38_ = _tmp48_;
		} else {
			gchar* _tmp49_;
			_tmp49_ = g_strdup ("");
			_g_free0 (_tmp38_);
			_tmp38_ = _tmp49_;
		}
		_tmp50_ = _tmp38_;
		_tmp38_ = NULL;
		prefix = _tmp50_;
		_tmp51_ = prefix;
		_tmp52_ = dc_message_get_quote_text (msg);
		_tmp53_ = _tmp52_;
		_tmp54_ = g_strconcat (_tmp51_, _tmp53_, NULL);
		_tmp55_ = _tmp54_;
		_tmp56_ = (GtkLabel*) gtk_label_new (_tmp55_);
		g_object_ref_sink (_tmp56_);
		_tmp57_ = _tmp56_;
		_g_free0 (_tmp55_);
		t = _tmp57_;
		_tmp58_ = t;
		gtk_widget_add_css_class ((GtkWidget*) _tmp58_, "quote-text");
		_tmp59_ = t;
		gtk_widget_set_halign ((GtkWidget*) _tmp59_, GTK_ALIGN_START);
		_tmp60_ = t;
		gtk_label_set_xalign (_tmp60_, (gfloat) 0);
		_tmp61_ = t;
		gtk_label_set_ellipsize (_tmp61_, PANGO_ELLIPSIZE_END);
		_tmp62_ = t;
		gtk_label_set_max_width_chars (_tmp62_, max_width_chars);
		_tmp63_ = t;
		gtk_label_set_lines (_tmp63_, lines);
		_tmp64_ = btn;
		_tmp65_ = t;
		gtk_button_set_child (_tmp64_, (GtkWidget*) _tmp65_);
		_g_object_unref0 (t);
		_g_free0 (prefix);
		_g_free0 (_tmp38_);
	}
	result = btn;
	return result;
}

/** Message body label with markdown + link markup. Shared by both row styles. */
static Block18Data*
block18_data_ref (Block18Data* _data18_)
{
	g_atomic_int_inc (&_data18_->_ref_count_);
	return _data18_;
}

static void
block18_data_unref (void * _userdata_)
{
	Block18Data* _data18_;
	_data18_ = (Block18Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data18_->_ref_count_)) {
		_g_object_unref0 (_data18_->text);
		g_slice_free (Block18Data, _data18_);
	}
}

static inline GRegex*
_thread_safe_regex_init (GRegex** re,
                         const gchar * pattern,
                         GRegexCompileFlags compile_flags)
{
	if (g_once_init_enter ((volatile gsize*) re)) {
		GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
		g_once_init_leave ((volatile gsize*) re, (gsize) val);
	}
	return *re;
}

static gboolean
__lambda73_ (Block18Data* _data18_,
             const gchar* uri)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (uri != NULL, FALSE);
	if (dc_is_delta_invite_uri (uri)) {
		GtkLabel* _tmp1_;
		GtkRoot* _tmp2_;
		_tmp1_ = _data18_->text;
		_tmp2_ = gtk_widget_get_root ((GtkWidget*) _tmp1_);
		_tmp0_ = DC_IS_WINDOW (_tmp2_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GtkLabel* _tmp3_;
		GtkRoot* _tmp4_;
		_tmp3_ = _data18_->text;
		_tmp4_ = gtk_widget_get_root ((GtkWidget*) _tmp3_);
		dc_window_handle_invite_uri (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, DC_TYPE_WINDOW, DcWindow), uri);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda73__gtk_label_activate_link (GtkLabel* _sender,
                                      const gchar* uri,
                                      gpointer self)
{
	gboolean result;
	result = __lambda73_ (self, uri);
	return result;
}

static GtkLabel*
dc_message_row_build_text_label (DcMessage* msg,
                                 gint max_width_chars)
{
	Block18Data* _data18_;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GtkLabel* _tmp2_;
	gboolean big_emoji = FALSE;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GtkLabel* _tmp16_;
	GtkLabel* _tmp17_;
	GtkLabel* _tmp18_;
	GtkLabel* _tmp19_;
	GtkLabel* _tmp20_;
	GtkLabel* _tmp23_;
	GtkLabel* _tmp24_;
	GtkLabel* _tmp25_;
	GError* _inner_error0_ = NULL;
	GtkLabel* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_data18_ = g_slice_new0 (Block18Data);
	_data18_->_ref_count_ = 1;
	_tmp0_ = dc_message_get_text (msg);
	_tmp1_ = _tmp0_;
	_tmp2_ = (GtkLabel*) gtk_label_new (_tmp1_);
	g_object_ref_sink (_tmp2_);
	_data18_->text = _tmp2_;
	_tmp3_ = dc_message_get_text (msg);
	_tmp4_ = _tmp3_;
	big_emoji = dc_message_row_is_single_emoji_text (_tmp4_);
	{
		gchar* markup = NULL;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* probe = NULL;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		PangoAttrList* attrs = NULL;
		gchar* parsed = NULL;
		gunichar accel = 0U;
		const gchar* _tmp10_;
		PangoAttrList* _tmp11_ = NULL;
		gchar* _tmp12_ = NULL;
		gunichar _tmp13_ = 0U;
		GtkLabel* _tmp14_;
		const gchar* _tmp15_;
		_tmp5_ = dc_message_get_text (msg);
		_tmp6_ = _tmp5_;
		_tmp7_ = dc_markdown_format (_tmp6_);
		markup = _tmp7_;
		_tmp8_ = markup;
		_tmp9_ = g_regex_replace (_thread_safe_regex_init (&_tmp_regex_0, "<\\/?a(\\s[^>]*)?>", 0), _tmp8_, (gssize) -1, 0, "", 0, &_inner_error0_);
		probe = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (markup);
			goto __catch0_g_error;
		}
		_tmp10_ = probe;
		pango_parse_markup (_tmp10_, -1, (gunichar) 0, &_tmp11_, &_tmp12_, &_tmp13_, &_inner_error0_);
		_pango_attr_list_unref0 (attrs);
		attrs = _tmp11_;
		_g_free0 (parsed);
		parsed = _tmp12_;
		accel = _tmp13_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (parsed);
			_pango_attr_list_unref0 (attrs);
			_g_free0 (probe);
			_g_free0 (markup);
			goto __catch0_g_error;
		}
		_tmp14_ = _data18_->text;
		_tmp15_ = markup;
		gtk_label_set_markup (_tmp14_, _tmp15_);
		_g_free0 (parsed);
		_pango_attr_list_unref0 (attrs);
		_g_free0 (probe);
		_g_free0 (markup);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		block18_data_unref (_data18_);
		_data18_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	_tmp16_ = _data18_->text;
	gtk_label_set_wrap (_tmp16_, TRUE);
	_tmp17_ = _data18_->text;
	gtk_label_set_wrap_mode (_tmp17_, PANGO_WRAP_WORD_CHAR);
	_tmp18_ = _data18_->text;
	gtk_widget_set_halign ((GtkWidget*) _tmp18_, GTK_ALIGN_START);
	_tmp19_ = _data18_->text;
	gtk_label_set_xalign (_tmp19_, (gfloat) 0);
	_tmp20_ = _data18_->text;
	gtk_label_set_selectable (_tmp20_, TRUE);
	if (big_emoji) {
		GtkLabel* _tmp21_;
		_tmp21_ = _data18_->text;
		gtk_widget_add_css_class ((GtkWidget*) _tmp21_, "message-big-emoji");
	}
	if (max_width_chars > 0) {
		GtkLabel* _tmp22_;
		_tmp22_ = _data18_->text;
		gtk_label_set_max_width_chars (_tmp22_, max_width_chars);
	}
	_tmp23_ = _data18_->text;
	g_signal_connect_data (_tmp23_, "activate-link", (GCallback) ___lambda73__gtk_label_activate_link, block18_data_ref (_data18_), (GClosureNotify) block18_data_unref, 0);
	_tmp24_ = _data18_->text;
	_tmp25_ = _g_object_ref0 (_tmp24_);
	result = _tmp25_;
	block18_data_unref (_data18_);
	_data18_ = NULL;
	return result;
}

static gboolean
dc_message_row_is_single_emoji_text (const gchar* raw)
{
	gchar* text = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint index = 0;
	const gchar* _tmp4_;
	gboolean _tmp5_;
	const gchar* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gboolean result;
	if (raw == NULL) {
		result = FALSE;
		return result;
	}
	_tmp0_ = string_strip (raw);
	text = _tmp0_;
	_tmp1_ = text;
	_tmp2_ = strlen (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == 0) {
		result = FALSE;
		_g_free0 (text);
		return result;
	}
	index = 0;
	_tmp4_ = text;
	_tmp5_ = dc_message_row_consume_emoji_sequence (_tmp4_, &index);
	if (!_tmp5_) {
		result = FALSE;
		_g_free0 (text);
		return result;
	}
	_tmp6_ = text;
	_tmp7_ = strlen (_tmp6_);
	_tmp8_ = _tmp7_;
	result = index == _tmp8_;
	_g_free0 (text);
	return result;
}

static gboolean
string_get_next_char (const gchar* self,
                      gint* index,
                      gunichar* c)
{
	gunichar _vala_c = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_c = g_utf8_get_char (((gchar*) self) + (*index));
	if (_vala_c != ((gunichar) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_utf8_next_char (((gchar*) self) + (*index));
		*index = (gint) (_tmp0_ - ((gchar*) self));
		result = TRUE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	} else {
		result = FALSE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	}
}

static gboolean
dc_message_row_consume_emoji_sequence (const gchar* text,
                                       gint* index)
{
	gunichar c = 0U;
	gunichar _tmp0_ = 0U;
	gboolean _tmp1_;
	gboolean result;
	g_return_val_if_fail (text != NULL, FALSE);
	_tmp1_ = string_get_next_char (text, index, &_tmp0_);
	c = _tmp0_;
	if (!_tmp1_) {
		result = FALSE;
		return result;
	}
	if (dc_message_row_is_keycap_base (c)) {
		gboolean _tmp2_;
		dc_message_row_consume_variation_selectors (text, index);
		_tmp2_ = dc_message_row_consume_char (text, index, (gunichar) 0x20e3);
		result = _tmp2_;
		return result;
	}
	if (dc_message_row_is_regional_indicator (c)) {
		gunichar _tmp3_ = 0U;
		gboolean _tmp4_;
		_tmp4_ = string_get_next_char (text, index, &_tmp3_);
		c = _tmp3_;
		if (!_tmp4_) {
			result = FALSE;
			return result;
		}
		result = dc_message_row_is_regional_indicator (c);
		return result;
	}
	if (!dc_message_row_is_emoji_base (c)) {
		result = FALSE;
		return result;
	}
	dc_message_row_consume_emoji_modifiers (text, index);
	while (TRUE) {
		gboolean _tmp5_;
		gunichar _tmp6_ = 0U;
		gboolean _tmp7_;
		_tmp5_ = dc_message_row_consume_char (text, index, (gunichar) 0x200d);
		if (!_tmp5_) {
			break;
		}
		_tmp7_ = string_get_next_char (text, index, &_tmp6_);
		c = _tmp6_;
		if (!_tmp7_) {
			result = FALSE;
			return result;
		}
		if (!dc_message_row_is_emoji_base (c)) {
			result = FALSE;
			return result;
		}
		dc_message_row_consume_emoji_modifiers (text, index);
	}
	result = TRUE;
	return result;
}

static gboolean
dc_message_row_consume_char (const gchar* text,
                             gint* index,
                             gunichar expected)
{
	gint next = 0;
	gunichar c = 0U;
	gunichar _tmp0_ = 0U;
	gboolean _tmp1_;
	gboolean result;
	g_return_val_if_fail (text != NULL, FALSE);
	next = *index;
	_tmp1_ = string_get_next_char (text, &next, &_tmp0_);
	c = _tmp0_;
	if (!_tmp1_) {
		result = FALSE;
		return result;
	}
	if (c != expected) {
		result = FALSE;
		return result;
	}
	*index = next;
	result = TRUE;
	return result;
}

static void
dc_message_row_consume_emoji_modifiers (const gchar* text,
                                        gint* index)
{
	g_return_if_fail (text != NULL);
	while (TRUE) {
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_;
		_tmp1_ = dc_message_row_consume_variation_selectors (text, index);
		if (_tmp1_) {
			_tmp0_ = TRUE;
		} else {
			gboolean _tmp2_;
			_tmp2_ = dc_message_row_consume_emoji_modifier (text, index);
			_tmp0_ = _tmp2_;
		}
		if (!_tmp0_) {
			break;
		}
	}
	dc_message_row_consume_tag_sequence (text, index);
}

static gboolean
dc_message_row_consume_variation_selectors (const gchar* text,
                                            gint* index)
{
	gboolean consumed = FALSE;
	gboolean result;
	g_return_val_if_fail (text != NULL, FALSE);
	consumed = FALSE;
	while (TRUE) {
		gint next = 0;
		gunichar c = 0U;
		gunichar _tmp0_ = 0U;
		gboolean _tmp1_;
		gboolean _tmp2_ = FALSE;
		next = *index;
		_tmp1_ = string_get_next_char (text, &next, &_tmp0_);
		c = _tmp0_;
		if (!_tmp1_) {
			result = consumed;
			return result;
		}
		if (c != ((gunichar) 0xfe0e)) {
			_tmp2_ = c != ((gunichar) 0xfe0f);
		} else {
			_tmp2_ = FALSE;
		}
		if (_tmp2_) {
			result = consumed;
			return result;
		}
		*index = next;
		consumed = TRUE;
	}
}

static gboolean
dc_message_row_consume_emoji_modifier (const gchar* text,
                                       gint* index)
{
	gint next = 0;
	gunichar c = 0U;
	gunichar _tmp0_ = 0U;
	gboolean _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	g_return_val_if_fail (text != NULL, FALSE);
	next = *index;
	_tmp1_ = string_get_next_char (text, &next, &_tmp0_);
	c = _tmp0_;
	if (!_tmp1_) {
		result = FALSE;
		return result;
	}
	if (c < ((gunichar) 0x1f3fb)) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = c > ((gunichar) 0x1f3ff);
	}
	if (_tmp2_) {
		result = FALSE;
		return result;
	}
	*index = next;
	result = TRUE;
	return result;
}

static void
dc_message_row_consume_tag_sequence (const gchar* text,
                                     gint* index)
{
	gint before = 0;
	gint next = 0;
	gunichar c = 0U;
	gboolean has_tag = FALSE;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (text != NULL);
	before = *index;
	next = *index;
	has_tag = FALSE;
	while (TRUE) {
		gunichar _tmp0_ = 0U;
		gboolean _tmp1_;
		gboolean _tmp2_ = FALSE;
		_tmp1_ = string_get_next_char (text, &next, &_tmp0_);
		c = _tmp0_;
		if (!_tmp1_) {
			break;
		}
		if (c < ((gunichar) 0xe0020)) {
			_tmp2_ = TRUE;
		} else {
			_tmp2_ = c > ((gunichar) 0xe007e);
		}
		if (_tmp2_) {
			break;
		}
		*index = next;
		has_tag = TRUE;
	}
	if (has_tag) {
		gboolean _tmp4_;
		_tmp4_ = dc_message_row_consume_char (text, index, (gunichar) 0xe007f);
		_tmp3_ = _tmp4_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		return;
	}
	*index = before;
}

static gboolean
dc_message_row_is_keycap_base (gunichar c)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	if (c == ((gunichar) 0x23)) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = c == ((gunichar) 0x2a);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp2_ = FALSE;
		if (c >= ((gunichar) 0x30)) {
			_tmp2_ = c <= ((gunichar) 0x39);
		} else {
			_tmp2_ = FALSE;
		}
		_tmp0_ = _tmp2_;
	}
	result = _tmp0_;
	return result;
}

static gboolean
dc_message_row_is_regional_indicator (gunichar c)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	if (c >= ((gunichar) 0x1f1e6)) {
		_tmp0_ = c <= ((gunichar) 0x1f1ff);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
dc_message_row_is_emoji_base (gunichar c)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp15_ = FALSE;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_ = FALSE;
	gboolean _tmp18_ = FALSE;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	gboolean _tmp21_ = FALSE;
	gboolean _tmp22_ = FALSE;
	gboolean _tmp23_ = FALSE;
	gboolean _tmp24_ = FALSE;
	gboolean _tmp25_ = FALSE;
	gboolean _tmp26_ = FALSE;
	gboolean result;
	if (c == ((gunichar) 0x00a9)) {
		_tmp26_ = TRUE;
	} else {
		_tmp26_ = c == ((gunichar) 0x00ae);
	}
	if (_tmp26_) {
		_tmp25_ = TRUE;
	} else {
		_tmp25_ = c == ((gunichar) 0x203c);
	}
	if (_tmp25_) {
		_tmp24_ = TRUE;
	} else {
		_tmp24_ = c == ((gunichar) 0x2049);
	}
	if (_tmp24_) {
		_tmp23_ = TRUE;
	} else {
		_tmp23_ = c == ((gunichar) 0x2122);
	}
	if (_tmp23_) {
		_tmp22_ = TRUE;
	} else {
		_tmp22_ = c == ((gunichar) 0x2139);
	}
	if (_tmp22_) {
		_tmp21_ = TRUE;
	} else {
		gboolean _tmp27_ = FALSE;
		if (c >= ((gunichar) 0x2194)) {
			_tmp27_ = c <= ((gunichar) 0x21aa);
		} else {
			_tmp27_ = FALSE;
		}
		_tmp21_ = _tmp27_;
	}
	if (_tmp21_) {
		_tmp20_ = TRUE;
	} else {
		_tmp20_ = c == ((gunichar) 0x231a);
	}
	if (_tmp20_) {
		_tmp19_ = TRUE;
	} else {
		_tmp19_ = c == ((gunichar) 0x231b);
	}
	if (_tmp19_) {
		_tmp18_ = TRUE;
	} else {
		_tmp18_ = c == ((gunichar) 0x2328);
	}
	if (_tmp18_) {
		_tmp17_ = TRUE;
	} else {
		_tmp17_ = c == ((gunichar) 0x23cf);
	}
	if (_tmp17_) {
		_tmp16_ = TRUE;
	} else {
		gboolean _tmp28_ = FALSE;
		if (c >= ((gunichar) 0x23e9)) {
			_tmp28_ = c <= ((gunichar) 0x23f3);
		} else {
			_tmp28_ = FALSE;
		}
		_tmp16_ = _tmp28_;
	}
	if (_tmp16_) {
		_tmp15_ = TRUE;
	} else {
		gboolean _tmp29_ = FALSE;
		if (c >= ((gunichar) 0x23f8)) {
			_tmp29_ = c <= ((gunichar) 0x23fa);
		} else {
			_tmp29_ = FALSE;
		}
		_tmp15_ = _tmp29_;
	}
	if (_tmp15_) {
		_tmp14_ = TRUE;
	} else {
		_tmp14_ = c == ((gunichar) 0x24c2);
	}
	if (_tmp14_) {
		_tmp13_ = TRUE;
	} else {
		_tmp13_ = c == ((gunichar) 0x25aa);
	}
	if (_tmp13_) {
		_tmp12_ = TRUE;
	} else {
		_tmp12_ = c == ((gunichar) 0x25ab);
	}
	if (_tmp12_) {
		_tmp11_ = TRUE;
	} else {
		_tmp11_ = c == ((gunichar) 0x25b6);
	}
	if (_tmp11_) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = c == ((gunichar) 0x25c0);
	}
	if (_tmp10_) {
		_tmp9_ = TRUE;
	} else {
		gboolean _tmp30_ = FALSE;
		if (c >= ((gunichar) 0x25fb)) {
			_tmp30_ = c <= ((gunichar) 0x25fe);
		} else {
			_tmp30_ = FALSE;
		}
		_tmp9_ = _tmp30_;
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		gboolean _tmp31_ = FALSE;
		if (c >= ((gunichar) 0x2600)) {
			_tmp31_ = c <= ((gunichar) 0x27bf);
		} else {
			_tmp31_ = FALSE;
		}
		_tmp8_ = _tmp31_;
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = c == ((gunichar) 0x2934);
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = c == ((gunichar) 0x2935);
	}
	if (_tmp6_) {
		_tmp5_ = TRUE;
	} else {
		gboolean _tmp32_ = FALSE;
		if (c >= ((gunichar) 0x2b05)) {
			_tmp32_ = c <= ((gunichar) 0x2b55);
		} else {
			_tmp32_ = FALSE;
		}
		_tmp5_ = _tmp32_;
	}
	if (_tmp5_) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = c == ((gunichar) 0x3030);
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = c == ((gunichar) 0x303d);
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = c == ((gunichar) 0x3297);
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = c == ((gunichar) 0x3299);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp33_ = FALSE;
		if (c >= ((gunichar) 0x1f000)) {
			_tmp33_ = c <= ((gunichar) 0x1faff);
		} else {
			_tmp33_ = FALSE;
		}
		_tmp0_ = _tmp33_;
	}
	result = _tmp0_;
	return result;
}

/** Reaction badge bar, or null when the message has no reactions. */
static GtkBox*
dc_message_row_build_reactions_box (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkBox* box = NULL;
	GtkBox* _tmp7_;
	GtkBox* _tmp8_;
	GtkBox* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	GtkBox* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp1_ = dc_message_get_reactions (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		_tmp3_ = dc_message_get_reactions (msg);
		_tmp4_ = _tmp3_;
		_tmp5_ = strlen (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_ == 0;
	}
	if (_tmp0_) {
		result = NULL;
		return result;
	}
	_tmp7_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
	g_object_ref_sink (_tmp7_);
	box = _tmp7_;
	_tmp8_ = box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp8_, "reaction-bar");
	_tmp9_ = box;
	gtk_widget_set_halign ((GtkWidget*) _tmp9_, GTK_ALIGN_START);
	_tmp10_ = dc_message_get_reactions (msg);
	_tmp11_ = _tmp10_;
	_tmp13_ = _tmp12_ = g_strsplit (_tmp11_, ",", 0);
	{
		gchar** part_collection = NULL;
		gint part_collection_length1 = 0;
		gint _part_collection_size_ = 0;
		gint part_it = 0;
		part_collection = _tmp13_;
		part_collection_length1 = _vala_array_length (_tmp12_);
		for (part_it = 0; part_it < part_collection_length1; part_it = part_it + 1) {
			gchar* _tmp14_;
			gchar* part = NULL;
			_tmp14_ = g_strdup (part_collection[part_it]);
			part = _tmp14_;
			{
				gchar** kv = NULL;
				const gchar* _tmp15_;
				gchar** _tmp16_;
				gchar** _tmp17_;
				gint kv_length1;
				gint _kv_size_;
				gchar** _tmp18_;
				gint _tmp18__length1;
				gchar* _tmp19_ = NULL;
				gchar** _tmp20_;
				gint _tmp20__length1;
				const gchar* _tmp21_;
				GtkLabel* badge = NULL;
				GtkLabel* _tmp30_;
				GtkLabel* _tmp31_;
				GtkBox* _tmp32_;
				GtkLabel* _tmp33_;
				_tmp15_ = part;
				_tmp17_ = _tmp16_ = g_strsplit (_tmp15_, ":", 2);
				kv = _tmp17_;
				kv_length1 = _vala_array_length (_tmp16_);
				_kv_size_ = kv_length1;
				_tmp18_ = kv;
				_tmp18__length1 = kv_length1;
				if (_tmp18__length1 < 2) {
					kv = (_vala_array_free (kv, kv_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (part);
					continue;
				}
				_tmp20_ = kv;
				_tmp20__length1 = kv_length1;
				_tmp21_ = _tmp20_[1];
				if (g_strcmp0 (_tmp21_, "1") == 0) {
					gchar** _tmp22_;
					gint _tmp22__length1;
					const gchar* _tmp23_;
					gchar* _tmp24_;
					_tmp22_ = kv;
					_tmp22__length1 = kv_length1;
					_tmp23_ = _tmp22_[0];
					_tmp24_ = g_strdup (_tmp23_);
					_g_free0 (_tmp19_);
					_tmp19_ = _tmp24_;
				} else {
					gchar** _tmp25_;
					gint _tmp25__length1;
					const gchar* _tmp26_;
					gchar** _tmp27_;
					gint _tmp27__length1;
					const gchar* _tmp28_;
					gchar* _tmp29_;
					_tmp25_ = kv;
					_tmp25__length1 = kv_length1;
					_tmp26_ = _tmp25_[0];
					_tmp27_ = kv;
					_tmp27__length1 = kv_length1;
					_tmp28_ = _tmp27_[1];
					_tmp29_ = g_strdup_printf ("%s %s", _tmp26_, _tmp28_);
					_g_free0 (_tmp19_);
					_tmp19_ = _tmp29_;
				}
				_tmp30_ = (GtkLabel*) gtk_label_new (_tmp19_);
				g_object_ref_sink (_tmp30_);
				badge = _tmp30_;
				_tmp31_ = badge;
				gtk_widget_add_css_class ((GtkWidget*) _tmp31_, "reaction-badge");
				_tmp32_ = box;
				_tmp33_ = badge;
				gtk_box_append (_tmp32_, (GtkWidget*) _tmp33_);
				_g_object_unref0 (badge);
				_g_free0 (_tmp19_);
				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);
	}
	result = box;
	return result;
}

static gchar*
dc_message_row_format_timestamp (gint64 ts)
{
	GDateTime* dt = NULL;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	if (ts <= ((gint64) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("");
		result = _tmp0_;
		return result;
	}
	_tmp1_ = g_date_time_new_from_unix_local (ts);
	dt = _tmp1_;
	_tmp2_ = dt;
	_tmp3_ = g_date_time_format (_tmp2_, "%H:%M");
	result = _tmp3_;
	_g_date_time_unref0 (dt);
	return result;
}

gint
dc_message_row_get_message_id (DcMessageRow* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_message_id;
	return result;
}

static void
dc_message_row_set_message_id (DcMessageRow* self,
                               gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_message_id (self);
	if (old_value != value) {
		self->priv->_message_id = value;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_MESSAGE_ID_PROPERTY]);
	}
}

gint64
dc_message_row_get_timestamp (DcMessageRow* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_timestamp;
	return result;
}

static void
dc_message_row_set_timestamp (DcMessageRow* self,
                              gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_timestamp (self);
	if (old_value != value) {
		self->priv->_timestamp = value;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_TIMESTAMP_PROPERTY]);
	}
}

gboolean
dc_message_row_get_is_outgoing (DcMessageRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_outgoing;
	return result;
}

static void
dc_message_row_set_is_outgoing (DcMessageRow* self,
                                gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_is_outgoing (self);
	if (old_value != value) {
		self->priv->_is_outgoing = value;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_IS_OUTGOING_PROPERTY]);
	}
}

const gchar*
dc_message_row_get_file_path (DcMessageRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file_path;
	result = _tmp0_;
	return result;
}

static void
dc_message_row_set_file_path (DcMessageRow* self,
                              const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_file_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_file_path);
		self->priv->_file_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_FILE_PATH_PROPERTY]);
	}
}

const gchar*
dc_message_row_get_file_name (DcMessageRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file_name;
	result = _tmp0_;
	return result;
}

static void
dc_message_row_set_file_name (DcMessageRow* self,
                              const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_file_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_file_name);
		self->priv->_file_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_FILE_NAME_PROPERTY]);
	}
}

const gchar*
dc_message_row_get_message_text (DcMessageRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_message_text;
	result = _tmp0_;
	return result;
}

static void
dc_message_row_set_message_text (DcMessageRow* self,
                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_message_text (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_message_text);
		self->priv->_message_text = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_MESSAGE_TEXT_PROPERTY]);
	}
}

gint
dc_message_row_get_quote_msg_id (DcMessageRow* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_quote_msg_id;
	return result;
}

static void
dc_message_row_set_quote_msg_id (DcMessageRow* self,
                                 gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_quote_msg_id (self);
	if (old_value != value) {
		self->priv->_quote_msg_id = value;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_QUOTE_MSG_ID_PROPERTY]);
	}
}

gboolean
dc_message_row_get_is_image (DcMessageRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_image;
	return result;
}

static void
dc_message_row_set_is_image (DcMessageRow* self,
                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_message_row_get_is_image (self);
	if (old_value != value) {
		self->priv->_is_image = value;
		g_object_notify_by_pspec ((GObject *) self, dc_message_row_properties[DC_MESSAGE_ROW_IS_IMAGE_PROPERTY]);
	}
}

static void
dc_message_row_class_init (DcMessageRowClass * klass,
                           gpointer klass_data)
{
	dc_message_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcMessageRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_message_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_message_row_set_property;
	G_OBJECT_CLASS (klass)->finalize = dc_message_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_MESSAGE_ID_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_MESSAGE_ID_PROPERTY] = g_param_spec_int ("message-id", "message-id", "message-id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_TIMESTAMP_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_TIMESTAMP_PROPERTY] = g_param_spec_int64 ("timestamp", "timestamp", "timestamp", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_IS_OUTGOING_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_IS_OUTGOING_PROPERTY] = g_param_spec_boolean ("is-outgoing", "is-outgoing", "is-outgoing", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_FILE_PATH_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_FILE_PATH_PROPERTY] = g_param_spec_string ("file-path", "file-path", "file-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_FILE_NAME_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_FILE_NAME_PROPERTY] = g_param_spec_string ("file-name", "file-name", "file-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_MESSAGE_TEXT_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_MESSAGE_TEXT_PROPERTY] = g_param_spec_string ("message-text", "message-text", "message-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_QUOTE_MSG_ID_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_QUOTE_MSG_ID_PROPERTY] = g_param_spec_int ("quote-msg-id", "quote-msg-id", "quote-msg-id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_MESSAGE_ROW_IS_IMAGE_PROPERTY, dc_message_row_properties[DC_MESSAGE_ROW_IS_IMAGE_PROPERTY] = g_param_spec_boolean ("is-image", "is-image", "is-image", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	dc_message_row_signals[DC_MESSAGE_ROW_QUOTE_CLICKED_SIGNAL] = g_signal_new ("quote-clicked", DC_TYPE_MESSAGE_ROW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}

static void
dc_message_row_instance_init (DcMessageRow * self,
                              gpointer klass)
{
	self->priv = dc_message_row_get_instance_private (self);
}

static void
dc_message_row_finalize (GObject * obj)
{
	DcMessageRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_MESSAGE_ROW, DcMessageRow);
	_g_free0 (self->priv->_file_path);
	_g_free0 (self->priv->_file_name);
	_g_free0 (self->priv->_message_text);
	G_OBJECT_CLASS (dc_message_row_parent_class)->finalize (obj);
}

/**
     * A single message bubble in the conversation view.
     * Incoming messages are left-aligned, outgoing messages right-aligned.
     */
static GType
dc_message_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcMessageRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_message_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcMessageRow), 0, (GInstanceInitFunc) dc_message_row_instance_init, NULL };
	GType dc_message_row_type_id;
	dc_message_row_type_id = g_type_register_static (gtk_box_get_type (), "DcMessageRow", &g_define_type_info, 0);
	DcMessageRow_private_offset = g_type_add_instance_private (dc_message_row_type_id, sizeof (DcMessageRowPrivate));
	return dc_message_row_type_id;
}

GType
dc_message_row_get_type (void)
{
	static volatile gsize dc_message_row_type_id__once = 0;
	if (g_once_init_enter (&dc_message_row_type_id__once)) {
		GType dc_message_row_type_id;
		dc_message_row_type_id = dc_message_row_get_type_once ();
		g_once_init_leave (&dc_message_row_type_id__once, dc_message_row_type_id);
	}
	return dc_message_row_type_id__once;
}

static void
_vala_dc_message_row_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	DcMessageRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_MESSAGE_ROW, DcMessageRow);
	switch (property_id) {
		case DC_MESSAGE_ROW_MESSAGE_ID_PROPERTY:
		g_value_set_int (value, dc_message_row_get_message_id (self));
		break;
		case DC_MESSAGE_ROW_TIMESTAMP_PROPERTY:
		g_value_set_int64 (value, dc_message_row_get_timestamp (self));
		break;
		case DC_MESSAGE_ROW_IS_OUTGOING_PROPERTY:
		g_value_set_boolean (value, dc_message_row_get_is_outgoing (self));
		break;
		case DC_MESSAGE_ROW_FILE_PATH_PROPERTY:
		g_value_set_string (value, dc_message_row_get_file_path (self));
		break;
		case DC_MESSAGE_ROW_FILE_NAME_PROPERTY:
		g_value_set_string (value, dc_message_row_get_file_name (self));
		break;
		case DC_MESSAGE_ROW_MESSAGE_TEXT_PROPERTY:
		g_value_set_string (value, dc_message_row_get_message_text (self));
		break;
		case DC_MESSAGE_ROW_QUOTE_MSG_ID_PROPERTY:
		g_value_set_int (value, dc_message_row_get_quote_msg_id (self));
		break;
		case DC_MESSAGE_ROW_IS_IMAGE_PROPERTY:
		g_value_set_boolean (value, dc_message_row_get_is_image (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_message_row_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	DcMessageRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_MESSAGE_ROW, DcMessageRow);
	switch (property_id) {
		case DC_MESSAGE_ROW_MESSAGE_ID_PROPERTY:
		dc_message_row_set_message_id (self, g_value_get_int (value));
		break;
		case DC_MESSAGE_ROW_TIMESTAMP_PROPERTY:
		dc_message_row_set_timestamp (self, g_value_get_int64 (value));
		break;
		case DC_MESSAGE_ROW_IS_OUTGOING_PROPERTY:
		dc_message_row_set_is_outgoing (self, g_value_get_boolean (value));
		break;
		case DC_MESSAGE_ROW_FILE_PATH_PROPERTY:
		dc_message_row_set_file_path (self, g_value_get_string (value));
		break;
		case DC_MESSAGE_ROW_FILE_NAME_PROPERTY:
		dc_message_row_set_file_name (self, g_value_get_string (value));
		break;
		case DC_MESSAGE_ROW_MESSAGE_TEXT_PROPERTY:
		dc_message_row_set_message_text (self, g_value_get_string (value));
		break;
		case DC_MESSAGE_ROW_QUOTE_MSG_ID_PROPERTY:
		dc_message_row_set_quote_msg_id (self, g_value_get_int (value));
		break;
		case DC_MESSAGE_ROW_IS_IMAGE_PROPERTY:
		dc_message_row_set_is_image (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

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

