Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
9772749076 | |||
b80c1adc33 | |||
097bd9b965 | |||
3d6a006f19 |
4 changed files with 16 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mention_2_mail"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
authors = ["Thelie <git.daniel@mowitz.rocks>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -8,7 +8,7 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
irc-proto = "0.15"
|
||||
irc_stream = { path = "irc-stream", version = "0.1" }
|
||||
irc_stream = { path = "irc-stream", version = "0.2" }
|
||||
lettre = "0.9"
|
||||
lettre_email = "0.9"
|
||||
native-tls = "0.2"
|
||||
|
|
|
@ -66,6 +66,13 @@ fn parse_server_dir(mut config: Value, server_config_path: PathBuf)
|
|||
config = merge_config_maps(config, client_config)?;
|
||||
},
|
||||
"channels.toml" => {
|
||||
let channels = Value::from(parse_toml_to_table(entry.path())?);
|
||||
if config.contains_key(&"channels".to_owned()) {
|
||||
config[&"channels".to_owned()] = channels;
|
||||
} else {
|
||||
config.insert("channels".to_owned(), channels);
|
||||
}
|
||||
|
||||
let channel_config = parse_toml_to_table(entry.path())?;
|
||||
config = merge_config_maps(config, channel_config)?;
|
||||
},
|
||||
|
|
|
@ -27,15 +27,16 @@ use std::{
|
|||
thread,
|
||||
};
|
||||
use lettre::{
|
||||
Transport,
|
||||
SmtpClient,
|
||||
smtp::authentication::{
|
||||
Credentials,
|
||||
Mechanism,
|
||||
},
|
||||
Transport,
|
||||
};
|
||||
use lettre_email::EmailBuilder;
|
||||
|
||||
|
||||
fn main() {
|
||||
let mut server_conf_flag = false;
|
||||
let mut config_path = None;
|
||||
|
@ -75,11 +76,13 @@ fn main() {
|
|||
|
||||
// TODO: This line has many problems…
|
||||
let (tx,rx): (std::sync::mpsc::Sender<(String, String, String, Vec<Option<[String; 2]>>)>, std::sync::mpsc::Receiver<(String, String, String, Vec<Option<[String; 2]>>)>)= channel();
|
||||
|
||||
let mut server_threads = vec![];
|
||||
|
||||
for s_conf in server_configs {
|
||||
let t = tx.clone();
|
||||
let addr = s_conf.get("server").unwrap().as_str()
|
||||
|
||||
let addr = s_conf.get("server").unwrap().as_str()
|
||||
.ok_or("Could not get server adress from config").unwrap();
|
||||
server_threads.push(thread::Builder::new()
|
||||
.name(addr.to_string())
|
||||
|
|
|
@ -269,7 +269,7 @@ pub fn handle_server
|
|||
// Handle all incoming messages after joining the channels.
|
||||
loop {
|
||||
let message = stream.read()?;
|
||||
let (answer, data) = handle_message(
|
||||
let (answer, data) = handle_message(
|
||||
message,
|
||||
&nick,
|
||||
clients.keys(),
|
||||
|
@ -281,7 +281,7 @@ pub fn handle_server
|
|||
None => ()
|
||||
}
|
||||
match data {
|
||||
Some((client, channel, context)) => match clients.get(&client) {
|
||||
Some((client, channel, context)) => match clients.get(&client) {
|
||||
Some(addr) => {
|
||||
let out = (
|
||||
addr.as_str()
|
||||
|
|
Loading…
Reference in a new issue