diff --git a/deltachat-jsonrpc/src/api/types/message.rs b/deltachat-jsonrpc/src/api/types/message.rs index 4c1005796..7855ef61a 100644 --- a/deltachat-jsonrpc/src/api/types/message.rs +++ b/deltachat-jsonrpc/src/api/types/message.rs @@ -48,6 +48,9 @@ pub struct MessageObject { has_location: bool, has_html: bool, view_type: MessageViewtype, + /// If message is a Pre-Message, + /// then this returns the viewtype it will have when it is downloaded. + post_message_view_type: Option, state: u32, /// An error text, if there is one. @@ -212,6 +215,7 @@ impl MessageObject { has_location: message.has_location(), has_html: message.has_html(), view_type: message.get_viewtype().into(), + post_message_view_type: message.get_post_message_viewtype().map(Into::into), state: message .get_state() .to_u32() @@ -683,6 +687,9 @@ pub struct MessageInfo { rfc724_mid: String, server_urls: Vec, hop_info: String, + /// If message is a Pre-Message, + /// then this returns the viewtype it will have when it is downloaded. + post_message_view_type: Option, } impl MessageInfo { @@ -706,6 +713,7 @@ impl MessageInfo { rfc724_mid: message.rfc724_mid().to_owned(), server_urls, hop_info, + post_message_view_type: message.get_post_message_viewtype().map(Into::into), }) } } diff --git a/src/message.rs b/src/message.rs index 8646598d6..ec6a0ad71 100644 --- a/src/message.rs +++ b/src/message.rs @@ -861,8 +861,7 @@ impl Message { /// If message is a Pre-Message, /// then this returns the viewtype it will have when it is downloaded. - #[cfg(test)] - pub(crate) fn get_post_message_viewtype(&self) -> Option { + pub fn get_post_message_viewtype(&self) -> Option { if self.download_state != DownloadState::Done { if let Some(viewtype) = self .param