/* 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];

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

typedef struct _DcConversationView DcConversationView;
typedef struct _DcConversationViewClass DcConversationViewClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block55Data Block55Data;

#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 _Block56Data Block56Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block57Data Block57Data;
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 _Block58Data Block58Data;
typedef struct _DcMessageActionsDeleteMessageData DcMessageActionsDeleteMessageData;
typedef struct _Block59Data Block59Data;

#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 _Block55Data {
	int _ref_count_;
	DcMessageActions* self;
	GtkPopover* popover;
	DcConversationView* view;
	gdouble saved_scroll;
	gint msg_id;
	gboolean is_outgoing;
	gdouble x;
	gdouble y;
	GtkWidget* parent;
};

struct _Block56Data {
	int _ref_count_;
	Block55Data * _data55_;
	gchar* emoji;
};

struct _Block57Data {
	int _ref_count_;
	Block55Data * _data55_;
	gchar* fpath;
	gchar* fname;
};

struct _DcMessageActionsSendReactionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcMessageActions* self;
	gint msg_id;
	gchar* emoji;
	DcMessage* current;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	gboolean already_used;
	gboolean _tmp2_;
	DcMessage* _tmp3_;
	DcMessage* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	DcMessage* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar** _tmp10_;
	gchar** _tmp11_;
	gchar** me_collection;
	gint me_collection_length1;
	gint _me_collection_size_;
	gint me_it;
	gchar* _tmp12_;
	gchar* me;
	const gchar* _tmp13_;
	DcRpcClient* _tmp14_;
	gchar** _tmp15_;
	gchar** _tmp16_;
	gint _tmp16__length1;
	DcRpcClient* _tmp17_;
	gchar* _tmp18_;
	gchar** _tmp19_;
	gchar** _tmp20_;
	gint _tmp20__length1;
	GError* e;
	DcWindow* _tmp21_;
	GError* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	GError* _inner_error0_;
};

struct _Block58Data {
	int _ref_count_;
	DcMessageActions* self;
	GtkEmojiChooser* chooser;
	DcConversationView* view;
	gdouble saved_scroll;
	gint msg_id;
};

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 _Block59Data {
	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_;
	DcConversationView* view;
	DcWindow* _tmp3_;
	DcConversationView* _tmp4_;
	DcConversationView* _tmp5_;
	DcConversationView* _tmp6_;
	DcMessage* _tmp7_;
	gint idx;
	GListStore* _tmp8_;
	GObject** replacements;
	DcMessage* _tmp9_;
	GObject* _tmp10_;
	GObject** _tmp11_;
	gint replacements_length1;
	gint _replacements_size_;
	GListStore* _tmp12_;
	GObject** _tmp13_;
	gint _tmp13__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);
VALA_EXTERN GType dc_conversation_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcConversationView, g_object_unref)
static Block55Data* block55_data_ref (Block55Data* _data55_);
static void block55_data_unref (void * _userdata_);
VALA_EXTERN gboolean dc_gtk_emoji_chooser_available (void);
static void _vala_array_add11 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
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_my_reactions (DcMessage* self);
static Block56Data* block56_data_ref (Block56Data* _data56_);
static void block56_data_unref (void * _userdata_);
static void ______lambda38_ (Block56Data* _data56_);
static void dc_message_actions_show_emoji_picker (DcMessageActions* self,
                                           gint msg_id,
                                           GtkWidget* parent,
                                           gdouble x,
                                           gdouble y);
static void _______lambda38__gtk_button_clicked (GtkButton* _sender,
                                          gpointer self);
static void ______lambda45_ (Block56Data* _data56_);
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 _______lambda45__gtk_button_clicked (GtkButton* _sender,
                                          gpointer self);
static void __lambda46_ (Block55Data* _data55_);
VALA_EXTERN void dc_message_actions_start_replying (DcMessageActions* self,
                                        gint msg_id);
static void ___lambda46__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda47_ (Block55Data* _data55_);
VALA_EXTERN void dc_message_actions_start_forwarding (DcMessageActions* self,
                                          gint msg_id);
static void ___lambda47__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
VALA_EXTERN gboolean dc_pinned_messages_manager_is_pinned (DcPinnedMessagesManager* self,
                                               gint msg_id);
static void __lambda51_ (Block55Data* _data55_);
VALA_EXTERN void dc_pinned_messages_manager_toggle_pin (DcPinnedMessagesManager* self,
                                            gint msg_id);
static void ___lambda51__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
static Block57Data* block57_data_ref (Block57Data* _data57_);
static void block57_data_unref (void * _userdata_);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
static void ___lambda52_ (Block57Data* _data57_);
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 ____lambda52__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN gboolean dc_message_get_can_edit_text (DcMessage* self);
static void ___lambda53_ (Block55Data* _data55_);
VALA_EXTERN void dc_message_actions_start_editing (DcMessageActions* self,
                                       gint msg_id);
static void ____lambda53__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda54_ (Block55Data* _data55_);
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 ___lambda56_ (Block55Data* _data55_);
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 ____lambda56__dc_void_func (gpointer self);
static void ___lambda57_ (Block55Data* _data55_);
static void ____lambda57__dc_void_func (gpointer self);
static void ___lambda58_ (Block55Data* _data55_);
static void ____lambda58__dc_void_func (gpointer self);
static void ___lambda54__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
VALA_EXTERN DcConversationView* dc_window_current_view (DcWindow* self);
VALA_EXTERN gdouble dc_conversation_view_get_scroll_value (DcConversationView* self);
VALA_EXTERN void dc_conversation_view_freeze_scroll_handler (DcConversationView* self,
                                                 guint ms);
static void __lambda59_ (Block55Data* _data55_);
VALA_EXTERN void dc_conversation_view_restore_scroll_value (DcConversationView* self,
                                                gdouble v);
VALA_EXTERN void dc_conversation_view_restore_scroll_value_deferred (DcConversationView* self,
                                                         gdouble v);
static gboolean __lambda60_ (Block55Data* _data55_);
static gboolean ___lambda60__gsource_func (gpointer self);
static void ___lambda59__gtk_popover_closed (GtkPopover* _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 Block58Data* block58_data_ref (Block58Data* _data58_);
static void block58_data_unref (void * _userdata_);
VALA_EXTERN GtkEmojiChooser* dc_create_emoji_chooser (void);
static void __lambda39_ (Block58Data* _data58_,
                  const gchar* emoji);
static void ___lambda39__gtk_emoji_chooser_emoji_picked (GtkEmojiChooser* _sender,
                                                  const gchar* text,
                                                  gpointer self);
static void __lambda43_ (Block58Data* _data58_);
static void ___lambda43__gtk_popover_closed (GtkPopover* _sender,
                                      gpointer self);
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);
static void dc_message_actions_start_editing_message (DcMessageActions* self,
                                               DcMessage* m);
VALA_EXTERN void dc_message_actions_start_editing_last (DcMessageActions* self);
VALA_EXTERN DcMessage* dc_find_last_editable_text_message (GListStore* store);
VALA_EXTERN const gchar* dc_message_get_text (DcMessage* self);
VALA_EXTERN void dc_compose_bar_begin_edit (DcComposeBar* self,
                                gint msg_id,
                                const gchar* current_text);
VALA_EXTERN gint dc_message_get_id (DcMessage* self);
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 Block59Data* block59_data_ref (Block59Data* _data59_);
static void block59_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 __lambda49_ (Block59Data* _data59_,
                  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 ___lambda49__dc_contact_picker_dialog_chat_picked (DcContactPickerDialog* _sender,
                                                        gint chat_id,
                                                        gpointer self);
static void __lambda50_ (Block59Data* _data59_,
                  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 ___lambda50__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_conversation_view_replace_message (DcConversationView* self,
                                           gint msg_id,
                                           DcMessage* new_msg);
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 gboolean 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 gssize _vala_array_length (gpointer array);
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 gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static Block55Data*
block55_data_ref (Block55Data* _data55_)
{
	g_atomic_int_inc (&_data55_->_ref_count_);
	return _data55_;
}

static void
block55_data_unref (void * _userdata_)
{
	Block55Data* _data55_;
	_data55_ = (Block55Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data55_->_ref_count_)) {
		DcMessageActions* self;
		self = _data55_->self;
		_g_object_unref0 (_data55_->view);
		_g_object_unref0 (_data55_->popover);
		_g_object_unref0 (_data55_->parent);
		_g_object_unref0 (self);
		g_slice_free (Block55Data, _data55_);
	}
}

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

static Block56Data*
block56_data_ref (Block56Data* _data56_)
{
	g_atomic_int_inc (&_data56_->_ref_count_);
	return _data56_;
}

static void
block56_data_unref (void * _userdata_)
{
	Block56Data* _data56_;
	_data56_ = (Block56Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data56_->_ref_count_)) {
		DcMessageActions* self;
		self = _data56_->_data55_->self;
		_g_free0 (_data56_->emoji);
		block55_data_unref (_data56_->_data55_);
		_data56_->_data55_ = NULL;
		g_slice_free (Block56Data, _data56_);
	}
}

static void
______lambda38_ (Block56Data* _data56_)
{
	Block55Data* _data55_;
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	_data55_ = _data56_->_data55_;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_message_actions_show_emoji_picker (self, _data55_->msg_id, _data55_->parent, _data55_->x, _data55_->y);
}

static void
_______lambda38__gtk_button_clicked (GtkButton* _sender,
                                     gpointer self)
{
	______lambda38_ (self);
}

static void
______lambda45_ (Block56Data* _data56_)
{
	Block55Data* _data55_;
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	const gchar* _tmp1_;
	_data55_ = _data56_->_data55_;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = _data56_->emoji;
	dc_message_actions_send_reaction (self, _data55_->msg_id, _tmp1_, NULL, NULL);
}

static void
_______lambda45__gtk_button_clicked (GtkButton* _sender,
                                     gpointer self)
{
	______lambda45_ (self);
}

static void
__lambda46_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_message_actions_start_replying (self, _data55_->msg_id);
}

static void
___lambda46__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda46_ (self);
}

static void
__lambda47_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_message_actions_start_forwarding (self, _data55_->msg_id);
}

static void
___lambda47__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda47_ (self);
}

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

static void
___lambda51__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda51_ (self);
}

static Block57Data*
block57_data_ref (Block57Data* _data57_)
{
	g_atomic_int_inc (&_data57_->_ref_count_);
	return _data57_;
}

static void
block57_data_unref (void * _userdata_)
{
	Block57Data* _data57_;
	_data57_ = (Block57Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data57_->_ref_count_)) {
		DcMessageActions* self;
		self = _data57_->_data55_->self;
		_g_free0 (_data57_->fname);
		_g_free0 (_data57_->fpath);
		block55_data_unref (_data57_->_data55_);
		_data57_->_data55_ = NULL;
		g_slice_free (Block57Data, _data57_);
	}
}

static void
___lambda52_ (Block57Data* _data57_)
{
	Block55Data* _data55_;
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	DcWindow* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	_data55_ = _data57_->_data55_;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = self->priv->window;
	_tmp2_ = _data57_->fpath;
	_tmp3_ = _data57_->fname;
	dc_window_save_attachment (_tmp1_, _tmp2_, _tmp3_, NULL, NULL);
}

static void
____lambda52__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda52_ (self);
}

static void
___lambda53_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_message_actions_start_editing (self, _data55_->msg_id);
}

static void
____lambda53__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda53_ (self);
}

static void
___lambda56_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	self = _data55_->self;
	dc_message_actions_delete_message (self, _data55_->msg_id, FALSE, NULL, NULL);
}

static void
____lambda56__dc_void_func (gpointer self)
{
	___lambda56_ (self);
}

static void
___lambda57_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	self = _data55_->self;
	dc_message_actions_delete_message (self, _data55_->msg_id, TRUE, NULL, NULL);
}

static void
____lambda57__dc_void_func (gpointer self)
{
	___lambda57_ (self);
}

static void
___lambda58_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	self = _data55_->self;
	dc_message_actions_delete_message (self, _data55_->msg_id, FALSE, NULL, NULL);
}

static void
____lambda58__dc_void_func (gpointer self)
{
	___lambda58_ (self);
}

static void
__lambda54_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_popover_popdown (_tmp0_);
	if (_data55_->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.", ____lambda56__dc_void_func, block55_data_ref (_data55_), block55_data_unref, ____lambda57__dc_void_func, block55_data_ref (_data55_), block55_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.", ____lambda58__dc_void_func, block55_data_ref (_data55_), block55_data_unref, NULL, NULL, NULL);
	}
}

static void
___lambda54__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda54_ (self);
}

static gboolean
__lambda60_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	GtkPopover* _tmp0_;
	gboolean result;
	self = _data55_->self;
	_tmp0_ = _data55_->popover;
	gtk_widget_unparent ((GtkWidget*) _tmp0_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda60__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda60_ (self);
	return result;
}

static void
__lambda59_ (Block55Data* _data55_)
{
	DcMessageActions* self;
	DcConversationView* _tmp0_;
	self = _data55_->self;
	_tmp0_ = _data55_->view;
	if (_tmp0_ != NULL) {
		DcConversationView* _tmp1_;
		DcConversationView* _tmp2_;
		_tmp1_ = _data55_->view;
		dc_conversation_view_restore_scroll_value (_tmp1_, _data55_->saved_scroll);
		_tmp2_ = _data55_->view;
		dc_conversation_view_restore_scroll_value_deferred (_tmp2_, _data55_->saved_scroll);
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda60__gsource_func, block55_data_ref (_data55_), block55_data_unref);
}

static void
___lambda59__gtk_popover_closed (GtkPopover* _sender,
                                 gpointer self)
{
	__lambda59_ (self);
}

void
dc_message_actions_show_context_menu (DcMessageActions* self,
                                      gint msg_id,
                                      gboolean is_outgoing,
                                      gdouble x,
                                      gdouble y,
                                      GtkWidget* parent)
{
	Block55Data* _data55_;
	GtkWidget* _tmp0_;
	GtkPopover* _tmp1_;
	GtkBox* vbox = NULL;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	gchar** emojis = NULL;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar** _tmp14_;
	gint emojis_length1;
	gint _emojis_size_;
	DcMessage* msg = NULL;
	GListStore* _tmp16_;
	DcMessage* _tmp17_;
	gchar** my_emojis = NULL;
	gchar** _tmp18_;
	gint my_emojis_length1;
	gint _my_emojis_size_;
	gboolean _tmp19_ = FALSE;
	DcMessage* _tmp20_;
	GtkBox* emoji_row1 = NULL;
	GtkBox* _tmp29_;
	GtkBox* emoji_row2 = NULL;
	GtkBox* _tmp30_;
	GtkBox* _tmp53_;
	GtkBox* _tmp54_;
	GtkBox* _tmp55_;
	GtkBox* _tmp56_;
	GtkBox* _tmp57_;
	GtkSeparator* _tmp58_;
	GtkSeparator* _tmp59_;
	GtkBox* reply_forward_row = NULL;
	GtkBox* _tmp60_;
	GtkBox* _tmp61_;
	GtkButton* reply_btn = NULL;
	GtkButton* _tmp62_;
	GtkButton* _tmp63_;
	GtkButton* _tmp64_;
	GtkButton* _tmp65_;
	GtkBox* _tmp66_;
	GtkButton* _tmp67_;
	GtkButton* forward_btn = NULL;
	GtkButton* _tmp68_;
	GtkButton* _tmp69_;
	GtkButton* _tmp70_;
	GtkButton* _tmp71_;
	GtkBox* _tmp72_;
	GtkButton* _tmp73_;
	GtkBox* _tmp74_;
	GtkBox* _tmp75_;
	gboolean msg_is_pinned = FALSE;
	DcPinnedMessagesManager* _tmp76_;
	const gchar* _tmp77_ = NULL;
	GtkButton* pin_btn = NULL;
	GtkButton* _tmp78_;
	GtkButton* _tmp79_;
	GtkButton* _tmp80_;
	GtkBox* _tmp81_;
	GtkButton* _tmp82_;
	gboolean _tmp83_ = FALSE;
	gboolean _tmp84_ = FALSE;
	DcMessage* _tmp85_;
	gboolean _tmp107_ = FALSE;
	DcMessage* _tmp108_;
	GtkBox* _tmp117_;
	GtkSeparator* _tmp118_;
	GtkSeparator* _tmp119_;
	GtkButton* del_btn = NULL;
	GtkButton* _tmp120_;
	GtkButton* _tmp121_;
	GtkButton* _tmp122_;
	GtkBox* _tmp123_;
	GtkButton* _tmp124_;
	GtkPopover* _tmp125_;
	GtkBox* _tmp126_;
	GtkPopover* _tmp127_;
	GtkPopover* _tmp128_;
	GdkRectangle _tmp129_ = {0};
	DcWindow* _tmp130_;
	DcConversationView* _tmp131_;
	gdouble _tmp132_ = 0.0;
	DcConversationView* _tmp133_;
	DcConversationView* _tmp135_;
	GtkPopover* _tmp137_;
	GtkPopover* _tmp138_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	_data55_ = g_slice_new0 (Block55Data);
	_data55_->_ref_count_ = 1;
	_data55_->self = g_object_ref (self);
	_data55_->msg_id = msg_id;
	_data55_->is_outgoing = is_outgoing;
	_data55_->x = x;
	_data55_->y = y;
	_tmp0_ = _g_object_ref0 (parent);
	_g_object_unref0 (_data55_->parent);
	_data55_->parent = _tmp0_;
	_tmp1_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp1_);
	_data55_->popover = _tmp1_;
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
	g_object_ref_sink (_tmp2_);
	vbox = _tmp2_;
	_tmp3_ = vbox;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 4);
	_tmp4_ = vbox;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp4_, 4);
	_tmp5_ = vbox;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp5_, 4);
	_tmp6_ = vbox;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp6_, 4);
	_tmp7_ = g_strdup ("\xf0\x9f\x91\x8d");
	_tmp8_ = g_strdup ("\xe2\x9d\xa4\xef\xb8\x8f");
	_tmp9_ = g_strdup ("\xf0\x9f\x98\x82");
	_tmp10_ = g_strdup ("\xf0\x9f\x98\xae");
	_tmp11_ = g_strdup ("\xf0\x9f\x98\xa2");
	_tmp12_ = g_strdup ("\xf0\x9f\x91\x8e");
	_tmp13_ = g_strdup ("\xf0\x9f\x94\xa5");
	_tmp14_ = g_new0 (gchar*, 7 + 1);
	_tmp14_[0] = _tmp7_;
	_tmp14_[1] = _tmp8_;
	_tmp14_[2] = _tmp9_;
	_tmp14_[3] = _tmp10_;
	_tmp14_[4] = _tmp11_;
	_tmp14_[5] = _tmp12_;
	_tmp14_[6] = _tmp13_;
	emojis = _tmp14_;
	emojis_length1 = 7;
	_emojis_size_ = emojis_length1;
	if (dc_gtk_emoji_chooser_available ()) {
		gchar* _tmp15_;
		_tmp15_ = g_strdup ("…");
		_vala_array_add11 (&emojis, &emojis_length1, &_emojis_size_, _tmp15_);
	}
	_tmp16_ = self->priv->message_store;
	_tmp17_ = dc_find_message (_tmp16_, _data55_->msg_id);
	msg = _tmp17_;
	_tmp18_ = g_new0 (gchar*, 0 + 1);
	my_emojis = _tmp18_;
	my_emojis_length1 = 0;
	_my_emojis_size_ = my_emojis_length1;
	_tmp20_ = msg;
	if (_tmp20_ != NULL) {
		DcMessage* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		_tmp21_ = msg;
		_tmp22_ = dc_message_get_my_reactions (_tmp21_);
		_tmp23_ = _tmp22_;
		_tmp19_ = _tmp23_ != NULL;
	} else {
		_tmp19_ = FALSE;
	}
	if (_tmp19_) {
		DcMessage* _tmp24_;
		const gchar* _tmp25_;
		const gchar* _tmp26_;
		gchar** _tmp27_;
		gchar** _tmp28_;
		_tmp24_ = msg;
		_tmp25_ = dc_message_get_my_reactions (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp28_ = _tmp27_ = g_strsplit (_tmp26_, ",", 0);
		my_emojis = (_vala_array_free (my_emojis, my_emojis_length1, (GDestroyNotify) g_free), NULL);
		my_emojis = _tmp28_;
		my_emojis_length1 = _vala_array_length (_tmp27_);
		_my_emojis_size_ = my_emojis_length1;
	}
	_tmp29_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp29_);
	emoji_row1 = _tmp29_;
	_tmp30_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp30_);
	emoji_row2 = _tmp30_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp31_ = FALSE;
			_tmp31_ = TRUE;
			while (TRUE) {
				Block56Data* _data56_;
				gchar** _tmp33_;
				gint _tmp33__length1;
				gchar** _tmp34_;
				gint _tmp34__length1;
				const gchar* _tmp35_;
				gchar* _tmp36_;
				GtkButton* btn = NULL;
				const gchar* _tmp37_;
				GtkButton* _tmp38_;
				GtkButton* _tmp39_;
				gboolean is_more = FALSE;
				const gchar* _tmp40_;
				_data56_ = g_slice_new0 (Block56Data);
				_data56_->_ref_count_ = 1;
				_data56_->_data55_ = block55_data_ref (_data55_);
				if (!_tmp31_) {
					gint _tmp32_;
					_tmp32_ = i;
					i = _tmp32_ + 1;
				}
				_tmp31_ = FALSE;
				_tmp33_ = emojis;
				_tmp33__length1 = emojis_length1;
				if (!(i < _tmp33__length1)) {
					block56_data_unref (_data56_);
					_data56_ = NULL;
					break;
				}
				_tmp34_ = emojis;
				_tmp34__length1 = emojis_length1;
				_tmp35_ = _tmp34_[i];
				_tmp36_ = g_strdup (_tmp35_);
				_data56_->emoji = _tmp36_;
				_tmp37_ = _data56_->emoji;
				_tmp38_ = (GtkButton*) gtk_button_new_with_label (_tmp37_);
				g_object_ref_sink (_tmp38_);
				btn = _tmp38_;
				_tmp39_ = btn;
				gtk_widget_add_css_class ((GtkWidget*) _tmp39_, "flat");
				_tmp40_ = _data56_->emoji;
				is_more = g_strcmp0 (_tmp40_, "…") == 0;
				if (is_more) {
					GtkButton* _tmp41_;
					GtkButton* _tmp42_;
					_tmp41_ = btn;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp41_, "More emojis…");
					_tmp42_ = btn;
					g_signal_connect_data (_tmp42_, "clicked", (GCallback) _______lambda38__gtk_button_clicked, block56_data_ref (_data56_), (GClosureNotify) block56_data_unref, 0);
				} else {
					gboolean already_used = FALSE;
					gchar** _tmp43_;
					gint _tmp43__length1;
					GtkButton* _tmp48_;
					already_used = FALSE;
					_tmp43_ = my_emojis;
					_tmp43__length1 = my_emojis_length1;
					{
						gchar** me_collection = NULL;
						gint me_collection_length1 = 0;
						gint _me_collection_size_ = 0;
						gint me_it = 0;
						me_collection = _tmp43_;
						me_collection_length1 = _tmp43__length1;
						for (me_it = 0; me_it < me_collection_length1; me_it = me_it + 1) {
							gchar* _tmp44_;
							gchar* me = NULL;
							_tmp44_ = g_strdup (me_collection[me_it]);
							me = _tmp44_;
							{
								const gchar* _tmp45_;
								const gchar* _tmp46_;
								_tmp45_ = me;
								_tmp46_ = _data56_->emoji;
								if (g_strcmp0 (_tmp45_, _tmp46_) == 0) {
									already_used = TRUE;
									_g_free0 (me);
									break;
								}
								_g_free0 (me);
							}
						}
					}
					if (already_used) {
						GtkButton* _tmp47_;
						_tmp47_ = btn;
						gtk_widget_add_css_class ((GtkWidget*) _tmp47_, "suggested-action");
					}
					_tmp48_ = btn;
					g_signal_connect_data (_tmp48_, "clicked", (GCallback) _______lambda45__gtk_button_clicked, block56_data_ref (_data56_), (GClosureNotify) block56_data_unref, 0);
				}
				if (i < 4) {
					GtkBox* _tmp49_;
					GtkButton* _tmp50_;
					_tmp49_ = emoji_row1;
					_tmp50_ = btn;
					gtk_box_append (_tmp49_, (GtkWidget*) _tmp50_);
				} else {
					GtkBox* _tmp51_;
					GtkButton* _tmp52_;
					_tmp51_ = emoji_row2;
					_tmp52_ = btn;
					gtk_box_append (_tmp51_, (GtkWidget*) _tmp52_);
				}
				_g_object_unref0 (btn);
				block56_data_unref (_data56_);
				_data56_ = NULL;
			}
		}
	}
	_tmp53_ = vbox;
	_tmp54_ = emoji_row1;
	gtk_box_append (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = vbox;
	_tmp56_ = emoji_row2;
	gtk_box_append (_tmp55_, (GtkWidget*) _tmp56_);
	_tmp57_ = vbox;
	_tmp58_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp58_);
	_tmp59_ = _tmp58_;
	gtk_box_append (_tmp57_, (GtkWidget*) _tmp59_);
	_g_object_unref0 (_tmp59_);
	_tmp60_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp60_);
	reply_forward_row = _tmp60_;
	_tmp61_ = reply_forward_row;
	gtk_box_set_homogeneous (_tmp61_, TRUE);
	_tmp62_ = (GtkButton*) gtk_button_new_with_label ("Reply");
	g_object_ref_sink (_tmp62_);
	reply_btn = _tmp62_;
	_tmp63_ = reply_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp63_, "flat");
	_tmp64_ = reply_btn;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp64_, TRUE);
	_tmp65_ = reply_btn;
	g_signal_connect_data (_tmp65_, "clicked", (GCallback) ___lambda46__gtk_button_clicked, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp66_ = reply_forward_row;
	_tmp67_ = reply_btn;
	gtk_box_append (_tmp66_, (GtkWidget*) _tmp67_);
	_tmp68_ = (GtkButton*) gtk_button_new_with_label ("Forward\u2026");
	g_object_ref_sink (_tmp68_);
	forward_btn = _tmp68_;
	_tmp69_ = forward_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp69_, "flat");
	_tmp70_ = forward_btn;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp70_, TRUE);
	_tmp71_ = forward_btn;
	g_signal_connect_data (_tmp71_, "clicked", (GCallback) ___lambda47__gtk_button_clicked, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp72_ = reply_forward_row;
	_tmp73_ = forward_btn;
	gtk_box_append (_tmp72_, (GtkWidget*) _tmp73_);
	_tmp74_ = vbox;
	_tmp75_ = reply_forward_row;
	gtk_box_append (_tmp74_, (GtkWidget*) _tmp75_);
	_tmp76_ = self->priv->pinned;
	msg_is_pinned = dc_pinned_messages_manager_is_pinned (_tmp76_, _data55_->msg_id);
	if (msg_is_pinned) {
		_tmp77_ = "Unpin from conversation";
	} else {
		_tmp77_ = "Pin in conversation";
	}
	_tmp78_ = (GtkButton*) gtk_button_new_with_label (_tmp77_);
	g_object_ref_sink (_tmp78_);
	pin_btn = _tmp78_;
	_tmp79_ = pin_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp79_, "flat");
	_tmp80_ = pin_btn;
	g_signal_connect_data (_tmp80_, "clicked", (GCallback) ___lambda51__gtk_button_clicked, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp81_ = vbox;
	_tmp82_ = pin_btn;
	gtk_box_append (_tmp81_, (GtkWidget*) _tmp82_);
	_tmp85_ = msg;
	if (_tmp85_ != NULL) {
		DcMessage* _tmp86_;
		const gchar* _tmp87_;
		const gchar* _tmp88_;
		_tmp86_ = msg;
		_tmp87_ = dc_message_get_file_path (_tmp86_);
		_tmp88_ = _tmp87_;
		_tmp84_ = _tmp88_ != NULL;
	} else {
		_tmp84_ = FALSE;
	}
	if (_tmp84_) {
		DcMessage* _tmp89_;
		const gchar* _tmp90_;
		const gchar* _tmp91_;
		gint _tmp92_;
		gint _tmp93_;
		_tmp89_ = msg;
		_tmp90_ = dc_message_get_file_path (_tmp89_);
		_tmp91_ = _tmp90_;
		_tmp92_ = strlen (_tmp91_);
		_tmp93_ = _tmp92_;
		_tmp83_ = _tmp93_ > 0;
	} else {
		_tmp83_ = FALSE;
	}
	if (_tmp83_) {
		Block57Data* _data57_;
		DcMessage* _tmp94_;
		const gchar* _tmp95_;
		const gchar* _tmp96_;
		gchar* _tmp97_;
		DcMessage* _tmp98_;
		const gchar* _tmp99_;
		const gchar* _tmp100_;
		gchar* _tmp101_;
		GtkButton* save_btn = NULL;
		GtkButton* _tmp102_;
		GtkButton* _tmp103_;
		GtkButton* _tmp104_;
		GtkBox* _tmp105_;
		GtkButton* _tmp106_;
		_data57_ = g_slice_new0 (Block57Data);
		_data57_->_ref_count_ = 1;
		_data57_->_data55_ = block55_data_ref (_data55_);
		_tmp94_ = msg;
		_tmp95_ = dc_message_get_file_path (_tmp94_);
		_tmp96_ = _tmp95_;
		_tmp97_ = g_strdup (_tmp96_);
		_data57_->fpath = _tmp97_;
		_tmp98_ = msg;
		_tmp99_ = dc_message_get_file_name (_tmp98_);
		_tmp100_ = _tmp99_;
		_tmp101_ = g_strdup (_tmp100_);
		_data57_->fname = _tmp101_;
		_tmp102_ = (GtkButton*) gtk_button_new_with_label ("Save file");
		g_object_ref_sink (_tmp102_);
		save_btn = _tmp102_;
		_tmp103_ = save_btn;
		gtk_widget_add_css_class ((GtkWidget*) _tmp103_, "flat");
		_tmp104_ = save_btn;
		g_signal_connect_data (_tmp104_, "clicked", (GCallback) ____lambda52__gtk_button_clicked, block57_data_ref (_data57_), (GClosureNotify) block57_data_unref, 0);
		_tmp105_ = vbox;
		_tmp106_ = save_btn;
		gtk_box_append (_tmp105_, (GtkWidget*) _tmp106_);
		_g_object_unref0 (save_btn);
		block57_data_unref (_data57_);
		_data57_ = NULL;
	}
	_tmp108_ = msg;
	if (_tmp108_ != NULL) {
		DcMessage* _tmp109_;
		gboolean _tmp110_;
		gboolean _tmp111_;
		_tmp109_ = msg;
		_tmp110_ = dc_message_get_can_edit_text (_tmp109_);
		_tmp111_ = _tmp110_;
		_tmp107_ = _tmp111_;
	} else {
		_tmp107_ = FALSE;
	}
	if (_tmp107_) {
		GtkButton* edit_btn = NULL;
		GtkButton* _tmp112_;
		GtkButton* _tmp113_;
		GtkButton* _tmp114_;
		GtkBox* _tmp115_;
		GtkButton* _tmp116_;
		_tmp112_ = (GtkButton*) gtk_button_new_with_label ("Edit");
		g_object_ref_sink (_tmp112_);
		edit_btn = _tmp112_;
		_tmp113_ = edit_btn;
		gtk_widget_add_css_class ((GtkWidget*) _tmp113_, "flat");
		_tmp114_ = edit_btn;
		g_signal_connect_data (_tmp114_, "clicked", (GCallback) ____lambda53__gtk_button_clicked, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
		_tmp115_ = vbox;
		_tmp116_ = edit_btn;
		gtk_box_append (_tmp115_, (GtkWidget*) _tmp116_);
		_g_object_unref0 (edit_btn);
	}
	_tmp117_ = vbox;
	_tmp118_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp118_);
	_tmp119_ = _tmp118_;
	gtk_box_append (_tmp117_, (GtkWidget*) _tmp119_);
	_g_object_unref0 (_tmp119_);
	_tmp120_ = (GtkButton*) gtk_button_new_with_label ("Delete…");
	g_object_ref_sink (_tmp120_);
	del_btn = _tmp120_;
	_tmp121_ = del_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp121_, "flat");
	_tmp122_ = del_btn;
	g_signal_connect_data (_tmp122_, "clicked", (GCallback) ___lambda54__gtk_button_clicked, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp123_ = vbox;
	_tmp124_ = del_btn;
	gtk_box_append (_tmp123_, (GtkWidget*) _tmp124_);
	_tmp125_ = _data55_->popover;
	_tmp126_ = vbox;
	gtk_popover_set_child (_tmp125_, (GtkWidget*) _tmp126_);
	_tmp127_ = _data55_->popover;
	gtk_widget_set_parent ((GtkWidget*) _tmp127_, _data55_->parent);
	_tmp128_ = _data55_->popover;
	_tmp129_.x = (gint) _data55_->x;
	_tmp129_.y = (gint) _data55_->y;
	_tmp129_.width = 1;
	_tmp129_.height = 1;
	gtk_popover_set_pointing_to (_tmp128_, &_tmp129_);
	_tmp130_ = self->priv->window;
	_tmp131_ = dc_window_current_view (_tmp130_);
	_data55_->view = _tmp131_;
	_tmp133_ = _data55_->view;
	if (_tmp133_ != NULL) {
		DcConversationView* _tmp134_;
		_tmp134_ = _data55_->view;
		_tmp132_ = dc_conversation_view_get_scroll_value (_tmp134_);
	} else {
		_tmp132_ = (gdouble) 0;
	}
	_data55_->saved_scroll = _tmp132_;
	_tmp135_ = _data55_->view;
	if (_tmp135_ != NULL) {
		DcConversationView* _tmp136_;
		_tmp136_ = _data55_->view;
		dc_conversation_view_freeze_scroll_handler (_tmp136_, (guint) 1500);
	}
	_tmp137_ = _data55_->popover;
	g_signal_connect_data (_tmp137_, "closed", (GCallback) ___lambda59__gtk_popover_closed, block55_data_ref (_data55_), (GClosureNotify) block55_data_unref, 0);
	_tmp138_ = _data55_->popover;
	gtk_popover_popup (_tmp138_);
	_g_object_unref0 (del_btn);
	_g_object_unref0 (pin_btn);
	_g_object_unref0 (forward_btn);
	_g_object_unref0 (reply_btn);
	_g_object_unref0 (reply_forward_row);
	_g_object_unref0 (emoji_row2);
	_g_object_unref0 (emoji_row1);
	my_emojis = (_vala_array_free (my_emojis, my_emojis_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (msg);
	emojis = (_vala_array_free (emojis, emojis_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (vbox);
	block55_data_unref (_data55_);
	_data55_ = 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_);
}

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;
		case 3:
		goto _state_3;
		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_->current = _data_->_tmp1_;
		_data_->already_used = FALSE;
		_data_->_tmp3_ = _data_->current;
		if (_data_->_tmp3_ != NULL) {
			_data_->_tmp4_ = _data_->current;
			_data_->_tmp5_ = dc_message_get_my_reactions (_data_->_tmp4_);
			_data_->_tmp6_ = _data_->_tmp5_;
			_data_->_tmp2_ = _data_->_tmp6_ != NULL;
		} else {
			_data_->_tmp2_ = FALSE;
		}
		if (_data_->_tmp2_) {
			_data_->_tmp7_ = _data_->current;
			_data_->_tmp8_ = dc_message_get_my_reactions (_data_->_tmp7_);
			_data_->_tmp9_ = _data_->_tmp8_;
			_data_->_tmp11_ = _data_->_tmp10_ = g_strsplit (_data_->_tmp9_, ",", 0);
			{
				_data_->me_collection_length1 = 0;
				_data_->_me_collection_size_ = 0;
				_data_->me_collection = _data_->_tmp11_;
				_data_->me_collection_length1 = _vala_array_length (_data_->_tmp10_);
				for (_data_->me_it = 0; _data_->me_it < _data_->me_collection_length1; _data_->me_it = _data_->me_it + 1) {
					_data_->_tmp12_ = g_strdup (_data_->me_collection[_data_->me_it]);
					_data_->me = _data_->_tmp12_;
					{
						_data_->_tmp13_ = _data_->me;
						if (g_strcmp0 (_data_->_tmp13_, _data_->emoji) == 0) {
							_data_->already_used = TRUE;
							_g_free0 (_data_->me);
							break;
						}
						_g_free0 (_data_->me);
					}
				}
				_data_->me_collection = (_vala_array_free (_data_->me_collection, _data_->me_collection_length1, (GDestroyNotify) g_free), NULL);
			}
		}
		if (_data_->already_used) {
			_data_->_tmp14_ = _data_->self->priv->rpc;
			_data_->_tmp15_ = g_new0 (gchar*, 0 + 1);
			_data_->_tmp16_ = _data_->_tmp15_;
			_data_->_tmp16__length1 = 0;
			_data_->_state_ = 1;
			dc_rpc_client_send_reaction (_data_->_tmp14_, _data_->msg_id, _data_->_tmp16_, (gint) 0, dc_message_actions_send_reaction_ready, _data_);
			return FALSE;
			_state_1:
			dc_rpc_client_send_reaction_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp16_ = (_vala_array_free (_data_->_tmp16_, _data_->_tmp16__length1, (GDestroyNotify) g_free), NULL);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->current);
				goto __catch0_g_error;
			}
		} else {
			_data_->_tmp17_ = _data_->self->priv->rpc;
			_data_->_tmp18_ = g_strdup (_data_->emoji);
			_data_->_tmp19_ = g_new0 (gchar*, 1 + 1);
			_data_->_tmp19_[0] = _data_->_tmp18_;
			_data_->_tmp20_ = _data_->_tmp19_;
			_data_->_tmp20__length1 = 1;
			_data_->_state_ = 2;
			dc_rpc_client_send_reaction (_data_->_tmp17_, _data_->msg_id, _data_->_tmp20_, (gint) 1, dc_message_actions_send_reaction_ready, _data_);
			return FALSE;
			_state_2:
			dc_rpc_client_send_reaction_finish (_data_->_tmp17_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp20_ = (_vala_array_free (_data_->_tmp20_, _data_->_tmp20__length1, (GDestroyNotify) g_free), NULL);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->current);
				goto __catch0_g_error;
			}
		}
		_data_->_state_ = 3;
		dc_message_actions_update_row (_data_->self, _data_->msg_id, dc_message_actions_send_reaction_ready, _data_);
		return FALSE;
		_state_3:
		dc_message_actions_update_row_finish (_data_->self, _data_->_res_);
		_g_object_unref0 (_data_->current);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp21_ = _data_->self->priv->window;
		_data_->_tmp22_ = _data_->e;
		_data_->_tmp23_ = _data_->_tmp22_->message;
		_data_->_tmp24_ = g_strconcat ("Reaction failed: ", _data_->_tmp23_, NULL);
		_data_->_tmp25_ = _data_->_tmp24_;
		dc_window_show_toast (_data_->_tmp21_, _data_->_tmp25_);
		_g_free0 (_data_->_tmp25_);
		_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 Block58Data*
block58_data_ref (Block58Data* _data58_)
{
	g_atomic_int_inc (&_data58_->_ref_count_);
	return _data58_;
}

static void
block58_data_unref (void * _userdata_)
{
	Block58Data* _data58_;
	_data58_ = (Block58Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data58_->_ref_count_)) {
		DcMessageActions* self;
		self = _data58_->self;
		_g_object_unref0 (_data58_->view);
		_g_object_unref0 (_data58_->chooser);
		_g_object_unref0 (self);
		g_slice_free (Block58Data, _data58_);
	}
}

static void
__lambda39_ (Block58Data* _data58_,
             const gchar* emoji)
{
	DcMessageActions* self;
	self = _data58_->self;
	g_return_if_fail (emoji != NULL);
	dc_message_actions_send_reaction (self, _data58_->msg_id, emoji, NULL, NULL);
}

static void
___lambda39__gtk_emoji_chooser_emoji_picked (GtkEmojiChooser* _sender,
                                             const gchar* text,
                                             gpointer self)
{
	__lambda39_ (self, text);
}

static void
__lambda43_ (Block58Data* _data58_)
{
	DcMessageActions* self;
	DcConversationView* _tmp0_;
	GtkEmojiChooser* _tmp3_;
	self = _data58_->self;
	_tmp0_ = _data58_->view;
	if (_tmp0_ != NULL) {
		DcConversationView* _tmp1_;
		DcConversationView* _tmp2_;
		_tmp1_ = _data58_->view;
		dc_conversation_view_restore_scroll_value (_tmp1_, _data58_->saved_scroll);
		_tmp2_ = _data58_->view;
		dc_conversation_view_restore_scroll_value_deferred (_tmp2_, _data58_->saved_scroll);
	}
	_tmp3_ = _data58_->chooser;
	gtk_widget_unparent ((GtkWidget*) _tmp3_);
}

static void
___lambda43__gtk_popover_closed (GtkPopover* _sender,
                                 gpointer self)
{
	__lambda43_ (self);
}

static void
dc_message_actions_show_emoji_picker (DcMessageActions* self,
                                      gint msg_id,
                                      GtkWidget* parent,
                                      gdouble x,
                                      gdouble y)
{
	Block58Data* _data58_;
	GtkEmojiChooser* _tmp0_;
	GtkEmojiChooser* _tmp1_;
	GtkEmojiChooser* _tmp3_;
	GtkEmojiChooser* _tmp4_;
	GtkEmojiChooser* _tmp5_;
	GdkRectangle _tmp6_ = {0};
	DcWindow* _tmp7_;
	DcConversationView* _tmp8_;
	gdouble _tmp9_ = 0.0;
	DcConversationView* _tmp10_;
	DcConversationView* _tmp12_;
	GtkEmojiChooser* _tmp14_;
	GtkEmojiChooser* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	_data58_ = g_slice_new0 (Block58Data);
	_data58_->_ref_count_ = 1;
	_data58_->self = g_object_ref (self);
	_data58_->msg_id = msg_id;
	_tmp0_ = dc_create_emoji_chooser ();
	_data58_->chooser = _tmp0_;
	_tmp1_ = _data58_->chooser;
	if (_tmp1_ == NULL) {
		DcWindow* _tmp2_;
		_tmp2_ = self->priv->window;
		dc_window_show_toast (_tmp2_, "Emoji picker unavailable");
		block58_data_unref (_data58_);
		_data58_ = NULL;
		return;
	}
	_tmp3_ = _data58_->chooser;
	g_signal_connect_data (_tmp3_, "emoji-picked", (GCallback) ___lambda39__gtk_emoji_chooser_emoji_picked, block58_data_ref (_data58_), (GClosureNotify) block58_data_unref, 0);
	_tmp4_ = _data58_->chooser;
	gtk_widget_set_parent ((GtkWidget*) _tmp4_, parent);
	_tmp5_ = _data58_->chooser;
	_tmp6_.x = (gint) x;
	_tmp6_.y = (gint) y;
	_tmp6_.width = 1;
	_tmp6_.height = 1;
	gtk_popover_set_pointing_to ((GtkPopover*) _tmp5_, &_tmp6_);
	_tmp7_ = self->priv->window;
	_tmp8_ = dc_window_current_view (_tmp7_);
	_data58_->view = _tmp8_;
	_tmp10_ = _data58_->view;
	if (_tmp10_ != NULL) {
		DcConversationView* _tmp11_;
		_tmp11_ = _data58_->view;
		_tmp9_ = dc_conversation_view_get_scroll_value (_tmp11_);
	} else {
		_tmp9_ = (gdouble) 0;
	}
	_data58_->saved_scroll = _tmp9_;
	_tmp12_ = _data58_->view;
	if (_tmp12_ != NULL) {
		DcConversationView* _tmp13_;
		_tmp13_ = _data58_->view;
		dc_conversation_view_freeze_scroll_handler (_tmp13_, (guint) 1500);
	}
	_tmp14_ = _data58_->chooser;
	g_signal_connect_data ((GtkPopover*) _tmp14_, "closed", (GCallback) ___lambda43__gtk_popover_closed, block58_data_ref (_data58_), (GClosureNotify) block58_data_unref, 0);
	_tmp15_ = _data58_->chooser;
	gtk_popover_popup ((GtkPopover*) _tmp15_);
	block58_data_unref (_data58_);
	_data58_ = NULL;
}

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) {
		DcMessage* _tmp3_;
		_tmp3_ = m;
		dc_message_actions_start_editing_message (self, _tmp3_);
	}
	_g_object_unref0 (m);
}

void
dc_message_actions_start_editing_last (DcMessageActions* self)
{
	DcMessage* m = NULL;
	GListStore* _tmp0_;
	DcMessage* _tmp1_;
	DcMessage* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->message_store;
	_tmp1_ = dc_find_last_editable_text_message (_tmp0_);
	m = _tmp1_;
	_tmp2_ = m;
	if (_tmp2_ != NULL) {
		DcMessage* _tmp3_;
		_tmp3_ = m;
		dc_message_actions_start_editing_message (self, _tmp3_);
	}
	_g_object_unref0 (m);
}

static void
dc_message_actions_start_editing_message (DcMessageActions* self,
                                          DcMessage* m)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	DcComposeBar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (m != NULL);
	_tmp1_ = dc_message_get_text (m);
	_tmp2_ = _tmp1_;
	_tmp0_ = _tmp2_;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp3_ = self->priv->compose_bar;
	_tmp4_ = dc_message_get_id (m);
	_tmp5_ = _tmp4_;
	dc_compose_bar_begin_edit (_tmp3_, _tmp5_, _tmp0_);
}

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 Block59Data*
block59_data_ref (Block59Data* _data59_)
{
	g_atomic_int_inc (&_data59_->_ref_count_);
	return _data59_;
}

static void
block59_data_unref (void * _userdata_)
{
	Block59Data* _data59_;
	_data59_ = (Block59Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data59_->_ref_count_)) {
		DcMessageActions* self;
		self = _data59_->self;
		_g_object_unref0 (self);
		g_slice_free (Block59Data, _data59_);
	}
}

static void
__lambda49_ (Block59Data* _data59_,
             gint chat_id)
{
	DcMessageActions* self;
	self = _data59_->self;
	dc_message_actions_forward_to_chat (self, _data59_->msg_id, chat_id, NULL, NULL);
}

static void
___lambda49__dc_contact_picker_dialog_chat_picked (DcContactPickerDialog* _sender,
                                                   gint chat_id,
                                                   gpointer self)
{
	__lambda49_ (self, chat_id);
}

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

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

void
dc_message_actions_start_forwarding (DcMessageActions* self,
                                     gint msg_id)
{
	Block59Data* _data59_;
	DcContactPickerDialog* picker = NULL;
	DcRpcClient* _tmp0_;
	DcWindow* _tmp1_;
	GListStore* _tmp2_;
	GListStore* _tmp3_;
	DcContactPickerDialog* _tmp4_;
	DcWindow* _tmp5_;
	g_return_if_fail (self != NULL);
	_data59_ = g_slice_new0 (Block59Data);
	_data59_->_ref_count_ = 1;
	_data59_->self = g_object_ref (self);
	_data59_->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) ___lambda49__dc_contact_picker_dialog_chat_picked, block59_data_ref (_data59_), (GClosureNotify) block59_data_unref, 0);
	g_signal_connect_data (picker, "contact-picked", (GCallback) ___lambda50__dc_contact_picker_dialog_contact_picked, block59_data_ref (_data59_), (GClosureNotify) block59_data_unref, 0);
	_tmp5_ = self->priv->window;
	adw_dialog_present ((AdwDialog*) picker, (GtkWidget*) _tmp5_);
	_g_object_unref0 (picker);
	block59_data_unref (_data59_);
	_data59_ = 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->window;
		_data_->_tmp4_ = dc_window_current_view (_data_->_tmp3_);
		_data_->view = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->view;
		if (_data_->_tmp5_ != NULL) {
			_data_->_tmp6_ = _data_->view;
			_data_->_tmp7_ = _data_->msg;
			dc_conversation_view_replace_message (_data_->_tmp6_, _data_->msg_id, _data_->_tmp7_);
		} else {
			_data_->_tmp8_ = _data_->self->priv->message_store;
			_data_->idx = dc_find_message_index (_data_->_tmp8_, _data_->msg_id);
			if (_data_->idx >= 0) {
				_data_->_tmp9_ = _data_->msg;
				_data_->_tmp10_ = _g_object_ref0 ((GObject*) _data_->_tmp9_);
				_data_->_tmp11_ = g_new0 (GObject*, 1 + 1);
				_data_->_tmp11_[0] = _data_->_tmp10_;
				_data_->replacements = _data_->_tmp11_;
				_data_->replacements_length1 = 1;
				_data_->_replacements_size_ = _data_->replacements_length1;
				_data_->_tmp12_ = _data_->self->priv->message_store;
				_data_->_tmp13_ = _data_->replacements;
				_data_->_tmp13__length1 = _data_->replacements_length1;
				g_list_store_splice (_data_->_tmp12_, (guint) _data_->idx, (guint) 1, _data_->_tmp13_, (guint) _data_->_tmp13__length1);
				_data_->replacements = (_vala_array_free (_data_->replacements, _data_->replacements_length1, (GDestroyNotify) g_object_unref), NULL);
			}
		}
		_g_object_unref0 (_data_->view);
		_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 gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

