mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
add server data for nauta to provider-db
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
use crate::dc_tools::EmailAddress;
|
use crate::dc_tools::EmailAddress;
|
||||||
|
use crate::provider::Protocol::*;
|
||||||
|
use crate::provider::Socket::*;
|
||||||
|
use crate::provider::UsernamePattern::*;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, ToPrimitive)]
|
#[derive(Debug, Copy, Clone, PartialEq, ToPrimitive)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
@@ -10,25 +13,35 @@ pub enum Status {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum ServerType {
|
pub enum Protocol {
|
||||||
SMTP = 1,
|
SMTP = 1,
|
||||||
IMAP = 2,
|
IMAP = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum ServerSocket {
|
pub enum Socket {
|
||||||
STARTTLS = 1,
|
STARTTLS = 1,
|
||||||
SSL = 2,
|
SSL = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
pub struct Server {
|
#[repr(u8)]
|
||||||
pub stype: u16,
|
pub enum UsernamePattern {
|
||||||
// more fields are needed, just to keep the example short
|
EMAIL = 1,
|
||||||
|
EMAILLOCALPART = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug)]
|
||||||
|
pub struct Server {
|
||||||
|
pub protocol: Protocol,
|
||||||
|
pub socket: Socket,
|
||||||
|
pub server: &'static str,
|
||||||
|
pub port: u16,
|
||||||
|
pub username_pattern: UsernamePattern,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Provider {
|
pub struct Provider {
|
||||||
pub domains: &'static str,
|
pub domains: &'static str,
|
||||||
pub status: Status,
|
pub status: Status,
|
||||||
@@ -37,38 +50,43 @@ pub struct Provider {
|
|||||||
pub server: Vec<Server>, // this seems to be okay
|
pub server: Vec<Server>, // this seems to be okay
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: the database will be auto-generated from the provider-db
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
// TODO: the database will be auto-generated from the provider-db
|
|
||||||
static ref DATABASE: Vec<Provider> = vec![
|
static ref DATABASE: Vec<Provider> = vec![
|
||||||
Provider {
|
Provider {
|
||||||
domains: "nauta.cu",
|
domains: "nauta.cu",
|
||||||
status: Status::OK,
|
status: Status::OK,
|
||||||
before_login_hint: "",
|
before_login_hint: "",
|
||||||
overview_page: "",
|
overview_page: "",
|
||||||
server: vec![Server { stype: 123 }, Server { stype: 456 }],
|
server: vec![
|
||||||
|
Server { protocol: IMAP, socket: STARTTLS, server: "imap.nauta.cu", port: 143, username_pattern: EMAIL },
|
||||||
|
Server { protocol: SMTP, socket: STARTTLS, server: "smtp.nauta.cu", port: 25, username_pattern: EMAIL },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
/*
|
Provider {
|
||||||
Provider {
|
domains: "outlook.com hotmail.com live.com",
|
||||||
domains: "outlook.com hotmail.com live.com",
|
status: Status::BROKEN,
|
||||||
status: Status::BROKEN,
|
before_login_hint: "Outlook-e-mail-addresses will not work as expected \
|
||||||
before_login_hint: "Outlook-e-mail-addresses will not work as expected \
|
as these servers remove some important transport information.\n\n\
|
||||||
as these servers remove some important transport information.\n\n\
|
Hopefully sooner or later there will be a fix; \
|
||||||
Hopefully sooner or later there will be a fix; \
|
for now, we suggest to use another e-mail-address \
|
||||||
for now, we suggest to use another e-mail-address \
|
or try Delta Chat again when the issue is fixed.",
|
||||||
or try Delta Chat again when the issue is fixed.",
|
overview_page: "https://provider.delta.chat/outlook.com",
|
||||||
overview_page: "https://provider.delta.chat/outlook.com",
|
server: vec![
|
||||||
},
|
],
|
||||||
Provider {
|
},
|
||||||
domains: "gmail.com googlemail.com",
|
Provider {
|
||||||
status: Status::PREPARATION,
|
domains: "gmail.com googlemail.com",
|
||||||
before_login_hint: "For Gmail Accounts, you need to create an App-Password \
|
status: Status::PREPARATION,
|
||||||
if you have \"2-Step Verification\" enabled. \
|
before_login_hint: "For Gmail Accounts, you need to create an App-Password \
|
||||||
If this setting is not available, \
|
if you have \"2-Step Verification\" enabled. \
|
||||||
you need to enable \"Less secure apps\".",
|
If this setting is not available, \
|
||||||
overview_page: "https://provider.delta.chat/gmail.com",
|
you need to enable \"Less secure apps\".",
|
||||||
},
|
overview_page: "https://provider.delta.chat/gmail.com",
|
||||||
*/
|
server: vec![
|
||||||
];
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_provider_info(addr: &str) -> Option<&Provider> {
|
pub fn get_provider_info(addr: &str) -> Option<&Provider> {
|
||||||
|
|||||||
Reference in New Issue
Block a user