Merge this trash pls #1

Merged
Thelie merged 5 commits from trash into master 2021-05-05 22:20:17 +02:00
2 changed files with 20 additions and 3 deletions
Showing only changes of commit 2e0c95ab57 - Show all commits

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

View file

@ -22,6 +22,9 @@ use std::{
io::Read,
net::TcpStream,
collections::VecDeque,
thread,
time,
sync::mpsc::channel,
};
use irc_proto::command::{
CapSubCommand,
@ -175,13 +178,23 @@ fn main() {
}
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() {
println!("Sending: {}", message.clone().to_string());
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 {
let message = match stream.read() {
Ok(m) => m,
@ -210,6 +223,10 @@ fn main() {
),
_ => println!("{}", message.clone().to_string())
}
match rx.try_recv() {
Ok(m) => stream.write(m).unwrap(),
Err(_e) => ()
}
}
}