Version 0.2.0 #2
1 changed files with 16 additions and 11 deletions
|
@ -23,6 +23,7 @@ use irc_proto::command::{
|
||||||
CapSubCommand,
|
CapSubCommand,
|
||||||
Command,
|
Command,
|
||||||
};
|
};
|
||||||
|
use toml::map::Map;
|
||||||
use irc_proto::message::Message;
|
use irc_proto::message::Message;
|
||||||
use toml::value::Value;
|
use toml::value::Value;
|
||||||
|
|
||||||
|
@ -142,7 +143,8 @@ pub fn handle_server(config: Value, tx: Sender<[String; 4]>)
|
||||||
.ok_or("Could not get server adress from config")?;
|
.ok_or("Could not get server adress from config")?;
|
||||||
let nick = config.get("nickname").unwrap().as_str()
|
let nick = config.get("nickname").unwrap().as_str()
|
||||||
.ok_or("Could not get nickname from config")?.to_owned();
|
.ok_or("Could not get nickname from config")?.to_owned();
|
||||||
|
let clients = config.get("clients").unwrap().as_table()
|
||||||
|
.get_or_insert(&Map::new());
|
||||||
let mut stream = super::connect::connect_irc(&config).unwrap();
|
let mut stream = super::connect::connect_irc(&config).unwrap();
|
||||||
let mut message_queue = get_irc_identify_messages(&config).unwrap();
|
let mut message_queue = get_irc_identify_messages(&config).unwrap();
|
||||||
|
|
||||||
|
@ -178,15 +180,18 @@ pub fn handle_server(config: Value, tx: Sender<[String; 4]>)
|
||||||
None => ()
|
None => ()
|
||||||
}
|
}
|
||||||
match data {
|
match data {
|
||||||
Some(d) => {
|
Some(d) => match clients.get(d[0].clone()) {
|
||||||
|
Some(addr) => {
|
||||||
// There must be a better way to do this…
|
// There must be a better way to do this…
|
||||||
let d = [
|
let out = [
|
||||||
server_name.to_owned(),
|
server_name.to_owned(),
|
||||||
d[0].clone(),
|
d[0].clone(),
|
||||||
d[1].clone(),
|
d[1].clone(),
|
||||||
d[2].clone()
|
d[2].clone(),
|
||||||
];
|
];
|
||||||
tx.send(d)?
|
tx.send(out)?
|
||||||
|
},
|
||||||
|
None => (),
|
||||||
},
|
},
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue