From 2aa1d6520a48e5c7d145edab96f8177846015734 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 16 Nov 2020 07:17:40 -0800 Subject: [PATCH] ircd::m::user::registar: Allow full mxid argument w/ localname extraction. --- matrix/user_register.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/matrix/user_register.cc b/matrix/user_register.cc index 01ff785f5..675266bb8 100644 --- a/matrix/user_register.cc +++ b/matrix/user_register.cc @@ -36,9 +36,11 @@ const // 3.3.1 The local part of the desired Matrix ID. If omitted, the homeserver MUST // generate a Matrix ID local part. - const auto &username + const string_view username { - json::get<"username"_>(*this) + valid(m::id::USER, json::get<"username"_>(*this))? + m::id::user(json::get<"username"_>(*this)).localname(): + string_view(json::get<"username"_>(*this)) }; // Generate canonical mxid. The home_server is appended if one is not