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

#include <glib-object.h>
#include <adwaita.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.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_ACTIONS (dc_message_actions_get_type ())
#define DC_MESSAGE_ACTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE_ACTIONS, DcMessageActions))
#define DC_MESSAGE_ACTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE_ACTIONS, DcMessageActionsClass))
#define DC_IS_MESSAGE_ACTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE_ACTIONS))
#define DC_IS_MESSAGE_ACTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE_ACTIONS))
#define DC_MESSAGE_ACTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE_ACTIONS, DcMessageActionsClass))

typedef struct _DcMessageActions DcMessageActions;
typedef struct _DcMessageActionsClass DcMessageActionsClass;
typedef struct _DcMessageActionsPrivate DcMessageActionsPrivate;

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

typedef struct _DcWindow DcWindow;
typedef struct _DcWindowClass DcWindowClass;

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

typedef struct _DcRpcClient DcRpcClient;
typedef struct _DcRpcClientClass DcRpcClientClass;

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

typedef struct _DcPinnedMessagesManager DcPinnedMessagesManager;
typedef struct _DcPinnedMessagesManagerClass DcPinnedMessagesManagerClass;

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

typedef struct _DcComposeBar DcComposeBar;
typedef struct _DcComposeBarClass DcComposeBarClass;

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

typedef struct _DcSettingsManager DcSettingsManager;
typedef struct _DcSettingsManagerClass DcSettingsManagerClass;
enum  {
	DC_MESSAGE_ACTIONS_0_PROPERTY,
	DC_MESSAGE_ACTIONS_NUM_PROPERTIES
};
static GParamSpec* dc_message_actions_properties[DC_MESSAGE_ACTIONS_NUM_PROPERTIES];
typedef struct _Block35Data Block35Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block36Data Block36Data;
#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;
typedef struct _Block37Data Block37Data;
typedef void (*DcVoidFunc) (gpointer user_data);
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DcMessageActionsSendReactionData DcMessageActionsSendReactionData;
typedef struct _DcMessageActionsDeleteMessageData DcMessageActionsDeleteMessageData;
typedef struct _Block38Data Block38Data;

#define DC_TYPE_CONTACT_PICKER_DIALOG (dc_contact_picker_dialog_get_type ())
#define DC_CONTACT_PICKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONTACT_PICKER_DIALOG, DcContactPickerDialog))
#define DC_CONTACT_PICKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONTACT_PICKER_DIALOG, DcContactPickerDialogClass))
#define DC_IS_CONTACT_PICKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONTACT_PICKER_DIALOG))
#define DC_IS_CONTACT_PICKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONTACT_PICKER_DIALOG))
#define DC_CONTACT_PICKER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONTACT_PICKER_DIALOG, DcContactPickerDialogClass))

typedef struct _DcContactPickerDialog DcContactPickerDialog;
typedef struct _DcContactPickerDialogClass DcContactPickerDialogClass;
typedef struct _DcMessageActionsForwardToChatData DcMessageActionsForwardToChatData;
typedef struct _DcMessageActionsForwardToContactData DcMessageActionsForwardToContactData;
typedef struct _DcMessageActionsEditMessageData DcMessageActionsEditMessageData;
typedef struct _DcMessageActionsUpdateRowData DcMessageActionsUpdateRowData;
typedef struct _DcMessageActionsOpenSenderProfileData DcMessageActionsOpenSenderProfileData;

struct _DcMessageActions {
	GObject parent_instance;
	DcMessageActionsPrivate * priv;
};

struct _DcMessageActionsClass {
	GObjectClass parent_class;
};

struct _DcMessageActionsPrivate {
	DcWindow* window;
	DcRpcClient* rpc;
	GListStore* message_store;
	DcPinnedMessagesManager* pinned;
	DcComposeBar* compose_bar;
	DcSettingsManager* settings;
};

struct _Block35Data {
	int _ref_count_;
	DcMessageActions* self;
	GtkPopover* popover;
	gint msg_id;
	gboolean is_outgoing;
};

struct _Block36Data {
	int _ref_count_;
	Block35Data * _data35_;
	gchar* emoji;
};

struct _Block37Data {
	int _ref_count_;
	Block35Data * _data35_;
	gchar* fpath;
	gchar* fname;
};

struct _DcMessageActionsSendReactionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageActions* self;
	gint msg_id;
	gchar* emoji;
	DcRpcClient* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	GError* e;
	DcWindow* _tmp4_;
	GError* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GError* _inner_error0_;
};

struct _DcMessageActionsDeleteMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageActions* self;
	gint msg_id;
	gboolean for_all;
	DcRpcClient* _tmp0_;
	gint* _tmp1_;
	gint* _tmp2_;
	gint _tmp2__length1;
	DcRpcClient* _tmp3_;
	gint* _tmp4_;
	gint* _tmp5_;
	gint _tmp5__length1;
	gint idx;
	GListStore* _tmp6_;
	GListStore* _tmp7_;
	GError* e;
	DcWindow* _tmp8_;
	GError* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _Block38Data {
	int _ref_count_;
	DcMessageActions* self;
	gint msg_id;
};

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

struct _DcMessageActionsForwardToContactData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageActions* self;
	gint msg_id;
	gint contact_id;
	gchar* email;
	gint cid;
	gint _tmp0_;
	DcRpcClient* _tmp1_;
	gint chat_id;
	DcRpcClient* _tmp2_;
	DcRpcClient* _tmp3_;
	gint* _tmp4_;
	gint* _tmp5_;
	gint _tmp5__length1;
	DcWindow* _tmp6_;
	DcWindow* _tmp7_;
	GError* e;
	DcWindow* _tmp8_;
	GError* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _DcMessageActionsEditMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageActions* self;
	gint msg_id;
	gchar* new_text;
	DcRpcClient* _tmp0_;
	GError* e;
	DcWindow* _tmp1_;
	GError* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* _inner_error0_;
};

struct _DcMessageActionsUpdateRowData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageActions* self;
	gint msg_id;
	DcMessage* msg;
	DcRpcClient* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	gint idx;
	GListStore* _tmp3_;
	GObject** replacements;
	DcMessage* _tmp4_;
	GObject* _tmp5_;
	GObject** _tmp6_;
	gint replacements_length1;
	gint _replacements_size_;
	GListStore* _tmp7_;
	GObject** _tmp8_;
	gint _tmp8__length1;
	GError* _inner_error0_;
};

struct _DcMessageActionsOpenSenderProfileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageActions* self;
	gint msg_id;
	DcMessage* m;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	DcMessage* _tmp4_;
	DcMessage* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	DcMessage* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	gint contact_id;
	DcRpcClient* _tmp11_;
	DcMessage* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gint chat_id;
	DcRpcClient* _tmp15_;
	DcWindow* _tmp16_;
	DcWindow* _tmp17_;
	GError* e;
	DcWindow* _tmp18_;
	GError* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GError* _inner_error0_;
};

static gint DcMessageActions_private_offset;
static gpointer dc_message_actions_parent_class = NULL;

VALA_EXTERN GType dc_message_actions_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessageActions, g_object_unref)
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
VALA_EXTERN GType dc_rpc_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcClient, g_object_unref)
VALA_EXTERN GType dc_pinned_messages_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcPinnedMessagesManager, g_object_unref)
VALA_EXTERN GType dc_compose_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcComposeBar, g_object_unref)
VALA_EXTERN GType dc_settings_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsManager, g_object_unref)
VALA_EXTERN DcMessageActions* dc_message_actions_new (DcWindow* window,
                                          DcRpcClient* rpc,
                                          GListStore* message_store,
                                          DcPinnedMessagesManager* pinned,
                                          DcComposeBar* compose_bar,
                                          DcSettingsManager* settings);
VALA_EXTERN DcMessageActions* dc_message_actions_construct (GType object_type,
                                                DcWindow* window,
                                                DcRpcClient* rpc,
                                                GListStore* message_store,
                                                DcPinnedMessagesManager* pinned,
                                                DcComposeBar* compose_bar,
                                                DcSettingsManager* settings);
VALA_EXTERN void dc_message_actions_show_context_menu (DcMessageActions* self,
                                           gint msg_id,
                                           gboolean is_outgoing,
                                           gdouble x,
                                           gdouble y,
                                           GtkWidget* parent);
