diff options
author | 2025-04-08 13:21:35 +0100 | |
---|---|---|
committer | 2025-04-08 13:21:35 +0100 | |
commit | 3abe88cd128b249f2038e13dbedcbd8341830126 (patch) | |
tree | b1832926b805fe495acbc7180b5ccdaf1dbfc5e1 /filamento/examples | |
parent | e518e899e53c072724254bd714db914cde7db5b2 (diff) | |
download | luz-3abe88cd128b249f2038e13dbedcbd8341830126.tar.gz luz-3abe88cd128b249f2038e13dbedcbd8341830126.tar.bz2 luz-3abe88cd128b249f2038e13dbedcbd8341830126.zip |
fix(filamento): use jpeg for user avatar on avatar:data node
Diffstat (limited to 'filamento/examples')
-rw-r--r-- | filamento/examples/example.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/filamento/examples/example.rs b/filamento/examples/example.rs index d7c03e4..8119743 100644 --- a/filamento/examples/example.rs +++ b/filamento/examples/example.rs @@ -2,10 +2,10 @@ use std::{path::Path, str::FromStr, sync::Arc, time::Duration}; use filamento::{Client, db::Db, files::FileStore}; use jid::JID; -use tokio::io; +use tokio::io::{self, AsyncReadExt}; use tracing::info; -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Files; impl FileStore for Files { @@ -65,6 +65,12 @@ async fn main() { .change_nick(Some("britney".to_string())) .await .unwrap(); + let mut profile_pic = tokio::fs::File::open("files/britney_starbies.jpg") + .await + .unwrap(); + let mut data = Vec::new(); + profile_pic.read_to_end(&mut data).await.unwrap(); + client.change_avatar(Some(data)).await.unwrap(); info!("sending message"); client .send_message( |