Include the <fin><set><first/><last/></></> nodes in the MAM iq result

fix #3322
This commit is contained in:
louiz’
2017-12-26 20:21:18 +01:00
parent 37340e593f
commit 131ef9946f
4 changed files with 26 additions and 4 deletions
+18 -1
View File
@@ -725,7 +725,24 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza)
if (!line.col<Database::Nick>().empty())
this->send_archived_message(line, to.full(), from.full(), query_id);
}
this->send_iq_result_full_jid(id, from.full(), to.full());
{
auto fin_ptr = std::make_unique<XmlNode>("fin");
{
XmlNode& fin = *(fin_ptr.get());
fin["xmlns"] = MAM_NS;
XmlSubNode set(fin, "set");
set["xmlns"] = RSM_NS;
if (!lines.empty())
{
XmlSubNode first(set, "first");
first["index"] = "0";
first.set_inner(lines[0].col<Database::Uuid>());
XmlSubNode last(set, "last");
last.set_inner(lines[lines.size() - 1].col<Database::Uuid>());
}
}
this->send_iq_result_full_jid(id, from.full(), to.full(), std::move(fin_ptr));
}
return true;
}
return false;
+3 -1
View File
@@ -640,13 +640,15 @@ void XmppComponent::send_iq_version_request(const std::string& from,
this->send_stanza(iq);
}
void XmppComponent::send_iq_result_full_jid(const std::string& id, const std::string& to_jid, const std::string& from_full_jid)
void XmppComponent::send_iq_result_full_jid(const std::string& id, const std::string& to_jid, const std::string& from_full_jid, std::unique_ptr<XmlNode> inner)
{
Stanza iq("iq");
iq["from"] = from_full_jid;
iq["to"] = to_jid;
iq["id"] = id;
iq["type"] = "result";
if (inner)
iq.add_child(std::move(inner));
this->send_stanza(iq);
}
+1 -1
View File
@@ -203,7 +203,7 @@ public:
*/
void send_iq_result(const std::string& id, const std::string& to_jid, const std::string& from);
void send_iq_result_full_jid(const std::string& id, const std::string& to_jid,
const std::string& from_full_jid);
const std::string& from_full_jid, std::unique_ptr<XmlNode> inner=nullptr);
void handle_handshake(const Stanza& stanza);
void handle_error(const Stanza& stanza);