From 3abe88cd128b249f2038e13dbedcbd8341830126 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 8 Apr 2025 13:21:35 +0100 Subject: fix(filamento): use jpeg for user avatar on avatar:data node --- filamento/examples/example.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'filamento/examples/example.rs') 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( -- cgit