Merge this trash pls #1
2 changed files with 20 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit bf53e62f1713dfe83198f75992cc0e889de398ff
|
Subproject commit 455c49dbb237b98c89692b46869ecb22cca8d0f5
|
21
src/main.rs
21
src/main.rs
|
@ -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) => ()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue