2 This file is part of notmuch.
4 Notmuch is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation, either version 3 of the License, or (at your
7 option) any later version.
9 Notmuch is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with notmuch. If not, see <http://www.gnu.org/licenses/>.
17 Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
20 from ctypes import CDLL, Structure, POINTER
22 #-----------------------------------------------------------------------------
23 #package-global instance of the notmuch library
26 if uname()[0] == 'Darwin':
27 nmlib = CDLL("libnotmuch.3.dylib")
29 nmlib = CDLL("libnotmuch.so.3")
31 raise ImportError("Could not find shared 'notmuch' library.")
33 from .compat import Python3StringMixIn, encode_utf8 as _str
36 """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
37 def __init__(self, names):
38 for number, name in enumerate(names):
39 setattr(self, name, number)
42 class NotmuchDatabaseS(Structure):
44 NotmuchDatabaseP = POINTER(NotmuchDatabaseS)
47 class NotmuchQueryS(Structure):
49 NotmuchQueryP = POINTER(NotmuchQueryS)
52 class NotmuchThreadsS(Structure):
54 NotmuchThreadsP = POINTER(NotmuchThreadsS)
57 class NotmuchThreadS(Structure):
59 NotmuchThreadP = POINTER(NotmuchThreadS)
62 class NotmuchMessagesS(Structure):
64 NotmuchMessagesP = POINTER(NotmuchMessagesS)
67 class NotmuchMessageS(Structure):
69 NotmuchMessageP = POINTER(NotmuchMessageS)
72 class NotmuchTagsS(Structure):
74 NotmuchTagsP = POINTER(NotmuchTagsS)
77 class NotmuchDirectoryS(Structure):
79 NotmuchDirectoryP = POINTER(NotmuchDirectoryS)
82 class NotmuchFilenamesS(Structure):
84 NotmuchFilenamesP = POINTER(NotmuchFilenamesS)