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

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include "libdino.h"
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include "xmpp-vala.h"
#include <adwaita.h>
#include <gio/gio.h>
#include <gee.h>
#include "dino_i18n.h"

#define DINO_UI_OPEN_CONVERSATION_DETAILS_URI "x-dino:open-conversation-details"
#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 DINO_UI_TYPE_CHAT_INPUT_CONTROLLER (dino_ui_chat_input_controller_get_type ())
#define DINO_UI_CHAT_INPUT_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, DinoUiChatInputController))
#define DINO_UI_CHAT_INPUT_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, DinoUiChatInputControllerClass))
#define DINO_UI_IS_CHAT_INPUT_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CHAT_INPUT_CONTROLLER))
#define DINO_UI_IS_CHAT_INPUT_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CHAT_INPUT_CONTROLLER))
#define DINO_UI_CHAT_INPUT_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, DinoUiChatInputControllerClass))

typedef struct _DinoUiChatInputController DinoUiChatInputController;
typedef struct _DinoUiChatInputControllerClass DinoUiChatInputControllerClass;
typedef struct _DinoUiChatInputControllerPrivate DinoUiChatInputControllerPrivate;

#define DINO_UI_CHAT_INPUT_TYPE_VIEW (dino_ui_chat_input_view_get_type ())
#define DINO_UI_CHAT_INPUT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputView))
#define DINO_UI_CHAT_INPUT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputViewClass))
#define DINO_UI_CHAT_INPUT_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW))
#define DINO_UI_CHAT_INPUT_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CHAT_INPUT_TYPE_VIEW))
#define DINO_UI_CHAT_INPUT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CHAT_INPUT_TYPE_VIEW, DinoUiChatInputViewClass))

typedef struct _DinoUiChatInputView DinoUiChatInputView;
typedef struct _DinoUiChatInputViewClass DinoUiChatInputViewClass;

#define DINO_UI_TYPE_CHAT_TEXT_VIEW_CONTROLLER (dino_ui_chat_text_view_controller_get_type ())
#define DINO_UI_CHAT_TEXT_VIEW_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CHAT_TEXT_VIEW_CONTROLLER, DinoUiChatTextViewController))
#define DINO_UI_CHAT_TEXT_VIEW_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CHAT_TEXT_VIEW_CONTROLLER, DinoUiChatTextViewControllerClass))
#define DINO_UI_IS_CHAT_TEXT_VIEW_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CHAT_TEXT_VIEW_CONTROLLER))
#define DINO_UI_IS_CHAT_TEXT_VIEW_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CHAT_TEXT_VIEW_CONTROLLER))
#define DINO_UI_CHAT_TEXT_VIEW_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CHAT_TEXT_VIEW_CONTROLLER, DinoUiChatTextViewControllerClass))

typedef struct _DinoUiChatTextViewController DinoUiChatTextViewController;
typedef struct _DinoUiChatTextViewControllerClass DinoUiChatTextViewControllerClass;
enum  {
	DINO_UI_CHAT_INPUT_CONTROLLER_0_PROPERTY,
	DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_DISPLAY_NAME_PROPERTY,
	DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_TOPIC_PROPERTY,
	DINO_UI_CHAT_INPUT_CONTROLLER_NUM_PROPERTIES
};
static GParamSpec* dino_ui_chat_input_controller_properties[DINO_UI_CHAT_INPUT_CONTROLLER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block22Data Block22Data;
typedef struct _DinoUiChatInputViewPrivate DinoUiChatInputViewPrivate;

#define DINO_UI_TYPE_CHAT_TEXT_VIEW (dino_ui_chat_text_view_get_type ())
#define DINO_UI_CHAT_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CHAT_TEXT_VIEW, DinoUiChatTextView))
#define DINO_UI_CHAT_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CHAT_TEXT_VIEW, DinoUiChatTextViewClass))
#define DINO_UI_IS_CHAT_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CHAT_TEXT_VIEW))
#define DINO_UI_IS_CHAT_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CHAT_TEXT_VIEW))
#define DINO_UI_CHAT_TEXT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CHAT_TEXT_VIEW, DinoUiChatTextViewClass))

typedef struct _DinoUiChatTextView DinoUiChatTextView;
typedef struct _DinoUiChatTextViewClass DinoUiChatTextViewClass;

#define DINO_UI_TYPE_ENCRYPTION_BUTTON (dino_ui_encryption_button_get_type ())
#define DINO_UI_ENCRYPTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_ENCRYPTION_BUTTON, DinoUiEncryptionButton))
#define DINO_UI_ENCRYPTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_ENCRYPTION_BUTTON, DinoUiEncryptionButtonClass))
#define DINO_UI_IS_ENCRYPTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_ENCRYPTION_BUTTON))
#define DINO_UI_IS_ENCRYPTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_ENCRYPTION_BUTTON))
#define DINO_UI_ENCRYPTION_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_ENCRYPTION_BUTTON, DinoUiEncryptionButtonClass))

typedef struct _DinoUiEncryptionButton DinoUiEncryptionButton;
typedef struct _DinoUiEncryptionButtonClass DinoUiEncryptionButtonClass;
typedef struct _DinoUiChatTextViewPrivate DinoUiChatTextViewPrivate;

#define DINO_UI_CONVERSATION_DETAILS_TYPE_DIALOG (dino_ui_conversation_details_dialog_get_type ())
#define DINO_UI_CONVERSATION_DETAILS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CONVERSATION_DETAILS_TYPE_DIALOG, DinoUiConversationDetailsDialog))
#define DINO_UI_CONVERSATION_DETAILS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CONVERSATION_DETAILS_TYPE_DIALOG, DinoUiConversationDetailsDialogClass))
#define DINO_UI_CONVERSATION_DETAILS_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CONVERSATION_DETAILS_TYPE_DIALOG))
#define DINO_UI_CONVERSATION_DETAILS_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CONVERSATION_DETAILS_TYPE_DIALOG))
#define DINO_UI_CONVERSATION_DETAILS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CONVERSATION_DETAILS_TYPE_DIALOG, DinoUiConversationDetailsDialogClass))

typedef struct _DinoUiConversationDetailsDialog DinoUiConversationDetailsDialog;
typedef struct _DinoUiConversationDetailsDialogClass DinoUiConversationDetailsDialogClass;
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

#define DINO_UI_QUOTE_TYPE_MODEL (dino_ui_quote_model_get_type ())
#define DINO_UI_QUOTE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_QUOTE_TYPE_MODEL, DinoUiQuoteModel))
#define DINO_UI_QUOTE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_QUOTE_TYPE_MODEL, DinoUiQuoteModelClass))
#define DINO_UI_QUOTE_IS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_QUOTE_TYPE_MODEL))
#define DINO_UI_QUOTE_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_QUOTE_TYPE_MODEL))
#define DINO_UI_QUOTE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_QUOTE_TYPE_MODEL, DinoUiQuoteModelClass))

typedef struct _DinoUiQuoteModel DinoUiQuoteModel;
typedef struct _DinoUiQuoteModelClass DinoUiQuoteModelClass;

#define DINO_UI_TYPE_APPLICATION (dino_ui_application_get_type ())
#define DINO_UI_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_APPLICATION, DinoUiApplication))
#define DINO_UI_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_APPLICATION, DinoUiApplicationClass))
#define DINO_UI_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_APPLICATION))
#define DINO_UI_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_APPLICATION))
#define DINO_UI_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_APPLICATION, DinoUiApplicationClass))

typedef struct _DinoUiApplication DinoUiApplication;
typedef struct _DinoUiApplicationClass DinoUiApplicationClass;
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	DINO_UI_CHAT_INPUT_CONTROLLER_ACTIVATE_LAST_MESSAGE_CORRECTION_SIGNAL,
	DINO_UI_CHAT_INPUT_CONTROLLER_FILE_PICKER_SELECTED_SIGNAL,
	DINO_UI_CHAT_INPUT_CONTROLLER_CLIPBOARD_PASTED_SIGNAL,
	DINO_UI_CHAT_INPUT_CONTROLLER_NUM_SIGNALS
};
static guint dino_ui_chat_input_controller_signals[DINO_UI_CHAT_INPUT_CONTROLLER_NUM_SIGNALS] = {0};

struct _DinoUiChatInputController {
	GObject parent_instance;
	DinoUiChatInputControllerPrivate * priv;
};

struct _DinoUiChatInputControllerClass {
	GObjectClass parent_class;
};

struct _DinoUiChatInputControllerPrivate {
	gchar* _conversation_display_name;
	gchar* _conversation_topic;
	DinoEntitiesConversation* conversation;
	DinoUiChatInputView* chat_input;
	GtkLabel* status_description_label;
	DinoStreamInteractor* stream_interactor;
	DinoPluginsInputFieldStatus* input_field_status;
	DinoUiChatTextViewController* chat_text_view_controller;
	DinoContentItem* quoted_content_item;
};

struct _Block22Data {
	int _ref_count_;
	DinoUiChatInputController* self;
	DinoUiChatInputView* chat_input;
	DinoStreamInteractor* stream_interactor;
};

struct _DinoUiChatInputView {
	GtkBox parent_instance;
	DinoUiChatInputViewPrivate * priv;
	GtkFrame* frame;
	GtkBox* quote_box;
	DinoUiChatTextView* chat_text_view;
	GtkButton* file_button;
	GtkMenuButton* emoji_button;
	GtkMenuButton* encryption_button;
	GtkSeparator* file_separator;
	GtkLabel* chat_input_status;
	DinoUiEncryptionButton* encryption_widget;
};

struct _DinoUiChatInputViewClass {
	GtkBoxClass parent_class;
};

struct _DinoUiChatTextView {
	GtkBox parent_instance;
	DinoUiChatTextViewPrivate * priv;
	GtkScrolledWindow* scrolled_window;
	GtkTextView* text_view;
};

struct _DinoUiChatTextViewClass {
	GtkBoxClass parent_class;
};

static gint DinoUiChatInputController_private_offset;
static gpointer dino_ui_chat_input_controller_parent_class = NULL;

