diff options
Diffstat (limited to 'main/src/ui')
-rw-r--r-- | main/src/ui/chat_input/chat_input_controller.vala | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala index 55196ea4..704cec94 100644 --- a/main/src/ui/chat_input/chat_input_controller.vala +++ b/main/src/ui/chat_input/chat_input_controller.vala @@ -39,7 +39,7 @@ public class ChatInputController : Object { chat_text_view_controller.send_text.connect(send_text); chat_input.encryption_widget.encryption_changed.connect(on_encryption_changed); - + chat_input.file_button.clicked.connect(() => file_picker_selected()); stream_interactor.get_module(MucManager.IDENTITY).received_occupant_role.connect(update_moderated_input_status); @@ -48,6 +48,7 @@ public class ChatInputController : Object { status_description_label.activate_link.connect((uri) => { if (uri == OPEN_CONVERSATION_DETAILS_URI){ ContactDetails.Dialog contact_details_dialog = new ContactDetails.Dialog(stream_interactor, conversation); + contact_details_dialog.set_transient_for((Gtk.Window) chat_input.get_toplevel()); contact_details_dialog.present(); } return true; @@ -63,10 +64,8 @@ public class ChatInputController : Object { chat_input.initialize_for_conversation(conversation); chat_text_view_controller.initialize_for_conversation(conversation); - - Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account); - - update_moderated_input_status(conversation.account, own_jid); + + update_moderated_input_status(conversation.account); } public void set_file_upload_active(bool active) { @@ -85,9 +84,8 @@ public class ChatInputController : Object { input_field_status = status; chat_input.set_input_state(status.message_type); - - if (status.contains_markup) status_description_label.use_markup = true; - else status_description_label.use_markup = false; + + status_description_label.use_markup = status.contains_markup; status_description_label.label = status.message; @@ -167,12 +165,13 @@ public class ChatInputController : Object { stream_interactor.get_module(ChatInteraction.IDENTITY).on_message_cleared(conversation); } } - - private void update_moderated_input_status(Account account, Xmpp.Jid jid) { - Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account); + + private void update_moderated_input_status(Account account, Xmpp.Jid? jid = null) { if (conversation.type_ == conversation.Type.GROUPCHAT){ - if (stream_interactor.get_module(MucManager.IDENTITY).is_moderated_room(conversation.account, conversation.counterpart) && - stream_interactor.get_module(MucManager.IDENTITY).get_role(own_jid, conversation.account)==Xmpp.Xep.Muc.Role.VISITOR) { + Xmpp.Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account); + if (own_jid == null) return; + if (stream_interactor.get_module(MucManager.IDENTITY).is_moderated_room(conversation.account, conversation.counterpart) && + stream_interactor.get_module(MucManager.IDENTITY).get_role(own_jid, conversation.account) == Xmpp.Xep.Muc.Role.VISITOR) { set_input_field_status(new Plugins.InputFieldStatus(_("This conference does not allow you to send messages. %s").printf("<a href=\"" + OPEN_CONVERSATION_DETAILS_URI + "\">" + _("Request permission") + "</a>"), Plugins.InputFieldStatus.MessageType.ERROR, Plugins.InputFieldStatus.InputState.NO_SEND, true)); } else { |