From d9b91206c0291fa8aa58df572292784a4f8ff878 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 28 Oct 2017 22:02:32 +0200 Subject: [PATCH] Keep MUC join dialog open until joined, show errors --- libdino/src/entity/message.vala | 9 +- libdino/src/service/muc_manager.vala | 12 +- main/CMakeLists.txt | 16 +- .../add_conversation/add_contact_dialog.ui | 2 +- .../add_conversation/add_groupchat_dialog.ui | 20 +- .../conference_details_fragment.ui | 380 +++++++++++------- main/data/add_conversation/list_row.ui | 2 +- .../add_conversation/select_jid_fragment.ui | 2 +- ...dialog.vala => add_conference_dialog.vala} | 20 +- .../{chat => }/add_contact_dialog.vala | 2 +- .../add_groupchat_dialog.vala | 5 +- .../conference_details_fragment.vala | 57 ++- .../{conference => }/conference_list.vala | 2 +- main/src/ui/add_conversation/list_row.vala | 2 +- .../{chat => }/roster_list.vala | 2 +- ...dialog.vala => select_contact_dialog.vala} | 22 +- .../add_conversation/select_jid_fragment.vala | 2 +- main/src/ui/application.vala | 12 +- main/src/ui/conversation_list_titlebar.vala | 10 +- main/src/ui/conversation_selector/list.vala | 2 + main/src/ui/notifications.vala | 2 +- main/src/ui/occupant_menu/view.vala | 2 +- .../accounts_combo_box.vala | 0 xmpp-vala/src/module/xep/0045_muc/module.vala | 6 +- xmpp-vala/src/module/xep/0199_ping.vala | 4 +- 25 files changed, 365 insertions(+), 230 deletions(-) rename main/src/ui/add_conversation/{conference/dialog.vala => add_conference_dialog.vala} (87%) rename main/src/ui/add_conversation/{chat => }/add_contact_dialog.vala (97%) rename main/src/ui/add_conversation/{conference => }/add_groupchat_dialog.vala (93%) rename main/src/ui/add_conversation/{conference => }/conference_details_fragment.vala (68%) rename main/src/ui/add_conversation/{conference => }/conference_list.vala (98%) rename main/src/ui/add_conversation/{chat => }/roster_list.vala (98%) rename main/src/ui/add_conversation/{chat/dialog.vala => select_contact_dialog.vala} (74%) rename main/src/ui/{add_conversation => util}/accounts_combo_box.vala (100%) diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala index cd54b0a5..3c5d03d3 100644 --- a/libdino/src/entity/message.vala +++ b/libdino/src/entity/message.vala @@ -43,7 +43,14 @@ public class Message : Object { /** UTC **/ public DateTime? local_time { get; set; } public Encryption encryption { get; set; default = Encryption.NONE; } - public Marked marked { get; set; default = Marked.NONE; } + private Marked marked_ = Marked.NONE; + public Marked marked { + get { return marked_; } + set { + if (marked == Marked.RECEIVED && marked == Marked.READ) return; + marked_ = value; + } + } public Xmpp.Message.Stanza stanza { get; set; } private Database? db; diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala index f9a67e7a..7522f2a4 100644 --- a/libdino/src/service/muc_manager.vala +++ b/libdino/src/service/muc_manager.vala @@ -9,6 +9,7 @@ public class MucManager : StreamInteractionModule, Object { public string id { get { return IDENTITY.id; } } public signal void joined(Account account, Jid jid, string nick); + public signal void enter_error(Account account, Jid jid, Xep.Muc.MucEnterError error); public signal void left(Account account, Jid jid); public signal void subject_set(Account account, Jid jid, string? subject); public signal void bookmarks_updated(Account account, Gee.List conferences); @@ -29,12 +30,9 @@ public class MucManager : StreamInteractionModule, Object { } public void join(Account account, Jid jid, string? nick, string? password) { - if (enter_errors.has_key(jid)) return; - Core.XmppStream? stream = stream_interactor.get_stream(account); if (stream == null) return; string nick_ = nick ?? account.bare_jid.localpart ?? account.bare_jid.domainpart; - set_autojoin(stream, jid, nick_, password); DateTime? history_since = null; Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); @@ -209,11 +207,15 @@ public class MucManager : StreamInteractionModule, Object { private void on_account_added(Account account) { stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_entered.connect( (stream, jid_string, nick) => { Jid jid = new Jid(jid_string); + enter_errors.unset(jid); + set_autojoin(stream, jid, nick, null); // TODO password joined(account, jid, nick); stream_interactor.get_module(MessageProcessor.IDENTITY).send_unsent_messages(account, jid); }); - stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_enter_error.connect( (stream, jid, error) => { - enter_errors[new Jid(jid)] = error; + stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_enter_error.connect( (stream, jid_str, error) => { + Jid jid = new Jid(jid_str); + enter_errors[jid] = error; + enter_error(account, jid, error); }); stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).self_removed_from_room.connect( (stream, jid, code) => { left(account, new Jid(jid)); diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 222adfb9..4fd55a47 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -72,15 +72,14 @@ SOURCES src/main.vala src/ui/application.vala - src/ui/add_conversation/chat/add_contact_dialog.vala - src/ui/add_conversation/chat/roster_list.vala - src/ui/add_conversation/chat/dialog.vala - src/ui/add_conversation/conference/add_groupchat_dialog.vala - src/ui/add_conversation/conference/conference_details_fragment.vala - src/ui/add_conversation/conference/conference_list.vala - src/ui/add_conversation/conference/dialog.vala - src/ui/add_conversation/accounts_combo_box.vala + src/ui/add_conversation/add_conference_dialog.vala + src/ui/add_conversation/add_contact_dialog.vala + src/ui/add_conversation/add_groupchat_dialog.vala + src/ui/add_conversation/conference_details_fragment.vala + src/ui/add_conversation/conference_list.vala src/ui/add_conversation/list_row.vala + src/ui/add_conversation/roster_list.vala + src/ui/add_conversation/select_contact_dialog.vala src/ui/add_conversation/select_jid_fragment.vala src/ui/avatar_generator.vala src/ui/chat_input/edit_history.vala @@ -121,6 +120,7 @@ SOURCES src/ui/occupant_menu/view.vala src/ui/settings_dialog.vala src/ui/unified_window.vala + src/ui/util/accounts_combo_box.vala src/ui/util/helper.vala src/ui/util/label_hybrid.vala CUSTOM_VAPIS diff --git a/main/data/add_conversation/add_contact_dialog.ui b/main/data/add_conversation/add_contact_dialog.ui index 3e99b2cc..c2077647 100644 --- a/main/data/add_conversation/add_contact_dialog.ui +++ b/main/data/add_conversation/add_contact_dialog.ui @@ -1,6 +1,6 @@ -