static Block35Data* block35_data_ref (Block35Data* _data35_);
static void block35_data_unref (void * _userdata_);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static void _____lambda18_ (Block36Data* _data36_);
VALA_EXTERN void dc_message_actions_send_reaction (DcMessageActions* self,
                                       gint msg_id,
                                       const gchar* emoji,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
VALA_EXTERN void dc_message_actions_send_reaction_finish (DcMessageActions* self,
                                              GAsyncResult* _res_);
static void ______lambda18__gtk_button_clicked (GtkButton* _sender,
                                         gpointer self);
static void __lambda19_ (Block35Data* _data35_);
VALA_EXTERN void dc_message_actions_start_replying (DcMessageActions* self,
                                        gint msg_id);
static void ___lambda19__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda20_ (Block35Data* _data35_);
VALA_EXTERN void dc_message_actions_start_forwarding (DcMessageActions* self,
                                          gint msg_id);
static void ___lambda20__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
VALA_EXTERN gboolean dc_pinned_messages_manager_is_pinned (DcPinnedMessagesManager* self,
                                               gint msg_id);
static void __lambda26_ (Block35Data* _data35_);
VALA_EXTERN void dc_pinned_messages_manager_toggle_pin (DcPinnedMessagesManager* self,
                                            gint msg_id);
static void ___lambda26__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
VALA_EXTERN GType dc_message_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessage, g_object_unref)
VALA_EXTERN DcMessage* dc_find_message (GListStore* store,
                            gint msg_id);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
