mirror of
https://github.com/matrix-construct/construct
synced 2025-01-12 07:54:12 +01:00
ircd:Ⓜ️:room::message: Fix reply fallback accepting non-mxid careted names.
This commit is contained in:
parent
2a608b8a7c
commit
6092fabe42
2 changed files with 23 additions and 7 deletions
|
@ -44,6 +44,10 @@ struct ircd::m::room::message
|
|||
/// not a reply. If malformed, the message is not considered a reply.
|
||||
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
|
||||
/// or the username was missing or malformed.
|
||||
id::user reply_to_user() const noexcept;
|
||||
|
|
|
@ -110,12 +110,12 @@ ircd::string_view
|
|||
ircd::m::room::message::reply_to_body()
|
||||
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 {};
|
||||
|
||||
string_view body
|
||||
|
@ -125,7 +125,7 @@ const noexcept
|
|||
|
||||
body = string_view
|
||||
{
|
||||
reply_to_user.end(), body.end()
|
||||
reply_to_name.end(), body.end()
|
||||
};
|
||||
|
||||
tokens(body, "\\n", [&body]
|
||||
|
@ -148,6 +148,21 @@ const noexcept
|
|||
ircd::m::user::id
|
||||
ircd::m::room::message::reply_to_user()
|
||||
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
|
||||
{
|
||||
|
@ -166,9 +181,6 @@ const noexcept
|
|||
between(body, '<', '>')
|
||||
};
|
||||
|
||||
if(!valid(m::id::USER, ret))
|
||||
return {};
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue