summaryrefslogtreecommitdiffstats
path: root/libimagmail
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-08-09 15:38:35 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-10-12 19:17:40 +0200
commit50fbc3898453257a82447d9e5a0f8e33feb42ef0 (patch)
treea1eaa6144f0dd29f50f46eac263986775f5fa90b /libimagmail
parentb53f12c0a6f9e98aa77684f4e4ad01cbf68476f1 (diff)
Initial import of codebase
Diffstat (limited to 'libimagmail')
-rw-r--r--libimagmail/src/error.rs10
-rw-r--r--libimagmail/src/mail.rs52
-rw-r--r--libimagmail/src/result.rs6
3 files changed, 68 insertions, 0 deletions
diff --git a/libimagmail/src/error.rs b/libimagmail/src/error.rs
new file mode 100644
index 00000000..6e3df32b
--- /dev/null
+++ b/libimagmail/src/error.rs
@@ -0,0 +1,10 @@
+generate_error_module!(
+ generate_error_types!(MailError, MailErrorKind,
+ IOError => "IO Error"
+ );
+);
+
+pub use self::error::MailError;
+pub use self::error::MailErrorKind;
+pub use self::error::MapErrInto;
+
diff --git a/libimagmail/src/mail.rs b/libimagmail/src/mail.rs
new file mode 100644
index 00000000..2fde3547
--- /dev/null
+++ b/libimagmail/src/mail.rs
@@ -0,0 +1,52 @@
+use std::result::Result as RResult;
+use std::path::Path;
+
+use libimagstore::store::{FileLockEntry, Store};
+
+pub struct Mail<'a> {
+ fle: FileLockEntry<'a>,
+ parsedmail: ParsedMail,
+}
+
+impl<'a> Mail<'a> {
+
+ /// Imports a mail from the Path passed
+ pub fn import_from_path<P: AsRef<Path>>(store: &Store, p: P) -> Result<Mail> {
+ unimplemented!()
+ }
+
+ /// Imports a mail from the String passed
+ pub fn import_from_string<S: AsRef<str>>(store: &Store, s: S) -> Result<Mail> {
+ unimplemented!()
+ }
+
+ /// Opens a mail by the passed hash
+ pub fn open<S: AsRef<str>>(store: &Store, hash: S) -> Result<Option<Mail>> {
+ unimplemented!()
+ }
+
+ pub fn get_field<S: AsRef<str>>(&self, field: S) -> Result<Option<&str>> {
+ unimplemented!()
+ }
+
+ pub fn get_from(&self) -> Result<Option<&str>> {
+ unimplemented!()
+ }
+
+ pub fn get_to(&self) -> Result<Option<&str>> {
+ unimplemented!()
+ }
+
+ pub fn get_subject(&self) -> Result<Option<&str>> {
+ unimplemented!()
+ }
+
+ pub fn get_message_id(&self) -> Result<Option<&str>> {
+ unimplemented!()
+ }
+
+ pub fn get_in_reply_to(&self) -> Result<Option<&str>> {
+ unimplemented!()
+ }
+
+}
diff --git a/libimagmail/src/result.rs b/libimagmail/src/result.rs
new file mode 100644
index 00000000..e7715513
--- /dev/null
+++ b/libimagmail/src/result.rs
@@ -0,0 +1,6 @@
+use std::result::Result as RResult;
+
+use error::MailError;
+
+pub type Result<T> = RResult<T, MailError>;
+