unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob b0d4603aefa0fac56e8c2f67045a7a8ab1c3e59b 3018 bytes (raw)
name: bindings/python/notmuch/indexopts.py 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
 
"""
This file is part of notmuch.

Notmuch is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.

Notmuch is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with notmuch.  If not, see <http://www.gnu.org/licenses/>.

Copyright 2015 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
"""
from ctypes import c_char_p, c_bool, c_int
from .globals import (
    nmlib,
    NotmuchIndexoptsP,
)
from .errors import (
    STATUS,
    NullPointerError,
    NotInitializedError,
)


class Indexopts(object):
    """Represents available options for notmuch indexing.
    """

    # create
    _create = nmlib.notmuch_indexopts_create
    _create.argtypes = []
    _create.restype = NotmuchIndexoptsP

    def __init__(self, try_decrypt=False, gpg_path=None):
        """
        :param try_decrypt: True if notmuch should try to decrypt messages
             while indexing, and index the cleartext.

        :param gpg_path: the name or path to the preferred GnuPG binary.
        """
        self._indexopts = Indexopts._create()
        self.gpg_path = gpg_path
        self.try_decrypt = try_decrypt

    # try_decrypt
    _get_try_decrypt = nmlib.notmuch_indexopts_get_try_decrypt
    _get_try_decrypt.argtypes = [NotmuchIndexoptsP]
    _get_try_decrypt.restype = bool

    _set_try_decrypt = nmlib.notmuch_indexopts_set_try_decrypt
    _set_try_decrypt.argtypes = [NotmuchIndexoptsP, c_bool]
    _set_try_decrypt.restype = c_int

    @property
    def try_decrypt(self):
        return Indexopts._get_try_decrypt(self._indexopts)

    @try_decrypt.setter
    def try_decrypt(self, try_decrypt):
        status = Indexopts._set_try_decrypt(self._indexopts, try_decrypt)
        if status != STATUS.SUCCESS:
            raise NotmuchError(status)

    # gpg_path
    _get_gpg_path = nmlib.notmuch_indexopts_get_gpg_path
    _get_gpg_path.argtypes = [NotmuchIndexoptsP]
    _get_gpg_path.restype = c_char_p

    _set_gpg_path = nmlib.notmuch_indexopts_set_gpg_path
    _set_gpg_path.argtypes = [NotmuchIndexoptsP, c_char_p]
    _set_gpg_path.restype = c_int

    @property
    def gpg_path(self):
        return Indexopts._get_gpg_path(self._indexopts)

    @gpg_path.setter
    def gpg_path(self, gpg_path):
        status = Indexopts._set_gpg_path(self._indexopts, gpg_path)
        if status != STATUS.SUCCESS:
            raise NotmuchError(status)
    

    _destroy = nmlib.notmuch_indexopts_destroy
    _destroy.argtypes = [NotmuchIndexoptsP]
    _destroy.restype = None

    def __del__(self):
        """Close and free the indexopts"""
        if self._indexopts:
            self._destroy(self._indexopts)

debug log:

solving b0d4603 ...
found b0d4603 in https://yhetil.org/notmuch/1454272801-23623-14-git-send-email-dkg@fifthhorseman.net/ ||
	https://yhetil.org/notmuch/1453258369-7366-14-git-send-email-dkg@fifthhorseman.net/ ||
	https://yhetil.org/notmuch/1467970047-8013-14-git-send-email-dkg@fifthhorseman.net/

applying [1/1] https://yhetil.org/notmuch/1454272801-23623-14-git-send-email-dkg@fifthhorseman.net/
diff --git a/bindings/python/notmuch/indexopts.py b/bindings/python/notmuch/indexopts.py
new file mode 100644
index 0000000..b0d4603

1:94: trailing whitespace.
    
Checking patch bindings/python/notmuch/indexopts.py...
Applied patch bindings/python/notmuch/indexopts.py cleanly.
warning: 1 line adds whitespace errors.

skipping https://yhetil.org/notmuch/1453258369-7366-14-git-send-email-dkg@fifthhorseman.net/ for b0d4603
skipping https://yhetil.org/notmuch/1467970047-8013-14-git-send-email-dkg@fifthhorseman.net/ for b0d4603
index at:
100644 b0d4603aefa0fac56e8c2f67045a7a8ab1c3e59b	bindings/python/notmuch/indexopts.py

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).