From 42d69b75019cf38933768aa505e5c8d8d84d7d89 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Wed, 3 Aug 2011 23:03:58 +0300 Subject: [PATCH] * mu-msg.[ch]: add mu_msg_is_readable --- src/mu-msg.c | 11 +++++++++++ src/mu-msg.h | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/mu-msg.c b/src/mu-msg.c index a82c86ad..0b1ac9e6 100644 --- a/src/mu-msg.c +++ b/src/mu-msg.c @@ -671,6 +671,17 @@ mu_msg_cmp (MuMsg *m1, MuMsg *m2, MuMsgFieldId mfid) } +gboolean +mu_msg_is_readable (MuMsg *self) +{ + g_return_val_if_fail (self, FALSE); + + return (access (get_str_field (self, MU_MSG_FIELD_ID_PATH), R_OK) + == 0) ? TRUE : FALSE; +} + + + enum _MaildirType { diff --git a/src/mu-msg.h b/src/mu-msg.h index d5d3b375..df481332 100644 --- a/src/mu-msg.h +++ b/src/mu-msg.h @@ -358,6 +358,16 @@ int mu_msg_cmp (MuMsg *m1, MuMsg *m2, MuMsgFieldId mfid); +/** + * check whether there there's a readable file behind this message + * + * @param self a MuMsg* + * + * @return TRUE if the message file is readable, FALSE otherwise + */ +gboolean mu_msg_is_readable (MuMsg *self); + + /** * convert the msg to a Lisp symbolic expression (for further processing in * e.g. emacs)