ircd:Ⓜ️:room::message: Fix reply fallback accepting non-mxid careted names.
This commit is contained in:
parent
2a608b8a7c
commit
6092fabe42
|
@ -44,6 +44,10 @@ struct ircd::m::room::message
|
||||||
/// not a reply. If malformed, the message is not considered a reply.
|
/// not a reply. If malformed, the message is not considered a reply.
|
||||||
id::event reply_to_event() const noexcept;
|
id::event reply_to_event() const noexcept;
|
||||||
|
|
||||||
|
/// The user who sent the message being replied to; empty if not a reply
|
||||||
|
/// or the name was missing.
|
||||||
|
string_view reply_to_name() const noexcept;
|
||||||
|
|
||||||
/// The user who sent the message being replied to; empty if not a reply
|
/// The user who sent the message being replied to; empty if not a reply
|
||||||
/// or the username was missing or malformed.
|
/// or the username was missing or malformed.
|
||||||
id::user reply_to_user() const noexcept;
|
id::user reply_to_user() const noexcept;
|
||||||
|
|
|
@ -110,12 +110,12 @@ ircd::string_view
|
||||||
ircd::m::room::message::reply_to_body()
|
ircd::m::room::message::reply_to_body()
|
||||||
const noexcept
|
const noexcept
|
||||||
{
|
{
|
||||||
const auto reply_to_user
|
const auto reply_to_name
|
||||||
{
|
{
|
||||||
this->reply_to_user()
|
this->reply_to_name()
|
||||||
};
|
};
|
||||||
|
|
||||||
if(likely(!reply_to_user))
|
if(likely(!reply_to_name))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
string_view body
|
string_view body
|
||||||
|
@ -125,7 +125,7 @@ const noexcept
|
||||||
|
|
||||||
body = string_view
|
body = string_view
|
||||||
{
|
{
|
||||||
reply_to_user.end(), body.end()
|
reply_to_name.end(), body.end()
|
||||||
};
|
};
|
||||||
|
|
||||||
tokens(body, "\\n", [&body]
|
tokens(body, "\\n", [&body]
|
||||||
|
@ -148,6 +148,21 @@ const noexcept
|
||||||
ircd::m::user::id
|
ircd::m::user::id
|
||||||
ircd::m::room::message::reply_to_user()
|
ircd::m::room::message::reply_to_user()
|
||||||
const noexcept
|
const noexcept
|
||||||
|
{
|
||||||
|
const auto reply_to_name
|
||||||
|
{
|
||||||
|
this->reply_to_name()
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!valid(m::id::USER, reply_to_name))
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return reply_to_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
ircd::string_view
|
||||||
|
ircd::m::room::message::reply_to_name()
|
||||||
|
const noexcept
|
||||||
{
|
{
|
||||||
string_view body
|
string_view body
|
||||||
{
|
{
|
||||||
|
@ -166,9 +181,6 @@ const noexcept
|
||||||
between(body, '<', '>')
|
between(body, '<', '>')
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!valid(m::id::USER, ret))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue