Updated irc-stream and appearantly changed this crate, too.

This commit is contained in:
Thelie 2021-05-05 20:31:49 +02:00
parent 3e3821d835
commit 2e0c95ab57
2 changed files with 20 additions and 3 deletions

@ -1 +1 @@
Subproject commit bf53e62f1713dfe83198f75992cc0e889de398ff Subproject commit 455c49dbb237b98c89692b46869ecb22cca8d0f5

View file

@ -22,6 +22,9 @@ use std::{
io::Read, io::Read,
net::TcpStream, net::TcpStream,
collections::VecDeque, collections::VecDeque,
thread,
time,
sync::mpsc::channel,
}; };
use irc_proto::command::{ use irc_proto::command::{
CapSubCommand, CapSubCommand,
@ -175,13 +178,23 @@ fn main() {
} }
let mut message_queue = get_irc_identify_messages(&config).unwrap(); let mut message_queue = get_irc_identify_messages(&config).unwrap();
message_queue = get_irc_join_messages(&config, message_queue).unwrap();
while let Some(message) = message_queue.pop_front() { while let Some(message) = message_queue.pop_front() {
println!("Sending: {}", message.clone().to_string());
stream.write(message).unwrap(); stream.write(message).unwrap();
} }
message_queue = get_irc_join_messages(&config, message_queue).unwrap();
//TODO remove this botch
let (tx, rx) = channel();
thread::spawn(move|| {
thread::sleep(time::Duration::from_secs(10));
while let Some(message) = message_queue.pop_front() {
println!("Sending: {}", message.clone().to_string());
tx.send(message).unwrap();
}
});
loop { loop {
let message = match stream.read() { let message = match stream.read() {
Ok(m) => m, Ok(m) => m,
@ -210,6 +223,10 @@ fn main() {
), ),
_ => println!("{}", message.clone().to_string()) _ => println!("{}", message.clone().to_string())
} }
match rx.try_recv() {
Ok(m) => stream.write(m).unwrap(),
Err(_e) => ()
}
} }
} }