diff options
| author | 2025-03-26 15:57:24 +0000 | |
|---|---|---|
| committer | 2025-03-26 15:57:24 +0000 | |
| commit | 521a8915f273dc2cda59080a2393e40e4f25db50 (patch) | |
| tree | 5fd01f240084566bb8d32261819f7ab14022346e /lampada/src | |
| parent | 4d1be876f8bccf8018728d5ee474f91c256da5c9 (diff) | |
| download | luz-521a8915f273dc2cda59080a2393e40e4f25db50.tar.gz luz-521a8915f273dc2cda59080a2393e40e4f25db50.tar.bz2 luz-521a8915f273dc2cda59080a2393e40e4f25db50.zip | |
feat(filamento): create example
Diffstat (limited to '')
| -rw-r--r-- | lampada/src/main.rs | 42 | 
1 files changed, 0 insertions, 42 deletions
| diff --git a/lampada/src/main.rs b/lampada/src/main.rs deleted file mode 100644 index 7b7469d..0000000 --- a/lampada/src/main.rs +++ /dev/null @@ -1,42 +0,0 @@ -use std::{path::Path, str::FromStr, time::Duration}; - -use jid::JID; -use lampada::{db::Db, CoreClientCommand, LuzHandle}; -use sqlx::SqlitePool; -use tokio::{ -    io::{AsyncReadExt, AsyncWriteExt}, -    sync::oneshot, -}; -use tracing::info; - -#[tokio::main] -async fn main() { -    tracing_subscriber::fmt::init(); -    let db = Db::create_connect_and_migrate(Path::new("./luz.db")) -        .await -        .unwrap(); -    let (luz, mut recv) = -        LuzHandle::new("test@blos.sm".try_into().unwrap(), "slayed".to_string(), db); - -    tokio::spawn(async move { -        while let Some(msg) = recv.recv().await { -            info!("{:#?}", msg) -        } -    }); - -    luz.send(CoreClientCommand::Connect).await.unwrap(); -    let (send, recv) = oneshot::channel(); -    tokio::time::sleep(Duration::from_secs(5)).await; -    info!("sending message"); -    luz.send(CoreClientCommand::SendMessage( -        JID::from_str("cel@blos.sm").unwrap(), -        luz::chat::Body { -            body: "hallo!!!".to_string(), -        }, -        send, -    )) -    .await -    .unwrap(); -    recv.await.unwrap().unwrap(); -    println!("sent message"); -} | 
