aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-23 07:28:07 +0100
committerDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-23 07:28:07 +0100
commitba417206ed8bb2341dcad5655d91ad09f6a0f073 (patch)
tree6ea86e1fed38de283bfa8893c4dee87bfab3bf32 /src
parentbe546fe6e4b709d1bb8770fdf0763ce4f494d0d6 (diff)
downloadmail-ba417206ed8bb2341dcad5655d91ad09f6a0f073.tar.gz
thread: count messages and files
Diffstat (limited to 'src')
-rw-r--r--src/ffi.rs11
-rw-r--r--src/thread.rs22
2 files changed, 27 insertions, 6 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
index 765b180..db67390 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -907,6 +907,17 @@ extern {
thread: *mut notmuch_thread_t,
) -> c_int;
+ /// Get the total number of files in 'thread'.
+ ///
+ /// This sums notmuch_message_count_files over all messages in the
+ /// thread
+ /// @returns Non-negative integer
+ /// @since libnotmuch 5.0 (notmuch 0.25)
+ ///
+ pub fn notmuch_thread_get_total_files(
+ thread: *mut notmuch_thread_t,
+ ) -> c_int;
+
/// Get a `notmuch_messages_t` iterator for the top-level messages in
/// 'thread' in oldest-first order.
///
diff --git a/src/thread.rs b/src/thread.rs
index cf5440c..2a502b4 100644
--- a/src/thread.rs
+++ b/src/thread.rs
@@ -25,12 +25,22 @@ impl<'q, 'd> NewFromPtr<*mut ffi::notmuch_thread_t> for Thread<'q, 'd> {
}
}
-// impl<'d> Thread<'d>(
-//
-//
-//
-// };
-//
+impl<'q, 'd> Thread<'q, 'd>{
+
+ pub fn total_messages(self: &Self) -> i32{
+ unsafe {
+ ffi::notmuch_thread_get_total_messages(self.0)
+ }
+ }
+
+ pub fn total_files(self: &Self) -> i32{
+ unsafe {
+ ffi::notmuch_thread_get_total_files(self.0)
+ }
+ }
+
+}
+
impl<'q, 'd> ops::Drop for Thread<'q, 'd> {
fn drop(&mut self) {