aboutsummaryrefslogtreecommitdiffstats
path: root/src/message.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/message.rs')
-rw-r--r--src/message.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/message.rs b/src/message.rs
index eb94cc8..6edfd7e 100644
--- a/src/message.rs
+++ b/src/message.rs
@@ -6,6 +6,8 @@ use std::{
result
};
+use std::path::PathBuf;
+
use error::Result;
use ffi;
@@ -31,11 +33,18 @@ impl<'q, 'd> NewFromPtr<*mut ffi::notmuch_message_t> for Message<'q, 'd> {
impl<'q, 'd> Message<'q, 'd>{
- pub fn id(self: &Self) -> result::Result<&'q str, str::Utf8Error>{
- let tid = unsafe {
+ pub fn id(self: &Self) -> String{
+ let mid = unsafe {
ffi::notmuch_message_get_message_id(self.0)
};
- tid.to_str()
+ mid.to_str().unwrap().to_string()
+ }
+
+ pub fn thread_id(self: &Self) -> String{
+ let tid = unsafe {
+ ffi::notmuch_message_get_thread_id(self.0)
+ };
+ tid.to_str().unwrap().to_string()
}
pub fn replies(self: &Self) -> Messages<'q, 'd>{
@@ -56,6 +65,12 @@ impl<'q, 'd> Message<'q, 'd>{
ffi::notmuch_message_get_filenames(self.0)
})
}
+
+ pub fn filename(self: &Self) -> PathBuf{
+ PathBuf::from(unsafe {
+ ffi::notmuch_message_get_filename(self.0)
+ }.to_str().unwrap())
+ }
}