~ubuntu-branches/debian/sid/openchange/sid

« back to all changes in this revision

Viewing changes to pyopenchange/pymapistoredb.c

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-04-12 20:07:57 UTC
  • mfrom: (11 sid)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20120412200757-k933d9trljmxj1l4
Tags: 1:1.0-4
* openchangeserver: Add dependency on openchangeproxy.
* Rebuild against newer version of Samba 4.
* Use dpkg-buildflags.
* Migrate to Git, update Vcs-Git header.
* Switch to debhelper 9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
   OpenChange MAPI implementation.
3
 
 
4
 
   Python interface to mapistore database
5
 
 
6
 
   Copyright (C) Julien Kerihuel 2010-2011.
7
 
 
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.
12
 
   
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.
17
 
   
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/>.
20
 
*/
21
 
 
22
 
#include <Python.h>
23
 
#include "pyopenchange/pymapistore.h"
24
 
 
25
 
void initmapistoredb(void);
26
 
 
27
 
static PyObject *py_MAPIStoreDB_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
28
 
{
29
 
        TALLOC_CTX                      *mem_ctx;
30
 
        struct mapistoredb_context      *mdb_ctx;
31
 
        PyMAPIStoreDBObject             *mdbobj;
32
 
 
33
 
        mem_ctx = talloc_new(NULL);
34
 
        if (mem_ctx == NULL) {
35
 
                PyErr_NoMemory();
36
 
                return NULL;
37
 
        }
38
 
 
39
 
        mdb_ctx = mapistoredb_new(mem_ctx);
40
 
        if (mdb_ctx == NULL) {
41
 
                PyErr_SetString(PyExc_TypeError, "mapistoredb initialization failed");
42
 
                return NULL;
43
 
        }
44
 
 
45
 
        mdbobj = PyObject_New(PyMAPIStoreDBObject, &PyMAPIStoreDB);
46
 
        mdbobj->mem_ctx = mem_ctx;
47
 
        mdbobj->mdb_ctx = mdb_ctx;
48
 
 
49
 
        return (PyObject *) mdbobj;
50
 
}
51
 
 
52
 
static void py_MAPIStoreDB_dealloc(PyObject *_self)
53
 
{
54
 
        PyMAPIStoreDBObject     *self = (PyMAPIStoreDBObject *)_self;
55
 
 
56
 
        talloc_free(self->mem_ctx);
57
 
        PyObject_Del(_self);
58
 
}
59
 
 
60
 
 
61
 
static PyObject *py_MAPIStoreDB_dump_configuration(PyMAPIStoreDBObject *self, PyObject *args)
62
 
{
63
 
        mapistoredb_dump_conf(self->mdb_ctx);
64
 
        return PyInt_FromLong(0);
65
 
}
66
 
 
67
 
static PyObject *py_MAPIStoreDB_initialize(PyMAPIStoreDBObject *self, PyObject *args, PyObject *kwargs)
68
 
{
69
 
        enum MAPISTORE_ERROR    retval;
70
 
        const char              *mpath = NULL;
71
 
        char                    *kwnames[] = { "path", NULL };
72
 
 
73
 
        /* Path is optional */
74
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "z", kwnames, &mpath)) {
75
 
                PyErr_SetString(PyExc_TypeError, "Invalid parameter");
76
 
                return NULL;
77
 
        }
78
 
 
79
 
        retval = mapistoredb_init(self->mdb_ctx, mpath);
80
 
        if (retval) {
81
 
                PyErr_SetString(PyExc_TypeError, "mapistoredb initialization failed");
82
 
        }
83
 
        return PyInt_FromLong(retval);
84
 
}
85
 
 
86
 
static PyObject *py_MAPIStoreDB_provision(PyMAPIStoreDBObject *self, PyObject *args, PyObject *kwargs)
87
 
{
88
 
        const char              *netbiosname;
89
 
        const char              *firstorg;
90
 
        const char              *firstou;
91
 
        char                    *kwnames[] = { "netbiosname", "firstorg", "firstou", NULL };
92
 
 
93
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sss", kwnames, &netbiosname, &firstorg, &firstou)) {
94
 
                return NULL;
95
 
        }
96
 
 
97
 
        mapistoredb_set_netbiosname(self->mdb_ctx, netbiosname);
98
 
        mapistoredb_set_firstorg(self->mdb_ctx, firstorg);
99
 
        mapistoredb_set_firstou(self->mdb_ctx, firstou);
