fixup 4aee957 (request history since last known messages)

This commit is contained in:
fiaxh 2017-08-16 17:58:04 +02:00
parent fb36ea0553
commit bff6885a6b
2 changed files with 4 additions and 4 deletions

View File

@ -36,11 +36,11 @@ public class MucManager : StreamInteractionModule, Object {
string nick_ = nick ?? account.bare_jid.localpart ?? account.bare_jid.domainpart; string nick_ = nick ?? account.bare_jid.localpart ?? account.bare_jid.domainpart;
set_autojoin(stream, jid, nick_, password); set_autojoin(stream, jid, nick_, password);
string history_since = null; DateTime? history_since = null;
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account);
if (conversation != null) { if (conversation != null) {
Entities.Message? last_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation); 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(); if (last_message != null) history_since = last_message.time;
} }
stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid.to_string(), nick_, password, history_since); stream.get_module(Xep.Muc.Module.IDENTITY).enter(stream, jid.bare_jid.to_string(), nick_, password, history_since);

View File

@ -69,7 +69,7 @@ public class Module : XmppStreamModule {
public signal void self_removed_from_room(XmppStream stream, string jid, StatusCode code); public signal void self_removed_from_room(XmppStream stream, string jid, StatusCode code);
public signal void removed_from_room(XmppStream stream, string jid, StatusCode? code); public signal void removed_from_room(XmppStream stream, string jid, StatusCode? code);
public void enter(XmppStream stream, string bare_jid, string nick, string? password, string? history_since) { public void enter(XmppStream stream, string bare_jid, string nick, string? password, DateTime? history_since) {
Presence.Stanza presence = new Presence.Stanza(); Presence.Stanza presence = new Presence.Stanza();
presence.to = bare_jid + "/" + nick; presence.to = bare_jid + "/" + nick;
StanzaNode x_node = new StanzaNode.build("x", NS_URI).add_self_xmlns(); StanzaNode x_node = new StanzaNode.build("x", NS_URI).add_self_xmlns();
@ -78,7 +78,7 @@ public class Module : XmppStreamModule {
} }
if (history_since != null) { if (history_since != null) {
StanzaNode history_node = new StanzaNode.build("history", NS_URI); StanzaNode history_node = new StanzaNode.build("history", NS_URI);
history_node.set_attribute("since", history_since); history_node.set_attribute("since", DateTimeProfiles.to_datetime(history_since));
x_node.put_node(history_node); x_node.put_node(history_node);
} }
presence.stanza.put_node(x_node); presence.stanza.put_node(x_node);