diff --git a/src/client/mod.rs b/src/client/mod.rs index 2828385..83d9519 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -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}; diff --git a/src/common.rs b/src/common.rs deleted file mode 100644 index b9dbfc3..0000000 --- a/src/common.rs +++ /dev/null @@ -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 or the MIT license -// , 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"; diff --git a/src/extension.rs b/src/extension.rs index f4cfadd..009dea4 100644 --- a/src/extension.rs +++ b/src/extension.rs @@ -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}; diff --git a/src/lib.rs b/src/lib.rs index c897d5a..f3e7d9f 100644 --- a/src/lib.rs +++ b/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; diff --git a/src/mailer/address.rs b/src/mailer/address.rs index ce18e5c..43f59a7 100644 --- a/src/mailer/address.rs +++ b/src/mailer/address.rs @@ -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 { diff --git a/src/mailer/header.rs b/src/mailer/header.rs index 9097a92..ec91ccc 100644 --- a/src/mailer/header.rs +++ b/src/mailer/header.rs @@ -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` diff --git a/src/mailer/mod.rs b/src/mailer/mod.rs index ef571e5..a655b09 100644 --- a/src/mailer/mod.rs +++ b/src/mailer/mod.rs @@ -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; diff --git a/src/tools.rs b/src/tools.rs index 9d1118d..8a7b117 100644 --- a/src/tools.rs +++ b/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]