100
 
 
101
 
        return PyInt_FromLong(mapistoredb_provision(self->mdb_ctx));
102
 
}
103
 
 
104
 
static PyObject *py_MAPIStoreDB_provision_named_properties(PyMAPIStoreDBObject *self, PyObject *args)
105
 
{
106
 
        return PyInt_FromLong(mapistoredb_namedprops_provision(self->mdb_ctx));
107
 
}
108
 
 
109
 
static PyObject *py_MAPIStoreDB_get_mapistore_uri(PyObject *module, PyObject *args, PyObject *kwargs)
110
 
{
111
 
        PyObject                        *ret;
112
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) module;
113
 
        const char * const              kwnames[] = { "folder", "username", "namespace", NULL };
114
 
        enum MAPISTORE_ERROR            retval;
115
 
        enum MAPISTORE_DFLT_FOLDERS     dflt_folder;
116
 
        uint32_t                        folder_int;
117
 
        const char                      *username;
118
 
        const char                      *ns;
119
 
        char                            *uri;
120
 
 
121
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iss", 
122
 
                                         discard_const_p(char *, kwnames), 
123
 
                                         &folder_int, &username, &ns)) {
124
 
                return NULL;
125
 
        }
126
 
 
127
 
        dflt_folder = (enum MAPISTORE_DFLT_FOLDERS)folder_int;
128
 
        retval = mapistoredb_get_mapistore_uri(self->mdb_ctx, dflt_folder, ns, username, &uri);
129
 
        if (retval == MAPISTORE_SUCCESS && uri != NULL) {
130
 
                ret = PyString_FromString(uri);
131
 
                return ret;
132
 
        }
133
 
 
134
 
        return NULL;
135
 
}
136
 
 
137
 
 
138
 
static PyObject *py_MAPIStoreDB_get_new_fid(PyMAPIStoreDBObject *_self, PyObject *args)
139
 
{
140
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
141
 
        enum MAPISTORE_ERROR            retval;
142
 
        uint64_t                        fmid = 0;
143
 
        char                            *username;
144
 
 
145
 
        if (!PyArg_ParseTuple(args, "s", &username)) {
146
 
                return NULL;
147
 
        }
148
 
 
149
 
        retval = mapistoredb_get_new_fmid(self->mdb_ctx, (const char *)username, &fmid);
150
 
        if (retval == MAPISTORE_SUCCESS) {
151
 
                return PyLong_FromUnsignedLongLong(fmid);
152
 
        }
153
 
 
154
 
        return NULL;
155
 
}
156
 
 
157
 
static PyObject *py_MAPIStoreDB_get_new_allocation_range(PyMAPIStoreDBObject *_self, PyObject *args)
158
 
{
159
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
160
 
        enum MAPISTORE_ERROR            retval;
161
 
        char                            *username;
162
 
        uint64_t                        range;
163
 
        uint64_t                        range_start = 0;
164
 
        uint64_t                        range_end = 0;
165
 
 
166
 
        if (!PyArg_ParseTuple(args, "sK", &username, &range)) {
167
 
                return NULL;
168
 
        }
169
 
 
170
 
        retval = mapistoredb_get_new_allocation_range(self->mdb_ctx, (const char *)username, range, &range_start, &range_end);
171
 
        if (retval == MAPISTORE_SUCCESS) {
172
 
                return Py_BuildValue("kKK", retval, range_start, range_end);
173
 
        }
174
 
 
175
 
        return Py_BuildValue("kKK", retval, range_start, range_start);
176
 
}
177
 
 
178
 
static PyObject *py_MAPIStoreDB_new_mailbox(PyMAPIStoreDBObject *_self, PyObject *args)
179
 
{
180
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
181
 
        enum MAPISTORE_ERROR            retval;
182
 
        char                            *username;
183
 
        char                            *mapistore_uri;
184
 
 
185
 
        if (!PyArg_ParseTuple(args, "ss", &username, &mapistore_uri)) {
186
 
                return NULL;
187
 
        }
188
 
 
189
 
        retval = mapistoredb_register_new_mailbox(self->mdb_ctx, username, mapistore_uri);
190
 
        return PyInt_FromLong(retval);
191
 
}
192
 
 
193
 
static PyObject *py_MAPIStoreDB_set_mailbox_allocation_range(PyMAPIStoreDBObject *_self, PyObject *args)
194
 
{
195
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
196
 
        enum MAPISTORE_ERROR            retval;
197
 
        uint64_t                        rstart;
198
 
        uint64_t                        rend;
199
 
        char                            *username;
200
 
 
201
 
        if (!PyArg_ParseTuple(args, "sKK", &username, &rstart, &rend)) {
202
 
                return NULL;
203
 
        }
204
 
 
205
 
        retval = mapistoredb_register_new_mailbox_allocation_range(self->mdb_ctx, username, rstart, rend);
206
 
        return PyInt_FromLong(retval);
207
 
}
208
 
 
209
 
static PyObject *py_MAPIStoreDB_release(PyMAPIStoreDBObject *_self, PyObject *args)
210
 
{
211
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
212
 
 
213
 
        mapistoredb_release(self->mdb_ctx);
214
 
        return PyInt_FromLong(MAPISTORE_SUCCESS);
215
 
}
216
 
 
217
 
static PyObject *py_MAPIStoreDB_errstr(PyMAPIStoreDBObject *_self, PyObject *args)
218
 
{
219
 
        enum MAPISTORE_ERROR            retval;
220
 
        int                             ret;
221
 
 
222
 
        if (!PyArg_ParseTuple(args, "i", &ret)) {
223
 
                return NULL;
224
 
        }
225
 
 
226
 
        retval = (enum MAPISTORE_ERROR) ret;
227
 
        return PyString_FromString(mapistore_errstr(retval));
228
 
}
229
 
 
230
 
static PyObject *py_MAPIStoreDB_namedprops_get_default_id(PyMAPIStoreDBObject *_self, PyObject *args, PyObject *kwargs)
231
 
{
232
 
        enum MAPISTORE_ERROR            retval;
233
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
234
 
        const char * const              kwnames[] = { "type", NULL };
235
 
        int                             type;
236
 
        enum MAPISTORE_NAMEDPROPS_TYPE  ntype;
237
 
        uint32_t                        dflt_id;
238
 
 
239
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i", 
240
 
                                         discard_const_p(char *, kwnames),
241
 
                                         &type)) {
242
 
                return NULL;
243
 
        }
244
 
 
245
 
        ntype = (enum MAPISTORE_NAMEDPROPS_TYPE) type;
246
 
        retval = mapistore_namedprops_get_default_id(self->mdb_ctx->mstore_ctx, ntype, &dflt_id);
247
 
 
248
 
        return Py_BuildValue("ii", retval, dflt_id);    
249
 
}
250
 
 
251
 
static PyObject *py_MAPIStoreDB_namedprops_provision_backends(PyMAPIStoreDBObject *_self, PyObject *args)
252
 
{
253
 
        enum MAPISTORE_ERROR            retval;
254
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
255
 
 
256
 
        retval = mapistoredb_namedprops_provision_backends(self->mdb_ctx);
257
 
        return PyInt_FromLong(retval);
258
 
}
259
 
 
260
 
static PyObject *py_MAPIStoreDB_namedprops_provision_user(PyMAPIStoreDBObject *_self, PyObject *args, PyObject *kwargs)
261
 
{
262
 
        enum MAPISTORE_ERROR            retval;
263
 
        PyMAPIStoreDBObject             *self = (PyMAPIStoreDBObject *) _self;
264
 
        const char * const              kwnames[] = { "username", NULL };
265
 
        char                            *username;
266
 
 
267
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", 
268
 
                                         discard_const_p(char *, kwnames),
269
 
                                         &username)) {
270
 
                return NULL;
271
 
        }
272
 
 
273
 
        retval = mapistoredb_namedprops_provision_user(self->mdb_ctx, username);
274
 
 
275
 
        return PyInt_FromLong(retval);
276
 
}
277
 
 
278
 
static PyObject *PyMAPIStoreDB_getParameter(PyObject *_self, void *data)
279
 
{
280
 
        PyMAPIStoreDBObject     *self = (PyMAPIStoreDBObject *) _self;
281
 
        const char              *attr = (const char *) data;
282
 
 
283
 
        if (!strcmp(attr, "netbiosname")) {
284
 
                return PyString_FromString(mapistoredb_get_netbiosname(self->mdb_ctx));
285
 
        } else if (!strcmp(attr, "firstorg")) {
286
 
                return PyString_FromString(mapistoredb_get_firstorg(self->mdb_ctx));
287
 
        } else if (!strcmp(attr, "firstou")) {
288
 
                return PyString_FromString(mapistoredb_get_firstou(self->mdb_ctx));
289
 
        } else if (!strcmp(attr, "mapping_path")) {
290
 
                return PyString_FromString(mapistore_get_mapping_path());
291
 
        } else if (!strcmp(attr, "database_path")) {
292
 
                return PyString_FromString(mapistore_get_database_path());
293
 
        } else if (!strcmp(attr, "nprops_database_path")) {
294
 
                return PyString_FromString(mapistore_get_named_properties_database_path());
295
 
        }
296
 
 
297
 
        PyErr_SetString(PyExc_TypeError, "Invalid parameter");
298
 
        return NULL;
299
 
}
300
 
 
301
 
 
302
 
static int PyMAPIStoreDB_set_dbpath(PyMAPIStoreDBObject *self, PyObject *value, void *py_data)
303
 
{
304
 
        enum MAPISTORE_ERROR    retval;
305
 
        char                    *dbpath;
306
 
 
307
 
        if (self->mdb_ctx->mstore_ctx) {
308
 
                PyErr_SetString(PyExc_AssertionError, "Already initialized");
309
 
                return -1;
310
 
        }
311
 
 
312
 
        if (!PyString_Check(value)) {
313
 
                PyErr_SetString(PyExc_ValueError, "The attribute must be a string");
314
 
                return -1;
315
 
        }
316
 
 
317
 
        dbpath = PyString_AsString(value);
318
 
 
319
 
        retval = mapistoredb_set_database_path(self->mdb_ctx, dbpath);
320
 
        if (retval) return -1;
321
 
 
322
 
        return 0;
323
 
}
324
 
 
325
 
 
326
 
static int PyMAPIStoreDB_set_mapping_path(PyMAPIStoreDBObject *self, PyObject *value, void *py_data)
327
 
{
328
 
        enum MAPISTORE_ERROR    retval;
329
 
        char                    *mapping_path;
330
 
 
331
 
        if (self->mdb_ctx->mstore_ctx) {
332
 
                PyErr_SetString(PyExc_AssertionError, "Already initialized");
333
 
                return -1;
334
 
        }
335
 
 
336
 
        if (!PyString_Check(value)) {
337
 
                PyErr_SetString(PyExc_ValueError, "The attribute must be a string");
338
 
                return -1;
339
 
        }
340
 
 
341
 
        mapping_path = PyString_AsString(value);
342
 
 
343
 
        retval = mapistoredb_set_mapping_path(self->mdb_ctx, mapping_path);
344
 
        if (retval) return -1;
345
 
 
346
 
        return 0;
347
 
}
348
 
 
349
 
 
350
 
static int PyMAPIStoreDB_set_nprops_dbpath(PyMAPIStoreDBObject *self, PyObject *value, void *py_data)
351
 
{
352
 
        enum MAPISTORE_ERROR    retval;
353
 
        char                    *nprops_dbpath;
354
 
 
355
 
        if (self->mdb_ctx->mstore_ctx) {
356
 
                PyErr_SetString(PyExc_AssertionError, "Already initialized");
357
 
                return -1;
358
 
        }
359
 
 
360
 
        if (!PyString_Check(value)) {
361
 
                PyErr_SetString(PyExc_ValueError, "The attribute must be a string");
362
 
                return -1;
363
 
        }
364
 
 
365
 
        nprops_dbpath = PyString_AsString(value);
366
 
 
367
 
        retval = mapistoredb_set_named_properties_database_path(self->mdb_ctx, nprops_dbpath);
368
 
        if (retval) return -1;
369
 
 
370
 
        return 0;
371
 
}
372
 
 
373
 
 
374
 
