From d80ef3bb7906a3adef8a3318a0051e6ebb742284 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 2 Jan 2020 20:50:06 +0100 Subject: Remove feature to print content as well When _list_ing a list of mails, we should not show the content at all. Signed-off-by: Matthias Beyer --- bin/domain/imag-mail/src/lib.rs | 47 ++++++++--------------------------------- bin/domain/imag-mail/src/ui.rs | 8 ------- 2 files changed, 9 insertions(+), 46 deletions(-) (limited to 'bin') diff --git a/bin/domain/imag-mail/src/lib.rs b/bin/domain/imag-mail/src/lib.rs index 0dd7f2bb..eb0f68b6 100644 --- a/bin/domain/imag-mail/src/lib.rs +++ b/bin/domain/imag-mail/src/lib.rs @@ -143,17 +143,6 @@ fn import_mail(rt: &Runtime) -> Result<()> { fn list(rt: &Runtime) -> Result<()> { let refconfig = get_ref_config(rt, "imag-mail")?; let scmd = rt.cli().subcommand_matches("list").unwrap(); // safe via clap - let print_content = scmd.is_present("list-read"); - - if print_content { - // TODO: Check whether workaround with "{}" is still necessary when updating "indoc" - warn!("{}", indoc!(r#"You requested to print the content of the mail as well. - We use the 'mailparse' crate underneath, but its implementation is nonoptimal. - Thus, the content might be printed as empty (no text in the email) - This is not reliable and might be wrong."#)); - - // TODO: Fix above. - } // TODO: Implement lister type in libimagmail for this // @@ -161,8 +150,7 @@ fn list(rt: &Runtime) -> Result<()> { // way we do not call get_ref_config() multiple times. fn list_mail<'a>(rt: &Runtime, refconfig: &::libimagentryref::reference::Config, - m: &FileLockEntry<'a>, - print_content: bool) -> Result<()> { + m: &FileLockEntry<'a>) -> Result<()> { let id = match m.get_message_id(&refconfig)? { Some(f) => f.into(), @@ -184,30 +172,13 @@ fn list(rt: &Runtime) -> Result<()> { None => "".to_owned(), }; - if print_content { - use libimagmail::hasher::MailHasher; - - let content = m.as_ref_with_hasher::() - .get_path(&refconfig) - .and_then(util::get_mail_text_content)?; - - writeln!(rt.stdout(), - "Mail: {id}\nFrom: {from}\nTo: {to}\n{subj}\n---\n{content}\n---\n", - from = from, - id = id, - subj = subject, - to = to, - content = content - )?; - } else { - writeln!(rt.stdout(), - "Mail: {id}\nFrom: {from}\nTo: {to}\n{subj}\n", - from = from, - id = id, - subj = subject, - to = to - )?; - } + writeln!(rt.stdout(), + "Mail: {id}\nFrom: {from}\nTo: {to}\n{subj}\n", + from = from, + id = id, + subj = subject, + to = to + )?; rt.report_touched(m.get_location())?; Ok(()) @@ -229,7 +200,7 @@ fn list(rt: &Runtime) -> Result<()> { .inspect(|id| debug!("Found: {:?}", id)) .into_get_iter(rt.store()) .map_inner_ok_or_else(|| err_msg("Did not find one entry")) - .and_then_ok(|m| list_mail(&rt, &refconfig, &m, print_content)) + .and_then_ok(|m| list_mail(&rt, &refconfig, &m)) .collect::>>() .map(|_| ()) } diff --git a/bin/domain/imag-mail/src/ui.rs b/bin/domain/imag-mail/src/ui.rs index e1fa88e6..c51ecdb6 100644 --- a/bin/domain/imag-mail/src/ui.rs +++ b/bin/domain/imag-mail/src/ui.rs @@ -51,14 +51,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .about("List all stored references to mails") .version("0.1") - .arg(Arg::with_name("list-read") - .long("read") - .short("r") - .takes_value(false) - .required(false) - .multiple(false) - .help("Print the textual content of the mail itself as well")) - .arg(Arg::with_name("list-id") .index(1) .takes_value(true) -- cgit v1.2.3