Compare commits

..

4 commits

Author SHA1 Message Date
9772749076 Update 'Cargo.toml'
Bump version of irc-stream.
2021-06-09 23:39:34 +02:00
b80c1adc33 Bump version 2021-06-09 23:26:06 +02:00
097bd9b965 Merge branch 'garbage' into main
Some improvemenst such as using smtp for mail.
2021-06-09 23:25:18 +02:00
3d6a006f19 Version 0.2.0
The bot can now send emails!

Reviewed-on: http://gitea.chaostreff-alzey.de/Thelie/Mention2Mail/pulls/2
Co-authored-by: Thelie <git.daniel@mowitz.rocks>
Co-committed-by: Thelie <git.daniel@mowitz.rocks>
2021-05-23 22:47:43 +02:00
4 changed files with 16 additions and 6 deletions

View file

@ -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"

View file

@ -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)?;
},

View file

@ -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,10 +76,12 @@ 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()
.ok_or("Could not get server adress from config").unwrap();
server_threads.push(thread::Builder::new()