xep-0106 escape the JIDs listed in a disco#items server query
fix #3325
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include <xmpp/adhoc_command.hpp>
|
#include <xmpp/adhoc_command.hpp>
|
||||||
#include <xmpp/biboumi_adhoc_commands.hpp>
|
#include <xmpp/biboumi_adhoc_commands.hpp>
|
||||||
#include <bridge/list_element.hpp>
|
#include <bridge/list_element.hpp>
|
||||||
|
#include <utils/encoding.hpp>
|
||||||
#include <config/config.hpp>
|
#include <config/config.hpp>
|
||||||
#include <utils/time.hpp>
|
#include <utils/time.hpp>
|
||||||
#include <xmpp/jid.hpp>
|
#include <xmpp/jid.hpp>
|
||||||
@@ -1010,7 +1011,9 @@ void BiboumiComponent::send_iq_room_list_result(const std::string& id, const std
|
|||||||
for (auto it = begin; it != end; ++it)
|
for (auto it = begin; it != end; ++it)
|
||||||
{
|
{
|
||||||
XmlSubNode item(query, "item");
|
XmlSubNode item(query, "item");
|
||||||
item["jid"] = it->channel + "@" + this->served_hostname;
|
std::string channel_name = it->channel;
|
||||||
|
xep0106::encode(channel_name);
|
||||||
|
item["jid"] = channel_name + "@" + this->served_hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rs_info.max >= 0 || !rs_info.after.empty() || !rs_info.before.empty()))
|
if ((rs_info.max >= 0 || !rs_info.after.empty() || !rs_info.before.empty()))
|
||||||
|
|||||||
@@ -2254,6 +2254,21 @@ if __name__ == '__main__':
|
|||||||
"/iq/disco_items:query/disco_items:item[@jid='#bar%{irc_server_one}']"
|
"/iq/disco_items:query/disco_items:item[@jid='#bar%{irc_server_one}']"
|
||||||
))
|
))
|
||||||
]),
|
]),
|
||||||
|
Scenario("channel_list_escaping",
|
||||||
|
[
|
||||||
|
handshake_sequence(),
|
||||||
|
|
||||||
|
partial(send_stanza,
|
||||||
|
"<presence from='{jid_one}/{resource_one}' to='#true\\2ffalse%{irc_server_one}/{nick_one}' />"),
|
||||||
|
connection_sequence("irc.localhost", '{jid_one}/{resource_one}'),
|
||||||
|
partial(expect_stanza,
|
||||||
|
"/message/body[text()='Mode #true/false [+nt] by {irc_host_one}']"),
|
||||||
|
partial(expect_stanza,
|
||||||
|
("/presence[@to='{jid_one}/{resource_one}'][@from='#true\\2ffalse%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
|
||||||
|
"/presence/muc_user:x/muc_user:status[@code='110']")
|
||||||
|
),
|
||||||
|
partial(expect_stanza, "/message[@from='#true\\2ffalse%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
|
||||||
|
]),
|
||||||
Scenario("channel_list_with_rsm",
|
Scenario("channel_list_with_rsm",
|
||||||
[
|
[
|
||||||
handshake_sequence(),
|
handshake_sequence(),
|
||||||
|
|||||||
Reference in New Issue
Block a user