VALA_EXTERN GType dino_ui_chat_input_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiChatInputController, g_object_unref)
VALA_EXTERN GType dino_ui_chat_input_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiChatInputView, g_object_unref)
VALA_EXTERN GType dino_ui_chat_text_view_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiChatTextViewController, g_object_unref)
VALA_EXTERN DinoUiChatInputController* dino_ui_chat_input_controller_new (DinoUiChatInputView* chat_input,
                                                              DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiChatInputController* dino_ui_chat_input_controller_construct (GType object_type,
                                                                    DinoUiChatInputView* chat_input,
                                                                    DinoStreamInteractor* stream_interactor);
static Block22Data* block22_data_ref (Block22Data* _data22_);
static void block22_data_unref (void * _userdata_);
VALA_EXTERN GType dino_ui_chat_text_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiChatTextView, g_object_unref)
VALA_EXTERN gpointer dino_ui_encryption_button_ref (gpointer instance);
VALA_EXTERN void dino_ui_encryption_button_unref (gpointer instance);
VALA_EXTERN GParamSpec* dino_ui_param_spec_encryption_button (const gchar* name,
                                                  const gchar* nick,
                                                  const gchar* blurb,
                                                  GType object_type,
                                                  GParamFlags flags);
VALA_EXTERN void dino_ui_value_set_encryption_button (GValue* value,
                                          gpointer v_object);
VALA_EXTERN void dino_ui_value_take_encryption_button (GValue* value,
                                           gpointer v_object);
VALA_EXTERN gpointer dino_ui_value_get_encryption_button (const GValue* value);
VALA_EXTERN GType dino_ui_encryption_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiEncryptionButton, dino_ui_encryption_button_unref)
VALA_EXTERN DinoUiChatTextViewController* dino_ui_chat_text_view_controller_new (DinoUiChatTextView* widget,
                                                                     DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiChatTextViewController* dino_ui_chat_text_view_controller_construct (GType object_type,
                                                                           DinoUiChatTextView* widget,
                                                                           DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiChatInputView* dino_ui_chat_input_view_init (DinoUiChatInputView* self,
                                                   DinoStreamInteractor* stream_interactor);
static void dino_ui_chat_input_controller_reset_input_field_status (DinoUiChatInputController* self);
static gboolean dino_ui_chat_input_controller_on_text_input_key_press (DinoUiChatInputController* self,
                                                                guint keyval,
                                                                guint keycode,
                                                                GdkModifierType state);
static gboolean _dino_ui_chat_input_controller_on_text_input_key_press_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                                      guint keyval,
                                                                                                      guint keycode,
                                                                                                      GdkModifierType state,
                                                                                                      gpointer self);
static void __lambda160_ (DinoUiChatInputController* self);
static void ___lambda160__gtk_text_view_paste_clipboard (GtkTextView* _sender,
                                                  gpointer self);
static void dino_ui_chat_input_controller_on_text_input_changed (DinoUiChatInputController* self);
static void _dino_ui_chat_input_controller_on_text_input_changed_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                                                   gpointer self);
static void dino_ui_chat_input_controller_send_text (DinoUiChatInputController* self);
static void _dino_ui_chat_input_controller_send_text_dino_ui_chat_text_view_controller_send_text (DinoUiChatTextViewController* _sender,
                                                                                           gpointer self);
static void dino_ui_chat_input_controller_on_encryption_changed (DinoUiChatInputController* self,
                                                          DinoEntitiesEncryption encryption);
static void _dino_ui_chat_input_controller_on_encryption_changed_dino_ui_encryption_button_encryption_changed (DinoUiEncryptionButton* _sender,
                                                                                                        DinoEntitiesEncryption encryption,
                                                                                                        gpointer self);
static void __lambda161_ (DinoUiChatInputController* self);
static void ___lambda161__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dino_ui_chat_input_controller_update_moderated_input_status (DinoUiChatInputController* self,
                                                                  DinoEntitiesAccount* account,
                                                                  XmppJid* jid);
static void _dino_ui_chat_input_controller_update_moderated_input_status_dino_muc_manager_received_occupant_role (DinoMucManager* _sender,
                                                                                                           DinoEntitiesAccount* account,
                                                                                                           XmppJid* jid,
                                                                                                           XmppXepMucRole* role,
                                                                                                           gpointer self);
static void _dino_ui_chat_input_controller_update_moderated_input_status_dino_muc_manager_room_info_updated (DinoMucManager* _sender,
                                                                                                      DinoEntitiesAccount* account,
                                                                                                      XmppJid* muc_jid,
                                                                                                      gpointer self);
static gboolean __lambda162_ (Block22Data* _data22_,
                       const gchar* uri);
VALA_EXTERN GType dino_ui_conversation_details_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationDetailsDialog, g_object_unref)
VALA_EXTERN DinoUiConversationDetailsDialog* dino_ui_conversation_details_setup_dialog (DinoEntitiesConversation* conversation,
                                                                            DinoStreamInteractor* stream_interactor,
                                                                            GtkWindow* parent);
static gboolean ___lambda162__gtk_label_activate_link (GtkLabel* _sender,
                                                const gchar* uri,
                                                gpointer self);
static void __lambda198_ (Block22Data* _data22_,
                   GVariant* variant);
VALA_EXTERN GType dino_ui_quote_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiQuoteModel, g_object_unref)
VALA_EXTERN DinoUiQuoteModel* dino_ui_quote_model_new_from_content_item (DinoContentItem* content_item,
                                                             DinoEntitiesConversation* conversation,
                                                             DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiQuoteModel* dino_ui_quote_model_construct_from_content_item (GType object_type,
                                                                   DinoContentItem* content_item,
                                                                   DinoEntitiesConversation* conversation,
                                                                   DinoStreamInteractor* stream_interactor);
VALA_EXTERN void dino_ui_quote_model_set_can_abort (DinoUiQuoteModel* self,
                                        gboolean value);
static void __lambda199_ (Block22Data* _data22_);
VALA_EXTERN void dino_ui_chat_input_view_unset_quoted_message (DinoUiChatInputView* self);
static void ___lambda199__dino_ui_quote_model_aborted (DinoUiQuoteModel* _sender,
                                                gpointer self);
VALA_EXTERN void dino_ui_chat_input_view_set_quoted_message (DinoUiChatInputView* self,
                                                 GtkWidget* quote_widget);
VALA_EXTERN GtkWidget* dino_ui_quote_get_widget (DinoUiQuoteModel* model);
static void ___lambda198__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
VALA_EXTERN void dino_ui_chat_input_controller_set_conversation (DinoUiChatInputController* self,
                                                     DinoEntitiesConversation* conversation);
VALA_EXTERN void dino_ui_encryption_button_set_conversation (DinoUiEncryptionButton* self,
                                                 DinoEntitiesConversation* conversation);
VALA_EXTERN void dino_ui_chat_input_view_initialize_for_conversation (DinoUiChatInputView* self,
                                                          DinoEntitiesConversation* conversation);
VALA_EXTERN void dino_ui_chat_text_view_controller_initialize_for_conversation (DinoUiChatTextViewController* self,
                                                                    DinoEntitiesConversation* conversation);
VALA_EXTERN void dino_ui_chat_input_controller_set_file_upload_active (DinoUiChatInputController* self,
                                                           gboolean active);
VALA_EXTERN void dino_ui_chat_input_view_set_file_upload_active (DinoUiChatInputView* self,
                                                     gboolean active);
VALA_EXTERN GType dino_ui_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiApplication, g_object_unref)
static void dino_ui_chat_input_controller_set_input_field_status (DinoUiChatInputController* self,
                                                           DinoPluginsInputFieldStatus* status);
static void _dino_ui_chat_input_controller_set_input_field_status_dino_plugins_set_input_field_status (DinoPluginsInputFieldStatus* field_status,
                                                                                                gpointer self);
VALA_EXTERN void dino_ui_chat_input_view_set_input_state (DinoUiChatInputView* self,
                                              DinoPluginsInputFieldStatusMessageType message_type);
VALA_EXTERN void dino_ui_chat_input_view_highlight_state_description (DinoUiChatInputView* self);
VALA_EXTERN GeeList* dino_ui_chat_text_view_get_markups (DinoUiChatTextView* self);
static gboolean _xmpp_xep_muc_role_equal (const XmppXepMucRole * s1,
                                   const XmppXepMucRole * s2);
VALA_EXTERN void dino_ui_chat_input_view_do_focus (DinoUiChatInputView* self);
VALA_EXTERN const gchar* dino_ui_chat_input_controller_get_conversation_display_name (DinoUiChatInputController* self);
VALA_EXTERN void dino_ui_chat_input_controller_set_conversation_display_name (DinoUiChatInputController* self,
                                                                  const gchar* value);
VALA_EXTERN const gchar* dino_ui_chat_input_controller_get_conversation_topic (DinoUiChatInputController* self);
VALA_EXTERN void dino_ui_chat_input_controller_set_conversation_topic (DinoUiChatInputController* self,
                                                           const gchar* value);
static void dino_ui_chat_input_controller_finalize (GObject * obj);
static GType dino_ui_chat_input_controller_get_type_once (void);
static void _vala_dino_ui_chat_input_controller_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void _vala_dino_ui_chat_input_controller_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_ui_chat_input_controller_get_instance_private (DinoUiChatInputController* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiChatInputController_private_offset);
}

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

static Block22Data*
block22_data_ref (Block22Data* _data22_)
{
	g_atomic_int_inc (&_data22_->_ref_count_);
	return _data22_;
}

static void
block22_data_unref (void * _userdata_)
{
	Block22Data* _data22_;
	_data22_ = (Block22Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data22_->_ref_count_)) {
		DinoUiChatInputController* self;
		self = _data22_->self;
		_g_object_unref0 (_data22_->chat_input);
		_g_object_unref0 (_data22_->stream_interactor);
		_g_object_unref0 (self);
		g_slice_free (Block22Data, _data22_);
	}
}

static gboolean
_dino_ui_chat_input_controller_on_text_input_key_press_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                             guint keyval,
                                                                                             guint keycode,
                                                                                             GdkModifierType state,
                                                                                             gpointer self)
{
	gboolean result;
	result = dino_ui_chat_input_controller_on_text_input_key_press ((DinoUiChatInputController*) self, keyval, keycode, state);
	return result;
}

static void
__lambda160_ (DinoUiChatInputController* self)
{
	g_signal_emit (self, dino_ui_chat_input_controller_signals[DINO_UI_CHAT_INPUT_CONTROLLER_CLIPBOARD_PASTED_SIGNAL], 0);
}

static void
___lambda160__gtk_text_view_paste_clipboard (GtkTextView* _sender,
                                             gpointer self)
{
	__lambda160_ ((DinoUiChatInputController*) self);
}

