diff options
author | Marvin W <git@larma.de> | 2017-03-13 21:54:12 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-03-13 22:00:17 +0100 |
commit | 2d6f580c871df055ca79b8a8be53e53e62aa155c (patch) | |
tree | 9c69f7c7e6a4f4ae2a3137fc580dbb507abf2ad4 /plugins/omemo/src/manager.vala | |
parent | 1a4cd2508bfc71801d9a1f7029580cc9e4fdf659 (diff) | |
download | dino-2d6f580c871df055ca79b8a8be53e53e62aa155c.tar.gz dino-2d6f580c871df055ca79b8a8be53e53e62aa155c.zip |
correctly bootstrap omemo when there is no devicelist on server yet + concurrency bug fixes
Diffstat (limited to 'plugins/omemo/src/manager.vala')
-rw-r--r-- | plugins/omemo/src/manager.vala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala index b2226e2a..197ba021 100644 --- a/plugins/omemo/src/manager.vala +++ b/plugins/omemo/src/manager.vala @@ -11,13 +11,14 @@ public class Manager : StreamInteractionModule, Object { private StreamInteractor stream_interactor; private Database db; - private ArrayList<Entities.Message> to_send_after_devicelist = new ArrayList<Entities.Message>(); - private ArrayList<Entities.Message> to_send_after_session = new ArrayList<Entities.Message>(); + private ConcurrentList<Entities.Message> to_send_after_devicelist = new ConcurrentList<Entities.Message>(); + private ConcurrentList<Entities.Message> to_send_after_session = new ConcurrentList<Entities.Message>(); private Manager(StreamInteractor stream_interactor, Database db) { this.stream_interactor = stream_interactor; this.db = db; + stream_interactor.stream_negotiated.connect(on_stream_negotiated); stream_interactor.account_added.connect(on_account_added); MessageManager.get_instance(stream_interactor).pre_message_received.connect(on_pre_message_received); MessageManager.get_instance(stream_interactor).pre_message_send.connect(on_pre_message_send); @@ -68,6 +69,11 @@ public class Manager : StreamInteractionModule, Object { stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).session_started.connect((jid, device_id) => on_session_started(account, jid)); } + private void on_stream_negotiated(Account account) { + Core.XmppStream stream = stream_interactor.get_stream(account); + stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).request_user_devicelist(stream, account.bare_jid.to_string()); + } + private void on_session_started(Account account, string jid) { lock(to_send_after_session) { Iterator<Entities.Message> iter = to_send_after_session.iterator(); |