unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>
Subject: [PATCH 5/5] bindings/ruby: replacy use of deprecated notmuch_message_get_flag
Date: Sat, 11 Jul 2020 15:30:08 -0300	[thread overview]
Message-ID: <20200711183008.1593624-6-david@tethera.net> (raw)
In-Reply-To: <20200711183008.1593624-1-david@tethera.net>

Depending on the flag, this actually can return an errror, so raise a
ruby exception if so.
---
 bindings/ruby/message.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c
index c55cf6e2..6ea82afa 100644
--- a/bindings/ruby/message.c
+++ b/bindings/ruby/message.c
@@ -137,13 +137,18 @@ VALUE
 notmuch_rb_message_get_flag (VALUE self, VALUE flagv)
 {
     notmuch_message_t *message;
+    notmuch_bool_t is_set;
+    notmuch_status_t status;
 
     Data_Get_Notmuch_Message (self, message);
 
     if (!FIXNUM_P (flagv))
 	rb_raise (rb_eTypeError, "Flag not a Fixnum");
 
-    return notmuch_message_get_flag (message, FIX2INT (flagv)) ? Qtrue : Qfalse;
+    status = notmuch_message_get_flag_st (message, FIX2INT (flagv), &is_set);
+    notmuch_rb_status_raise (status);
+
+    return is_set ? Qtrue : Qfalse;
 }
 
 /*
-- 
2.27.0

  parent reply	other threads:[~2020-07-11 18:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11 18:30 fix deprecation warnings for notmuch_message_get_flag David Bremner
2020-07-11 18:30 ` [PATCH 1/5] cli/search: replace deprecated notmuch_message_get_flag David Bremner
2020-07-11 18:30 ` [PATCH 2/5] cli/show: " David Bremner
2020-07-11 18:30 ` [PATCH 3/5] lib/add-message: drop use of " David Bremner
2020-07-11 18:30 ` [PATCH 4/5] lib/thread: replace " David Bremner
2020-07-11 18:30 ` David Bremner [this message]
2020-07-13 23:51   ` [PATCH] cli/new: replace newly deprecated n_m_has_maildir_flag David Bremner
2020-07-20 12:14     ` David Bremner
2020-07-18 14:31 ` fix deprecation warnings for notmuch_message_get_flag David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200711183008.1593624-6-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).