static void
_dino_ui_chat_input_controller_on_text_input_changed_gtk_text_buffer_changed (GtkTextBuffer* _sender,
                                                                              gpointer self)
{
	dino_ui_chat_input_controller_on_text_input_changed ((DinoUiChatInputController*) self);
}

static void
_dino_ui_chat_input_controller_send_text_dino_ui_chat_text_view_controller_send_text (DinoUiChatTextViewController* _sender,
                                                                                      gpointer self)
{
	dino_ui_chat_input_controller_send_text ((DinoUiChatInputController*) self);
}

static void
_dino_ui_chat_input_controller_on_encryption_changed_dino_ui_encryption_button_encryption_changed (DinoUiEncryptionButton* _sender,
                                                                                                   DinoEntitiesEncryption encryption,
                                                                                                   gpointer self)
{
	dino_ui_chat_input_controller_on_encryption_changed ((DinoUiChatInputController*) self, encryption);
}

static void
__lambda161_ (DinoUiChatInputController* self)
{
	g_signal_emit (self, dino_ui_chat_input_controller_signals[DINO_UI_CHAT_INPUT_CONTROLLER_FILE_PICKER_SELECTED_SIGNAL], 0);
}

static void
___lambda161__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda161_ ((DinoUiChatInputController*) self);
}

static void
_dino_ui_chat_input_controller_update_moderated_input_status_dino_muc_manager_received_occupant_role (DinoMucManager* _sender,
                                                                                                      DinoEntitiesAccount* account,
                                                                                                      XmppJid* jid,
                                                                                                      XmppXepMucRole* role,
                                                                                                      gpointer self)
{
	dino_ui_chat_input_controller_update_moderated_input_status ((DinoUiChatInputController*) self, account, jid);
}

static void
_dino_ui_chat_input_controller_update_moderated_input_status_dino_muc_manager_room_info_updated (DinoMucManager* _sender,
                                                                                                 DinoEntitiesAccount* account,
                                                                                                 XmppJid* muc_jid,
                                                                                                 gpointer self)
{
	dino_ui_chat_input_controller_update_moderated_input_status ((DinoUiChatInputController*) self, account, muc_jid);
}

static gboolean
__lambda162_ (Block22Data* _data22_,
              const gchar* uri)
{
	DinoUiChatInputController* self;
	gboolean result;
	self = _data22_->self;
	g_return_val_if_fail (uri != NULL, FALSE);
	if (g_strcmp0 (uri, DINO_UI_OPEN_CONVERSATION_DETAILS_URI) == 0) {
		DinoUiConversationDetailsDialog* conversation_details = NULL;
		DinoEntitiesConversation* _tmp0_;
		GtkRoot* _tmp1_;
		DinoUiConversationDetailsDialog* _tmp2_;
		DinoUiConversationDetailsDialog* _tmp3_;
		_tmp0_ = self->priv->conversation;
		_tmp1_ = gtk_widget_get_root ((GtkWidget*) _data22_->chat_input);
		_tmp2_ = dino_ui_conversation_details_setup_dialog (_tmp0_, _data22_->stream_interactor, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow));
		conversation_details = _tmp2_;
		_tmp3_ = conversation_details;
		gtk_window_present ((GtkWindow*) _tmp3_);
		_g_object_unref0 (conversation_details);
	}
	result = TRUE;
	return result;
}

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

static gpointer
_g_variant_type_copy0 (gpointer self)
{
	return self ? g_variant_type_copy (self) : NULL;
}

static void
__lambda199_ (Block22Data* _data22_)
{
	DinoUiChatInputController* self;
	self = _data22_->self;
	_g_object_unref0 (self->priv->quoted_content_item);
	self->priv->quoted_content_item = NULL;
	dino_ui_chat_input_view_unset_quoted_message (_data22_->chat_input);
}

static void
___lambda199__dino_ui_quote_model_aborted (DinoUiQuoteModel* _sender,
                                           gpointer self)
{
	__lambda199_ (self);
}

static void
__lambda198_ (Block22Data* _data22_,
              GVariant* variant)
{
	DinoUiChatInputController* self;
	gint conversation_id = 0;
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	gint _tmp2_;
	DinoEntitiesConversation* conversation = NULL;
	DinoModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	DinoConversationManager* _tmp5_;
	DinoEntitiesConversation* _tmp6_;
	DinoEntitiesConversation* _tmp7_;
	gboolean _tmp8_ = FALSE;
	DinoEntitiesConversation* _tmp9_;
	gint content_item_id = 0;
	GVariant* _tmp12_;
	GVariant* _tmp13_;
	gint _tmp14_;
	DinoContentItem* content_item = NULL;
	DinoModuleIdentity* _tmp15_;
	gpointer _tmp16_;
	DinoContentItemStore* _tmp17_;
	DinoEntitiesConversation* _tmp18_;
	DinoContentItem* _tmp19_;
	DinoContentItem* _tmp20_;
	DinoContentItem* _tmp21_;
	DinoContentItem* _tmp22_;
	DinoContentItem* _tmp23_;
	DinoUiQuoteModel* quote_model = NULL;
	DinoContentItem* _tmp24_;
	DinoEntitiesConversation* _tmp25_;
	DinoUiQuoteModel* _tmp26_ = NULL;
	DinoUiQuoteModel* _tmp27_;
	DinoUiQuoteModel* _tmp28_;
	GtkWidget* _tmp29_;
	GtkWidget* _tmp30_;
	self = _data22_->self;
	_tmp0_ = g_variant_get_child_value (variant, (gsize) 0);
	_tmp1_ = _tmp0_;
	_tmp2_ = (gint) g_variant_get_int32 (_tmp1_);
	_g_variant_unref0 (_tmp1_);
	conversation_id = _tmp2_;
	_tmp3_ = dino_conversation_manager_IDENTITY;
	_tmp4_ = dino_stream_interactor_get_module (_data22_->stream_interactor, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (DinoConversationManager*) _tmp4_;
	_tmp6_ = dino_conversation_manager_get_conversation_by_id (_tmp5_, conversation_id);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp5_);
	conversation = _tmp7_;
	_tmp9_ = conversation;
	if (_tmp9_ == NULL) {
		_tmp8_ = TRUE;
	} else {
		DinoEntitiesConversation* _tmp10_;
		DinoEntitiesConversation* _tmp11_;
		_tmp10_ = self->priv->conversation;
		_tmp11_ = conversation;
		_tmp8_ = !dino_entities_conversation_equals (_tmp10_, _tmp11_);
	}
	if (_tmp8_) {
		_g_object_unref0 (conversation);
		return;
	}
	_tmp12_ = g_variant_get_child_value (variant, (gsize) 1);
	_tmp13_ = _tmp12_;
	_tmp14_ = (gint) g_variant_get_int32 (_tmp13_);
	_g_variant_unref0 (_tmp13_);
	content_item_id = _tmp14_;
	_tmp15_ = dino_content_item_store_IDENTITY;
	_tmp16_ = dino_stream_interactor_get_module (_data22_->stream_interactor, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp15_);
	_tmp17_ = (DinoContentItemStore*) _tmp16_;
	_tmp18_ = conversation;
	_tmp19_ = dino_content_item_store_get_item_by_id (_tmp17_, _tmp18_, content_item_id);
	_tmp20_ = _tmp19_;
	_g_object_unref0 (_tmp17_);
	content_item = _tmp20_;
	_tmp21_ = content_item;
	if (_tmp21_ == NULL) {
		_g_object_unref0 (content_item);
		_g_object_unref0 (conversation);
		return;
	}
	_tmp22_ = content_item;
	_tmp23_ = _g_object_ref0 (_tmp22_);
	_g_object_unref0 (self->priv->quoted_content_item);
	self->priv->quoted_content_item = _tmp23_;
	_tmp24_ = content_item;
	_tmp25_ = conversation;
	_tmp26_ = dino_ui_quote_model_new_from_content_item (_tmp24_, _tmp25_, _data22_->stream_interactor);
	dino_ui_quote_model_set_can_abort (_tmp26_, TRUE);
	quote_model = _tmp26_;
	_tmp27_ = quote_model;
	g_signal_connect_data (_tmp27_, "aborted", (GCallback) ___lambda199__dino_ui_quote_model_aborted, block22_data_ref (_data22_), (GClosureNotify) block22_data_unref, 0);
	_tmp28_ = quote_model;
	_tmp29_ = dino_ui_quote_get_widget (_tmp28_);
	_tmp30_ = _tmp29_;
	dino_ui_chat_input_view_set_quoted_message (_data22_->chat_input, _tmp30_);
	_g_object_unref0 (_tmp30_);
	_g_object_unref0 (quote_model);
	_g_object_unref0 (content_item);
	_g_object_unref0 (conversation);
}

static void
___lambda198__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda198_ (self, parameter);
}

