return PyInt_FromLong(0);
}
-static PyObject *py_MAPIStoreDB_provision(PyMAPIStoreDBObject *self, PyObject *args)
+static PyObject *py_MAPIStoreDB_provision(PyMAPIStoreDBObject *self, PyObject *args, PyObject *kwargs)
{
+ const char *netbiosname;
+ const char *firstorg;
+ const char *firstou;
+ char *kwnames[] = { "netbiosname", "firstorg", "firstou", NULL };
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sss", kwnames, &netbiosname, &firstorg, &firstou)) {
+ return NULL;
+ }
+
+ mapistoredb_set_netbiosname(self->mdb_ctx, netbiosname);
+ mapistoredb_set_firstorg(self->mdb_ctx, firstorg);
+ mapistoredb_set_firstou(self->mdb_ctx, firstou);
+
return PyInt_FromLong(mapistoredb_provision(self->mdb_ctx));
}
return PyInt_FromLong(retval);
}
-static int PyMAPIStoreDB_setParameter(PyObject *_self, PyObject *value, void *data)
-{
- PyMAPIStoreDBObject *self = (PyMAPIStoreDBObject *) _self;
- const char *attr = (const char *) data;
- const char *str;
-
- if (!self->mdb_ctx) return -1;
-
- if (!PyArg_Parse(value, "s", &str)) {
- return -1;
- }
-
- if (!strcmp(attr, "netbiosname")) {
- return mapistoredb_set_netbiosname(self->mdb_ctx, str);
- } else if (!strcmp(attr, "firstorg")) {
- return mapistoredb_set_firstorg(self->mdb_ctx, str);
- } else if (!strcmp(attr, "firstou")) {
- return mapistoredb_set_firstou(self->mdb_ctx, str);
- }
-
- return 0;
-}
-
static PyObject *PyMAPIStoreDB_getParameter(PyObject *_self, void *data)
{
PyMAPIStoreDBObject *self = (PyMAPIStoreDBObject *) _self;
static PyMethodDef mapistoredb_methods[] = {
{ "dump_configuration", (PyCFunction)py_MAPIStoreDB_dump_configuration, METH_VARARGS },
- { "provision", (PyCFunction)py_MAPIStoreDB_provision, METH_VARARGS },
+ { "provision", (PyCFunction)py_MAPIStoreDB_provision, METH_KEYWORDS },
{ "get_mapistore_uri", (PyCFunction)py_MAPIStoreDB_get_mapistore_uri, METH_VARARGS },
{ "get_new_fid", (PyCFunction)py_MAPIStoreDB_get_new_fid, METH_VARARGS },
{ "get_new_allocation_range", (PyCFunction)py_MAPIStoreDB_get_new_allocation_range, METH_VARARGS },
static PyGetSetDef mapistoredb_getsetters[] = {
{ "netbiosname", (getter)PyMAPIStoreDB_getParameter,
- (setter)PyMAPIStoreDB_setParameter, "netbiosname", "netbiosname"},
+ (setter)NULL, "netbiosname", "netbiosname"},
{ "firstorg", (getter)PyMAPIStoreDB_getParameter,
- (setter)PyMAPIStoreDB_setParameter, "firstorg", "firstorg"},
+ (setter)NULL, "firstorg", "firstorg"},
{ "firstou", (getter)PyMAPIStoreDB_getParameter,
- (setter)PyMAPIStoreDB_setParameter, "firstou", "firstou"},
+ (setter)NULL, "firstou", "firstou"},
{ NULL },
};
newTitle("[Step 1]. Initializing mapistore database", '=')
MAPIStoreDB = mapistoredb.mapistoredb("/tmp/mapistoredb")
-newTitle("[Step 2]. Modify and dump configuration", '=')
-MAPIStoreDB.netbiosname = "server"
-MAPIStoreDB.firstorg = "OpenChange Project"
-MAPIStoreDB.firstou = "OpenChange Development Unit"
-
-newTitle("[Step 3]. Provisioning mapistore database", '=')
-ret = MAPIStoreDB.provision()
+newTitle("[Step 2]. Provisioning mapistore database", '=')
+ret = MAPIStoreDB.provision(netbiosname = "server",
+ firstorg = "OpenChange Project",
+ firstou = "OpenChange Development Unit")
if (ret == 0):
print "\t* Provisioning: SUCCESS"
else:
MAPIStoreDB.dump_configuration()
-newTitle("[Step 4]. Testing API parts", '=')
+newTitle("[Step 3]. Testing API parts", '=')
newTitle("A. Testing NetBIOS name", '-')
print "* NetBIOS name: %s" %MAPIStoreDB.netbiosname
print "* First Organisation: %s" %MAPIStoreDB.firstorg
-newTitle("[Step 5]. Retrieve mapistore URI for fsocpf", '=')
+newTitle("[Step 4]. Retrieve mapistore URI for fsocpf", '=')
newTitle("*fsocpf:", '=')
print "\t* Inbox: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_INBOX, "jkerihuel", "fsocpf://")
print "\t* Calendar: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_CALENDAR, "jkerihuel", "fsocpf://")
print "\t* IPM SUbtree: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_IPM_SUBTREE, "jkerihuel", "mstoredb://")
print "\t* Inbox: %s" % MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_INBOX, "jkerihuel", "mstoredb://")
-newTitle("[Step 6]. Create a new mailbox", '=')
+newTitle("[Step 5]. Create a new mailbox", '=')
uri = MAPIStoreDB.get_mapistore_uri(mapistoredb.MDB_ROOT_FOLDER, "jkerihuel", "mstoredb://")
ret = MAPIStoreDB.new_mailbox("jkerihuel", uri)
print "\t* new_mailbox: ret = %d" % ret
-newTitle("[Step 7]. Get and Set a new allocation range to the mailbox ", '=')
+newTitle("[Step 6]. Get and Set a new allocation range to the mailbox ", '=')
(retval,rstart,rend) = MAPIStoreDB.get_new_allocation_range("jkerihuel", 0x1000)
if retval == 0:
print "\t* range start = 0x%.16x" % rstart