Update tokio-xmpp, switch to rustls
Some checks failed
moparisthebest/sendxmpp-rs/pipeline/head There was a failure building this commit
Some checks failed
moparisthebest/sendxmpp-rs/pipeline/head There was a failure building this commit
This commit is contained in:
parent
294da89d22
commit
7aff2080df
1208
Cargo.lock
generated
1208
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -25,11 +25,10 @@ serde_derive = "1.0"
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
gumdrop = "0.8.0"
|
gumdrop = "0.8.0"
|
||||||
gumdrop_derive = "0.8.0"
|
gumdrop_derive = "0.8.0"
|
||||||
dirs = "3.0.1"
|
dirs = "4.0.0"
|
||||||
tokio-xmpp = "3.0.0"
|
tokio-xmpp = { version = "3.2.0", default-features = false, features = ["tls-rust"] }
|
||||||
tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "macros", "io-util", "io-std"] }
|
tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "macros", "io-util", "io-std"] }
|
||||||
tokio-tls = { package = "tokio-native-tls", version = "0.3" }
|
xmpp-parsers = "0.19"
|
||||||
xmpp-parsers = "0.18"
|
|
||||||
die = "0.2.0"
|
die = "0.2.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
|
11
src/main.rs
11
src/main.rs
@ -10,14 +10,13 @@ use gumdrop::Options;
|
|||||||
use serde_derive::Deserialize;
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use tokio_xmpp::{xmpp_stream, SimpleClient as Client};
|
use tokio_xmpp::{SimpleClient as Client};
|
||||||
use xmpp_parsers::message::{Body, Message, MessageType};
|
use xmpp_parsers::message::{Body, Message, MessageType};
|
||||||
use xmpp_parsers::muc::Muc;
|
use xmpp_parsers::muc::Muc;
|
||||||
use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceType};
|
use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceType};
|
||||||
use xmpp_parsers::{BareJid, Element, FullJid, Jid};
|
use xmpp_parsers::{BareJid, Element, FullJid, Jid};
|
||||||
|
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
use tokio_tls::TlsStream;
|
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Result};
|
use anyhow::{anyhow, bail, Result};
|
||||||
|
|
||||||
@ -121,19 +120,13 @@ async fn main() {
|
|||||||
|
|
||||||
// can paste this to test: <message xmlns="jabber:client" to="travis@burtrum.org" type="chat"><body>woot</body></message>
|
// can paste this to test: <message xmlns="jabber:client" to="travis@burtrum.org" type="chat"><body>woot</body></message>
|
||||||
|
|
||||||
pub struct OpenClient {
|
let mut open_client = client.into_inner().into_inner();
|
||||||
pub stream: xmpp_stream::XMPPStream<TlsStream<tokio::net::TcpStream>>,
|
|
||||||
}
|
|
||||||
let client: OpenClient = unsafe { std::mem::transmute(client) };
|
|
||||||
let mut open_client = client.stream.stream.try_lock().die("could not lock client stream");
|
|
||||||
let open_client = open_client.get_mut();
|
|
||||||
|
|
||||||
let mut rd_buf = [0u8; 256]; // todo: proper buffer size?
|
let mut rd_buf = [0u8; 256]; // todo: proper buffer size?
|
||||||
let mut stdin_buf = rd_buf.clone();
|
let mut stdin_buf = rd_buf.clone();
|
||||||
|
|
||||||
let mut stdin = tokio::io::stdin();
|
let mut stdin = tokio::io::stdin();
|
||||||
let mut stdout = tokio::io::stdout();
|
let mut stdout = tokio::io::stdout();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
n = open_client.read(&mut rd_buf) => {
|
n = open_client.read(&mut rd_buf) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user