0
0
Fork 0
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:
Jason Volk 2018-02-17 16:10:01 -08:00
parent 9173c13b89
commit 62f4db4cce

View file

@ -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) };
}()}
{
}