Respond to disco#info on MUC JIDs
Otherwise, some client won’t do MAM, since they don’t know biboumi supports it.
This commit is contained in:
@@ -422,7 +422,13 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
|
|||||||
}
|
}
|
||||||
else if (iid.type == Iid::Type::Channel)
|
else if (iid.type == Iid::Type::Channel)
|
||||||
{
|
{
|
||||||
if (node == MUC_TRAFFIC_NS)
|
log_debug("type_channel");
|
||||||
|
if (node.empty())
|
||||||
|
{
|
||||||
|
this->send_irc_channel_disco_info(id, from, to_str);
|
||||||
|
stanza_error.disable();
|
||||||
|
}
|
||||||
|
else if (node == MUC_TRAFFIC_NS)
|
||||||
{
|
{
|
||||||
this->send_irc_channel_muc_traffic_info(id, from, to_str);
|
this->send_irc_channel_muc_traffic_info(id, from, to_str);
|
||||||
stanza_error.disable();
|
stanza_error.disable();
|
||||||
@@ -755,6 +761,32 @@ void BiboumiComponent::send_irc_channel_muc_traffic_info(const std::string& id,
|
|||||||
this->send_stanza(iq);
|
this->send_stanza(iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BiboumiComponent::send_irc_channel_disco_info(const std::string& id, const std::string& jid_to, const std::string& jid_from)
|
||||||
|
{
|
||||||
|
log_debug("jid_from: ", jid_from);
|
||||||
|
Jid from(jid_from);
|
||||||
|
Iid iid(from.local, {});
|
||||||
|
Stanza iq("iq");
|
||||||
|
{
|
||||||
|
iq["type"] = "result";
|
||||||
|
iq["id"] = id;
|
||||||
|
iq["to"] = jid_to;
|
||||||
|
iq["from"] = jid_from;
|
||||||
|
XmlSubNode query(iq, "query");
|
||||||
|
query["xmlns"] = DISCO_INFO_NS;
|
||||||
|
XmlSubNode identity(query, "identity");
|
||||||
|
identity["category"] = "conference";
|
||||||
|
identity["type"] = "irc";
|
||||||
|
identity["name"] = "IRC channel "s + iid.get_local() + " from server " + iid.get_server() + " over biboumi";
|
||||||
|
for (const char *ns: {DISCO_INFO_NS, MUC_NS, ADHOC_NS, PING_NS, MAM_NS, VERSION_NS})
|
||||||
|
{
|
||||||
|
XmlSubNode feature(query, "feature");
|
||||||
|
feature["var"] = ns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->send_stanza(iq);
|
||||||
|
}
|
||||||
|
|
||||||
void BiboumiComponent::send_ping_request(const std::string& from,
|
void BiboumiComponent::send_ping_request(const std::string& from,
|
||||||
const std::string& jid_to,
|
const std::string& jid_to,
|
||||||
const std::string& id)
|
const std::string& id)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public:
|
|||||||
* http://xmpp.org/extensions/xep-0045.html#impl-service-traffic
|
* http://xmpp.org/extensions/xep-0045.html#impl-service-traffic
|
||||||
*/
|
*/
|
||||||
void send_irc_channel_muc_traffic_info(const std::string& id, const std::string& jid_to, const std::string& jid_from);
|
void send_irc_channel_muc_traffic_info(const std::string& id, const std::string& jid_to, const std::string& jid_from);
|
||||||
|
void send_irc_channel_disco_info(const std::string& id, const std::string& jid_to, const std::string& jid_from);
|
||||||
/**
|
/**
|
||||||
* Send a ping request
|
* Send a ping request
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1866,6 +1866,38 @@ if __name__ == '__main__':
|
|||||||
"<iq from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' id='1' type='get'><query xmlns='http://jabber.org/protocol/disco#info' node='http://jabber.org/protocol/muc#traffic'/></iq>"),
|
"<iq from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' id='1' type='get'><query xmlns='http://jabber.org/protocol/disco#info' node='http://jabber.org/protocol/muc#traffic'/></iq>"),
|
||||||
partial(expect_stanza, "/iq[@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}'][@type='result']/disco_info:query[@node='http://jabber.org/protocol/muc#traffic']"),
|
partial(expect_stanza, "/iq[@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}'][@type='result']/disco_info:query[@node='http://jabber.org/protocol/muc#traffic']"),
|
||||||
]),
|
]),
|
||||||
|
Scenario("muc_disco_info",
|
||||||
|
[
|
||||||
|
handshake_sequence(),
|
||||||
|
|
||||||
|
partial(send_stanza,
|
||||||
|
"<iq from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' id='1' type='get'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>"),
|
||||||
|
partial(expect_stanza,
|
||||||
|
("/iq[@from='#foo%{irc_server_one}'][@to='{jid_one}/{resource_one}'][@type='result']/disco_info:query",
|
||||||
|
"/iq[@type='result']/disco_info:query/disco_info:identity[@category='conference'][@type='irc'][@name='IRC channel #foo from server {irc_host_one} over biboumi']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='jabber:iq:version']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='http://jabber.org/protocol/commands']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='urn:xmpp:ping']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='urn:xmpp:mam:2']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='jabber:iq:version']",
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
Scenario("fixed_muc_disco_info",
|
||||||
|
[
|
||||||
|
handshake_sequence(),
|
||||||
|
|
||||||
|
partial(send_stanza,
|
||||||
|
"<iq from='{jid_one}/{resource_one}' to='#foo@{biboumi_host}' id='1' type='get'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>"),
|
||||||
|
partial(expect_stanza,
|
||||||
|
("/iq[@from='#foo@{biboumi_host}'][@to='{jid_one}/{resource_one}'][@type='result']/disco_info:query",
|
||||||
|
"/iq[@type='result']/disco_info:query/disco_info:identity[@category='conference'][@type='irc'][@name='IRC channel #foo from server {irc_host_one} over biboumi']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='jabber:iq:version']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='http://jabber.org/protocol/commands']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='urn:xmpp:ping']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='urn:xmpp:mam:2']",
|
||||||
|
"/iq/disco_info:query/disco_info:feature[@var='jabber:iq:version']",
|
||||||
|
)),
|
||||||
|
], conf='fixed_server'),
|
||||||
Scenario("raw_message",
|
Scenario("raw_message",
|
||||||
[
|
[
|
||||||
handshake_sequence(),
|
handshake_sequence(),
|
||||||
|
|||||||
Reference in New Issue
Block a user