Reorganize common constants
This commit is contained in:
@@ -22,8 +22,9 @@ use crypto::hmac::Hmac;
|
||||
use crypto::md5::Md5;
|
||||
use crypto::mac::Mac;
|
||||
|
||||
use SMTP_PORT;
|
||||
use tools::get_first_word;
|
||||
use common::{NUL, CRLF, MESSAGE_ENDING, SMTP_PORT};
|
||||
use tools::{NUL, CRLF, MESSAGE_ENDING};
|
||||
use response::Response;
|
||||
use extension::Extension;
|
||||
use error::{SmtpResult, ErrorKind};
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
// Copyright 2014 Alexis Mousset. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Constants defined in SMTP RFCs
|
||||
|
||||
use std::old_io::net::ip::Port;
|
||||
|
||||
/// Default smtp port
|
||||
pub static SMTP_PORT: Port = 25;
|
||||
|
||||
/// Default smtps port
|
||||
pub static SMTPS_PORT: Port = 465;
|
||||
|
||||
/// Default submission port
|
||||
pub static SUBMISSION_PORT: Port = 587;
|
||||
|
||||
/// The word separator for SMTP transactions
|
||||
pub static SP: &'static str = " ";
|
||||
|
||||
/// The line ending for SMTP transactions (carriage return + line feed)
|
||||
pub static CRLF: &'static str = "\r\n";
|
||||
|
||||
/// Carriage return
|
||||
pub static CR: &'static str = "\r";
|
||||
|
||||
/// Line feed
|
||||
pub static LF: &'static str = "\n";
|
||||
|
||||
/// Colon
|
||||
pub static COLON: &'static str = ":";
|
||||
|
||||
/// The ending of message content
|
||||
pub static MESSAGE_ENDING: &'static str = "\r\n.\r\n";
|
||||
|
||||
/// NUL unicode character
|
||||
pub static NUL: &'static str = "\0";
|
||||
@@ -12,7 +12,7 @@
|
||||
use std::str::FromStr;
|
||||
use std::result::Result;
|
||||
|
||||
use common::CRLF;
|
||||
use tools::CRLF;
|
||||
use response::Response;
|
||||
use self::Extension::{PlainAuthentication, CramMd5Authentication, EightBitMime, SmtpUtfEight, StartTls};
|
||||
|
||||
|
||||
16
src/lib.rs
16
src/lib.rs
@@ -111,11 +111,21 @@ extern crate crypto;
|
||||
extern crate time;
|
||||
extern crate uuid;
|
||||
|
||||
mod tools;
|
||||
mod extension;
|
||||
pub mod client;
|
||||
pub mod extension;
|
||||
pub mod response;
|
||||
pub mod common;
|
||||
pub mod error;
|
||||
pub mod tools;
|
||||
pub mod sendable_email;
|
||||
pub mod mailer;
|
||||
|
||||
use std::old_io::net::ip::Port;
|
||||
|
||||
/// Default smtp port
|
||||
pub static SMTP_PORT: Port = 25;
|
||||
|
||||
/// Default smtps port
|
||||
pub static SMTPS_PORT: Port = 465;
|
||||
|
||||
/// Default submission port
|
||||
pub static SUBMISSION_PORT: Port = 587;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
use std::fmt::{Display, Formatter, Result};
|
||||
|
||||
use common::SP;
|
||||
use tools::SP;
|
||||
|
||||
/// Converts an adress or an address with an alias to an `Address`
|
||||
pub trait ToAddress {
|
||||
|
||||
@@ -13,7 +13,7 @@ use time::Tm;
|
||||
|
||||
use std::fmt::{Display, Formatter, Result};
|
||||
|
||||
use common::{SP, COLON};
|
||||
use tools::{SP, COLON};
|
||||
use mailer::address::Address;
|
||||
|
||||
/// Converts to an `Header`
|
||||
|
||||
@@ -15,7 +15,7 @@ use time::{now, Tm};
|
||||
|
||||
use mailer::header::{ToHeader, Header};
|
||||
use mailer::address::ToAddress;
|
||||
use common::CRLF;
|
||||
use tools::CRLF;
|
||||
use sendable_email::SendableEmail;
|
||||
|
||||
pub mod header;
|
||||
|
||||
21
src/tools.rs
21
src/tools.rs
@@ -11,7 +11,26 @@
|
||||
|
||||
use std::string::String;
|
||||
|
||||
use common::{CR, LF, CRLF};
|
||||
/// The word separator for SMTP transactions
|
||||
pub static SP: &'static str = " ";
|
||||
|
||||
/// The line ending for SMTP transactions (carriage return + line feed)
|
||||
pub static CRLF: &'static str = "\r\n";
|
||||
|
||||
/// Carriage return
|
||||
pub static CR: &'static str = "\r";
|
||||
|
||||
/// Line feed
|
||||
pub static LF: &'static str = "\n";
|
||||
|
||||
/// Colon
|
||||
pub static COLON: &'static str = ":";
|
||||
|
||||
/// The ending of message content
|
||||
pub static MESSAGE_ENDING: &'static str = "\r\n.\r\n";
|
||||
|
||||
/// NUL unicode character
|
||||
pub static NUL: &'static str = "\0";
|
||||
|
||||
/// Removes the trailing line return at the end of a string
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user