1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
//! Simple SMTP-to-Telegram gateway. Can parse email and send them as telegram
//! messages to specified chats, generally you specify which email address is
//! available in configuration, everything else is sent to default address.
mod mail;
mod telegram;
mod utils;
#[cfg(test)]
mod tests;
use crate::mail::MailServer;
use smol::{
fs::metadata,
};
use just_getopt::{
OptFlags,
OptSpecs,
OptValue,
};
use stacked_errors::{
Result,
StackableErr,
bail,
};
use std::{
io::Cursor,
os::unix::fs::PermissionsExt,
path::Path,
};
#[tokio::main(flavor = "current_thread")]
async fn main () -> Result<()> {
let specs = OptSpecs::new()
.option("help", "h", OptValue::None)
.option("help", "help", OptValue::None)
.option("config", "c", OptValue::Required)
.option("config", "config", OptValue::Required)
.flag(OptFlags::OptionsEverywhere);
let mut args = std::env::args();
|
|
<
<
>
>
>
>
>
>
>
|
>
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
//! Simple SMTP-to-Telegram gateway. Can parse email and send them as telegram
//! messages to specified chats, generally you specify which email address is
//! available in configuration, everything else is sent to default address.
mod mail;
mod telegram;
mod utils;
#[cfg(test)]
mod tests;
use crate::mail::MailServer;
use async_compat::Compat;
use just_getopt::{
OptFlags,
OptSpecs,
OptValue,
};
use smol::{
fs::metadata,
};
use stacked_errors::{
Result,
StackableErr,
bail,
};
use std::{
io::Cursor,
os::unix::fs::PermissionsExt,
path::Path,
};
fn main () -> Result<()> {
smol::block_on(Compat::new(async {
async_main().await.unwrap()
}));
Ok(())
}
async fn async_main () -> Result<()> {
let specs = OptSpecs::new()
.option("help", "h", OptValue::None)
.option("help", "help", OptValue::None)
.option("config", "c", OptValue::Required)
.option("config", "config", OptValue::Required)
.flag(OptFlags::OptionsEverywhere);
let mut args = std::env::args();
|