DinoUiChatInputController*
dino_ui_chat_input_controller_construct (GType object_type,
                                         DinoUiChatInputView* chat_input,
                                         DinoStreamInteractor* stream_interactor)
{
	DinoUiChatInputController * self = NULL;
	Block22Data* _data22_;
	DinoUiChatInputView* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoUiChatInputView* _tmp2_;
	GtkLabel* _tmp3_;
	GtkLabel* _tmp4_;
	DinoStreamInteractor* _tmp5_;
	DinoUiChatTextView* _tmp6_;
	DinoUiChatTextViewController* _tmp7_;
	DinoUiChatInputView* _tmp8_;
	DinoUiChatInputView* _tmp9_;
	GtkEventControllerKey* text_input_key_events = NULL;
	gchar* _tmp10_;
	GtkEventControllerKey* _tmp11_ = NULL;
	DinoUiChatTextView* _tmp12_;
	GtkTextView* _tmp13_;
	GtkEventController* _tmp14_;
	DinoUiChatTextView* _tmp15_;
	GtkTextView* _tmp16_;
	DinoUiChatTextView* _tmp17_;
	GtkTextView* _tmp18_;
	GtkTextBuffer* _tmp19_;
	GtkTextBuffer* _tmp20_;
	DinoUiChatTextViewController* _tmp21_;
	DinoUiEncryptionButton* _tmp22_;
	GtkButton* _tmp23_;
	DinoModuleIdentity* _tmp24_;
	gpointer _tmp25_;
	DinoMucManager* _tmp26_;
	DinoModuleIdentity* _tmp27_;
	gpointer _tmp28_;
	DinoMucManager* _tmp29_;
	GtkLabel* _tmp30_;
	GSimpleAction* quote_action = NULL;
	const GVariantType* _tmp31_;
	GVariantType* _tmp32_;
	const GVariantType* _tmp33_;
	GVariantType* _tmp34_;
	GVariantType** _tmp35_;
	GVariantType** _tmp36_;
	gint _tmp36__length1;
	GVariantType* _tmp37_;
	GVariantType* _tmp38_;
	GSimpleAction* _tmp39_;
	GSimpleAction* _tmp40_;
	GApplication* _tmp41_;
	g_return_val_if_fail (chat_input != NULL, NULL);
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	_data22_ = g_slice_new0 (Block22Data);
	_data22_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (chat_input);
	_g_object_unref0 (_data22_->chat_input);
	_data22_->chat_input = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (_data22_->stream_interactor);
	_data22_->stream_interactor = _tmp1_;
	self = (DinoUiChatInputController*) g_object_new (object_type, NULL);
	_data22_->self = g_object_ref (self);
	_tmp2_ = _g_object_ref0 (_data22_->chat_input);
	_g_object_unref0 (self->priv->chat_input);
	self->priv->chat_input = _tmp2_;
	_tmp3_ = _data22_->chat_input->chat_input_status;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->status_description_label);
	self->priv->status_description_label = _tmp4_;
	_tmp5_ = _g_object_ref0 (_data22_->stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp5_;
	_tmp6_ = _data22_->chat_input->chat_text_view;
	_tmp7_ = dino_ui_chat_text_view_controller_new (_tmp6_, _data22_->stream_interactor);
	_g_object_unref0 (self->priv->chat_text_view_controller);
	self->priv->chat_text_view_controller = _tmp7_;
	_tmp8_ = dino_ui_chat_input_view_init (_data22_->chat_input, _data22_->stream_interactor);
	_tmp9_ = _tmp8_;
	_g_object_unref0 (_tmp9_);
	dino_ui_chat_input_controller_reset_input_field_status (self);
	_tmp10_ = g_strdup ("dino-text-input-controller-key-events");
	_tmp11_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	gtk_event_controller_set_name ((GtkEventController*) _tmp11_, _tmp10_);
	_g_free0 (_tmp10_);
	text_input_key_events = _tmp11_;
	g_signal_connect_object (text_input_key_events, "key-pressed", (GCallback) _dino_ui_chat_input_controller_on_text_input_key_press_gtk_event_controller_key_key_pressed, self, 0);
	_tmp12_ = _data22_->chat_input->chat_text_view;
	_tmp13_ = _tmp12_->text_view;
	_tmp14_ = _g_object_ref0 ((GtkEventController*) text_input_key_events);
	gtk_widget_add_controller ((GtkWidget*) _tmp13_, _tmp14_);
	_tmp15_ = _data22_->chat_input->chat_text_view;
	_tmp16_ = _tmp15_->text_view;
	g_signal_connect_object (_tmp16_, "paste-clipboard", (GCallback) ___lambda160__gtk_text_view_paste_clipboard, self, 0);
	_tmp17_ = _data22_->chat_input->chat_text_view;
	_tmp18_ = _tmp17_->text_view;
	_tmp19_ = gtk_text_view_get_buffer (_tmp18_);
	_tmp20_ = _tmp19_;
	g_signal_connect_object (_tmp20_, "changed", (GCallback) _dino_ui_chat_input_controller_on_text_input_changed_gtk_text_buffer_changed, self, 0);
	_tmp21_ = self->priv->chat_text_view_controller;
	g_signal_connect_object (_tmp21_, "send-text", (GCallback) _dino_ui_chat_input_controller_send_text_dino_ui_chat_text_view_controller_send_text, self, 0);
	_tmp22_ = _data22_->chat_input->encryption_widget;
	g_signal_connect_object (_tmp22_, "encryption-changed", (GCallback) _dino_ui_chat_input_controller_on_encryption_changed_dino_ui_encryption_button_encryption_changed, self, 0);
	_tmp23_ = _data22_->chat_input->file_button;
	g_signal_connect_object (_tmp23_, "clicked", (GCallback) ___lambda161__gtk_button_clicked, self, 0);
	_tmp24_ = dino_muc_manager_IDENTITY;
	_tmp25_ = dino_stream_interactor_get_module (_data22_->stream_interactor, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp24_);
	_tmp26_ = (DinoMucManager*) _tmp25_;
	g_signal_connect_object (_tmp26_, "received-occupant-role", (GCallback) _dino_ui_chat_input_controller_update_moderated_input_status_dino_muc_manager_received_occupant_role, self, 0);
	_g_object_unref0 (_tmp26_);
	_tmp27_ = dino_muc_manager_IDENTITY;
	_tmp28_ = dino_stream_interactor_get_module (_data22_->stream_interactor, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp27_);
	_tmp29_ = (DinoMucManager*) _tmp28_;
	g_signal_connect_object (_tmp29_, "room-info-updated", (GCallback) _dino_ui_chat_input_controller_update_moderated_input_status_dino_muc_manager_room_info_updated, self, 0);
	_g_object_unref0 (_tmp29_);
	_tmp30_ = self->priv->status_description_label;
	g_signal_connect_data (_tmp30_, "activate-link", (GCallback) ___lambda162__gtk_label_activate_link, block22_data_ref (_data22_), (GClosureNotify) block22_data_unref, 0);
	_tmp31_ = G_VARIANT_TYPE_INT32;
	_tmp32_ = _g_variant_type_copy0 (_tmp31_);
	_tmp33_ = G_VARIANT_TYPE_INT32;
	_tmp34_ = _g_variant_type_copy0 (_tmp33_);
	_tmp35_ = g_new0 (GVariantType*, 2 + 1);
	_tmp35_[0] = _tmp32_;
	_tmp35_[1] = _tmp34_;
	_tmp36_ = _tmp35_;
	_tmp36__length1 = 2;
	_tmp37_ = g_variant_type_new_tuple (_tmp36_, 2);
	_tmp38_ = _tmp37_;
	_tmp39_ = g_simple_action_new ("quote", _tmp38_);
	_tmp40_ = _tmp39_;
	_g_variant_type_free0 (_tmp38_);
	_tmp36_ = (_vala_array_free (_tmp36_, _tmp36__length1, (GDestroyNotify) g_variant_type_free), NULL);
	quote_action = _tmp40_;
	g_signal_connect_data (quote_action, "activate", (GCallback) ___lambda198__g_simple_action_activate, block22_data_ref (_data22_), (GClosureNotify) block22_data_unref, 0);
	_tmp41_ = g_application_get_default ();
	g_action_map_add_action ((GActionMap*) _tmp41_, (GAction*) quote_action);
	_g_object_unref0 (quote_action);
	_g_object_unref0 (text_input_key_events);
	block22_data_unref (_data22_);
	_data22_ = NULL;
	return self;
}

DinoUiChatInputController*
dino_ui_chat_input_controller_new (DinoUiChatInputView* chat_input,
                                   DinoStreamInteractor* stream_interactor)
{
	return dino_ui_chat_input_controller_construct (DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, chat_input, stream_interactor);
}

void
dino_ui_chat_input_controller_set_conversation (DinoUiChatInputController* self,
                                                DinoEntitiesConversation* conversation)
{
	DinoUiChatInputView* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoUiChatInputView* _tmp2_;
	DinoUiEncryptionButton* _tmp3_;
	DinoUiChatInputView* _tmp4_;
	DinoUiChatTextViewController* _tmp5_;
	DinoEntitiesAccount* _tmp6_;
	DinoEntitiesAccount* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conversation != NULL);
	dino_ui_chat_input_controller_reset_input_field_status (self);
	_g_object_unref0 (self->priv->quoted_content_item);
	self->priv->quoted_content_item = NULL;
	_tmp0_ = self->priv->chat_input;
	dino_ui_chat_input_view_unset_quoted_message (_tmp0_);
	_tmp1_ = _g_object_ref0 (conversation);
	_g_object_unref0 (self->priv->conversation);
	self->priv->conversation = _tmp1_;
	_tmp2_ = self->priv->chat_input;
	_tmp3_ = _tmp2_->encryption_widget;
	dino_ui_encryption_button_set_conversation (_tmp3_, conversation);
	_tmp4_ = self->priv->chat_input;
	dino_ui_chat_input_view_initialize_for_conversation (_tmp4_, conversation);
	_tmp5_ = self->priv->chat_text_view_controller;
	dino_ui_chat_text_view_controller_initialize_for_conversation (_tmp5_, conversation);
	_tmp6_ = dino_entities_conversation_get_account (conversation);
	_tmp7_ = _tmp6_;
	dino_ui_chat_input_controller_update_moderated_input_status (self, _tmp7_, NULL);
}

void
dino_ui_chat_input_controller_set_file_upload_active (DinoUiChatInputController* self,
                                                      gboolean active)
{
	DinoUiChatInputView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->chat_input;
	dino_ui_chat_input_view_set_file_upload_active (_tmp0_, active);
}

static void
_dino_ui_chat_input_controller_set_input_field_status_dino_plugins_set_input_field_status (DinoPluginsInputFieldStatus* field_status,
                                                                                           gpointer self)
{
	dino_ui_chat_input_controller_set_input_field_status ((DinoUiChatInputController*) self, field_status);
}

