diff options
| author | David Bremner <david@tethera.net> | 2022-01-01 10:36:43 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-01-01 11:48:40 -0400 |
| commit | 9cc026f3daaa7731527787f8c7e729c0a08c456c (patch) | |
| tree | c835c6eb6cbb00c9c8db6804d3d728a07a45db70 /bindings/python-cffi/notmuch2 | |
| parent | e9c55864cde6e9b9653b9963a36f633f34a57779 (diff) | |
bindings/python-cffi: add matched property to message objects
Existing users of the legacy python bindings use
message.get_flags(Message.FLAG.MATCH) to determine which messages in a
thread matched. Since the bindings don't provide get_flags anymore,
they should provide a property analogous to the existing "excluded"
property.
Diffstat (limited to 'bindings/python-cffi/notmuch2')
| -rw-r--r-- | bindings/python-cffi/notmuch2/_message.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bindings/python-cffi/notmuch2/_message.py b/bindings/python-cffi/notmuch2/_message.py index 2f232076..a460d8c1 100644 --- a/bindings/python-cffi/notmuch2/_message.py +++ b/bindings/python-cffi/notmuch2/_message.py @@ -206,6 +206,20 @@ class Message(base.NotmuchObject): return bool(ret) @property + def matched(self): + """Indicates whether this message was matched by the query. + + When a thread is created from a search, some of the + messages may not match the original query. This property + is set to *True* for those that do match. + + :raises ObjectDestroyedError: if used after destroyed. + """ + ret = capi.lib.notmuch_message_get_flag( + self._msg_p, capi.lib.NOTMUCH_MESSAGE_FLAG_MATCH) + return bool(ret) + + @property def date(self): """The message date as an integer. |
