@@ -716,10 +716,8 @@ impl From<deltachat::ephemeral::Timer> for EphemeralTimer {
716
716
#[ derive( Deserialize , TypeDef , schemars:: JsonSchema ) ]
717
717
#[ serde( rename_all = "camelCase" ) ]
718
718
pub struct LateFilingMediaSize {
719
- // The new width to store in the message object. None if you don't want to change the width.
720
- pub width : Option < u32 > ,
721
- // The new height to store in the message object. None if you don't want to change the height.
722
- pub height : Option < u32 > ,
719
+ // The new width and height to store in the message object. None if you don't want to change the dimensions.
720
+ pub wh : Option < ( u32 , u32 ) > ,
723
721
// The new duration to store in the message object. None if you don't want to change it.
724
722
pub duration : Option < u32 > ,
725
723
}
@@ -731,22 +729,20 @@ impl LateFilingMediaSize {
731
729
message_id : MsgId ,
732
730
) -> anyhow:: Result < ( ) > {
733
731
let mut message = deltachat:: message:: Message :: load_from_db ( context, message_id) . await ?;
732
+ let ( width, height) = match self . wh {
733
+ Some ( ( w, h) ) => (
734
+ w. to_i32 ( ) . context ( "conversion to i32 failed" ) ?,
735
+ h. to_i32 ( ) . context ( "conversion to i32 failed" ) ?,
736
+ ) ,
737
+ None => ( 0 , 0 ) ,
738
+ } ;
739
+ let duration = self
740
+ . duration
741
+ . unwrap_or ( 0 )
742
+ . to_i32 ( )
743
+ . context ( "conversion to i32 failed" ) ?;
734
744
message
735
- . latefiling_mediasize (
736
- context,
737
- self . width
738
- . unwrap_or ( 0 )
739
- . to_i32 ( )
740
- . context ( "conversion to i32 failed" ) ?,
741
- self . height
742
- . unwrap_or ( 0 )
743
- . to_i32 ( )
744
- . context ( "conversion to i32 failed" ) ?,
745
- self . duration
746
- . unwrap_or ( 0 )
747
- . to_i32 ( )
748
- . context ( "conversion to i32 failed" ) ?,
749
- )
745
+ . latefiling_mediasize ( context, width, height, duration)
750
746
. await ?;
751
747
Ok ( ( ) )
752
748
}
0 commit comments