From 5f7279eb85e5b6b2c36c133571505e32f8efdc31 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 12 Oct 2019 02:09:28 +0300 Subject: [PATCH] auto_mozilla: server is only configured if the type matches This fixes the testcase introduced in previous commit --- src/configure/auto_mozilla.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/configure/auto_mozilla.rs b/src/configure/auto_mozilla.rs index 87920c1c2..56943333f 100644 --- a/src/configure/auto_mozilla.rs +++ b/src/configure/auto_mozilla.rs @@ -22,6 +22,7 @@ struct MozAutoconfigure<'a> { pub tag_config: MozConfigTag, } +#[derive(PartialEq)] enum MozServer { Undefined, Imap, @@ -172,13 +173,17 @@ fn moz_autoconfigure_endtag_cb(event: &BytesEnd, moz_ac: &mut MozAutoconfigure) let tag = String::from_utf8_lossy(event.name()).trim().to_lowercase(); if tag == "incomingserver" { + if moz_ac.tag_server == MozServer::Imap { + moz_ac.out_imap_set = true; + } moz_ac.tag_server = MozServer::Undefined; moz_ac.tag_config = MozConfigTag::Undefined; - moz_ac.out_imap_set = true; } else if tag == "outgoingserver" { + if moz_ac.tag_server == MozServer::Smtp { + moz_ac.out_smtp_set = true; + } moz_ac.tag_server = MozServer::Undefined; moz_ac.tag_config = MozConfigTag::Undefined; - moz_ac.out_smtp_set = true; } else { moz_ac.tag_config = MozConfigTag::Undefined; }