mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd:Ⓜ️ Fix/cleanup m::id generator ctor.
This commit is contained in:
parent
9173c13b89
commit
62f4db4cce
1 changed files with 8 additions and 9 deletions
17
ircd/m/id.cc
17
ircd/m/id.cc
|
@ -457,31 +457,30 @@ ircd::m::id::id(const enum sigil &sigil,
|
|||
{
|
||||
//TODO: output grammar
|
||||
|
||||
char name[64]; switch(sigil)
|
||||
char namebuf[64];
|
||||
string_view name; switch(sigil)
|
||||
{
|
||||
case sigil::USER:
|
||||
printer::random_prefixed("guest", name);
|
||||
name = printer::random_prefixed("guest", namebuf);
|
||||
break;
|
||||
|
||||
case sigil::ROOM_ALIAS:
|
||||
printer::random_prefixed("", name);
|
||||
name = printer::random_prefixed("", namebuf);
|
||||
break;
|
||||
|
||||
case sigil::DEVICE:
|
||||
printer::random_alpha(name, 16);
|
||||
name = printer::random_alpha(namebuf, 16);
|
||||
break;
|
||||
|
||||
default:
|
||||
printer::random_timebased(name);
|
||||
name = printer::random_timebased(namebuf);
|
||||
break;
|
||||
};
|
||||
|
||||
const auto len
|
||||
return fmt::sprintf
|
||||
{
|
||||
fmt::sprintf(buf, "%c%s:%s", char(sigil), name, host)
|
||||
buf, "%c%s:%s", char(sigil), name, host
|
||||
};
|
||||
|
||||
return string_view { buffer::data(buf), size_t(len) };
|
||||
}()}
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue