2
OpenChange MAPI implementation.
4
Python interface to mapistore
6
Copyright (C) Julien Kerihuel 2010-2011.
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#include "pyopenchange/pymapistore.h"
24
#include "pyopenchange/pymapi.h"
26
void initmapistore(void);
28
static PyObject *py_mapistore_set_mapping_path(PyObject *mod, PyObject *args)
30
const char *mapping_path;
32
if (!PyArg_ParseTuple(args, "s", &mapping_path)) {
36
return PyInt_FromLong(mapistore_set_mapping_path(mapping_path));
39
static PyObject *py_mapistore_set_database_path(PyObject *mod, PyObject *args)
43
if (!PyArg_ParseTuple(args, "s", &db_path)) {
47
return PyInt_FromLong(mapistore_set_database_path(db_path));
50
static PyObject *py_mapistore_set_named_properties_database_path(PyObject *mod, PyObject *args)
54
if (!PyArg_ParseTuple(args, "s", &db_path)) {
58
return PyInt_FromLong(mapistore_set_named_properties_database_path(db_path));
61
static PyObject *py_mapistore_errstr(PyObject *mod, PyObject *args)
65
if (!PyArg_ParseTuple(args, "k", &ret)) {
69
return PyString_FromString(mapistore_errstr(ret));
72
static PyMethodDef py_mapistore_global_methods[] = {
73
{ "set_mapping_path", (PyCFunction)py_mapistore_set_mapping_path, METH_VARARGS },
74
{ "set_database_path", (PyCFunction)py_mapistore_set_database_path, METH_VARARGS },
75
{ "set_named_properties_database_path", (PyCFunction)py_mapistore_set_named_properties_database_path, METH_VARARGS },
76
{ "errstr", (PyCFunction)py_mapistore_errstr, METH_VARARGS },
80
void initmapistore(void)
84
if (PyType_Ready(&PyMAPIStore) < 0) {
88
if (PyType_Ready(&PyMAPIStoreFolder) < 0) {
92
m = Py_InitModule3("mapistore", py_mapistore_global_methods,
93
"An interface to OpenChange MAPIStore");
98
PyModule_AddObject(m, "MDB_ROOT_FOLDER", PyInt_FromLong((int)MDB_ROOT_FOLDER));
99
PyModule_AddObject(m, "MDB_DEFERRED_ACTIONS", PyInt_FromLong((int)MDB_DEFERRED_ACTIONS));
100
PyModule_AddObject(m, "MDB_SPOOLER_QUEUE", PyInt_FromLong((int)MDB_SPOOLER_QUEUE));
101
PyModule_AddObject(m, "MDB_TODO_SEARCH", PyInt_FromLong((int)MDB_TODO_SEARCH));
102
PyModule_AddObject(m, "MDB_IPM_SUBTREE", PyInt_FromLong((int)MDB_IPM_SUBTREE));
103
PyModule_AddObject(m, "MDB_INBOX", PyInt_FromLong((int)MDB_INBOX));
104
PyModule_AddObject(m, "MDB_OUTBOX", PyInt_FromLong((int)MDB_OUTBOX));
105
PyModule_AddObject(m, "MDB_SENT_ITEMS", PyInt_FromLong((int)MDB_SENT_ITEMS));
106
PyModule_AddObject(m, "MDB_DELETED_ITEMS", PyInt_FromLong((int)MDB_DELETED_ITEMS));
107
PyModule_AddObject(m, "MDB_COMMON_VIEWS", PyInt_FromLong((int)MDB_COMMON_VIEWS));
108
PyModule_AddObject(m, "MDB_SCHEDULE", PyInt_FromLong((int)MDB_SCHEDULE));
109
PyModule_AddObject(m, "MDB_SEARCH", PyInt_FromLong((int)MDB_SEARCH));
110
PyModule_AddObject(m, "MDB_VIEWS", PyInt_FromLong((int)MDB_VIEWS));
111
PyModule_AddObject(m, "MDB_SHORTCUTS", PyInt_FromLong((int)MDB_SHORTCUTS));
112
PyModule_AddObject(m, "MDB_REMINDERS", PyInt_FromLong((int)MDB_REMINDERS));
113
PyModule_AddObject(m, "MDB_CALENDAR", PyInt_FromLong((int)MDB_CALENDAR));
114
PyModule_AddObject(m, "MDB_CONTACTS", PyInt_FromLong((int)MDB_CONTACTS));
115
PyModule_AddObject(m, "MDB_JOURNAL", PyInt_FromLong((int)MDB_JOURNAL));
116
PyModule_AddObject(m, "MDB_NOTES", PyInt_FromLong((int)MDB_NOTES));
117
PyModule_AddObject(m, "MDB_TASKS", PyInt_FromLong((int)MDB_TASKS));
118
PyModule_AddObject(m, "MDB_DRAFTS", PyInt_FromLong((int)MDB_DRAFTS));
119
PyModule_AddObject(m, "MDB_TRACKED_MAIL", PyInt_FromLong((int)MDB_TRACKED_MAIL));
120
PyModule_AddObject(m, "MDB_SYNC_ISSUES", PyInt_FromLong((int)MDB_SYNC_ISSUES));
121
PyModule_AddObject(m, "MDB_CONFLICTS", PyInt_FromLong((int)MDB_CONFLICTS));
122
PyModule_AddObject(m, "MDB_LOCAL_FAILURES", PyInt_FromLong((int)MDB_LOCAL_FAILURES));
123
PyModule_AddObject(m, "MDB_SERVER_FAILURES", PyInt_FromLong((int)MDB_SERVER_FAILURES));
124
PyModule_AddObject(m, "MDB_JUNK_EMAIL", PyInt_FromLong((int)MDB_JUNK_EMAIL));
125
PyModule_AddObject(m, "MDB_RSS_FEEDS", PyInt_FromLong((int)MDB_RSS_FEEDS));
126
PyModule_AddObject(m, "MDB_CONVERSATION_ACT", PyInt_FromLong((int)MDB_CONVERSATION_ACT));
127
PyModule_AddObject(m, "MDB_LAST_SPECIALFOLDER", PyInt_FromLong((int)MDB_LAST_SPECIALFOLDER));
128
PyModule_AddObject(m, "MDB_CUSTOM", PyInt_FromLong((int)MDB_CUSTOM));
130
PyModule_AddObject(m, "DEL_MESSAGES", PyInt_FromLong(0x1));
131
PyModule_AddObject(m, "DEL_FOLDERS", PyInt_FromLong(0x4));
132
PyModule_AddObject(m, "DELETE_HARD_DELETE", PyInt_FromLong(0x10));
134
PyModule_AddObject(m, "MAPISTORE_FOLDER", PyInt_FromLong(MAPISTORE_FOLDER));
135
PyModule_AddObject(m, "MAPISTORE_MESSAGE", PyInt_FromLong(MAPISTORE_MESSAGE));
137
PyModule_AddObject(m, "FOLDER_GENERIC", PyInt_FromLong(FOLDER_GENERIC));
138
PyModule_AddObject(m, "FOLDER_SEARCH", PyInt_FromLong(FOLDER_SEARCH));
140
Py_INCREF(&PyMAPIStore);
141
PyModule_AddObject(m, "mapistore", (PyObject *)&PyMAPIStore);
143
Py_INCREF((PyObject *)&PyMAPIStoreFolder);
144
PyModule_AddObject(m, "Folder", (PyObject *)&PyMAPIStoreFolder);