mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
Move read_autoconf_file to its own module
This commit is contained in:
@@ -9,10 +9,10 @@ use crate::constants::*;
|
||||
use crate::context::Context;
|
||||
use crate::login_param::LoginParam;
|
||||
|
||||
use super::read_autoconf_file;
|
||||
use super::read_url::read_url;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
enum Error {
|
||||
pub enum Error {
|
||||
#[fail(display = "XML error at position {}", position)]
|
||||
InvalidXml {
|
||||
position: usize,
|
||||
@@ -24,6 +24,8 @@ enum Error {
|
||||
IncompleteAutoconfig(LoginParam),
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
struct OutlookAutodiscover {
|
||||
pub out: LoginParam,
|
||||
pub out_imap_set: bool,
|
||||
@@ -133,9 +135,9 @@ pub fn outlk_autodiscover(
|
||||
_param_in: &LoginParam,
|
||||
) -> Option<LoginParam> {
|
||||
let mut url = url.to_string();
|
||||
/* Follow up to 10 xml-redirects (http-redirects are followed in read_autoconf_file() */
|
||||
/* Follow up to 10 xml-redirects (http-redirects are followed in read_url() */
|
||||
for _i in 0..10 {
|
||||
if let Some(xml_raw) = read_autoconf_file(context, &url) {
|
||||
if let Ok(xml_raw) = read_url(context, &url) {
|
||||
match parse_xml(&xml_raw) {
|
||||
Err(err) => {
|
||||
warn!(context, "{}", err);
|
||||
|
||||
Reference in New Issue
Block a user