mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
use Chat-User-Avatar and Chat-Group-Avatar
we change the name on the wire as the old Chat-Group-Image header could not be used on random mails, it was the marker for a "Changed" message, if we would keep this names, things will fail for exising installations as messages are dropped and a "Group image changed" message is shown instead.
This commit is contained in:
committed by
holger krekel
parent
7c3d8356c4
commit
d681fa6cba
@@ -237,8 +237,8 @@ pub fn dc_receive_imf(
|
||||
);
|
||||
}
|
||||
|
||||
if mime_parser.profile_image != ImageAction::None {
|
||||
match contact::set_profile_image(&context, from_id, mime_parser.profile_image) {
|
||||
if mime_parser.user_avatar != AvatarAction::None {
|
||||
match contact::set_profile_image(&context, from_id, mime_parser.user_avatar) {
|
||||
Ok(()) => {
|
||||
context.call_cb(Event::ChatModified(chat_id));
|
||||
true
|
||||
@@ -898,13 +898,13 @@ fn create_or_lookup_group(
|
||||
|
||||
mime_parser.is_system_message = SystemMessage::GroupNameChanged;
|
||||
} else if let Some(value) = mime_parser.get(HeaderDef::ChatContent).cloned() {
|
||||
if value == "group-avatar-changed" && mime_parser.group_avatar != ImageAction::None
|
||||
if value == "group-avatar-changed" && mime_parser.group_avatar != AvatarAction::None
|
||||
{
|
||||
// this is just an explicit message containing the group-avatar,
|
||||
// apart from that, the group-avatar is send along with various other messages
|
||||
mime_parser.is_system_message = SystemMessage::GroupImageChanged;
|
||||
better_msg = context.stock_system_msg(
|
||||
if mime_parser.group_avatar == ImageAction::Delete {
|
||||
if mime_parser.group_avatar == AvatarAction::Delete {
|
||||
StockMessage::MsgGrpImgDeleted
|
||||
} else {
|
||||
StockMessage::MsgGrpImgChanged
|
||||
@@ -1036,19 +1036,19 @@ fn create_or_lookup_group(
|
||||
}
|
||||
}
|
||||
}
|
||||
if mime_parser.group_avatar != ImageAction::None {
|
||||
if mime_parser.group_avatar != AvatarAction::None {
|
||||
info!(context, "group-avatar change for {}", chat_id);
|
||||
if let Ok(mut chat) = Chat::load_from_db(context, chat_id) {
|
||||
match &mime_parser.group_avatar {
|
||||
ImageAction::Change(profile_image) => {
|
||||
AvatarAction::Change(profile_image) => {
|
||||
chat.param.set(Param::ProfileImage, profile_image);
|
||||
true
|
||||
}
|
||||
ImageAction::Delete => {
|
||||
AvatarAction::Delete => {
|
||||
chat.param.remove(Param::ProfileImage);
|
||||
true
|
||||
}
|
||||
ImageAction::None => false,
|
||||
AvatarAction::None => false,
|
||||
};
|
||||
chat.update_param(context)?;
|
||||
send_EVENT_CHAT_MODIFIED = true;
|
||||
|
||||
Reference in New Issue
Block a user