feat: Send avatars as large as usual images when possible

- Remove limits on the avatar width and height, having a limit on its weight is sufficient.
- Send avatars as large as usual images in protected chats, Outlook servers can't see avatars there
  anyway (they don't allow headers larger than 32k).
This commit is contained in:
iequidoo
2024-08-07 18:42:22 -03:00
parent b74ff278ce
commit ec7f3ec90f
6 changed files with 97 additions and 68 deletions

View File

@@ -4068,7 +4068,9 @@ pub async fn set_chat_profile_image(
msg.text = stock_str::msg_grp_img_deleted(context, ContactId::SELF).await;
} else {
let mut image_blob = BlobObject::new_from_path(context, Path::new(new_image)).await?;
image_blob.recode_to_avatar_size(context).await?;
image_blob
.recode_to_avatar_size(context, chat.is_protected())
.await?;
chat.param.set(Param::ProfileImage, image_blob.as_name());
msg.param.set(Param::Arg, image_blob.as_name());
msg.text = stock_str::msg_grp_img_changed(context, ContactId::SELF).await;