static void
dino_ui_chat_input_controller_on_encryption_changed (DinoUiChatInputController* self,
                                                     DinoEntitiesEncryption encryption)
{
	DinoUiApplication* app = NULL;
	GApplication* _tmp0_;
	DinoUiApplication* _tmp1_;
	DinoPluginsEncryptionListEntry* encryption_entry = NULL;
	DinoUiApplication* _tmp2_;
	DinoPluginsRegistry* _tmp3_;
	DinoPluginsRegistry* _tmp4_;
	GeeHashMap* _tmp5_;
	gpointer _tmp6_;
	DinoPluginsEncryptionListEntry* _tmp7_;
	DinoEntitiesConversation* _tmp8_;
	g_return_if_fail (self != NULL);
	dino_ui_chat_input_controller_reset_input_field_status (self);
	if (encryption == DINO_ENTITIES_ENCRYPTION_NONE) {
		return;
	}
	_tmp0_ = g_application_get_default ();
	_tmp1_ = _g_object_ref0 (DINO_UI_IS_APPLICATION (_tmp0_) ? ((DinoUiApplication*) _tmp0_) : NULL);
	app = _tmp1_;
	_tmp2_ = app;
	_tmp3_ = dino_application_get_plugin_registry ((DinoApplication*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_->encryption_list_entries;
	_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, (gpointer) ((gintptr) encryption));
	encryption_entry = (DinoPluginsEncryptionListEntry*) _tmp6_;
	_tmp7_ = encryption_entry;
	_tmp8_ = self->priv->conversation;
	dino_plugins_encryption_list_entry_encryption_activated (_tmp7_, _tmp8_, _dino_ui_chat_input_controller_set_input_field_status_dino_plugins_set_input_field_status, self);
	_g_object_unref0 (encryption_entry);
	_g_object_unref0 (app);
}

static void
dino_ui_chat_input_controller_set_input_field_status (DinoUiChatInputController* self,
                                                      DinoPluginsInputFieldStatus* status)
{
	DinoPluginsInputFieldStatus* _tmp0_;
	DinoUiChatInputView* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp3_;
	const gchar* _tmp4_;
	DinoUiChatInputView* _tmp5_;
	GtkButton* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (status);
	_g_object_unref0 (self->priv->input_field_status);
	self->priv->input_field_status = _tmp0_;
	_tmp1_ = self->priv->chat_input;
	dino_ui_chat_input_view_set_input_state (_tmp1_, status->message_type);
	_tmp2_ = self->priv->status_description_label;
	gtk_label_set_use_markup (_tmp2_, status->contains_markup);
	_tmp3_ = self->priv->status_description_label;
	_tmp4_ = status->message;
	gtk_label_set_label (_tmp3_, _tmp4_);
	_tmp5_ = self->priv->chat_input;
	_tmp6_ = _tmp5_->file_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp6_, status->input_state == DINO_PLUGINS_INPUT_FIELD_STATUS_INPUT_STATE_NORMAL);
}

