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:
B. Petersen
2019-12-11 02:44:16 +01:00
committed by holger krekel
parent 7c3d8356c4
commit d681fa6cba
8 changed files with 52 additions and 54 deletions

View File

@@ -15,7 +15,7 @@ use crate::events::Event;
use crate::key::*;
use crate::login_param::LoginParam;
use crate::message::{MessageState, MsgId};
use crate::mimeparser::ImageAction;
use crate::mimeparser::AvatarAction;
use crate::param::*;
use crate::peerstate::*;
use crate::sql;
@@ -966,21 +966,21 @@ fn set_block_contact(context: &Context, contact_id: u32, new_blocking: bool) {
pub fn set_profile_image(
context: &Context,
contact_id: u32,
profile_image: ImageAction,
profile_image: AvatarAction,
) -> Result<()> {
// the given profile image is expected to be already in the blob directory
// as profile images can be set only by receiving messages, this should be always the case, however.
let mut contact = Contact::load_from_db(context, contact_id)?;
let changed = match profile_image {
ImageAction::Change(profile_image) => {
AvatarAction::Change(profile_image) => {
contact.param.set(Param::ProfileImage, profile_image);
true
}
ImageAction::Delete => {
AvatarAction::Delete => {
contact.param.remove(Param::ProfileImage);
true
}
ImageAction::None => false,
AvatarAction::None => false,
};
if changed {
contact.update_param(context)?;