static PyMethodDef mapistoredb_methods[] = {
375
 
        { "initialize", (PyCFunction)py_MAPIStoreDB_initialize, METH_KEYWORDS },
376
 
        { "dump_configuration", (PyCFunction)py_MAPIStoreDB_dump_configuration, METH_VARARGS },
377
 
        { "provision", (PyCFunction)py_MAPIStoreDB_provision, METH_KEYWORDS },
378
 
        { "get_mapistore_uri", (PyCFunction)py_MAPIStoreDB_get_mapistore_uri, METH_KEYWORDS },
379
 
        { "get_new_fid", (PyCFunction)py_MAPIStoreDB_get_new_fid, METH_VARARGS },
380
 
        { "get_new_allocation_range", (PyCFunction)py_MAPIStoreDB_get_new_allocation_range, METH_VARARGS },
381
 
        { "new_mailbox", (PyCFunction)py_MAPIStoreDB_new_mailbox, METH_VARARGS },
382
 
        { "set_mailbox_allocation_range", (PyCFunction)py_MAPIStoreDB_set_mailbox_allocation_range, METH_VARARGS },
383
 
        { "release", (PyCFunction)py_MAPIStoreDB_release, METH_VARARGS },
384
 
        { "errstr", (PyCFunction)py_MAPIStoreDB_errstr, METH_VARARGS },
385
 
        /* named properties functions */
386
 
        { "provision_named_properties", (PyCFunction)py_MAPIStoreDB_provision_named_properties, METH_VARARGS },
387
 
        { "namedprops_get_default_id", (PyCFunction)py_MAPIStoreDB_namedprops_get_default_id, METH_KEYWORDS },
388
 
        { "namedprops_provision_user", (PyCFunction)py_MAPIStoreDB_namedprops_provision_user, METH_KEYWORDS },
389
 
        { "namedprops_provision_backends", (PyCFunction)py_MAPIStoreDB_namedprops_provision_backends, METH_VARARGS },
390
 
        { NULL },
391
 
};
392
 
 
393
 
static PyGetSetDef mapistoredb_getsetters[] = {
394
 
        { "netbiosname", (getter)PyMAPIStoreDB_getParameter,
395
 
          (setter)NULL, "netbiosname", "netbiosname"},
396
 
        { "firstorg", (getter)PyMAPIStoreDB_getParameter,
397
 
          (setter)NULL, "firstorg", "firstorg"},
398
 
        { "firstou", (getter)PyMAPIStoreDB_getParameter,
399
 
          (setter)NULL, "firstou", "firstou"},
400
 
        { "mapping_path", (getter)PyMAPIStoreDB_getParameter, 
401
 
          (setter)PyMAPIStoreDB_set_mapping_path, "mapping_path", "mapping_path" },
402
 
        { "database_path", (getter)PyMAPIStoreDB_getParameter, 
403
 
          (setter)PyMAPIStoreDB_set_dbpath, "database_path", "database_path" },
404
 
        { "namedprops_database_path", (getter)PyMAPIStoreDB_getParameter, 
405
 
          (setter)PyMAPIStoreDB_set_nprops_dbpath, "namedprops_database_path", "namedprops_database_path" },
406
 
        { NULL },
407
 
};
408
 
 
409
 
PyTypeObject PyMAPIStoreDB = {
410
 
        PyObject_HEAD_INIT(NULL) 0,
411
 
        .tp_name = "mapistoredb",
412
 
        .tp_basicsize = sizeof (PyMAPIStoreDBObject),
413
 
        .tp_methods = mapistoredb_methods,
414
 
        .tp_getset = mapistoredb_getsetters,
415
 
        .tp_doc = "mapistore database object",
416
 
        .tp_new = py_MAPIStoreDB_new,
417
 
        .tp_dealloc = (destructor) py_MAPIStoreDB_dealloc,
418
 
        .tp_flags = Py_TPFLAGS_DEFAULT,
419
 
};
420
 
 
421
 
static PyMethodDef py_mapistoredb_global_methods[] = {
422
 
        { NULL },
423
 
};
424
 
 
425
 
void initmapistoredb(void)
426
 