static void
dino_ui_chat_input_controller_reset_input_field_status (DinoUiChatInputController* self)
{
	DinoPluginsInputFieldStatus* _tmp0_;
	DinoPluginsInputFieldStatus* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dino_plugins_input_field_status_new ("", DINO_PLUGINS_INPUT_FIELD_STATUS_MESSAGE_TYPE_NONE, DINO_PLUGINS_INPUT_FIELD_STATUS_INPUT_STATE_NORMAL, FALSE);
	_tmp1_ = _tmp0_;
	dino_ui_chat_input_controller_set_input_field_status (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
}

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

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

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static void
dino_ui_chat_input_controller_send_text (DinoUiChatInputController* self)
{
	DinoPluginsInputFieldStatus* _tmp0_;
	gchar* text = NULL;
	DinoUiChatInputView* _tmp2_;
	DinoUiChatTextView* _tmp3_;
	GtkTextView* _tmp4_;
	GtkTextBuffer* _tmp5_;
	GtkTextBuffer* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	DinoContentItem* quoted_content_item_bak = NULL;
	DinoContentItem* _tmp9_;
	DinoContentItem* _tmp10_;
	GeeList* markups = NULL;
	DinoUiChatInputView* _tmp11_;
	DinoUiChatTextView* _tmp12_;
	GeeList* _tmp13_;
	DinoUiChatInputView* _tmp14_;
	DinoUiChatTextView* _tmp15_;
	GtkTextView* _tmp16_;
	GtkTextBuffer* _tmp17_;
	GtkTextBuffer* _tmp18_;
	DinoUiChatInputView* _tmp19_;
	const gchar* _tmp20_;
	gint _tmp142_ = 0;
	DinoContentItem* _tmp143_;
	DinoEntitiesConversation* _tmp147_;
	const gchar* _tmp148_;
	GeeList* _tmp149_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->input_field_status;
	if (_tmp0_->input_state == DINO_PLUGINS_INPUT_FIELD_STATUS_INPUT_STATE_NO_SEND) {
		DinoUiChatInputView* _tmp1_;
		_tmp1_ = self->priv->chat_input;
		dino_ui_chat_input_view_highlight_state_description (_tmp1_);
		return;
	}
	_tmp2_ = self->priv->chat_input;
	_tmp3_ = _tmp2_->chat_text_view;
	_tmp4_ = _tmp3_->text_view;
	_tmp5_ = gtk_text_view_get_buffer (_tmp4_);
	_tmp6_ = _tmp5_;
	g_object_get (_tmp6_, "text", &_tmp7_, NULL);
	_tmp8_ = _tmp7_;
	text = _tmp8_;
	_tmp9_ = self->priv->quoted_content_item;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	quoted_content_item_bak = _tmp10_;
	_tmp11_ = self->priv->chat_input;
	_tmp12_ = _tmp11_->chat_text_view;
	_tmp13_ = dino_ui_chat_text_view_get_markups (_tmp12_);
	markups = _tmp13_;
	_tmp14_ = self->priv->chat_input;
	_tmp15_ = _tmp14_->chat_text_view;
	_tmp16_ = _tmp15_->text_view;
	_tmp17_ = gtk_text_view_get_buffer (_tmp16_);
	_tmp18_ = _tmp17_;
	g_object_set (_tmp18_, "text", "", NULL);
	_tmp19_ = self->priv->chat_input;
	dino_ui_chat_input_view_unset_quoted_message (_tmp19_);
	_g_object_unref0 (self->priv->quoted_content_item);
	self->priv->quoted_content_item = NULL;
	_tmp20_ = text;
	if (g_str_has_prefix (_tmp20_, "/")) {
		gchar** token = NULL;
		const gchar* _tmp21_;
		gchar** _tmp22_;
		gchar** _tmp23_;
		gint token_length1;
		gint _token_size_;
		gchar** _tmp24_;
		gint _tmp24__length1;
		const gchar* _tmp25_;
		const gchar* _tmp26_;
		GQuark _tmp28_ = 0U;
		static GQuark _tmp27_label0 = 0;
		static GQuark _tmp27_label1 = 0;
		static GQuark _tmp27_label2 = 0;
		static GQuark _tmp27_label3 = 0;
		static GQuark _tmp27_label4 = 0;
		static GQuark _tmp27_label5 = 0;
		static GQuark _tmp27_label6 = 0;
		_tmp21_ = text;
		_tmp23_ = _tmp22_ = g_strsplit (_tmp21_, " ", 2);
		token = _tmp23_;
		token_length1 = _vala_array_length (_tmp22_);
		_token_size_ = token_length1;
		_tmp24_ = token;
		_tmp24__length1 = token_length1;
		_tmp25_ = _tmp24_[0];
		_tmp26_ = _tmp25_;
		_tmp28_ = (NULL == _tmp26_) ? 0 : g_quark_from_string (_tmp26_);
		if (_tmp28_ == ((0 != _tmp27_label0) ? _tmp27_label0 : (_tmp27_label0 = g_quark_from_static_string ("/me")))) {
			switch (0) {
				default:
				{
					break;
				}
			}
		} else if (_tmp28_ == ((0 != _tmp27_label1) ? _tmp27_label1 : (_tmp27_label1 = g_quark_from_static_string ("/say")))) {
			switch (0) {
				default:
				{
					gchar** _tmp29_;
					gint _tmp29__length1;
					gchar** _tmp30_;
					gint _tmp30__length1;
					const gchar* _tmp31_;
					gchar* _tmp32_;
					_tmp29_ = token;
					_tmp29__length1 = token_length1;
					if (_tmp29__length1 == 1) {
						token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (markups);
						_g_object_unref0 (quoted_content_item_bak);
						_g_free0 (text);
						return;
					}
					_tmp30_ = token;
					_tmp30__length1 = token_length1;
					_tmp31_ = _tmp30_[1];
					_tmp32_ = g_strdup (_tmp31_);
					_g_free0 (text);
					text = _tmp32_;
					break;
				}
			}
		} else if (_tmp28_ == ((0 != _tmp27_label2) ? _tmp27_label2 : (_tmp27_label2 = g_quark_from_static_string ("/kick")))) {
			switch (0) {
				default:
				{
					DinoStreamInteractor* _tmp33_;
					DinoModuleIdentity* _tmp34_;
					gpointer _tmp35_;
					DinoMucManager* _tmp36_;
					DinoEntitiesConversation* _tmp37_;
					DinoEntitiesAccount* _tmp38_;
					DinoEntitiesAccount* _tmp39_;
					DinoEntitiesConversation* _tmp40_;
					XmppJid* _tmp41_;
					XmppJid* _tmp42_;
					gchar** _tmp43_;
					gint _tmp43__length1;
					const gchar* _tmp44_;
					_tmp33_ = self->priv->stream_interactor;
					_tmp34_ = dino_muc_manager_IDENTITY;
					_tmp35_ = dino_stream_interactor_get_module (_tmp33_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp34_);
					_tmp36_ = (DinoMucManager*) _tmp35_;
					_tmp37_ = self->priv->conversation;
					_tmp38_ = dino_entities_conversation_get_account (_tmp37_);
					_tmp39_ = _tmp38_;
					_tmp40_ = self->priv->conversation;
					_tmp41_ = dino_entities_conversation_get_counterpart (_tmp40_);
					_tmp42_ = _tmp41_;
					_tmp43_ = token;
					_tmp43__length1 = token_length1;
					_tmp44_ = _tmp43_[1];
					dino_muc_manager_kick (_tmp36_, _tmp39_, _tmp42_, _tmp44_);
					_g_object_unref0 (_tmp36_);
					token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (markups);
					_g_object_unref0 (quoted_content_item_bak);
					_g_free0 (text);
					return;
				}
			}
		} else if (_tmp28_ == ((0 != _tmp27_label3) ? _tmp27_label3 : (_tmp27_label3 = g_quark_from_static_string ("/affiliate")))) {
			switch (0) {
				default:
				{
					gchar** _tmp45_;
					gint _tmp45__length1;
					_tmp45_ = token;
					_tmp45__length1 = token_length1;
					if (_tmp45__length1 > 1) {
						gchar** user_role = NULL;
						gchar** _tmp46_;
						gint _tmp46__length1;
						const gchar* _tmp47_;
						gchar** _tmp48_;
						gchar** _tmp49_;
						gint user_role_length1;
						gint _user_role_size_;
						gchar** _tmp50_;
						gint _tmp50__length1;
						_tmp46_ = token;
						_tmp46__length1 = token_length1;
						_tmp47_ = _tmp46_[1];
						_tmp49_ = _tmp48_ = g_strsplit (_tmp47_, " ", 0);
						user_role = _tmp49_;
						user_role_length1 = _vala_array_length (_tmp48_);
						_user_role_size_ = user_role_length1;
						_tmp50_ = user_role;
						_tmp50__length1 = user_role_length1;
						if (_tmp50__length1 >= 2) {
							gchar* nick = NULL;
							gchar** _tmp51_;
							gint _tmp51__length1;
							gchar** _tmp52_;
							gint _tmp52__length1;
							gchar* _tmp53_;
							gchar* _tmp54_;
							gchar* _tmp55_;
							gchar* _tmp56_;
							gchar* role = NULL;
							gchar** _tmp57_;
							gint _tmp57__length1;
							gchar** _tmp58_;
							gint _tmp58__length1;
							const gchar* _tmp59_;
							gchar* _tmp60_;
							DinoStreamInteractor* _tmp61_;
							DinoModuleIdentity* _tmp62_;
							gpointer _tmp63_;
							DinoMucManager* _tmp64_;
							DinoEntitiesConversation* _tmp65_;
							DinoEntitiesAccount* _tmp66_;
							DinoEntitiesAccount* _tmp67_;
							DinoEntitiesConversation* _tmp68_;
							XmppJid* _tmp69_;
							XmppJid* _tmp70_;
							const gchar* _tmp71_;
							const gchar* _tmp72_;
							_tmp51_ = user_role;
							_tmp51__length1 = user_role_length1;
							_tmp52_ = user_role;
							_tmp52__length1 = user_role_length1;
							_tmp53_ = _vala_g_strjoinv (" ", _tmp51_ + 0, (gint) ((_tmp52__length1 - 1) - 0));
							_tmp54_ = _tmp53_;
							_tmp55_ = string_strip (_tmp54_);
							_tmp56_ = _tmp55_;
							_g_free0 (_tmp54_);
							nick = _tmp56_;
							_tmp57_ = user_role;
							_tmp57__length1 = user_role_length1;
							_tmp58_ = user_role;
							_tmp58__length1 = user_role_length1;
							_tmp59_ = _tmp57_[_tmp58__length1 - 1];
							_tmp60_ = string_strip (_tmp59_);
							role = _tmp60_;
							_tmp61_ = self->priv->stream_interactor;
							_tmp62_ = dino_muc_manager_IDENTITY;
							_tmp63_ = dino_stream_interactor_get_module (_tmp61_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp62_);
							_tmp64_ = (DinoMucManager*) _tmp63_;
							_tmp65_ = self->priv->conversation;
							_tmp66_ = dino_entities_conversation_get_account (_tmp65_);
							_tmp67_ = _tmp66_;
							_tmp68_ = self->priv->conversation;
							_tmp69_ = dino_entities_conversation_get_counterpart (_tmp68_);
							_tmp70_ = _tmp69_;
							_tmp71_ = nick;
							_tmp72_ = role;
							dino_muc_manager_change_affiliation (_tmp64_, _tmp67_, _tmp70_, _tmp71_, _tmp72_);
							_g_object_unref0 (_tmp64_);
							_g_free0 (role);
							_g_free0 (nick);
						}
						user_role = (_vala_array_free (user_role, user_role_length1, (GDestroyNotify) g_free), NULL);
					}
					token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (markups);
					_g_object_unref0 (quoted_content_item_bak);
					_g_free0 (text);
					return;
				}
			}
		} else if (_tmp28_ == ((0 != _tmp27_label4) ? _tmp27_label4 : (_tmp27_label4 = g_quark_from_static_string ("/nick")))) {
			switch (0) {
				default:
				{
					DinoStreamInteractor* _tmp73_;
					DinoModuleIdentity* _tmp74_;
					gpointer _tmp75_;
					DinoMucManager* _tmp76_;
					DinoEntitiesConversation* _tmp77_;
					gchar** _tmp78_;
					gint _tmp78__length1;
					const gchar* _tmp79_;
					_tmp73_ = self->priv->stream_interactor;
					_tmp74_ = dino_muc_manager_IDENTITY;
					_tmp75_ = dino_stream_interactor_get_module (_tmp73_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp74_);
					_tmp76_ = (DinoMucManager*) _tmp75_;
					_tmp77_ = self->priv->conversation;
					_tmp78_ = token;
					_tmp78__length1 = token_length1;
					_tmp79_ = _tmp78_[1];
					dino_muc_manager_change_nick (_tmp76_, _tmp77_, _tmp79_, NULL, NULL);
					_g_object_unref0 (_tmp76_);
					token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (markups);
					_g_object_unref0 (quoted_content_item_bak);
					_g_free0 (text);
					return;
				}
			}
		} else if (_tmp28_ == ((0 != _tmp27_label5) ? _tmp27_label5 : (_tmp27_label5 = g_quark_from_static_string ("/ping")))) {
			switch (0) {
				default:
				{
					XmppXmppStream* stream = NULL;
					DinoStreamInteractor* _tmp80_;
					DinoEntitiesConversation* _tmp81_;
					DinoEntitiesAccount* _tmp82_;
					DinoEntitiesAccount* _tmp83_;
					XmppXmppStream* _tmp84_;
					_tmp80_ = self->priv->stream_interactor;
					_tmp81_ = self->priv->conversation;
					_tmp82_ = dino_entities_conversation_get_account (_tmp81_);
					_tmp83_ = _tmp82_;
					_tmp84_ = dino_stream_interactor_get_stream (_tmp80_, _tmp83_);
					stream = _tmp84_;
					{
						XmppJid* _tmp85_ = NULL;
						DinoEntitiesConversation* _tmp86_;
						XmppJid* _tmp87_;
						XmppJid* _tmp88_;
						gchar** _tmp89_;
						gint _tmp89__length1;
						const gchar* _tmp90_;
						XmppJid* _tmp91_;
						XmppXmppStream* _tmp92_;
						XmppModuleIdentity* _tmp93_;
						gpointer _tmp94_;
						XmppXepPingModule* _tmp95_;
						XmppXmppStream* _tmp96_;
						_tmp86_ = self->priv->conversation;
						_tmp87_ = dino_entities_conversation_get_counterpart (_tmp86_);
						_tmp88_ = _tmp87_;
						_tmp89_ = token;
						_tmp89__length1 = token_length1;
						_tmp90_ = _tmp89_[1];
						_tmp91_ = xmpp_jid_with_resource (_tmp88_, _tmp90_, &_inner_error0_);
						_tmp85_ = _tmp91_;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
								goto __catch0_xmpp_invalid_jid_error;
							}
							_g_object_unref0 (stream);
							token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
							_g_object_unref0 (markups);
							_g_object_unref0 (quoted_content_item_bak);
							_g_free0 (text);
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
						_tmp92_ = stream;
						_tmp93_ = xmpp_xep_ping_module_IDENTITY;
						_tmp94_ = xmpp_xmpp_stream_get_module (_tmp92_, XMPP_XEP_PING_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp93_);
						_tmp95_ = (XmppXepPingModule*) _tmp94_;
						_tmp96_ = stream;
						xmpp_xep_ping_module_send_ping (_tmp95_, _tmp96_, _tmp85_, NULL, NULL);
						_g_object_unref0 (_tmp95_);
						_xmpp_jid_unref0 (_tmp85_);
					}
					goto __finally0;
					__catch0_xmpp_invalid_jid_error:
					{
						GError* e = NULL;
						GError* _tmp97_;
						const gchar* _tmp98_;
						e = _inner_error0_;
						_inner_error0_ = NULL;
						_tmp97_ = e;
						_tmp98_ = _tmp97_->message;
						g_warning ("chat_input_controller.vala:178: Could not ping invalid Jid: %s", _tmp98_);
						_g_error_free0 (e);
					}
					__finally0:
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_g_object_unref0 (stream);
						token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (markups);
						_g_object_unref0 (quoted_content_item_bak);
						_g_free0 (text);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return;
					}
					_g_object_unref0 (stream);
					token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (markups);
					_g_object_unref0 (quoted_content_item_bak);
					_g_free0 (text);
					return;
				}
			}
		} else if (_tmp28_ == ((0 != _tmp27_label6) ? _tmp27_label6 : (_tmp27_label6 = g_quark_from_static_string ("/topic")))) {
			switch (0) {
				default:
				{
					DinoStreamInteractor* _tmp99_;
					DinoModuleIdentity* _tmp100_;
					gpointer _tmp101_;
					DinoMucManager* _tmp102_;
					DinoEntitiesConversation* _tmp103_;
					DinoEntitiesAccount* _tmp104_;
					DinoEntitiesAccount* _tmp105_;
					DinoEntitiesConversation* _tmp106_;
					XmppJid* _tmp107_;
					XmppJid* _tmp108_;
					gchar** _tmp109_;
					gint _tmp109__length1;
					const gchar* _tmp110_;
					_tmp99_ = self->priv->stream_interactor;
					_tmp100_ = dino_muc_manager_IDENTITY;
					_tmp101_ = dino_stream_interactor_get_module (_tmp99_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp100_);
					_tmp102_ = (DinoMucManager*) _tmp101_;
					_tmp103_ = self->priv->conversation;
					_tmp104_ = dino_entities_conversation_get_account (_tmp103_);
					_tmp105_ = _tmp104_;
					_tmp106_ = self->priv->conversation;
					_tmp107_ = dino_entities_conversation_get_counterpart (_tmp106_);
					_tmp108_ = _tmp107_;
					_tmp109_ = token;
					_tmp109__length1 = token_length1;
					_tmp110_ = _tmp109_[1];
					dino_muc_manager_change_subject (_tmp102_, _tmp105_, _tmp108_, _tmp110_);
					_g_object_unref0 (_tmp102_);
					token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (markups);
					_g_object_unref0 (quoted_content_item_bak);
					_g_free0 (text);
					return;
				}
			}
		} else {
			switch (0) {
				default:
				{
					gchar** _tmp111_;
					gint _tmp111__length1;
					const gchar* _tmp112_;
					_tmp111_ = token;
					_tmp111__length1 = token_length1;
					_tmp112_ = _tmp111_[0];
					if (g_str_has_prefix (_tmp112_, "//")) {
						const gchar* _tmp113_;
						gchar* _tmp114_;
						_tmp113_ = text;
						_tmp114_ = string_substring (_tmp113_, (glong) 1, (glong) -1);
						_g_free0 (text);
						text = _tmp114_;
					} else {
						gchar* cmd_name = NULL;
						gchar** _tmp115_;
						gint _tmp115__length1;
						const gchar* _tmp116_;
						gchar* _tmp117_;
						DinoApplication* app = NULL;
						GApplication* _tmp118_;
						DinoApplication* _tmp119_;
						gboolean _tmp120_ = FALSE;
						DinoApplication* _tmp121_;
						_tmp115_ = token;
						_tmp115__length1 = token_length1;
						_tmp116_ = _tmp115_[0];
						_tmp117_ = string_substring (_tmp116_, (glong) 1, (glong) -1);
						cmd_name = _tmp117_;
						_tmp118_ = g_application_get_default ();
						_tmp119_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp118_, DINO_TYPE_APPLICATION) ? ((DinoApplication*) _tmp118_) : NULL);
						app = _tmp119_;
						_tmp121_ = app;
						if (_tmp121_ != NULL) {
							DinoApplication* _tmp122_;
							DinoPluginsRegistry* _tmp123_;
							DinoPluginsRegistry* _tmp124_;
							GeeMap* _tmp125_;
							const gchar* _tmp126_;
							_tmp122_ = app;
							_tmp123_ = dino_application_get_plugin_registry (_tmp122_);
							_tmp124_ = _tmp123_;
							_tmp125_ = _tmp124_->text_commands;
							_tmp126_ = cmd_name;
							_tmp120_ = gee_map_has_key (_tmp125_, _tmp126_);
						} else {
							_tmp120_ = FALSE;
						}
						if (_tmp120_) {
							gchar* new_text = NULL;
							DinoApplication* _tmp127_;
							DinoPluginsRegistry* _tmp128_;
							DinoPluginsRegistry* _tmp129_;
							GeeMap* _tmp130_;
							const gchar* _tmp131_;
							gpointer _tmp132_;
							DinoPluginsTextCommand* _tmp133_;
							gchar** _tmp134_;
							gint _tmp134__length1;
							const gchar* _tmp135_;
							DinoEntitiesConversation* _tmp136_;
							gchar* _tmp137_;
							gchar* _tmp138_;
							const gchar* _tmp139_;
							const gchar* _tmp140_;
							gchar* _tmp141_;
							_tmp127_ = app;
							_tmp128_ = dino_application_get_plugin_registry (_tmp127_);
							_tmp129_ = _tmp128_;
							_tmp130_ = _tmp129_->text_commands;
							_tmp131_ = cmd_name;
							_tmp132_ = gee_map_get (_tmp130_, _tmp131_);
							_tmp133_ = (DinoPluginsTextCommand*) _tmp132_;
							_tmp134_ = token;
							_tmp134__length1 = token_length1;
							_tmp135_ = _tmp134_[1];
							_tmp136_ = self->priv->conversation;
							_tmp137_ = dino_plugins_text_command_handle_command (_tmp133_, _tmp135_, _tmp136_);
							_tmp138_ = _tmp137_;
							_g_object_unref0 (_tmp133_);
							new_text = _tmp138_;
							_tmp139_ = new_text;
							if (_tmp139_ == NULL) {
								_g_free0 (new_text);
								_g_object_unref0 (app);
								_g_free0 (cmd_name);
								token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
								_g_object_unref0 (markups);
								_g_object_unref0 (quoted_content_item_bak);
								_g_free0 (text);
								return;
							}
							_tmp140_ = new_text;
							_tmp141_ = g_strdup ((const gchar*) _tmp140_);
							_g_free0 (text);
							text = _tmp141_;
							_g_free0 (new_text);
						}
						_g_object_unref0 (app);
						_g_free0 (cmd_name);
					}
					break;
				}
			}
		}
		token = (_vala_array_free (token, token_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp143_ = quoted_content_item_bak;
	if (_tmp143_ != NULL) {
		DinoContentItem* _tmp144_;
		gint _tmp145_;
		gint _tmp146_;
		_tmp144_ = quoted_content_item_bak;
		_tmp145_ = dino_content_item_get_id (_tmp144_);
		_tmp146_ = _tmp145_;
		_tmp142_ = _tmp146_;
	} else {
		_tmp142_ = 0;
	}
	_tmp147_ = self->priv->conversation;
	_tmp148_ = text;
	_tmp149_ = markups;
	dino_send_message (_tmp147_, _tmp148_, _tmp142_, NULL, _tmp149_);
	_g_object_unref0 (markups);
	_g_object_unref0 (quoted_content_item_bak);
	_g_free0 (text);
}

static void
dino_ui_chat_input_controller_on_text_input_changed (DinoUiChatInputController* self)
{
	DinoUiChatInputView* _tmp0_;
	DinoUiChatTextView* _tmp1_;
	GtkTextView* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gboolean _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->chat_input;
	_tmp1_ = _tmp0_->chat_text_view;
	_tmp2_ = _tmp1_->text_view;
	_tmp3_ = gtk_text_view_get_buffer (_tmp2_);
	_tmp4_ = _tmp3_;
	g_object_get (_tmp4_, "text", &_tmp5_, NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strcmp0 (_tmp7_, "") != 0;
	_g_free0 (_tmp7_);
	if (_tmp8_) {
		DinoStreamInteractor* _tmp9_;
		DinoModuleIdentity* _tmp10_;
		gpointer _tmp11_;
		DinoChatInteraction* _tmp12_;
		DinoEntitiesConversation* _tmp13_;
		_tmp9_ = self->priv->stream_interactor;
		_tmp10_ = dino_chat_interaction_IDENTITY;
		_tmp11_ = dino_stream_interactor_get_module (_tmp9_, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp10_);
		_tmp12_ = (DinoChatInteraction*) _tmp11_;
		_tmp13_ = self->priv->conversation;
		dino_chat_interaction_on_message_entered (_tmp12_, _tmp13_);
		_g_object_unref0 (_tmp12_);
	} else {
		DinoStreamInteractor* _tmp14_;
		DinoModuleIdentity* _tmp15_;
		gpointer _tmp16_;
		DinoChatInteraction* _tmp17_;
		DinoEntitiesConversation* _tmp18_;
		_tmp14_ = self->priv->stream_interactor;
		_tmp15_ = dino_chat_interaction_IDENTITY;
		_tmp16_ = dino_stream_interactor_get_module (_tmp14_, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp15_);
		_tmp17_ = (DinoChatInteraction*) _tmp16_;
		_tmp18_ = self->priv->conversation;
		dino_chat_interaction_on_message_cleared (_tmp17_, _tmp18_);
		_g_object_unref0 (_tmp17_);
	}
}

static gboolean
_xmpp_xep_muc_role_equal (const XmppXepMucRole * s1,
                          const XmppXepMucRole * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static void
dino_ui_chat_input_controller_update_moderated_input_status (DinoUiChatInputController* self,
                                                             DinoEntitiesAccount* account,
                                                             XmppJid* jid)
{
	gboolean _tmp0_ = FALSE;
	DinoEntitiesConversation* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	_tmp1_ = self->priv->conversation;
	if (_tmp1_ != NULL) {
		DinoEntitiesConversation* _tmp2_;
		DinoEntitiesConversationType _tmp3_;
		DinoEntitiesConversationType _tmp4_;
		_tmp2_ = self->priv->conversation;
		_tmp3_ = dino_entities_conversation_get_type_ (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ == DINO_ENTITIES_CONVERSATION_TYPE_GROUPCHAT;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		XmppJid* own_jid = NULL;
		DinoStreamInteractor* _tmp5_;
		DinoModuleIdentity* _tmp6_;
		gpointer _tmp7_;
		DinoMucManager* _tmp8_;
		DinoEntitiesConversation* _tmp9_;
		XmppJid* _tmp10_;
		XmppJid* _tmp11_;
		DinoEntitiesConversation* _tmp12_;
		DinoEntitiesAccount* _tmp13_;
		DinoEntitiesAccount* _tmp14_;
		XmppJid* _tmp15_;
		XmppJid* _tmp16_;
		XmppJid* _tmp17_;
		gboolean _tmp18_ = FALSE;
		DinoStreamInteractor* _tmp19_;
		DinoModuleIdentity* _tmp20_;
		gpointer _tmp21_;
		DinoMucManager* _tmp22_;
		DinoEntitiesConversation* _tmp23_;
		DinoEntitiesAccount* _tmp24_;
		DinoEntitiesAccount* _tmp25_;
		DinoEntitiesConversation* _tmp26_;
		XmppJid* _tmp27_;
		XmppJid* _tmp28_;
		gboolean _tmp29_;
		_tmp5_ = self->priv->stream_interactor;
		_tmp6_ = dino_muc_manager_IDENTITY;
		_tmp7_ = dino_stream_interactor_get_module (_tmp5_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp6_);
		_tmp8_ = (DinoMucManager*) _tmp7_;
		_tmp9_ = self->priv->conversation;
		_tmp10_ = dino_entities_conversation_get_counterpart (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = self->priv->conversation;
		_tmp13_ = dino_entities_conversation_get_account (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = dino_muc_manager_get_own_jid (_tmp8_, _tmp11_, _tmp14_);
		_tmp16_ = _tmp15_;
		_g_object_unref0 (_tmp8_);
		own_jid = _tmp16_;
		_tmp17_ = own_jid;
		if (_tmp17_ == NULL) {
			_xmpp_jid_unref0 (own_jid);
			return;
		}
		_tmp19_ = self->priv->stream_interactor;
		_tmp20_ = dino_muc_manager_IDENTITY;
		_tmp21_ = dino_stream_interactor_get_module (_tmp19_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp20_);
		_tmp22_ = (DinoMucManager*) _tmp21_;
		_tmp23_ = self->priv->conversation;
		_tmp24_ = dino_entities_conversation_get_account (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = self->priv->conversation;
		_tmp27_ = dino_entities_conversation_get_counterpart (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = dino_muc_manager_is_moderated_room (_tmp22_, _tmp25_, _tmp28_);
		_g_object_unref0 (_tmp22_);
		if (_tmp29_) {
			DinoStreamInteractor* _tmp30_;
			DinoModuleIdentity* _tmp31_;
			gpointer _tmp32_;
			DinoMucManager* _tmp33_;
			XmppJid* _tmp34_;
			DinoEntitiesConversation* _tmp35_;
			DinoEntitiesAccount* _tmp36_;
			DinoEntitiesAccount* _tmp37_;
			XmppXepMucRole* _tmp38_;
			XmppXepMucRole* _tmp39_;
			XmppXepMucRole _tmp40_;
			_tmp30_ = self->priv->stream_interactor;
			_tmp31_ = dino_muc_manager_IDENTITY;
			_tmp32_ = dino_stream_interactor_get_module (_tmp30_, DINO_TYPE_MUC_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp31_);
			_tmp33_ = (DinoMucManager*) _tmp32_;
			_tmp34_ = own_jid;
			_tmp35_ = self->priv->conversation;
			_tmp36_ = dino_entities_conversation_get_account (_tmp35_);
			_tmp37_ = _tmp36_;
			_tmp38_ = dino_muc_manager_get_role (_tmp33_, _tmp34_, _tmp37_);
			_tmp39_ = _tmp38_;
			_tmp40_ = XMPP_XEP_MUC_ROLE_VISITOR;
			_tmp18_ = _xmpp_xep_muc_role_equal (_tmp39_, &_tmp40_) == TRUE;
			_g_free0 (_tmp39_);
			_g_object_unref0 (_tmp33_);
		} else {
			_tmp18_ = FALSE;
		}
		if (_tmp18_) {
			gchar* msg_str = NULL;
			const gchar* _tmp41_;
			gchar* _tmp42_;
			gchar* _tmp43_;
			gchar* _tmp44_;
			gchar* _tmp45_;
			gchar* _tmp46_;
			gchar* _tmp47_;
			const gchar* _tmp48_;
			gchar* _tmp49_;
			gchar* _tmp50_;
			gchar* _tmp51_;
			gchar* _tmp52_;
			const gchar* _tmp53_;
			DinoPluginsInputFieldStatus* _tmp54_;
			DinoPluginsInputFieldStatus* _tmp55_;
			_tmp41_ = dino_gettext ("This conference does not allow you to send messages.");
			_tmp42_ = g_strconcat (_tmp41_, " <a href=\"", NULL);
			_tmp43_ = _tmp42_;
			_tmp44_ = g_strconcat (_tmp43_, DINO_UI_OPEN_CONVERSATION_DETAILS_URI, NULL);
			_tmp45_ = _tmp44_;
			_tmp46_ = g_strconcat (_tmp45_, "\">", NULL);
			_tmp47_ = _tmp46_;
			_tmp48_ = dino_gettext ("Request permission");
			_tmp49_ = g_strconcat (_tmp47_, _tmp48_, NULL);
			_tmp50_ = _tmp49_;
			_tmp51_ = g_strconcat (_tmp50_, "</a>", NULL);
			_tmp52_ = _tmp51_;
			_g_free0 (_tmp50_);
			_g_free0 (_tmp47_);
			_g_free0 (_tmp45_);
			_g_free0 (_tmp43_);
			msg_str = _tmp52_;
			_tmp53_ = msg_str;
			_tmp54_ = dino_plugins_input_field_status_new (_tmp53_, DINO_PLUGINS_INPUT_FIELD_STATUS_MESSAGE_TYPE_ERROR, DINO_PLUGINS_INPUT_FIELD_STATUS_INPUT_STATE_NO_SEND, TRUE);
			_tmp55_ = _tmp54_;
			dino_ui_chat_input_controller_set_input_field_status (self, _tmp55_);
			_g_object_unref0 (_tmp55_);
			_g_free0 (msg_str);
		} else {
			dino_ui_chat_input_controller_reset_input_field_status (self);
		}
		_xmpp_jid_unref0 (own_jid);
	}
}

static gboolean
dino_ui_chat_input_controller_on_text_input_key_press (DinoUiChatInputController* self,
                                                       guint keyval,
                                                       guint keycode,
                                                       GdkModifierType state)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (keyval == GDK_KEY_Up) {
		DinoUiChatInputView* _tmp1_;
		DinoUiChatTextView* _tmp2_;
		GtkTextView* _tmp3_;
		GtkTextBuffer* _tmp4_;
		GtkTextBuffer* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp1_ = self->priv->chat_input;
		_tmp2_ = _tmp1_->chat_text_view;
		_tmp3_ = _tmp2_->text_view;
		_tmp4_ = gtk_text_view_get_buffer (_tmp3_);
		_tmp5_ = _tmp4_;
		g_object_get (_tmp5_, "text", &_tmp6_, NULL);
		_tmp7_ = _tmp6_;
		_tmp8_ = _tmp7_;
		_tmp0_ = g_strcmp0 (_tmp8_, "") == 0;
		_g_free0 (_tmp8_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		g_signal_emit (self, dino_ui_chat_input_controller_signals[DINO_UI_CHAT_INPUT_CONTROLLER_ACTIVATE_LAST_MESSAGE_CORRECTION_SIGNAL], 0);
		result = TRUE;
		return result;
	} else {
		DinoUiChatInputView* _tmp9_;
		_tmp9_ = self->priv->chat_input;
		dino_ui_chat_input_view_do_focus (_tmp9_);
	}
	result = FALSE;
	return result;
}

const gchar*
dino_ui_chat_input_controller_get_conversation_display_name (DinoUiChatInputController* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_conversation_display_name;
	result = _tmp0_;
	return result;
}

void
dino_ui_chat_input_controller_set_conversation_display_name (DinoUiChatInputController* self,
                                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_chat_input_controller_get_conversation_display_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_conversation_display_name);
		self->priv->_conversation_display_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_chat_input_controller_properties[DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_DISPLAY_NAME_PROPERTY]);
	}
}

const gchar*
dino_ui_chat_input_controller_get_conversation_topic (DinoUiChatInputController* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_conversation_topic;
	result = _tmp0_;
	return result;
}

void
dino_ui_chat_input_controller_set_conversation_topic (DinoUiChatInputController* self,
                                                      const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_chat_input_controller_get_conversation_topic (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_conversation_topic);
		self->priv->_conversation_topic = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_chat_input_controller_properties[DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_TOPIC_PROPERTY]);
	}
}

static void
dino_ui_chat_input_controller_class_init (DinoUiChatInputControllerClass * klass,
                                          gpointer klass_data)
{
	dino_ui_chat_input_controller_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiChatInputController_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_chat_input_controller_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_chat_input_controller_set_property;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_chat_input_controller_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_DISPLAY_NAME_PROPERTY, dino_ui_chat_input_controller_properties[DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_DISPLAY_NAME_PROPERTY] = g_param_spec_string ("conversation-display-name", "conversation-display-name", "conversation-display-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_TOPIC_PROPERTY, dino_ui_chat_input_controller_properties[DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_TOPIC_PROPERTY] = g_param_spec_string ("conversation-topic", "conversation-topic", "conversation-topic", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	dino_ui_chat_input_controller_signals[DINO_UI_CHAT_INPUT_CONTROLLER_ACTIVATE_LAST_MESSAGE_CORRECTION_SIGNAL] = g_signal_new ("activate-last-message-correction", DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dino_ui_chat_input_controller_signals[DINO_UI_CHAT_INPUT_CONTROLLER_FILE_PICKER_SELECTED_SIGNAL] = g_signal_new ("file-picker-selected", DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dino_ui_chat_input_controller_signals[DINO_UI_CHAT_INPUT_CONTROLLER_CLIPBOARD_PASTED_SIGNAL] = g_signal_new ("clipboard-pasted", DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dino_ui_chat_input_controller_instance_init (DinoUiChatInputController * self,
                                             gpointer klass)
{
	self->priv = dino_ui_chat_input_controller_get_instance_private (self);
	self->priv->quoted_content_item = NULL;
}

static void
dino_ui_chat_input_controller_finalize (GObject * obj)
{
	DinoUiChatInputController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, DinoUiChatInputController);
	_g_free0 (self->priv->_conversation_display_name);
	_g_free0 (self->priv->_conversation_topic);
	_g_object_unref0 (self->priv->conversation);
	_g_object_unref0 (self->priv->chat_input);
	_g_object_unref0 (self->priv->status_description_label);
	_g_object_unref0 (self->priv->stream_interactor);
	_g_object_unref0 (self->priv->input_field_status);
	_g_object_unref0 (self->priv->chat_text_view_controller);
	_g_object_unref0 (self->priv->quoted_content_item);
	G_OBJECT_CLASS (dino_ui_chat_input_controller_parent_class)->finalize (obj);
}

static GType
dino_ui_chat_input_controller_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiChatInputControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_chat_input_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiChatInputController), 0, (GInstanceInitFunc) dino_ui_chat_input_controller_instance_init, NULL };
	GType dino_ui_chat_input_controller_type_id;
	dino_ui_chat_input_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoUiChatInputController", &g_define_type_info, 0);
	DinoUiChatInputController_private_offset = g_type_add_instance_private (dino_ui_chat_input_controller_type_id, sizeof (DinoUiChatInputControllerPrivate));
	return dino_ui_chat_input_controller_type_id;
}

