Compare commits

..

3 commits

5 changed files with 24 additions and 7 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "irc-stream"]
path = irc-stream
url = ssh://git@chaostreff-alzey.de:222/Thelie/irc-stream.git

10
Cargo.lock generated
View file

@ -287,6 +287,14 @@ dependencies = [
"tokio-util",
]
[[package]]
name = "irc_stream"
version = "0.1.0"
dependencies = [
"futures",
"irc-proto",
]
[[package]]
name = "itoa"
version = "0.4.7"
@ -342,8 +350,8 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
name = "mention_2_mail"
version = "0.1.0"
dependencies = [
"futures",
"irc-proto",
"irc_stream",
"lettre",
"native-tls",
"toml",

View file

@ -8,6 +8,8 @@ edition = "2018"
[dependencies]
irc-proto = "0.15"
irc_stream = { path = "irc-stream", version = "0.1" }
lettre = "0.9"
toml = "0.5"
native-tls = "0.2"
toml = "0.5"

1
irc-stream Submodule

@ -0,0 +1 @@
Subproject commit fea845a5335691b8e75b3981f93ae59335043eb1

View file

@ -23,6 +23,7 @@ use std::{
net::TcpStream,
};
use irc_proto;
use irc_stream::{IrcStream, IrcRead, IrcWrite};
use toml::Value;
use native_tls::{TlsConnector,TlsStream};
@ -86,16 +87,18 @@ fn main() {
// Weird workaround for multitrait dyn pointer
// https://github.com/rust-lang/rfcs/issues/2035
// would be a charm...
trait ReadWrite: Read + Write {}
impl<T: Read + Write> ReadWrite for T {}
let mut stream: &dyn ReadWrite;
trait IrcReadWrite: IrcRead + IrcWrite {}
impl<T: IrcRead + IrcWrite> IrcReadWrite for T {}
let mut stream: &dyn IrcReadWrite;
if config["tls"].as_bool().unwrap() == true {
stream = &connect_irc_tls(&config).unwrap();
stream = &IrcStream::new(connect_irc_tls(&config).unwrap());
} else {
stream = &connect_irc(&config).unwrap();
stream = &IrcStream::new(connect_irc(&config).unwrap());
}
//let irc_stream = IrcStream::new(stream);
// TODO: Identify with irc server
//stream.write(irc_proto.Message{
// tags: None,