ircd:Ⓜ️:media: Add optional file name to file room state.
This commit is contained in:
parent
96119166fa
commit
8ebd2089f2
|
@ -33,7 +33,7 @@ namespace ircd::m::media::file
|
||||||
room::id::buf room_id(const mxc &);
|
room::id::buf room_id(const mxc &);
|
||||||
|
|
||||||
size_t read(const room &, const closure &);
|
size_t read(const room &, const closure &);
|
||||||
size_t write(const room &, const user::id &, const const_buffer &content, const string_view &content_type);
|
size_t write(const room &, const user::id &, const const_buffer &content, const string_view &content_type, const string_view &name = {});
|
||||||
|
|
||||||
room::id::buf
|
room::id::buf
|
||||||
download(const mxc &,
|
download(const mxc &,
|
||||||
|
|
|
@ -221,7 +221,8 @@ size_t
|
||||||
ircd::m::media::file::write(const m::room &room,
|
ircd::m::media::file::write(const m::room &room,
|
||||||
const m::user::id &user_id,
|
const m::user::id &user_id,
|
||||||
const const_buffer &content,
|
const const_buffer &content,
|
||||||
const string_view &content_type)
|
const string_view &content_type,
|
||||||
|
const string_view &name)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
static const size_t BLK_SZ
|
static const size_t BLK_SZ
|
||||||
|
@ -256,6 +257,12 @@ try
|
||||||
{ "mime_type", content_type }
|
{ "mime_type", content_type }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(name)
|
||||||
|
send(room, user_id, "ircd.file.stat.name", "", json::members
|
||||||
|
{
|
||||||
|
{ "name", name }
|
||||||
|
});
|
||||||
|
|
||||||
size_t off{0}, wrote{0};
|
size_t off{0}, wrote{0};
|
||||||
while(off < size(content))
|
while(off < size(content))
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ post__upload(client &client,
|
||||||
|
|
||||||
const size_t written
|
const size_t written
|
||||||
{
|
{
|
||||||
m::media::file::write(room, request.user_id, buf, content_type)
|
m::media::file::write(room, request.user_id, buf, content_type, filename)
|
||||||
};
|
};
|
||||||
|
|
||||||
char uribuf[256];
|
char uribuf[256];
|
||||||
|
|
Loading…
Reference in New Issue