diff options
author | fiaxh <git@mx.ax.lt> | 2017-10-28 22:02:32 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-10-31 15:41:45 +0100 |
commit | d9b91206c0291fa8aa58df572292784a4f8ff878 (patch) | |
tree | 09721f9fdffbb87ec8ab25fd1c44a7bc535fffab /libdino | |
parent | 7e83529afcd0ccfff5c65c99e4427bd6cf3f82ac (diff) | |
download | dino-d9b91206c0291fa8aa58df572292784a4f8ff878.tar.gz dino-d9b91206c0291fa8aa58df572292784a4f8ff878.zip |
Keep MUC join dialog open until joined, show errors
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/entity/message.vala | 9 | ||||
-rw-r--r-- | libdino/src/service/muc_manager.vala | 12 |
2 files changed, 15 insertions, 6 deletions
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<Xep.Bookmarks.Conference> 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)); |