1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
use std::{path::Path, str::FromStr, time::Duration};
use filamento::{Client, db::Db};
use jid::JID;
use tracing::info;
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let db = Db::create_connect_and_migrate(Path::new("./filamento.db"))
.await
.unwrap();
let (client, mut recv) =
Client::new("test@blos.sm".try_into().unwrap(), "slayed".to_string(), db);
tokio::spawn(async move {
while let Some(msg) = recv.recv().await {
info!("{:#?}", msg)
}
});
client.connect().await.unwrap();
tokio::time::sleep(Duration::from_secs(5)).await;
info!("changing nick");
client.change_nick("britney".to_string()).await.unwrap();
info!("sending message");
client
.send_message(
JID::from_str("cel@blos.sm").unwrap(),
filamento::chat::Body {
body: "hallo!!!".to_string(),
},
)
.await
.unwrap();
info!("sent message");
tokio::time::sleep(Duration::from_secs(5)).await;
// info!("sending disco query");
// let info = client.disco_info(None, None).await.unwrap();
// info!("got disco result: {:#?}", info);
// let items = client.disco_items(None, None).await.unwrap();
// info!("got disco result: {:#?}", items);
// let info = client
// .disco_info(Some("blos.sm".parse().unwrap()), None)
// .await
// .unwrap();
// info!("got disco result: {:#?}", info);
// let items = client
// .disco_items(Some("blos.sm".parse().unwrap()), None)
// .await
// .unwrap();
// info!("got disco result: {:#?}", items);
// let info = client
// .disco_info(Some("pubsub.blos.sm".parse().unwrap()), None)
// .await
// .unwrap();
// info!("got disco result: {:#?}", info);
// let items = client
// .disco_items(Some("pubsub.blos.sm".parse().unwrap()), None)
// .await
// .unwrap();
// info!("got disco result: {:#?}", items);
}
|