@@ -277,31 +277,31 @@ impl TryFrom<MessageType> for RumaMessageType {
277
277
RumaImageMessageEventContent :: new ( content. body , ( * content. source ) . clone ( ) )
278
278
. info ( content. info . map ( Into :: into) . map ( Box :: new) ) ;
279
279
event_content. formatted = content. formatted . map ( Into :: into) ;
280
- event_content. filename = content. filename ;
280
+ event_content. filename = content. raw_filename ;
281
281
Self :: Image ( event_content)
282
282
}
283
283
MessageType :: Audio { content } => {
284
284
let mut event_content =
285
285
RumaAudioMessageEventContent :: new ( content. body , ( * content. source ) . clone ( ) )
286
286
. info ( content. info . map ( Into :: into) . map ( Box :: new) ) ;
287
287
event_content. formatted = content. formatted . map ( Into :: into) ;
288
- event_content. filename = content. filename ;
288
+ event_content. filename = content. raw_filename ;
289
289
Self :: Audio ( event_content)
290
290
}
291
291
MessageType :: Video { content } => {
292
292
let mut event_content =
293
293
RumaVideoMessageEventContent :: new ( content. body , ( * content. source ) . clone ( ) )
294
294
. info ( content. info . map ( Into :: into) . map ( Box :: new) ) ;
295
295
event_content. formatted = content. formatted . map ( Into :: into) ;
296
- event_content. filename = content. filename ;
296
+ event_content. filename = content. raw_filename ;
297
297
Self :: Video ( event_content)
298
298
}
299
299
MessageType :: File { content } => {
300
300
let mut event_content =
301
301
RumaFileMessageEventContent :: new ( content. body , ( * content. source ) . clone ( ) )
302
302
. info ( content. info . map ( Into :: into) . map ( Box :: new) ) ;
303
303
event_content. formatted = content. formatted . map ( Into :: into) ;
304
- event_content. filename = content. filename ;
304
+ event_content. filename = content. raw_filename ;
305
305
Self :: File ( event_content)
306
306
}
307
307
MessageType :: Notice { content } => {
@@ -337,7 +337,10 @@ impl From<RumaMessageType> for MessageType {
337
337
content : ImageMessageContent {
338
338
body : c. body . clone ( ) ,
339
339
formatted : c. formatted . as_ref ( ) . map ( Into :: into) ,
340
- filename : c. filename . clone ( ) ,
340
+ raw_filename : c. filename . clone ( ) ,
341
+ filename : c. filename ( ) . to_owned ( ) ,
342
+ caption : c. caption ( ) . map ( ToString :: to_string) ,
343
+ formatted_caption : c. formatted_caption ( ) . map ( Into :: into) ,
341
344
source : Arc :: new ( c. source . clone ( ) ) ,
342
345
info : c. info . as_deref ( ) . map ( Into :: into) ,
343
346
} ,
@@ -346,7 +349,10 @@ impl From<RumaMessageType> for MessageType {
346
349
content : AudioMessageContent {
347
350
body : c. body . clone ( ) ,
348
351
formatted : c. formatted . as_ref ( ) . map ( Into :: into) ,
349
- filename : c. filename . clone ( ) ,
352
+ raw_filename : c. filename . clone ( ) ,
353
+ filename : c. filename ( ) . to_owned ( ) ,
354
+ caption : c. caption ( ) . map ( ToString :: to_string) ,
355
+ formatted_caption : c. formatted_caption ( ) . map ( Into :: into) ,
350
356
source : Arc :: new ( c. source . clone ( ) ) ,
351
357
info : c. info . as_deref ( ) . map ( Into :: into) ,
352
358
audio : c. audio . map ( Into :: into) ,
@@ -357,7 +363,10 @@ impl From<RumaMessageType> for MessageType {
357
363
content : VideoMessageContent {
358
364
body : c. body . clone ( ) ,
359
365
formatted : c. formatted . as_ref ( ) . map ( Into :: into) ,
360
- filename : c. filename . clone ( ) ,
366
+ raw_filename : c. filename . clone ( ) ,
367
+ filename : c. filename ( ) . to_owned ( ) ,
368
+ caption : c. caption ( ) . map ( ToString :: to_string) ,
369
+ formatted_caption : c. formatted_caption ( ) . map ( Into :: into) ,
361
370
source : Arc :: new ( c. source . clone ( ) ) ,
362
371
info : c. info . as_deref ( ) . map ( Into :: into) ,
363
372
} ,
@@ -366,7 +375,10 @@ impl From<RumaMessageType> for MessageType {
366
375
content : FileMessageContent {
367
376
body : c. body . clone ( ) ,
368
377
formatted : c. formatted . as_ref ( ) . map ( Into :: into) ,
369
- filename : c. filename . clone ( ) ,
378
+ raw_filename : c. filename . clone ( ) ,
379
+ filename : c. filename ( ) . to_owned ( ) ,
380
+ caption : c. caption ( ) . map ( ToString :: to_string) ,
381
+ formatted_caption : c. formatted_caption ( ) . map ( Into :: into) ,
370
382
source : Arc :: new ( c. source . clone ( ) ) ,
371
383
info : c. info . as_deref ( ) . map ( Into :: into) ,
372
384
} ,
@@ -440,18 +452,38 @@ pub struct EmoteMessageContent {
440
452
441
453
#[ derive( Clone , uniffi:: Record ) ]
442
454
pub struct ImageMessageContent {
455
+ /// The original body field, deserialized from the event. Prefer the use of
456
+ /// `filename` and `caption` over this.
443
457
pub body : String ,
458
+ /// The original formatted body field, deserialized from the event. Prefer
459
+ /// the use of `filename` and `formatted_caption` over this.
444
460
pub formatted : Option < FormattedBody > ,
445
- pub filename : Option < String > ,
461
+ /// The original filename field, deserialized from the event. Prefer the use
462
+ /// of `filename` over this.
463
+ pub raw_filename : Option < String > ,
464
+ /// The computed filename, for use in a client.
465
+ pub filename : String ,
466
+ pub caption : Option < String > ,
467
+ pub formatted_caption : Option < FormattedBody > ,
446
468
pub source : Arc < MediaSource > ,
447
469
pub info : Option < ImageInfo > ,
448
470
}
449
471
450
472
#[ derive( Clone , uniffi:: Record ) ]
451
473
pub struct AudioMessageContent {
474
+ /// The original body field, deserialized from the event. Prefer the use of
475
+ /// `filename` and `caption` over this.
452
476
pub body : String ,
477
+ /// The original formatted body field, deserialized from the event. Prefer
478
+ /// the use of `filename` and `formatted_caption` over this.
453
479
pub formatted : Option < FormattedBody > ,
454
- pub filename : Option < String > ,
480
+ /// The original filename field, deserialized from the event. Prefer the use
481
+ /// of `filename` over this.
482
+ pub raw_filename : Option < String > ,
483
+ /// The computed filename, for use in a client.
484
+ pub filename : String ,
485
+ pub caption : Option < String > ,
486
+ pub formatted_caption : Option < FormattedBody > ,
455
487
pub source : Arc < MediaSource > ,
456
488
pub info : Option < AudioInfo > ,
457
489
pub audio : Option < UnstableAudioDetailsContent > ,
@@ -460,18 +492,38 @@ pub struct AudioMessageContent {
460
492
461
493
#[ derive( Clone , uniffi:: Record ) ]
462
494
pub struct VideoMessageContent {
495
+ /// The original body field, deserialized from the event. Prefer the use of
496
+ /// `filename` and `caption` over this.
463
497
pub body : String ,
498
+ /// The original formatted body field, deserialized from the event. Prefer
499
+ /// the use of `filename` and `formatted_caption` over this.
464
500
pub formatted : Option < FormattedBody > ,
465
- pub filename : Option < String > ,
501
+ /// The original filename field, deserialized from the event. Prefer the use
502
+ /// of `filename` over this.
503
+ pub raw_filename : Option < String > ,
504
+ /// The computed filename, for use in a client.
505
+ pub filename : String ,
506
+ pub caption : Option < String > ,
507
+ pub formatted_caption : Option < FormattedBody > ,
466
508
pub source : Arc < MediaSource > ,
467
509
pub info : Option < VideoInfo > ,
468
510
}
469
511
470
512
#[ derive( Clone , uniffi:: Record ) ]
471
513
pub struct FileMessageContent {
514
+ /// The original body field, deserialized from the event. Prefer the use of
515
+ /// `filename` and `caption` over this.
472
516
pub body : String ,
517
+ /// The original formatted body field, deserialized from the event. Prefer
518
+ /// the use of `filename` and `formatted_caption` over this.
473
519
pub formatted : Option < FormattedBody > ,
474
- pub filename : Option < String > ,
520
+ /// The original filename field, deserialized from the event. Prefer the use
521
+ /// of `filename` over this.
522
+ pub raw_filename : Option < String > ,
523
+ /// The computed filename, for use in a client.
524
+ pub filename : String ,
525
+ pub caption : Option < String > ,
526
+ pub formatted_caption : Option < FormattedBody > ,
475
527
pub source : Arc < MediaSource > ,
476
528
pub info : Option < FileInfo > ,
477
529
}
0 commit comments