mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
add profile-icon for device-chat
This commit is contained in:
committed by
holger krekel
parent
4c30bf80ce
commit
231110fb61
BIN
assets/icon-device.png
Normal file
BIN
assets/icon-device.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
15
src/chat.rs
15
src/chat.rs
@@ -592,6 +592,12 @@ pub fn set_blocking(context: &Context, chat_id: u32, new_blocking: Blocked) -> b
|
|||||||
.is_ok()
|
.is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn copy_device_icon_to_blobs(context: &Context) -> Result<String, Error> {
|
||||||
|
let icon = include_bytes!("../assets/icon-device.png");
|
||||||
|
let blob = BlobObject::create(context, "icon-device.png".to_string(), icon)?;
|
||||||
|
Ok(blob.as_name().to_string())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn create_or_lookup_by_contact_id(
|
pub fn create_or_lookup_by_contact_id(
|
||||||
context: &Context,
|
context: &Context,
|
||||||
contact_id: u32,
|
contact_id: u32,
|
||||||
@@ -616,9 +622,12 @@ pub fn create_or_lookup_by_contact_id(
|
|||||||
100,
|
100,
|
||||||
chat_name,
|
chat_name,
|
||||||
match contact_id {
|
match contact_id {
|
||||||
DC_CONTACT_ID_SELF => "K=1", // K = Param::Selftalk
|
DC_CONTACT_ID_SELF => "K=1".to_string(), // K = Param::Selftalk
|
||||||
DC_CONTACT_ID_DEVICE => "D=1", // K = Param::Devicetalk
|
DC_CONTACT_ID_DEVICE => {
|
||||||
_ => ""
|
let icon = copy_device_icon_to_blobs(context)?;
|
||||||
|
format!("D=1\ni={}", icon) // D = Param::Devicetalk, i = Param::ProfileImage
|
||||||
|
},
|
||||||
|
_ => "".to_string()
|
||||||
},
|
},
|
||||||
create_blocked as u8,
|
create_blocked as u8,
|
||||||
contact.get_addr(),
|
contact.get_addr(),
|
||||||
|
|||||||
Reference in New Issue
Block a user