diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-28 19:34:40 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-09-15 13:21:13 +0300 |
commit | 0812242f60a96b2093307b3f125dfc4f42a64f2d (patch) | |
tree | 38c6e8934dc3f72b46b65d22efafb045d2768437 /testing | |
parent | 3f7d962abd4c63afdc10fdba2e8f66ca839de993 (diff) |
Add IMAP backend
TODOs: new message events (untagged responses)
Diffstat (limited to 'testing')
-rw-r--r-- | testing/Cargo.toml | 4 | ||||
-rw-r--r-- | testing/src/imap_conn.rs | 35 |
2 files changed, 39 insertions, 0 deletions
diff --git a/testing/Cargo.toml b/testing/Cargo.toml index 6880f205..22ba9a59 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -12,6 +12,10 @@ path = "src/email_parse.rs" name = "linebreak" path = "src/linebreak.rs" +[[bin]] +name = "imapconn" +path = "src/imap_conn.rs" + [dependencies] melib = { path = "../melib", version = "*" } diff --git a/testing/src/imap_conn.rs b/testing/src/imap_conn.rs new file mode 100644 index 00000000..af700c0e --- /dev/null +++ b/testing/src/imap_conn.rs @@ -0,0 +1,35 @@ +extern crate melib; +use melib::*; +use std::collections::HashMap; + +use melib::backends::ImapType; +use melib::AccountSettings; +use melib::Result; + +fn main() -> Result<()> { + let mut args = std::env::args().skip(1).collect::<Vec<String>>(); + if args.len() != 3 { + eprintln!("Usage: imap_conn server_hostname server_username server_password"); + std::process::exit(1); + } + + let (a, b, c) = ( + std::mem::replace(&mut args[0], String::new()), + std::mem::replace(&mut args[1], String::new()), + std::mem::replace(&mut args[2], String::new()), + ); + let set = AccountSettings { + extra: [ + ("server_hostname".to_string(), a), + ("server_username".to_string(), b), + ("server_password".to_string(), c), + ] + .iter() + .cloned() + .collect(), + ..Default::default() + }; + let mut imap = ImapType::new(&set); + imap.shell(); + Ok(()) +} |