]> git.cworth.org Git - notmuch/commitdiff
bindings/ruby: replacy use of deprecated notmuch_message_get_flag
authorDavid Bremner <david@tethera.net>
Sat, 11 Jul 2020 18:30:08 +0000 (15:30 -0300)
committerDavid Bremner <david@tethera.net>
Sat, 18 Jul 2020 14:03:29 +0000 (11:03 -0300)
Depending on the flag, this actually can return an errror, so raise a
ruby exception if so.

bindings/ruby/message.c

index c55cf6e20d11b8faf3e10d979ad43a79952499db..6ea82afa20c5071086883b437054d80613e7a45d 100644 (file)
@@ -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;
 }
 
 /*