mirror of
https://github.com/matrix-construct/construct
synced 2025-03-17 15:00:21 +01:00
ircd:Ⓜ️:media: Add optional file name to file room state.
This commit is contained in:
parent
96119166fa
commit
8ebd2089f2
3 changed files with 10 additions and 3 deletions
|
@ -33,7 +33,7 @@ namespace ircd::m::media::file
|
|||
room::id::buf room_id(const mxc &);
|
||||
|
||||
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
|
||||
download(const mxc &,
|
||||
|
|
|
@ -221,7 +221,8 @@ size_t
|
|||
ircd::m::media::file::write(const m::room &room,
|
||||
const m::user::id &user_id,
|
||||
const const_buffer &content,
|
||||
const string_view &content_type)
|
||||
const string_view &content_type,
|
||||
const string_view &name)
|
||||
try
|
||||
{
|
||||
static const size_t BLK_SZ
|
||||
|
@ -256,6 +257,12 @@ try
|
|||
{ "mime_type", content_type }
|
||||
});
|
||||
|
||||
if(name)
|
||||
send(room, user_id, "ircd.file.stat.name", "", json::members
|
||||
{
|
||||
{ "name", name }
|
||||
});
|
||||
|
||||
size_t off{0}, wrote{0};
|
||||
while(off < size(content))
|
||||
{
|
||||
|
|
|
@ -75,7 +75,7 @@ post__upload(client &client,
|
|||
|
||||
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];
|
||||
|
|
Loading…
Add table
Reference in a new issue