diff options
| author | 2025-02-20 21:08:16 +0000 | |
|---|---|---|
| committer | 2025-02-20 21:08:16 +0000 | |
| commit | 2e6ad369c51fa7e60df8c7deaa59ec7705c3ff98 (patch) | |
| tree | d6191b02372f66c918954acaa570736e544c0193 /luz/src/main.rs | |
| parent | c0d2aae0385aee7f1bb2ecb330e72e40b8fde6a2 (diff) | |
| download | luz-2e6ad369c51fa7e60df8c7deaa59ec7705c3ff98.tar.gz luz-2e6ad369c51fa7e60df8c7deaa59ec7705c3ff98.tar.bz2 luz-2e6ad369c51fa7e60df8c7deaa59ec7705c3ff98.zip | |
implement CLIENT
Diffstat (limited to 'luz/src/main.rs')
| -rw-r--r-- | luz/src/main.rs | 26 | 
1 files changed, 22 insertions, 4 deletions
| diff --git a/luz/src/main.rs b/luz/src/main.rs index 5e9cd13..9779351 100644 --- a/luz/src/main.rs +++ b/luz/src/main.rs @@ -1,8 +1,13 @@ -use std::time::Duration; +use std::{str::FromStr, time::Duration}; +use jid::JID;  use luz::{CommandMessage, LuzHandle};  use sqlx::SqlitePool; -use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use tokio::{ +    io::{AsyncReadExt, AsyncWriteExt}, +    sync::oneshot, +}; +use tracing::info;  #[tokio::main]  async fn main() { @@ -13,10 +18,23 @@ async fn main() {      tokio::spawn(async move {          while let Some(msg) = recv.recv().await { -            println!("{:#?}", msg) +            info!("{:#?}", msg)          }      });      luz.send(CommandMessage::Connect).await.unwrap(); -    tokio::time::sleep(Duration::from_secs(15)).await; +    let (send, recv) = oneshot::channel(); +    tokio::time::sleep(Duration::from_secs(5)).await; +    info!("sending message"); +    luz.send(CommandMessage::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");  } | 
