Creates a new blob and sets it as a file associated with a message. In order to deduplicate files that contain the same data, the file will be named ` . `, e.g. `ce940175885d7b78f7b7e9f1396611f.jpg`. NOTE: The file must not be modified after this function was called.
(
&mut self,
context: &Context,
name: &str,
data: &[u8],
filemime: Option<&str>,
)
| 1146 | /// |
| 1147 | /// NOTE: The file must not be modified after this function was called. |
| 1148 | pub fn set_file_from_bytes( |
| 1149 | &mut self, |
| 1150 | context: &Context, |
| 1151 | name: &str, |
| 1152 | data: &[u8], |
| 1153 | filemime: Option<&str>, |
| 1154 | ) -> Result<()> { |
| 1155 | let blob = BlobObject::create_and_deduplicate_from_bytes(context, data, name)?; |
| 1156 | self.param.set(Param::Filename, name); |
| 1157 | self.param.set(Param::File, blob.as_name()); |
| 1158 | self.param.set_optional(Param::MimeType, filemime); |
| 1159 | |
| 1160 | Ok(()) |
| 1161 | } |
| 1162 | |
| 1163 | /// Makes message a vCard-containing message using the specified contacts. |
| 1164 | pub async fn make_vcard(&mut self, context: &Context, contacts: &[ContactId]) -> Result<()> { |