events: Make extensible events conversion helpers private
This commit is contained in:
		
							parent
							
								
									bda17c3662
								
							
						
					
					
						commit
						be2310294a
					
				@ -165,7 +165,7 @@ impl FileContent {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Create a new `FileContent` with the given media source, file info and filename.
 | 
			
		||||
    pub fn from_room_message_content(
 | 
			
		||||
    pub(crate) fn from_room_message_content(
 | 
			
		||||
        source: MediaSource,
 | 
			
		||||
        filename: Option<String>,
 | 
			
		||||
        mimetype: Option<String>,
 | 
			
		||||
@ -210,7 +210,7 @@ impl FileContentInfo {
 | 
			
		||||
    /// Create a new `FileContentInfo` with the given filename, mimetype and size.
 | 
			
		||||
    ///
 | 
			
		||||
    /// Returns `None` if all parameters are `None`.
 | 
			
		||||
    pub fn from_room_message_content(
 | 
			
		||||
    pub(crate) fn from_room_message_content(
 | 
			
		||||
        filename: Option<String>,
 | 
			
		||||
        mimetype: Option<String>,
 | 
			
		||||
        size: Option<UInt>,
 | 
			
		||||
 | 
			
		||||
@ -203,7 +203,7 @@ impl ThumbnailContent {
 | 
			
		||||
    /// Create a `ThumbnailContent` with the given thumbnail source and info.
 | 
			
		||||
    ///
 | 
			
		||||
    /// Returns `None` if no thumbnail was found.
 | 
			
		||||
    pub fn from_room_message_content(
 | 
			
		||||
    pub(crate) fn from_room_message_content(
 | 
			
		||||
        source: Option<MediaSource>,
 | 
			
		||||
        info: Option<Box<ThumbnailInfo>>,
 | 
			
		||||
    ) -> Option<Self> {
 | 
			
		||||
 | 
			
		||||
@ -177,7 +177,10 @@ impl MessageContent {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Create a new `MessageContent` from the given body and optional formatted body.
 | 
			
		||||
    pub fn from_room_message_content(body: String, formatted: Option<FormattedBody>) -> Self {
 | 
			
		||||
    pub(crate) fn from_room_message_content(
 | 
			
		||||
        body: String,
 | 
			
		||||
        formatted: Option<FormattedBody>,
 | 
			
		||||
    ) -> Self {
 | 
			
		||||
        if let Some(FormattedBody { body: html_body, .. }) =
 | 
			
		||||
            formatted.filter(|formatted| formatted.format == MessageFormat::Html)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
@ -165,7 +165,7 @@ impl ImageInfo {
 | 
			
		||||
 | 
			
		||||
    /// Create an `ImageInfo` from the given file info, image info and thumbnail.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3552")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    fn from_extensible_content(
 | 
			
		||||
        file_info: Option<&FileContentInfo>,
 | 
			
		||||
        image: &ImageContent,
 | 
			
		||||
        thumbnail: &[ThumbnailContent],
 | 
			
		||||
@ -235,7 +235,7 @@ impl ThumbnailInfo {
 | 
			
		||||
    ///
 | 
			
		||||
    /// Returns `None` if `file_info` and `image` are `None`.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3552")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    fn from_extensible_content(
 | 
			
		||||
        file_info: Option<&ThumbnailFileContentInfo>,
 | 
			
		||||
        image: Option<&ImageContent>,
 | 
			
		||||
    ) -> Option<Self> {
 | 
			
		||||
@ -280,7 +280,7 @@ pub struct EncryptedFile {
 | 
			
		||||
#[cfg(feature = "unstable-msc3551")]
 | 
			
		||||
impl EncryptedFile {
 | 
			
		||||
    /// Create an `EncryptedFile` from the given url and encryption info.
 | 
			
		||||
    pub fn from_extensible_content(url: &MxcUri, encryption_info: &EncryptedContent) -> Self {
 | 
			
		||||
    fn from_extensible_content(url: &MxcUri, encryption_info: &EncryptedContent) -> Self {
 | 
			
		||||
        let EncryptedContent { key, iv, hashes, v } = encryption_info.to_owned();
 | 
			
		||||
        Self { url: url.to_owned(), key, iv, hashes, v }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -132,7 +132,7 @@ impl AudioMessageEventContent {
 | 
			
		||||
 | 
			
		||||
    /// Create a new `AudioMessageEventContent` with the given message, file info and audio info.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3246")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    pub(crate) fn from_extensible_content(
 | 
			
		||||
        message: MessageContent,
 | 
			
		||||
        file: FileContent,
 | 
			
		||||
        audio: AudioContent,
 | 
			
		||||
@ -203,7 +203,7 @@ impl AudioInfo {
 | 
			
		||||
    ///
 | 
			
		||||
    /// Returns `None` if the `AudioInfo` would be empty.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3246")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    fn from_extensible_content(
 | 
			
		||||
        file_info: Option<&FileContentInfo>,
 | 
			
		||||
        audio: &AudioContent,
 | 
			
		||||
    ) -> Option<Self> {
 | 
			
		||||
 | 
			
		||||
@ -101,7 +101,7 @@ impl FileMessageEventContent {
 | 
			
		||||
 | 
			
		||||
    /// Create a new `FileMessageEventContent` with the given message and file info.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3551")]
 | 
			
		||||
    pub fn from_extensible_content(message: MessageContent, file: FileContent) -> Self {
 | 
			
		||||
    pub(crate) fn from_extensible_content(message: MessageContent, file: FileContent) -> Self {
 | 
			
		||||
        let body = if let Some(body) = message.find_plain() {
 | 
			
		||||
            body.to_owned()
 | 
			
		||||
        } else {
 | 
			
		||||
 | 
			
		||||
@ -147,7 +147,7 @@ impl ImageMessageEventContent {
 | 
			
		||||
    /// Create a new `ImageMessageEventContent` with the given message, file info, image info,
 | 
			
		||||
    /// thumbnails and captions.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3552")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    pub(crate) fn from_extensible_content(
 | 
			
		||||
        message: MessageContent,
 | 
			
		||||
        file: FileContent,
 | 
			
		||||
        image: Box<ImageContent>,
 | 
			
		||||
 | 
			
		||||
@ -82,7 +82,7 @@ impl LocationMessageEventContent {
 | 
			
		||||
    /// Create a new `LocationMessageEventContent` with the given message, location info, asset and
 | 
			
		||||
    /// timestamp.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3488")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    pub(crate) fn from_extensible_content(
 | 
			
		||||
        message: MessageContent,
 | 
			
		||||
        location: LocationContent,
 | 
			
		||||
        asset: AssetContent,
 | 
			
		||||
 | 
			
		||||
@ -153,7 +153,7 @@ impl VideoMessageEventContent {
 | 
			
		||||
    /// Create a new `VideoMessageEventContent` with the given message, file info, video info,
 | 
			
		||||
    /// thumbnails and captions.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3553")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    pub(crate) fn from_extensible_content(
 | 
			
		||||
        message: MessageContent,
 | 
			
		||||
        file: FileContent,
 | 
			
		||||
        video: Box<VideoContent>,
 | 
			
		||||
@ -240,7 +240,7 @@ impl VideoInfo {
 | 
			
		||||
 | 
			
		||||
    /// Create a `VideoInfo` from the given file info, video info and thumbnail.
 | 
			
		||||
    #[cfg(feature = "unstable-msc3553")]
 | 
			
		||||
    pub fn from_extensible_content(
 | 
			
		||||
    fn from_extensible_content(
 | 
			
		||||
        file_info: Option<&FileContentInfo>,
 | 
			
		||||
        video: &VideoContent,
 | 
			
		||||
        thumbnail: &[ThumbnailContent],
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user