diff options
author | louiz’ <louiz@louiz.org> | 2018-04-24 19:13:10 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-04-24 20:25:39 +0200 |
commit | a90f196a1ce779d502baf0aadff6e6917fec8a02 (patch) | |
tree | ecd826fcb245083ce75d6cd5d6c0bc5836d4b2a7 /src/xmpp | |
parent | b70136b96e579e8d38a30a298f885899cb80514c (diff) | |
download | biboumi-a90f196a1ce779d502baf0aadff6e6917fec8a02.tar.gz biboumi-a90f196a1ce779d502baf0aadff6e6917fec8a02.tar.bz2 biboumi-a90f196a1ce779d502baf0aadff6e6917fec8a02.tar.xz biboumi-a90f196a1ce779d502baf0aadff6e6917fec8a02.zip |
Revert "Use the Date to find a next page in RSM, not the id"
This reverts commit 5ef7ba08028065b03d51d1dc70bb35aeb41ae19d.
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/biboumi_component.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 9bcfa8a..95b38f0 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -716,7 +716,7 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza) } const XmlNode* set = query->get_child("set", RSM_NS); int limit = -1; - std::string reference_uuid{}; + Id::real_type reference_record_id{Id::unset_value}; Database::Paging paging_order{Database::Paging::first}; if (set) { @@ -726,10 +726,9 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza) const XmlNode* after = set->get_child("after", RSM_NS); if (after) { - // Will throw if the uuid does not exist, that’s all. - Database::get_muc_log(from.bare(), iid.get_local(), iid.get_server(), + auto after_record = Database::get_muc_log(from.bare(), iid.get_local(), iid.get_server(), after->get_inner(), start, end); - reference_uuid = after->get_inner(); + reference_record_id = after_record.col<Id>(); } const XmlNode* before = set->get_child("before", RSM_NS); if (before) @@ -737,9 +736,8 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza) paging_order = Database::Paging::last; if (!before->get_inner().empty()) { - // Will throw if the uuid does not exist - Database::get_muc_log(from.bare(), iid.get_local(), iid.get_server(), before->get_inner(), start, end); - reference_uuid = before->get_inner(); + auto before_record = Database::get_muc_log(from.bare(), iid.get_local(), iid.get_server(), before->get_inner(), start, end); + reference_record_id = before_record.col<Id>(); } } } @@ -751,7 +749,7 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza) if ((limit == -1 && start.empty() && end.empty()) || limit > 100) limit = 101; - auto lines = Database::get_muc_logs(from.bare(), iid.get_local(), iid.get_server(), limit, start, end, reference_uuid, paging_order); + auto lines = Database::get_muc_logs(from.bare(), iid.get_local(), iid.get_server(), limit, start, end, reference_record_id, paging_order); bool complete = true; if (lines.size() > 100) { |