aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/muc_manager.vala
diff options
context:
space:
mode:
authorMax Weller <maximilian.weller@stud.tu-darmstadt.de>2017-08-05 12:56:32 +0200
committerfiaxh <fiaxh@users.noreply.github.com>2017-08-05 12:56:32 +0200
commit4aee95703d5619f7d55373d2f0bb130781266656 (patch)
tree7f946073c7a6e4b059ee329cb148df097677a7bf /libdino/src/service/muc_manager.vala
parentea174ab632ced082eb0f1c51cea1bc9dc5c7c89e (diff)
downloaddino-4aee95703d5619f7d55373d2f0bb130781266656.tar.gz
dino-4aee95703d5619f7d55373d2f0bb130781266656.zip
request history since last known messages (#110)
request history since last known messages when rejoining a room at startup
Diffstat (limited to 'libdino/src/service/muc_manager.vala')
-rw-r--r--libdino/src/service/muc_manager.vala10
1 files changed, 9 insertions, 1 deletions
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index 7761373f..779783cc 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -35,7 +35,15 @@ public class MucManager : StreamInteractionModule, Object {
if (stream == null) return;
string nick_ = nick ?? account.bare_jid.localpart ?? account.bare_jid.domainpart;
set_autojoin(stream, jid, nick_, password);
- stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid.to_string(), nick_, password);
+
+ string history_since = null;
+ Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account);
+ if (conversation != null) {
+ Entities.Message? last_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation);
+ if (last_message != null) history_since = last_message.time.to_string();
+ }
+
+ stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid.to_string(), nick_, password, history_since);
}
public void part(Account account, Jid jid) {