{
427
 
        PyObject        *m;
428
 
 
429
 
        if (PyType_Ready(&PyMAPIStoreDB) < 0) {
430
 
                return;
431
 
        }
432
 
 
433
 
        m = Py_InitModule3("mapistoredb", py_mapistoredb_global_methods,
434
 
                           "An interface to MAPIStore database");
435
 
 
436
 
        if (m == NULL) {
437
 
                return;
438
 
        }
439
 
 
440
 
        PyModule_AddObject(m, "MDB_ROOT_FOLDER", PyInt_FromLong((int)MDB_ROOT_FOLDER));
441
 
        PyModule_AddObject(m, "MDB_DEFERRED_ACTIONS", PyInt_FromLong((int)MDB_DEFERRED_ACTIONS));
442
 
        PyModule_AddObject(m, "MDB_SPOOLER_QUEUE", PyInt_FromLong((int)MDB_SPOOLER_QUEUE));
443
 
        PyModule_AddObject(m, "MDB_TODO_SEARCH", PyInt_FromLong((int)MDB_TODO_SEARCH));
444
 
        PyModule_AddObject(m, "MDB_IPM_SUBTREE", PyInt_FromLong((int)MDB_IPM_SUBTREE));
445
 
        PyModule_AddObject(m, "MDB_INBOX", PyInt_FromLong((int)MDB_INBOX));
446
 
        PyModule_AddObject(m, "MDB_OUTBOX", PyInt_FromLong((int)MDB_OUTBOX));
447
 
        PyModule_AddObject(m, "MDB_SENT_ITEMS", PyInt_FromLong((int)MDB_SENT_ITEMS));
448
 
        PyModule_AddObject(m, "MDB_DELETED_ITEMS", PyInt_FromLong((int)MDB_DELETED_ITEMS));
449
 
        PyModule_AddObject(m, "MDB_COMMON_VIEWS", PyInt_FromLong((int)MDB_COMMON_VIEWS));
450
 
        PyModule_AddObject(m, "MDB_SCHEDULE", PyInt_FromLong((int)MDB_SCHEDULE));
451
 
        PyModule_AddObject(m, "MDB_SEARCH", PyInt_FromLong((int)MDB_SEARCH));
452
 
        PyModule_AddObject(m, "MDB_VIEWS", PyInt_FromLong((int)MDB_VIEWS));
453
 
        PyModule_AddObject(m, "MDB_SHORTCUTS", PyInt_FromLong((int)MDB_SHORTCUTS));
454
 
        PyModule_AddObject(m, "MDB_REMINDERS", PyInt_FromLong((int)MDB_REMINDERS));
455
 
        PyModule_AddObject(m, "MDB_CALENDAR", PyInt_FromLong((int)MDB_CALENDAR));
456
 
        PyModule_AddObject(m, "MDB_CONTACTS", PyInt_FromLong((int)MDB_CONTACTS));
457
 
        PyModule_AddObject(m, "MDB_JOURNAL", PyInt_FromLong((int)MDB_JOURNAL));
458
 
        PyModule_AddObject(m, "MDB_NOTES", PyInt_FromLong((int)MDB_NOTES));
459
 
        PyModule_AddObject(m, "MDB_TASKS", PyInt_FromLong((int)MDB_TASKS));
460
 
        PyModule_AddObject(m, "MDB_DRAFTS", PyInt_FromLong((int)MDB_DRAFTS));
461
 
        PyModule_AddObject(m, "MDB_TRACKED_MAIL", PyInt_FromLong((int)MDB_TRACKED_MAIL));
462
 
        PyModule_AddObject(m, "MDB_SYNC_ISSUES", PyInt_FromLong((int)MDB_SYNC_ISSUES));
463
 
        PyModule_AddObject(m, "MDB_CONFLICTS", PyInt_FromLong((int)MDB_CONFLICTS));
464
 
        PyModule_AddObject(m, "MDB_LOCAL_FAILURES", PyInt_FromLong((int)MDB_LOCAL_FAILURES));
465
 
        PyModule_AddObject(m, "MDB_SERVER_FAILURES", PyInt_FromLong((int)MDB_SERVER_FAILURES));
466
 
        PyModule_AddObject(m, "MDB_JUNK_EMAIL", PyInt_FromLong((int)MDB_JUNK_EMAIL));
467
 
        PyModule_AddObject(m, "MDB_RSS_FEEDS", PyInt_FromLong((int)MDB_RSS_FEEDS));
468
 
        PyModule_AddObject(m, "MDB_CONVERSATION_ACT", PyInt_FromLong((int)MDB_CONVERSATION_ACT));
469
 
        PyModule_AddObject(m, "MDB_LAST_SPECIALFOLDER", PyInt_FromLong((int)MDB_LAST_SPECIALFOLDER));
470
 
        PyModule_AddObject(m, "MDB_CUSTOM", PyInt_FromLong((int)MDB_CUSTOM));
471
 
        
472
 
        PyModule_AddObject(m, "MAPISTORE_NAMEDPROPS_INTERNAL", PyInt_FromLong((int)MAPISTORE_NAMEDPROPS_INTERNAL));
473
 
        PyModule_AddObject(m, "MAPISTORE_NAMEDPROPS_EXTERNAL", PyInt_FromLong((int)MAPISTORE_NAMEDPROPS_EXTERNAL));
474
 
 
475
 
        Py_INCREF(&PyMAPIStoreDB);
476
 
        PyModule_AddObject(m, "mapistoredb", (PyObject *)&PyMAPIStoreDB);
477
 
}