Skip to content

Commit

Permalink
Add get and set flags for message
Browse files Browse the repository at this point in the history
  • Loading branch information
dagle committed Aug 14, 2022
1 parent 4816ce9 commit d80a08a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use Query;
use Thread;
use Tags;

pub use ffi::MessageFlag;

#[derive(Clone, Debug, FromVariants)]
pub(crate) enum MessageOwner {
Database(Database),
Expand Down Expand Up @@ -89,6 +91,14 @@ impl Message {
)
}

pub fn get_flag(&self, flag: MessageFlag) -> bool {
unsafe { ffi::notmuch_message_get_flag(self.ptr.0, flag.into()) != 0}
}

pub fn set_flag(&self, flag: MessageFlag, value: bool) {
unsafe { ffi::notmuch_message_set_flag(self.ptr.0, flag.into(), value as i32)}
}

pub fn date(&self) -> i64 {
unsafe { ffi::notmuch_message_get_date(self.ptr.0) as i64 }
}
Expand Down

0 comments on commit d80a08a

Please sign in to comment.