mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Fix avatar retrieval.
This commit is contained in:
parent
c17d43b685
commit
cbce8a5e7f
1 changed files with 5 additions and 2 deletions
|
@ -40,9 +40,12 @@ pub(crate) fn handle_metadata_pubsub_event(from: &Jid, tx: &mut mpsc::UnboundedS
|
|||
let metadata = Metadata::try_from(payload).unwrap();
|
||||
for info in metadata.infos {
|
||||
let filename = format!("data/{}/{}", from, hash_to_hex(&*info.id));
|
||||
let metadata = fs::metadata(filename.clone()).unwrap();
|
||||
let file_length = match fs::metadata(filename.clone()) {
|
||||
Ok(metadata) => metadata.len(),
|
||||
Err(_) => 0,
|
||||
};
|
||||
// TODO: Also check the hash.
|
||||
if info.bytes as u64 == metadata.len() {
|
||||
if info.bytes as u64 == file_length {
|
||||
events.push(Event::AvatarRetrieved(from.clone(), filename));
|
||||
} else {
|
||||
let iq = download_avatar(from);
|
||||
|
|
Loading…
Reference in a new issue