mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:15:11 +00:00
[MOD] Add width/height information when possible
This commit is contained in:
parent
09d38993bb
commit
d989331716
5 changed files with 103 additions and 3 deletions
|
|
@ -79,7 +79,7 @@ MatrixCreateNickChange(char *nick)
|
|||
return map;
|
||||
}
|
||||
HashMap *
|
||||
MatrixCreateMedia(char *mxc, char *body, char *mime)
|
||||
MatrixCreateMedia(char *mxc, char *body, char *mime, FileInfo *info)
|
||||
{
|
||||
HashMap *map;
|
||||
char *mime_type = NULL, *matrix_type = NULL;
|
||||
|
|
@ -120,6 +120,11 @@ MatrixCreateMedia(char *mxc, char *body, char *mime)
|
|||
|
||||
map = HashMapCreate();
|
||||
JsonSet(map, JsonValueString(mime), 2, "info", "mimetype");
|
||||
if (info && info->width && info->height)
|
||||
{
|
||||
JsonSet(map, JsonValueInteger(info->width), 2, "info", "w");
|
||||
JsonSet(map, JsonValueInteger(info->height), 2, "info", "h");
|
||||
}
|
||||
HashMapSet(map, "msgtype", JsonValueString(matrix_type));
|
||||
HashMapSet(map, "mimetype", JsonValueString(mime));
|
||||
HashMapSet(map, "body", JsonValueString(body));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue