diff --git a/src/chat.rs b/src/chat.rs index d9405154b..a46115723 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -314,6 +314,7 @@ impl Chat { || self.typ == Chattype::VerifiedGroup && self.param.get_int(Param::Unpromoted).unwrap_or_default() == 1 { + msg.param.set_int(Param::AttachGroupImage, 1); self.param.remove(Param::Unpromoted); self.update_param(context)?; } diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 8f06e73e4..c7b615a15 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -332,6 +332,15 @@ impl<'a, 'b> MimeFactory<'a, 'b> { _ => {} } + if self + .msg + .param + .get_bool(Param::AttachGroupImage) + .unwrap_or_default() + { + return chat.param.get(Param::ProfileImage).map(Into::into); + } + None } Loaded::MDN => None, diff --git a/src/param.rs b/src/param.rs index 3276f2afe..399a7d152 100644 --- a/src/param.rs +++ b/src/param.rs @@ -48,6 +48,10 @@ pub enum Param { Arg4 = b'H', /// For Messages Error = b'L', + + /// For Messages + AttachGroupImage = b'A', + /// For Messages: space-separated list of messaged IDs of forwarded copies. /// /// This is used when a [crate::message::Message] is in the @@ -192,6 +196,11 @@ impl Params { self.get(key).and_then(|s| s.parse().ok()) } + /// Get the given parameter and parse as `bool`. + pub fn get_bool(&self, key: Param) -> Option { + self.get_int(key).map(|v| v != 0) + } + /// Get the parameter behind `Param::Cmd` interpreted as `SystemMessage`. pub fn get_cmd(&self) -> SystemMessage { self.get_int(Param::Cmd)