static void ___lambda27_ (Block37Data* _data37_);
VALA_EXTERN void dc_window_save_attachment (DcWindow* self,
                                const gchar* src_path,
                                const gchar* name,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void dc_window_save_attachment_finish (DcWindow* self,
                                       GAsyncResult* _res_);
static void ____lambda27__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN const gchar* dc_message_get_text (DcMessage* self);
static void ____lambda28_ (Block35Data* _data35_);
VALA_EXTERN void dc_message_actions_start_editing (DcMessageActions* self,
                                       gint msg_id);
static void _____lambda28__gtk_button_clicked (GtkButton* _sender,
                                        gpointer self);
static void __lambda29_ (Block35Data* _data35_);
VALA_EXTERN void dc_confirm_delete_options (GtkWidget* parent,
                                const gchar* title,
                                const gchar* body,
                                DcVoidFunc on_delete_for_me,
                                gpointer on_delete_for_me_target,
                                GDestroyNotify on_delete_for_me_target_destroy_notify,
                                DcVoidFunc on_delete_for_everyone,
                                gpointer on_delete_for_everyone_target,
                                GDestroyNotify on_delete_for_everyone_target_destroy_notify);
static void ___lambda31_ (Block35Data* _data35_);
VALA_EXTERN void dc_message_actions_delete_message (DcMessageActions* self,
                                        gint msg_id,
                                        gboolean for_all,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN void dc_message_actions_delete_message_finish (DcMessageActions* self,
                                               GAsyncResult* _res_);
static void ____lambda31__dc_void_func (gpointer self);
static void ___lambda32_ (Block35Data* _data35_);
static void ____lambda32__dc_void_func (gpointer self);
static void ___lambda33_ (Block35Data* _data35_);
static void ____lambda33__dc_void_func (gpointer self);
static void ___lambda29__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void dc_message_actions_send_reaction_data_free (gpointer _data);
static gboolean dc_message_actions_send_reaction_co (DcMessageActionsSendReactionData* _data_);
VALA_EXTERN void dc_rpc_client_send_reaction (DcRpcClient* self,
                                  gint msg_id,
                                  gchar** emojis,
                                  gint emojis_length1,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_send_reaction_finish (DcRpcClient* self,
                                         GAsyncResult* _res_,
                                         GError** error);
static void dc_message_actions_send_reaction_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
VALA_EXTERN void dc_message_actions_update_row (DcMessageActions* self,
                                    gint msg_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN void dc_message_actions_update_row_finish (DcMessageActions* self,
                                           GAsyncResult* _res_);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
static void dc_message_actions_delete_message_data_free (gpointer _data);
static gboolean dc_message_actions_delete_message_co (DcMessageActionsDeleteMessageData* _data_);
VALA_EXTERN void dc_rpc_client_delete_messages_for_all (DcRpcClient* self,
                                            gint* msg_ids,
                                            gint msg_ids_length1,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages_for_all_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static void dc_message_actions_delete_message_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages (DcRpcClient* self,
                                    gint* msg_ids,
                                    gint msg_ids_length1,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           GError** error);
VALA_EXTERN gint dc_find_message_index (GListStore* store,
                            gint msg_id);
VALA_EXTERN void dc_compose_bar_begin_edit (DcComposeBar* self,
                                gint msg_id,
                                const gchar* current_text);
VALA_EXTERN gboolean dc_message_get_is_outgoing (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_sender_name (DcMessage* self);
VALA_EXTERN void dc_compose_bar_begin_reply (DcComposeBar* self,
                                 gint msg_id,
                                 const gchar* sender_name,
                                 const gchar* preview);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
VALA_EXTERN GType dc_contact_picker_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcContactPickerDialog, g_object_unref)
VALA_EXTERN GListStore* dc_window_get_chat_store (DcWindow* self);
VALA_EXTERN DcContactPickerDialog* dc_contact_picker_dialog_new (DcRpcClient* rpc,
                                                     GListStore* chat_store,
                                                     const gchar* title);
VALA_EXTERN DcContactPickerDialog* dc_contact_picker_dialog_construct (GType object_type,
                                                           DcRpcClient* rpc,
                                                           GListStore* chat_store,
                                                           const gchar* title);
static void __lambda22_ (Block38Data* _data38_,
                  gint chat_id);
static void dc_message_actions_forward_to_chat (DcMessageActions* self,
                                         gint msg_id,
                                         gint chat_id,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dc_message_actions_forward_to_chat_finish (DcMessageActions* self,
                                                GAsyncResult* _res_);
static void ___lambda22__dc_contact_picker_dialog_chat_picked (DcContactPickerDialog* _sender,
                                                        gint chat_id,
                                                        gpointer self);
static void __lambda25_ (Block38Data* _data38_,
                  gint contact_id,
                  const gchar* email);
static void dc_message_actions_forward_to_contact (DcMessageActions* self,
                                            gint msg_id,
                                            gint contact_id,
                                            const gchar* email,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void dc_message_actions_forward_to_contact_finish (DcMessageActions* self,
                                                   GAsyncResult* _res_);
static void ___lambda25__dc_contact_picker_dialog_contact_picked (DcContactPickerDialog* _sender,
                                                           gint contact_id,
                                                           const gchar* email,
                                                           gpointer self);
static void dc_message_actions_forward_to_chat_data_free (gpointer _data);
static gboolean dc_message_actions_forward_to_chat_co (DcMessageActionsForwardToChatData* _data_);
VALA_EXTERN void dc_rpc_client_forward_messages (DcRpcClient* self,
                                     gint* msg_ids,
                                     gint msg_ids_length1,
                                     gint chat_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_forward_messages_finish (DcRpcClient* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static void dc_message_actions_forward_to_chat_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
VALA_EXTERN void dc_window_request_reload_chats (DcWindow* self);
static void dc_message_actions_forward_to_contact_data_free (gpointer _data);
static gboolean dc_message_actions_forward_to_contact_co (DcMessageActionsForwardToContactData* _data_);
VALA_EXTERN void dc_rpc_client_get_or_create_contact (DcRpcClient* self,
                                          const gchar* email,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_or_create_contact_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void dc_message_actions_forward_to_contact_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_get_or_create_chat_by_contact (DcRpcClient* self,
                                                  gint contact_id,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_or_create_chat_by_contact_finish (DcRpcClient* self,
                                                         GAsyncResult* _res_,
                                                         GError** error);
static void dc_message_actions_edit_message_data_free (gpointer _data);
VALA_EXTERN void dc_message_actions_edit_message (DcMessageActions* self,
                                      gint msg_id,
                                      const gchar* new_text,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN void dc_message_actions_edit_message_finish (DcMessageActions* self,
                                             GAsyncResult* _res_);
static gboolean dc_message_actions_edit_message_co (DcMessageActionsEditMessageData* _data_);
VALA_EXTERN void dc_rpc_client_send_edit_request (DcRpcClient* self,
                                      gint msg_id,
                                      const gchar* new_text,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_send_edit_request_finish (DcRpcClient* self,
                                             GAsyncResult* _res_,
                                             GError** error);
static void dc_message_actions_edit_message_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static void dc_message_actions_update_row_data_free (gpointer _data);
static gboolean dc_message_actions_update_row_co (DcMessageActionsUpdateRowData* _data_);
VALA_EXTERN void dc_rpc_client_fetch_message (DcRpcClient* self,
                                  gint msg_id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_client_fetch_message_finish (DcRpcClient* self,
                                               GAsyncResult* _res_,
                                               GError** error);
static void dc_message_actions_update_row_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN void dc_message_actions_handle_double_click (DcMessageActions* self,
                                             gint msg_id);
VALA_EXTERN gint dc_settings_manager_get_double_click_action (DcSettingsManager* self);
VALA_EXTERN void dc_message_actions_open_sender_profile (DcMessageActions* self,
                                             gint msg_id,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
VALA_EXTERN void dc_message_actions_open_sender_profile_finish (DcMessageActions* self,
                                                    GAsyncResult* _res_);
VALA_EXTERN void dc_compose_bar_grab_entry_focus (DcComposeBar* self);
static void dc_message_actions_open_sender_profile_data_free (gpointer _data);
static gboolean dc_message_actions_open_sender_profile_co (DcMessageActionsOpenSenderProfileData* _data_);
VALA_EXTERN const gchar* dc_message_get_sender_address (DcMessage* self);
VALA_EXTERN void dc_rpc_client_lookup_contact (DcRpcClient* self,
                                   const gchar* email,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_lookup_contact_finish (DcRpcClient* self,
                                          GAsyncResult* _res_,
                                          GError** error);
static void dc_message_actions_open_sender_profile_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
VALA_EXTERN void dc_window_select_chat_by_id (DcWindow* self,
                                  gint chat_id);
static void dc_message_actions_finalize (GObject * obj);
static GType dc_message_actions_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dc_message_actions_get_instance_private (DcMessageActions* self)
{
	return G_STRUCT_MEMBER_P (self, DcMessageActions_private_offset);
}

DcMessageActions*
dc_message_actions_construct (GType object_type,
                              DcWindow* window,
                              DcRpcClient* rpc,
                              GListStore* message_store,
                              DcPinnedMessagesManager* pinned,
                              DcComposeBar* compose_bar,
                              DcSettingsManager* settings)
{
	DcMessageActions * self = NULL;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	g_return_val_if_fail (message_store != NULL, NULL);
	g_return_val_if_fail (pinned != NULL, NULL);
	g_return_val_if_fail (compose_bar != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	self = (DcMessageActions*) g_object_new (object_type, NULL);
	self->priv->window = window;
	self->priv->rpc = rpc;
	self->priv->message_store = message_store;
	self->priv->pinned = pinned;
	self->priv->compose_bar = compose_bar;
	self->priv->settings = settings;
	return self;
}

DcMessageActions*
dc_message_actions_new (DcWindow* window,
                        DcRpcClient* rpc,
                        GListStore* message_store,
                        DcPinnedMessagesManager* pinned,
                        DcComposeBar* compose_bar,
                        DcSettingsManager* settings)
{
	return dc_message_actions_construct (DC_TYPE_MESSAGE_ACTIONS, window, rpc, message_store, pinned, compose_bar, settings);
}

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

static void
block35_data_unref (void * _userdata_)
{
	Block35Data* _data35_;
	_data35_ = (Block35Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data35_->_ref_count_)) {
		DcMessageActions* self;
		self = _data35_->self;
		_g_object_unref0 (_data35_->popover);
		_g_object_unref0 (self);
		g_slice_free (Block35Data, _data35_);
	}
}

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

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

static void
_____lambda18_ (Block36Data* _data36_)
{
	Block35Data* _data35_;
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	const gchar* _tmp1_;
	_data35_ = _data36_->_data35_;
	self = _data35_->self;
	_tmp0_ = _data35_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = _data36_->emoji;
	dc_message_actions_send_reaction (self, _data35_->msg_id, _tmp1_, NULL, NULL);
}

static void
______lambda18__gtk_button_clicked (GtkButton* _sender,
                                    gpointer self)
{
	_____lambda18_ (self);
}

static void
__lambda19_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data35_->self;
	_tmp0_ = _data35_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_message_actions_start_replying (self, _data35_->msg_id);
}

static void
___lambda19__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda19_ (self);
}

static void
__lambda20_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data35_->self;
	_tmp0_ = _data35_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_message_actions_start_forwarding (self, _data35_->msg_id);
}

static void
___lambda20__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda20_ (self);
}

static void
__lambda26_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	DcPinnedMessagesManager* _tmp1_;
	self = _data35_->self;
	_tmp0_ = _data35_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = self->priv->pinned;
	dc_pinned_messages_manager_toggle_pin (_tmp1_, _data35_->msg_id);
}

static void
___lambda26__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda26_ (self);
}

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

static void
block37_data_unref (void * _userdata_)
{
	Block37Data* _data37_;
	_data37_ = (Block37Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data37_->_ref_count_)) {
		DcMessageActions* self;
		self = _data37_->_data35_->self;
		_g_free0 (_data37_->fname);
		_g_free0 (_data37_->fpath);
		block35_data_unref (_data37_->_data35_);
		_data37_->_data35_ = NULL;
		g_slice_free (Block37Data, _data37_);
	}
}

static void
___lambda27_ (Block37Data* _data37_)
{
	Block35Data* _data35_;
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	DcWindow* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	_data35_ = _data37_->_data35_;
	self = _data35_->self;
	_tmp0_ = _data35_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = self->priv->window;
	_tmp2_ = _data37_->fpath;
	_tmp3_ = _data37_->fname;
	dc_window_save_attachment (_tmp1_, _tmp2_, _tmp3_, NULL, NULL);
}

static void
____lambda27__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda27_ (self);
}

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

static void
____lambda28_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data35_->self;
	_tmp0_ = _data35_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_message_actions_start_editing (self, _data35_->msg_id);
}

static void
_____lambda28__gtk_button_clicked (GtkButton* _sender,
                                   gpointer self)
{
	____lambda28_ (self);
}

static void
___lambda31_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	self = _data35_->self;
	dc_message_actions_delete_message (self, _data35_->msg_id, FALSE, NULL, NULL);
}

static void
____lambda31__dc_void_func (gpointer self)
{
	___lambda31_ (self);
}

static void
___lambda32_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	self = _data35_->self;
	dc_message_actions_delete_message (self, _data35_->msg_id, TRUE, NULL, NULL);
}

static void
____lambda32__dc_void_func (gpointer self)
{
	___lambda32_ (self);
}

static void
___lambda33_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	self = _data35_->self;
	dc_message_actions_delete_message (self, _data35_->msg_id, FALSE, NULL, NULL);
}

static void
____lambda33__dc_void_func (gpointer self)
{
	___lambda33_ (self);
}

static void
__lambda29_ (Block35Data* _data35_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data35_->self;
	_tmp0_ = _data35_->popover;
	gtk_popover_popdown (_tmp0_);
	if (_data35_->is_outgoing) {
		DcWindow* _tmp1_;
		_tmp1_ = self->priv->window;
		dc_confirm_delete_options ((GtkWidget*) _tmp1_, "Delete Message?", "Delete this message from your device only, or from all participants? T" \
"his cannot be undone.", ____lambda31__dc_void_func, block35_data_ref (_data35_), block35_data_unref, ____lambda32__dc_void_func, block35_data_ref (_data35_), block35_data_unref);
	} else {
		DcWindow* _tmp2_;
		_tmp2_ = self->priv->window;
		dc_confirm_delete_options ((GtkWidget*) _tmp2_, "Delete Message?", "Delete this message from your device? This cannot be undone.", ____lambda33__dc_void_func, block35_data_ref (_data35_), block35_data_unref, NULL, NULL, NULL);
	}
}

static void
___lambda29__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda29_ (self);
}

void
dc_message_actions_show_context_menu (DcMessageActions* self,
                                      gint msg_id,
                                      gboolean is_outgoing,
                                      gdouble x,
                                      gdouble y,
                                      GtkWidget* parent)
{
	Block35Data* _data35_;
	GtkPopover* _tmp0_;
	GtkBox* vbox = NULL;
	GtkBox* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	gchar** emojis = NULL;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar** _tmp12_;
	gint emojis_length1;
	gint _emojis_size_;
	GtkBox* emoji_row1 = NULL;
	GtkBox* _tmp13_;
	GtkBox* emoji_row2 = NULL;
	GtkBox* _tmp14_;
	GtkBox* _tmp29_;
	GtkBox* _tmp30_;
	GtkBox* _tmp31_;
	GtkBox* _tmp32_;
	GtkBox* _tmp33_;
	GtkSeparator* _tmp34_;
	GtkSeparator* _tmp35_;
	GtkButton* reply_btn = NULL;
	GtkButton* _tmp36_;
	GtkButton* _tmp37_;
	GtkButton* _tmp38_;
	GtkBox* _tmp39_;
	GtkButton* _tmp40_;
	GtkButton* forward_btn = NULL;
	GtkButton* _tmp41_;
	GtkButton* _tmp42_;
	GtkButton* _tmp43_;
	GtkBox* _tmp44_;
	GtkButton* _tmp45_;
	gboolean msg_is_pinned = FALSE;
	DcPinnedMessagesManager* _tmp46_;
	const gchar* _tmp47_ = NULL;
	GtkButton* pin_btn = NULL;
	GtkButton* _tmp48_;
	GtkButton* _tmp49_;
	GtkButton* _tmp50_;
	GtkBox* _tmp51_;
	GtkButton* _tmp52_;
	DcMessage* msg = NULL;
	GListStore* _tmp53_;
	DcMessage* _tmp54_;
	gboolean _tmp55_ = FALSE;
	gboolean _tmp56_ = FALSE;
	DcMessage* _tmp57_;
	GtkBox* _tmp96_;
	GtkSeparator* _tmp97_;
	GtkSeparator* _tmp98_;
	GtkButton* del_btn = NULL;
	GtkButton* _tmp99_;
	GtkBox* _tmp100_;
	GtkPopover* _tmp101_;
	GtkBox* _tmp102_;
	GtkPopover* _tmp103_;
	GtkPopover* _tmp104_;
	GdkRectangle _tmp105_ = {0};
	GtkPopover* _tmp106_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	_data35_ = g_slice_new0 (Block35Data);
	_data35_->_ref_count_ = 1;
	_data35_->self = g_object_ref (self);
	_data35_->msg_id = msg_id;
	_data35_->is_outgoing = is_outgoing;
	_tmp0_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp0_);
	_data35_->popover = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
	g_object_ref_sink (_tmp1_);
	vbox = _tmp1_;
	_tmp2_ = vbox;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp2_, 4);
	_tmp3_ = vbox;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp3_, 4);
	_tmp4_ = vbox;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp4_, 4);
	_tmp5_ = vbox;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 4);
	_tmp6_ = g_strdup ("\xf0\x9f\x91\x8d");
	_tmp7_ = g_strdup ("\xe2\x9d\xa4\xef\xb8\x8f");
	_tmp8_ = g_strdup ("\xf0\x9f\x98\x82");
	_tmp9_ = g_strdup ("\xf0\x9f\x98\xae");
	_tmp10_ = g_strdup ("\xf0\x9f\x98\xa2");
	_tmp11_ = g_strdup ("\xf0\x9f\x91\x8e");
	_tmp12_ = g_new0 (gchar*, 6 + 1);
	_tmp12_[0] = _tmp6_;
	_tmp12_[1] = _tmp7_;
	_tmp12_[2] = _tmp8_;
	_tmp12_[3] = _tmp9_;
	_tmp12_[4] = _tmp10_;
	_tmp12_[5] = _tmp11_;
	emojis = _tmp12_;
	emojis_length1 = 6;
	_emojis_size_ = emojis_length1;
	_tmp13_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp13_);
	emoji_row1 = _tmp13_;
	_tmp14_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp14_);
	emoji_row2 = _tmp14_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp15_ = FALSE;
			_tmp15_ = TRUE;
			while (TRUE) {
				Block36Data* _data36_;
				gchar** _tmp17_;
				gint _tmp17__length1;
				gchar** _tmp18_;
				gint _tmp18__length1;
				const gchar* _tmp19_;
				gchar* _tmp20_;
				GtkButton* btn = NULL;
				const gchar* _tmp21_;
				GtkButton* _tmp22_;
				GtkButton* _tmp23_;
				GtkButton* _tmp24_;
				_data36_ = g_slice_new0 (Block36Data);
				_data36_->_ref_count_ = 1;
				_data36_->_data35_ = block35_data_ref (_data35_);
				if (!_tmp15_) {
					gint _tmp16_;
					_tmp16_ = i;
					i = _tmp16_ + 1;
				}
				_tmp15_ = FALSE;
				_tmp17_ = emojis;
				_tmp17__length1 = emojis_length1;
				if (!(i < _tmp17__length1)) {
					block36_data_unref (_data36_);
					_data36_ = NULL;
					break;
				}
				_tmp18_ = emojis;
				_tmp18__length1 = emojis_length1;
				_tmp19_ = _tmp18_[i];
				_tmp20_ = g_strdup (_tmp19_);
				_data36_->emoji = _tmp20_;
				_tmp21_ = _data36_->emoji;
				_tmp22_ = (GtkButton*) gtk_button_new_with_label (_tmp21_);
				g_object_ref_sink (_tmp22_);
				btn = _tmp22_;
				_tmp23_ = btn;
				gtk_widget_add_css_class ((GtkWidget*) _tmp23_, "flat");
				_tmp24_ = btn;
				g_signal_connect_data (_tmp24_, "clicked", (GCallback) ______lambda18__gtk_button_clicked, block36_data_ref (_data36_), (GClosureNotify) block36_data_unref, 0);
				if (i < 3) {
					GtkBox* _tmp25_;
					GtkButton* _tmp26_;
					_tmp25_ = emoji_row1;
					_tmp26_ = btn;
					gtk_box_append (_tmp25_, (GtkWidget*) _tmp26_);
				} else {
					GtkBox* _tmp27_;
					GtkButton* _tmp28_;
					_tmp27_ = emoji_row2;
					_tmp28_ = btn;
					gtk_box_append (_tmp27_, (GtkWidget*) _tmp28_);
				}
				_g_object_unref0 (btn);
				block36_data_unref (_data36_);
				_data36_ = NULL;
			}
		}
	}
	_tmp29_ = vbox;
	_tmp30_ = emoji_row1;
	gtk_box_append (_tmp29_, (GtkWidget*) _tmp30_);
	_tmp31_ = vbox;
	_tmp32_ = emoji_row2;
	gtk_box_append (_tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = vbox;
	_tmp34_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp34_);
	_tmp35_ = _tmp34_;
	gtk_box_append (_tmp33_, (GtkWidget*) _tmp35_);
	_g_object_unref0 (_tmp35_);
	_tmp36_ = (GtkButton*) gtk_button_new_with_label ("Reply");
	g_object_ref_sink (_tmp36_);
	reply_btn = _tmp36_;
	_tmp37_ = reply_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp37_, "flat");
	_tmp38_ = reply_btn;
	g_signal_connect_data (_tmp38_, "clicked", (GCallback) ___lambda19__gtk_button_clicked, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	_tmp39_ = vbox;
	_tmp40_ = reply_btn;
	gtk_box_append (_tmp39_, (GtkWidget*) _tmp40_);
	_tmp41_ = (GtkButton*) gtk_button_new_with_label ("Forward\u2026");
	g_object_ref_sink (_tmp41_);
	forward_btn = _tmp41_;
	_tmp42_ = forward_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp42_, "flat");
	_tmp43_ = forward_btn;
	g_signal_connect_data (_tmp43_, "clicked", (GCallback) ___lambda20__gtk_button_clicked, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	_tmp44_ = vbox;
	_tmp45_ = forward_btn;
	gtk_box_append (_tmp44_, (GtkWidget*) _tmp45_);
	_tmp46_ = self->priv->pinned;
	msg_is_pinned = dc_pinned_messages_manager_is_pinned (_tmp46_, _data35_->msg_id);
	if (msg_is_pinned) {
		_tmp47_ = "Unpin";
	} else {
		_tmp47_ = "Pin";
	}
	_tmp48_ = (GtkButton*) gtk_button_new_with_label (_tmp47_);
	g_object_ref_sink (_tmp48_);
	pin_btn = _tmp48_;
	_tmp49_ = pin_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp49_, "flat");
	_tmp50_ = pin_btn;
	g_signal_connect_data (_tmp50_, "clicked", (GCallback) ___lambda26__gtk_button_clicked, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	_tmp51_ = vbox;
	_tmp52_ = pin_btn;
	gtk_box_append (_tmp51_, (GtkWidget*) _tmp52_);
	_tmp53_ = self->priv->message_store;
	_tmp54_ = dc_find_message (_tmp53_, _data35_->msg_id);
	msg = _tmp54_;
	_tmp57_ = msg;
	if (_tmp57_ != NULL) {
		DcMessage* _tmp58_;
		const gchar* _tmp59_;
		const gchar* _tmp60_;
		_tmp58_ = msg;
		_tmp59_ = dc_message_get_file_path (_tmp58_);
		_tmp60_ = _tmp59_;
		_tmp56_ = _tmp60_ != NULL;
	} else {
		_tmp56_ = FALSE;
	}
	if (_tmp56_) {
		DcMessage* _tmp61_;
		const gchar* _tmp62_;
		const gchar* _tmp63_;
		gint _tmp64_;
		gint _tmp65_;
		_tmp61_ = msg;
		_tmp62_ = dc_message_get_file_path (_tmp61_);
		_tmp63_ = _tmp62_;
		_tmp64_ = strlen (_tmp63_);
		_tmp65_ = _tmp64_;
		_tmp55_ = _tmp65_ > 0;
	} else {
		_tmp55_ = FALSE;
	}
	if (_tmp55_) {
		Block37Data* _data37_;
		DcMessage* _tmp66_;
		const gchar* _tmp67_;
		const gchar* _tmp68_;
		gchar* _tmp69_;
		DcMessage* _tmp70_;
		const gchar* _tmp71_;
		const gchar* _tmp72_;
		gchar* _tmp73_;
		GtkButton* save_btn = NULL;
		GtkButton* _tmp74_;
		GtkButton* _tmp75_;
		GtkButton* _tmp76_;
		GtkBox* _tmp77_;
		GtkButton* _tmp78_;
		_data37_ = g_slice_new0 (Block37Data);
		_data37_->_ref_count_ = 1;
		_data37_->_data35_ = block35_data_ref (_data35_);
		_tmp66_ = msg;
		_tmp67_ = dc_message_get_file_path (_tmp66_);
		_tmp68_ = _tmp67_;
		_tmp69_ = g_strdup (_tmp68_);
		_data37_->fpath = _tmp69_;
		_tmp70_ = msg;
		_tmp71_ = dc_message_get_file_name (_tmp70_);
		_tmp72_ = _tmp71_;
		_tmp73_ = g_strdup (_tmp72_);
		_data37_->fname = _tmp73_;
		_tmp74_ = (GtkButton*) gtk_button_new_with_label ("Save file");
		g_object_ref_sink (_tmp74_);
		save_btn = _tmp74_;
		_tmp75_ = save_btn;
		gtk_widget_add_css_class ((GtkWidget*) _tmp75_, "flat");
		_tmp76_ = save_btn;
		g_signal_connect_data (_tmp76_, "clicked", (GCallback) ____lambda27__gtk_button_clicked, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
		_tmp77_ = vbox;
		_tmp78_ = save_btn;
		gtk_box_append (_tmp77_, (GtkWidget*) _tmp78_);
		_g_object_unref0 (save_btn);
		block37_data_unref (_data37_);
		_data37_ = NULL;
	}
	if (_data35_->is_outgoing) {
		gboolean has_text = FALSE;
		DcMessage* _tmp79_;
		has_text = FALSE;
		_tmp79_ = msg;
		if (_tmp79_ != NULL) {
			gboolean _tmp80_ = FALSE;
			DcMessage* _tmp81_;
			const gchar* _tmp82_;
			const gchar* _tmp83_;
			_tmp81_ = msg;
			_tmp82_ = dc_message_get_text (_tmp81_);
			_tmp83_ = _tmp82_;
			if (_tmp83_ != NULL) {
				DcMessage* _tmp84_;
				const gchar* _tmp85_;
				const gchar* _tmp86_;
				gchar* _tmp87_;
				gchar* _tmp88_;
				gint _tmp89_;
				gint _tmp90_;
				_tmp84_ = msg;
				_tmp85_ = dc_message_get_text (_tmp84_);
				_tmp86_ = _tmp85_;
				_tmp87_ = string_strip (_tmp86_);
				_tmp88_ = _tmp87_;
				_tmp89_ = strlen (_tmp88_);
				_tmp90_ = _tmp89_;
				_tmp80_ = _tmp90_ > 0;
				_g_free0 (_tmp88_);
			} else {
				_tmp80_ = FALSE;
			}
			has_text = _tmp80_;
		}
		if (has_text) {
			GtkButton* edit_btn = NULL;
			GtkButton* _tmp91_;
			GtkButton* _tmp92_;
			GtkButton* _tmp93_;
			GtkBox* _tmp94_;
			GtkButton* _tmp95_;
			_tmp91_ = (GtkButton*) gtk_button_new_with_label ("Edit");
			g_object_ref_sink (_tmp91_);
			edit_btn = _tmp91_;
			_tmp92_ = edit_btn;
			gtk_widget_add_css_class ((GtkWidget*) _tmp92_, "flat");
			_tmp93_ = edit_btn;
			g_signal_connect_data (_tmp93_, "clicked", (GCallback) _____lambda28__gtk_button_clicked, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
			_tmp94_ = vbox;
			_tmp95_ = edit_btn;
			gtk_box_append (_tmp94_, (GtkWidget*) _tmp95_);
			_g_object_unref0 (edit_btn);
		}
	}
	_tmp96_ = vbox;
	_tmp97_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp97_);
	_tmp98_ = _tmp97_;
	gtk_box_append (_tmp96_, (GtkWidget*) _tmp98_);
	_g_object_unref0 (_tmp98_);
	_tmp99_ = (GtkButton*) gtk_button_new_with_label ("Delete…");
	g_object_ref_sink (_tmp99_);
	del_btn = _tmp99_;
	gtk_widget_add_css_class ((GtkWidget*) del_btn, "flat");
	g_signal_connect_data (del_btn, "clicked", (GCallback) ___lambda29__gtk_button_clicked, block35_data_ref (_data35_), (GClosureNotify) block35_data_unref, 0);
	_tmp100_ = vbox;
	gtk_box_append (_tmp100_, (GtkWidget*) del_btn);
	_tmp101_ = _data35_->popover;
	_tmp102_ = vbox;
	gtk_popover_set_child (_tmp101_, (GtkWidget*) _tmp102_);
	_tmp103_ = _data35_->popover;
	gtk_widget_set_parent ((GtkWidget*) _tmp103_, parent);
	_tmp104_ = _data35_->popover;
	_tmp105_.x = (gint) x;
	_tmp105_.y = (gint) y;
	_tmp105_.width = 1;
	_tmp105_.height = 1;
	gtk_popover_set_pointing_to (_tmp104_, &_tmp105_);
	_tmp106_ = _data35_->popover;
	gtk_popover_popup (_tmp106_);
	_g_object_unref0 (del_btn);
	_g_object_unref0 (msg);
	_g_object_unref0 (pin_btn);
	_g_object_unref0 (forward_btn);
	_g_object_unref0 (reply_btn);
	_g_object_unref0 (emoji_row2);
	_g_object_unref0 (emoji_row1);
	emojis = (_vala_array_free (emojis, emojis_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (vbox);
	block35_data_unref (_data35_);
	_data35_ = NULL;
}

static void
dc_message_actions_send_reaction_data_free (gpointer _data)
{
	DcMessageActionsSendReactionData* _data_;
	_data_ = _data;
	_g_free0 (_data_->emoji);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcMessageActionsSendReactionData, _data_);
}

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

void
dc_message_actions_send_reaction (DcMessageActions* self,
                                  gint msg_id,
                                  const gchar* emoji,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	DcMessageActionsSendReactionData* _data_;
	DcMessageActions* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (emoji != NULL);
	_data_ = g_slice_new0 (DcMessageActionsSendReactionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_actions_send_reaction_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	_tmp1_ = g_strdup (emoji);
	_g_free0 (_data_->emoji);
	_data_->emoji = _tmp1_;
	dc_message_actions_send_reaction_co (_data_);
}

void
dc_message_actions_send_reaction_finish (DcMessageActions* self,
                                         GAsyncResult* _res_)
{
	DcMessageActionsSendReactionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_actions_send_reaction_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	DcMessageActionsSendReactionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_actions_send_reaction_co (_data_);
}

static gboolean
dc_message_actions_send_reaction_co (DcMessageActionsSendReactionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_tmp1_ = g_strdup (_data_->emoji);
		_data_->_tmp2_ = g_new0 (gchar*, 1 + 1);
		_data_->_tmp2_[0] = _data_->_tmp1_;
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp3__length1 = 1;
		_data_->_state_ = 1;
		dc_rpc_client_send_reaction (_data_->_tmp0_, _data_->msg_id, _data_->_tmp3_, (gint) 1, dc_message_actions_send_reaction_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_send_reaction_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp3_ = (_vala_array_free (_data_->_tmp3_, _data_->_tmp3__length1, (GDestroyNotify) g_free), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_state_ = 2;
		dc_message_actions_update_row (_data_->self, _data_->msg_id, dc_message_actions_send_reaction_ready, _data_);
		return FALSE;
		_state_2:
		dc_message_actions_update_row_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->self->priv->window;
		_data_->_tmp5_ = _data_->e;
		_data_->_tmp6_ = _data_->_tmp5_->message;
		_data_->_tmp7_ = g_strconcat ("Reaction failed: ", _data_->_tmp6_, NULL);
		_data_->_tmp8_ = _data_->_tmp7_;
		dc_window_show_toast (_data_->_tmp4_, _data_->_tmp8_);
		_g_free0 (_data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

void
dc_message_actions_delete_message (DcMessageActions* self,
                                   gint msg_id,
                                   gboolean for_all,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	DcMessageActionsDeleteMessageData* _data_;
	DcMessageActions* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcMessageActionsDeleteMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_actions_delete_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	_data_->for_all = for_all;
	dc_message_actions_delete_message_co (_data_);
}

void
dc_message_actions_delete_message_finish (DcMessageActions* self,
                                          GAsyncResult* _res_)
{
	DcMessageActionsDeleteMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_actions_delete_message_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DcMessageActionsDeleteMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_actions_delete_message_co (_data_);
}

static gboolean
dc_message_actions_delete_message_co (DcMessageActionsDeleteMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		if (_data_->for_all) {
			_data_->_tmp0_ = _data_->self->priv->rpc;
			_data_->_tmp1_ = g_new0 (gint, 1);
			_data_->_tmp1_[0] = _data_->msg_id;
			_data_->_tmp2_ = _data_->_tmp1_;
			_data_->_tmp2__length1 = 1;
			_data_->_state_ = 1;
			dc_rpc_client_delete_messages_for_all (_data_->_tmp0_, _data_->_tmp2_, (gint) 1, dc_message_actions_delete_message_ready, _data_);
			return FALSE;
			_state_1:
			dc_rpc_client_delete_messages_for_all_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp2_ = (g_free (_data_->_tmp2_), NULL);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			_data_->_tmp3_ = _data_->self->priv->rpc;
			_data_->_tmp4_ = g_new0 (gint, 1);
			_data_->_tmp4_[0] = _data_->msg_id;
			_data_->_tmp5_ = _data_->_tmp4_;
			_data_->_tmp5__length1 = 1;
			_data_->_state_ = 2;
			dc_rpc_client_delete_messages (_data_->_tmp3_, _data_->_tmp5_, (gint) 1, dc_message_actions_delete_message_ready, _data_);
			return FALSE;
			_state_2:
			dc_rpc_client_delete_messages_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp5_ = (g_free (_data_->_tmp5_), NULL);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		_data_->_tmp6_ = _data_->self->priv->message_store;
		_data_->idx = dc_find_message_index (_data_->_tmp6_, _data_->msg_id);
		if (_data_->idx >= 0) {
			_data_->_tmp7_ = _data_->self->priv->message_store;
			g_list_store_remove (_data_->_tmp7_, (guint) _data_->idx);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp8_ = _data_->self->priv->window;
		_data_->_tmp9_ = _data_->e;
		_data_->_tmp10_ = _data_->_tmp9_->message;
		_data_->_tmp11_ = g_strconcat ("Delete failed: ", _data_->_tmp10_, NULL);
		_data_->_tmp12_ = _data_->_tmp11_;
		dc_window_show_toast (_data_->_tmp8_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
dc_message_actions_start_editing (DcMessageActions* self,
                                  gint msg_id)
{
	DcMessage* m = NULL;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->message_store;
	_tmp1_ = dc_find_message (_tmp0_, msg_id);
	m = _tmp1_;
	_tmp2_ = m;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_ = NULL;
		DcMessage* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		DcComposeBar* _tmp7_;
		_tmp4_ = m;
		_tmp5_ = dc_message_get_text (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp3_ = _tmp6_;
		if (_tmp3_ == NULL) {
			_tmp3_ = "";
		}
		_tmp7_ = self->priv->compose_bar;
		dc_compose_bar_begin_edit (_tmp7_, msg_id, _tmp3_);
	}
	_g_object_unref0 (m);
}

void
dc_message_actions_start_replying (DcMessageActions* self,
                                   gint msg_id)
{
	DcMessage* m = NULL;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->message_store;
	_tmp1_ = dc_find_message (_tmp0_, msg_id);
	m = _tmp1_;
	_tmp2_ = m;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_ = NULL;
		DcMessage* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		gchar* sender = NULL;
		gchar* _tmp11_;
		const gchar* _tmp12_ = NULL;
		DcMessage* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* preview = NULL;
		gchar* _tmp16_;
		DcComposeBar* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		_tmp4_ = m;
		_tmp5_ = dc_message_get_is_outgoing (_tmp4_);
		_tmp6_ = _tmp5_;
		if (_tmp6_) {
			_tmp3_ = "You";
		} else {
			const gchar* _tmp7_ = NULL;
			DcMessage* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_tmp8_ = m;
			_tmp9_ = dc_message_get_sender_name (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp7_ = _tmp10_;
			if (_tmp7_ == NULL) {
				_tmp7_ = "";
			}
			_tmp3_ = _tmp7_;
		}
		_tmp11_ = g_strdup (_tmp3_);
		sender = _tmp11_;
		_tmp13_ = m;
		_tmp14_ = dc_message_get_text (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp12_ = _tmp15_;
		if (_tmp12_ == NULL) {
			_tmp12_ = "(attachment)";
		}
		_tmp16_ = g_strdup (_tmp12_);
		preview = _tmp16_;
		_tmp17_ = self->priv->compose_bar;
		_tmp18_ = sender;
		_tmp19_ = preview;
		dc_compose_bar_begin_reply (_tmp17_, msg_id, _tmp18_, _tmp19_);
		_g_free0 (preview);
		_g_free0 (sender);
	}
	_g_object_unref0 (m);
}

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

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

static void
__lambda22_ (Block38Data* _data38_,
             gint chat_id)
{
	DcMessageActions* self;
	self = _data38_->self;
	dc_message_actions_forward_to_chat (self, _data38_->msg_id, chat_id, NULL, NULL);
}

static void
___lambda22__dc_contact_picker_dialog_chat_picked (DcContactPickerDialog* _sender,
                                                   gint chat_id,
                                                   gpointer self)
{
	__lambda22_ (self, chat_id);
}

static void
__lambda25_ (Block38Data* _data38_,
             gint contact_id,
             const gchar* email)
{
	DcMessageActions* self;
	self = _data38_->self;
	g_return_if_fail (email != NULL);
	dc_message_actions_forward_to_contact (self, _data38_->msg_id, contact_id, email, NULL, NULL);
}

static void
___lambda25__dc_contact_picker_dialog_contact_picked (DcContactPickerDialog* _sender,
                                                      gint contact_id,
                                                      const gchar* email,
                                                      gpointer self)
{
	__lambda25_ (self, contact_id, email);
}

void
dc_message_actions_start_forwarding (DcMessageActions* self,
                                     gint msg_id)
{
	Block38Data* _data38_;
	DcContactPickerDialog* picker = NULL;
	DcRpcClient* _tmp0_;
	DcWindow* _tmp1_;
	GListStore* _tmp2_;
	GListStore* _tmp3_;
	DcContactPickerDialog* _tmp4_;
	DcWindow* _tmp5_;
	g_return_if_fail (self != NULL);
	_data38_ = g_slice_new0 (Block38Data);
	_data38_->_ref_count_ = 1;
	_data38_->self = g_object_ref (self);
	_data38_->msg_id = msg_id;
	_tmp0_ = self->priv->rpc;
	_tmp1_ = self->priv->window;
	_tmp2_ = dc_window_get_chat_store (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = dc_contact_picker_dialog_new (_tmp0_, _tmp3_, "Forward To");
	g_object_ref_sink (_tmp4_);
	picker = _tmp4_;
	g_signal_connect_data (picker, "chat-picked", (GCallback) ___lambda22__dc_contact_picker_dialog_chat_picked, block38_data_ref (_data38_), (GClosureNotify) block38_data_unref, 0);
	g_signal_connect_data (picker, "contact-picked", (GCallback) ___lambda25__dc_contact_picker_dialog_contact_picked, block38_data_ref (_data38_), (GClosureNotify) block38_data_unref, 0);
	_tmp5_ = self->priv->window;
	adw_dialog_present ((AdwDialog*) picker, (GtkWidget*) _tmp5_);
	_g_object_unref0 (picker);
	block38_data_unref (_data38_);
	_data38_ = NULL;
}

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

static void
dc_message_actions_forward_to_chat (DcMessageActions* self,
                                    gint msg_id,
                                    gint chat_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DcMessageActionsForwardToChatData* _data_;
	DcMessageActions* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcMessageActionsForwardToChatData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_actions_forward_to_chat_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	_data_->chat_id = chat_id;
	dc_message_actions_forward_to_chat_co (_data_);
}

static void
dc_message_actions_forward_to_chat_finish (DcMessageActions* self,
                                           GAsyncResult* _res_)
{
	DcMessageActionsForwardToChatData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_actions_forward_to_chat_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DcMessageActionsForwardToChatData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_actions_forward_to_chat_co (_data_);
}

static gboolean
dc_message_actions_forward_to_chat_co (DcMessageActionsForwardToChatData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_tmp1_ = g_new0 (gint, 1);
		_data_->_tmp1_[0] = _data_->msg_id;
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp2__length1 = 1;
		_data_->_state_ = 1;
		dc_rpc_client_forward_messages (_data_->_tmp0_, _data_->_tmp2_, (gint) 1, _data_->chat_id, dc_message_actions_forward_to_chat_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_forward_messages_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp2_ = (g_free (_data_->_tmp2_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp3_);
		_data_->_tmp4_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp4_, "Message forwarded");
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = _data_->self->priv->window;
		_data_->_tmp6_ = _data_->e;
		_data_->_tmp7_ = _data_->_tmp6_->message;
		_data_->_tmp8_ = g_strconcat ("Forward failed: ", _data_->_tmp7_, NULL);
		_data_->_tmp9_ = _data_->_tmp8_;
		dc_window_show_toast (_data_->_tmp5_, _data_->_tmp9_);
		_g_free0 (_data_->_tmp9_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_message_actions_forward_to_contact_data_free (gpointer _data)
{
	DcMessageActionsForwardToContactData* _data_;
	_data_ = _data;
	_g_free0 (_data_->email);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcMessageActionsForwardToContactData, _data_);
}

static void
dc_message_actions_forward_to_contact (DcMessageActions* self,
                                       gint msg_id,
                                       gint contact_id,
                                       const gchar* email,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	DcMessageActionsForwardToContactData* _data_;
	DcMessageActions* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (email != NULL);
	_data_ = g_slice_new0 (DcMessageActionsForwardToContactData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_actions_forward_to_contact_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	_data_->contact_id = contact_id;
	_tmp1_ = g_strdup (email);
	_g_free0 (_data_->email);
	_data_->email = _tmp1_;
	dc_message_actions_forward_to_contact_co (_data_);
}

static void
dc_message_actions_forward_to_contact_finish (DcMessageActions* self,
                                              GAsyncResult* _res_)
{
	DcMessageActionsForwardToContactData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_actions_forward_to_contact_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	DcMessageActionsForwardToContactData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_actions_forward_to_contact_co (_data_);
}

static gboolean
dc_message_actions_forward_to_contact_co (DcMessageActionsForwardToContactData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->cid = _data_->contact_id;
		if (_data_->cid <= 0) {
			_data_->_tmp1_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_get_or_create_contact (_data_->_tmp1_, _data_->email, dc_message_actions_forward_to_contact_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp0_ = dc_rpc_client_get_or_create_contact_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->cid = _data_->_tmp0_;
		}
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_get_or_create_chat_by_contact (_data_->_tmp2_, _data_->cid, dc_message_actions_forward_to_contact_ready, _data_);
		return FALSE;
		_state_2:
		_data_->chat_id = dc_rpc_client_get_or_create_chat_by_contact_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->self->priv->rpc;
		_data_->_tmp4_ = g_new0 (gint, 1);
		_data_->_tmp4_[0] = _data_->msg_id;
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp5__length1 = 1;
		_data_->_state_ = 3;
		dc_rpc_client_forward_messages (_data_->_tmp3_, _data_->_tmp5_, (gint) 1, _data_->chat_id, dc_message_actions_forward_to_contact_ready, _data_);
		return FALSE;
		_state_3:
		dc_rpc_client_forward_messages_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp5_ = (g_free (_data_->_tmp5_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp6_);
		_data_->_tmp7_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp7_, "Message forwarded");
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp8_ = _data_->self->priv->window;
		_data_->_tmp9_ = _data_->e;
		_data_->_tmp10_ = _data_->_tmp9_->message;
		_data_->_tmp11_ = g_strconcat ("Forward failed: ", _data_->_tmp10_, NULL);
		_data_->_tmp12_ = _data_->_tmp11_;
		dc_window_show_toast (_data_->_tmp8_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_message_actions_edit_message_data_free (gpointer _data)
{
	DcMessageActionsEditMessageData* _data_;
	_data_ = _data;
	_g_free0 (_data_->new_text);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcMessageActionsEditMessageData, _data_);
}

void
dc_message_actions_edit_message (DcMessageActions* self,
                                 gint msg_id,
                                 const gchar* new_text,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcMessageActionsEditMessageData* _data_;
	DcMessageActions* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_text != NULL);
	_data_ = g_slice_new0 (DcMessageActionsEditMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_actions_edit_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	_tmp1_ = g_strdup (new_text);
	_g_free0 (_data_->new_text);
	_data_->new_text = _tmp1_;
	dc_message_actions_edit_message_co (_data_);
}

void
dc_message_actions_edit_message_finish (DcMessageActions* self,
                                        GAsyncResult* _res_)
{
	DcMessageActionsEditMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_actions_edit_message_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcMessageActionsEditMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_actions_edit_message_co (_data_);
}

static gboolean
dc_message_actions_edit_message_co (DcMessageActionsEditMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_send_edit_request (_data_->_tmp0_, _data_->msg_id, _data_->new_text, dc_message_actions_edit_message_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_send_edit_request_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_state_ = 2;
		dc_message_actions_update_row (_data_->self, _data_->msg_id, dc_message_actions_edit_message_ready, _data_);
		return FALSE;
		_state_2:
		dc_message_actions_update_row_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp1_ = _data_->self->priv->window;
		_data_->_tmp2_ = _data_->e;
		_data_->_tmp3_ = _data_->_tmp2_->message;
		_data_->_tmp4_ = g_strconcat ("Edit failed: ", _data_->_tmp3_, NULL);
		_data_->_tmp5_ = _data_->_tmp4_;
		dc_window_show_toast (_data_->_tmp1_, _data_->_tmp5_);
		_g_free0 (_data_->_tmp5_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

void
dc_message_actions_update_row (DcMessageActions* self,
                               gint msg_id,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DcMessageActionsUpdateRowData* _data_;
	DcMessageActions* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcMessageActionsUpdateRowData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_actions_update_row_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	dc_message_actions_update_row_co (_data_);
}

void
dc_message_actions_update_row_finish (DcMessageActions* self,
                                      GAsyncResult* _res_)
{
	DcMessageActionsUpdateRowData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_actions_update_row_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DcMessageActionsUpdateRowData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_actions_update_row_co (_data_);
}

static gboolean
dc_message_actions_update_row_co (DcMessageActionsUpdateRowData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_fetch_message (_data_->_tmp0_, _data_->msg_id, dc_message_actions_update_row_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = dc_rpc_client_fetch_message_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		_data_->msg = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->msg;
		if (_data_->_tmp2_ == NULL) {
			_g_object_unref0 (_data_->msg);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp3_ = _data_->self->priv->message_store;
		_data_->idx = dc_find_message_index (_data_->_tmp3_, _data_->msg_id);
		if (_data_->idx >= 0) {
			_data_->_tmp4_ = _data_->msg;
			_data_->_tmp5_ = _g_object_ref0 ((GObject*) _data_->_tmp4_);
			_data_->_tmp6_ = g_new0 (GObject*, 1 + 1);
			_data_->_tmp6_[0] = _data_->_tmp5_;
			_data_->replacements = _data_->_tmp6_;
			_data_->replacements_length1 = 1;
			_data_->_replacements_size_ = _data_->replacements_length1;
			_data_->_tmp7_ = _data_->self->priv->message_store;
			_data_->_tmp8_ = _data_->replacements;
			_data_->_tmp8__length1 = _data_->replacements_length1;
			g_list_store_splice (_data_->_tmp7_, (guint) _data_->idx, (guint) 1, _data_->_tmp8_, (guint) _data_->_tmp8__length1);
			_data_->replacements = (_vala_array_free (_data_->replacements, _data_->replacements_length1, (GDestroyNotify) g_object_unref), NULL);
		}
		_g_object_unref0 (_data_->msg);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
dc_message_actions_handle_double_click (DcMessageActions* self,
                                        gint msg_id)
{
	DcSettingsManager* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	DcComposeBar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = dc_settings_manager_get_double_click_action (_tmp0_);
	_tmp2_ = _tmp1_;
	switch (_tmp2_) {
		case 0:
		{
			dc_message_actions_start_replying (self, msg_id);
			break;
		}
		case 1:
		{
			dc_message_actions_send_reaction (self, msg_id, "\xe2\x9d\xa4\xef\xb8\x8f", NULL, NULL);
			break;
		}
		case 2:
		{
			dc_message_actions_send_reaction (self, msg_id, "\xf0\x9f\x91\x8d", NULL, NULL);
			break;
		}
		case 3:
		{
			dc_message_actions_open_sender_profile (self, msg_id, NULL, NULL);
			break;
		}
		case 4:
		{
			break;
		}
		default:
		break;
	}
	_tmp3_ = self->priv->compose_bar;
	dc_compose_bar_grab_entry_focus (_tmp3_);
}

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

void
dc_message_actions_open_sender_profile (DcMessageActions* self,
                                        gint msg_id,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	DcMessageActionsOpenSenderProfileData* _data_;
	DcMessageActions* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcMessageActionsOpenSenderProfileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_message_actions_open_sender_profile_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->msg_id = msg_id;
	dc_message_actions_open_sender_profile_co (_data_);
}

void
dc_message_actions_open_sender_profile_finish (DcMessageActions* self,
                                               GAsyncResult* _res_)
{
	DcMessageActionsOpenSenderProfileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_message_actions_open_sender_profile_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	DcMessageActionsOpenSenderProfileData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_message_actions_open_sender_profile_co (_data_);
}

static gboolean
dc_message_actions_open_sender_profile_co (DcMessageActionsOpenSenderProfileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->message_store;
	_data_->_tmp1_ = dc_find_message (_data_->_tmp0_, _data_->msg_id);
	_data_->m = _data_->_tmp1_;
	_data_->_tmp4_ = _data_->m;
	if (_data_->_tmp4_ == NULL) {
		_data_->_tmp3_ = TRUE;
	} else {
		_data_->_tmp5_ = _data_->m;
		_data_->_tmp6_ = dc_message_get_sender_address (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp3_ = _data_->_tmp7_ == NULL;
	}
	if (_data_->_tmp3_) {
		_data_->_tmp2_ = TRUE;
	} else {
		_data_->_tmp8_ = _data_->m;
		_data_->_tmp9_ = dc_message_get_is_outgoing (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp2_ = _data_->_tmp10_;
	}
	if (_data_->_tmp2_) {
		_g_object_unref0 (_data_->m);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp11_ = _data_->self->priv->rpc;
		_data_->_tmp12_ = _data_->m;
		_data_->_tmp13_ = dc_message_get_sender_address (_data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_state_ = 1;
		dc_rpc_client_lookup_contact (_data_->_tmp11_, _data_->_tmp14_, dc_message_actions_open_sender_profile_ready, _data_);
		return FALSE;
		_state_1:
		_data_->contact_id = dc_rpc_client_lookup_contact_finish (_data_->_tmp11_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->contact_id <= 0) {
			_g_object_unref0 (_data_->m);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp15_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_get_or_create_chat_by_contact (_data_->_tmp15_, _data_->contact_id, dc_message_actions_open_sender_profile_ready, _data_);
		return FALSE;
		_state_2:
		_data_->chat_id = dc_rpc_client_get_or_create_chat_by_contact_finish (_data_->_tmp15_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->chat_id > 0) {
			_data_->_tmp16_ = _data_->self->priv->window;
			dc_window_request_reload_chats (_data_->_tmp16_);
			_data_->_tmp17_ = _data_->self->priv->window;
			dc_window_select_chat_by_id (_data_->_tmp17_, _data_->chat_id);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp18_ = _data_->self->priv->window;
		_data_->_tmp19_ = _data_->e;
		_data_->_tmp20_ = _data_->_tmp19_->message;
		_data_->_tmp21_ = g_strconcat ("Could not open profile: ", _data_->_tmp20_, NULL);
		_data_->_tmp22_ = _data_->_tmp21_;
		dc_window_show_toast (_data_->_tmp18_, _data_->_tmp22_);
		_g_free0 (_data_->_tmp22_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->m);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->m);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_message_actions_class_init (DcMessageActionsClass * klass,
                               gpointer klass_data)
{
	dc_message_actions_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcMessageActions_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dc_message_actions_finalize;
}

static void
dc_message_actions_instance_init (DcMessageActions * self,
                                  gpointer klass)
{
	self->priv = dc_message_actions_get_instance_private (self);
}

static void
dc_message_actions_finalize (GObject * obj)
{
	DcMessageActions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_MESSAGE_ACTIONS, DcMessageActions);
	G_OBJECT_CLASS (dc_message_actions_parent_class)->finalize (obj);
}

static GType
dc_message_actions_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcMessageActionsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_message_actions_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcMessageActions), 0, (GInstanceInitFunc) dc_message_actions_instance_init, NULL };
	GType dc_message_actions_type_id;
	dc_message_actions_type_id = g_type_register_static (G_TYPE_OBJECT, "DcMessageActions", &g_define_type_info, 0);
	DcMessageActions_private_offset = g_type_add_instance_private (dc_message_actions_type_id, sizeof (DcMessageActionsPrivate));
	return dc_message_actions_type_id;
}

GType
dc_message_actions_get_type (void)
{
	static volatile gsize dc_message_actions_type_id__once = 0;
	if (g_once_init_enter (&dc_message_actions_type_id__once)) {
		GType dc_message_actions_type_id;
		dc_message_actions_type_id = dc_message_actions_get_type_once ();
		g_once_init_leave (&dc_message_actions_type_id__once, dc_message_actions_type_id);
	}
	return dc_message_actions_type_id__once;
}

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

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

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