GType
dino_ui_chat_input_controller_get_type (void)
{
	static volatile gsize dino_ui_chat_input_controller_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_chat_input_controller_type_id__once)) {
		GType dino_ui_chat_input_controller_type_id;
		dino_ui_chat_input_controller_type_id = dino_ui_chat_input_controller_get_type_once ();
		g_once_init_leave (&dino_ui_chat_input_controller_type_id__once, dino_ui_chat_input_controller_type_id);
	}
	return dino_ui_chat_input_controller_type_id__once;
}

static void
_vala_dino_ui_chat_input_controller_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	DinoUiChatInputController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, DinoUiChatInputController);
	switch (property_id) {
		case DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_DISPLAY_NAME_PROPERTY:
		g_value_set_string (value, dino_ui_chat_input_controller_get_conversation_display_name (self));
		break;
		case DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_TOPIC_PROPERTY:
		g_value_set_string (value, dino_ui_chat_input_controller_get_conversation_topic (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_chat_input_controller_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec)
{
	DinoUiChatInputController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_CHAT_INPUT_CONTROLLER, DinoUiChatInputController);
	switch (property_id) {
		case DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_DISPLAY_NAME_PROPERTY:
		dino_ui_chat_input_controller_set_conversation_display_name (self, g_value_get_string (value));
		break;
		case DINO_UI_CHAT_INPUT_CONTROLLER_CONVERSATION_TOPIC_PROPERTY:
		dino_ui_chat_input_controller_set_conversation_topic (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

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

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

