mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 08:56:29 +03:00
add sticker type (#653)
* add sticker type this pr adds the message type 'sticker'. stickers are handled as normal images but tagged with the header `Chat-Content: sticker` it's up to the ui to render these stickers appropriate. * cargo fmt
This commit is contained in:
@@ -189,6 +189,7 @@ impl<'a> MimeParser<'a> {
|
||||
textpart.typ == Viewtype::Text
|
||||
&& (filepart.typ == Viewtype::Image
|
||||
|| filepart.typ == Viewtype::Gif
|
||||
|| filepart.typ == Viewtype::Sticker
|
||||
|| filepart.typ == Viewtype::Audio
|
||||
|| filepart.typ == Viewtype::Voice
|
||||
|| filepart.typ == Viewtype::Video
|
||||
@@ -256,6 +257,14 @@ impl<'a> MimeParser<'a> {
|
||||
part_mut.typ = Viewtype::Voice;
|
||||
}
|
||||
}
|
||||
if self.parts[0].typ == Viewtype::Image {
|
||||
if let Some(content_type) = self.lookup_optional_field("Chat-Content") {
|
||||
if content_type == "sticker".to_string() {
|
||||
let part_mut = &mut self.parts[0];
|
||||
part_mut.typ = Viewtype::Sticker;
|
||||
}
|
||||
}
|
||||
}
|
||||
let part = &self.parts[0];
|
||||
if part.typ == Viewtype::Audio
|
||||
|| part.typ == Viewtype::Voice
|
||||
|
||||
Reference in New Issue
Block a user