Support all allowed channel prefixes

RFC 2812 specifies in §1.3 that “Channels names are strings (beginning
with a '&', '#', '+' or '!' character) of length up to fifty (50)
characters.”

We previously only allowed the first two prefix characters, or any other
one if the server overrides the list with ISUPPORT.
This commit is contained in:
Link Mauve
2025-07-29 16:04:36 +02:00
committed by Link Mauve
parent e4d32f9392
commit 7cd4e06f84
6 changed files with 13 additions and 12 deletions
+5 -5
View File
@@ -482,7 +482,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
// Depending on the 'to' jid in the request, we use one adhoc
// command handler or an other
Iid iid(to.local, {'#', '&'});
Iid iid(to.local, {'&', '#', '+', '!'});
AdhocCommandsHandler* adhoc_handler;
if (to.local.empty())
adhoc_handler = &this->adhoc_commands_handler;
@@ -532,7 +532,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
const XmlNode* query;
if ((query = stanza.get_child("query", DISCO_INFO_NS)))
{ // Disco info
Iid iid(to.local, {'#', '&'});
Iid iid(to.local, {'&', '#', '+', '!'});
const std::string node = query->get_tag("node");
if (to_str == this->served_hostname)
{
@@ -736,7 +736,7 @@ bool BiboumiComponent::handle_mam_request(const Stanza& stanza)
const XmlNode* query = stanza.get_child("query", MAM_NS);
Iid iid(to.local, {'#', '&'});
Iid iid(to.local, {'&', '#', '+', '!'});
if (query && iid.type == Iid::Type::Channel && to.resource.empty())
{
const std::string query_id = query->get_tag("queryid");
@@ -865,7 +865,7 @@ void BiboumiComponent::send_archived_message(const Database::MucLogLine& log_lin
bool BiboumiComponent::handle_room_configuration_form_request(const std::string& from, const Jid& to, const std::string& id)
{
Iid iid(to.local, {'#', '&'});
Iid iid(to.local, {'&', '#', '+', '!'});
if (iid.type != Iid::Type::Channel || !to.resource.empty())
return false;
@@ -887,7 +887,7 @@ bool BiboumiComponent::handle_room_configuration_form_request(const std::string&
bool BiboumiComponent::handle_room_configuration_form(const XmlNode& query, const std::string &from, const Jid &to, const std::string &id)
{
Iid iid(to.local, {'#', '&'});
Iid iid(to.local, {'&', '#', '+', '!'});
if (iid.type != Iid::Type::Channel || !to.resource.empty())
return false;