Add stubs for Session class.
authorJelmer Vernooij <jelmer@openchange.org>
Sun, 14 Dec 2008 17:52:59 +0000 (17:52 +0000)
committerJelmer Vernooij <jelmer@openchange.org>
Sun, 14 Dec 2008 17:52:59 +0000 (17:52 +0000)
pymapi/pymapi.c
pymapi/pymapi.h [new file with mode: 0644]
pymapi/session.c [new file with mode: 0644]

index bfc83a82b045f2c79e0da850ddf94d8ba86f712b..12c742d2f73c18576cceb61c9fd55aaf648ee0e4 100644 (file)
@@ -17,8 +17,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <libmapi/libmapi.h>
-#include <Python.h>
+#include "pymapi/pymapi.h"
 
 void initmapi(void);
 
@@ -33,4 +32,7 @@ void initmapi(void)
        m = Py_InitModule3("mapi", mapi_methods, "MAPI/RPC Python bindings");
        if (m == NULL)
                return;
+
+       Py_INCREF((PyObject *)&PyMapiSessionType);
+       PyModule_AddObject(m, "Session", (PyObject *)&PyMapiSessionType);
 }
diff --git a/pymapi/pymapi.h b/pymapi/pymapi.h
new file mode 100644 (file)
index 0000000..cd80f77
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+   OpenChange MAPI implementation.
+
+   Copyright (C) Jelmer Vernooij <jelmer@openchange.org> 2008.
+
+   This program 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.
+   
+   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _PYMAPI_H_
+#define _PYMAPI_H_
+
+#include <libmapi/libmapi.h>
+#include <Python.h>
+
+PyAPI_DATA(PyTypeObject) PyMapiSessionType;
+
+#endif
diff --git a/pymapi/session.c b/pymapi/session.c
new file mode 100644 (file)
index 0000000..60fc574
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+   OpenChange MAPI implementation.
+
+   Copyright (C) Jelmer Vernooij <jelmer@openchange.org> 2008.
+
+   This program 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.
+   
+   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "pymapi/pymapi.h"
+
+typedef struct {
+       PyObject_HEAD   
+       struct mapi_session *session;
+} PyMapiSessionObject;
+
+static PyObject *py_session_create(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+       /* FIXME */
+       return (PyObject *)PyObject_New(PyMapiSessionObject, type);
+}
+
+static PyObject *py_session_login(PyObject *args, PyObject *kwargs)
+{
+       /* FIXME */
+       return NULL;
+}
+
+static PyMethodDef session_methods[] = {
+       { "login", (PyCFunction) py_session_login, METH_VARARGS|METH_KEYWORDS },
+       { NULL },
+};
+
+static PyGetSetDef session_getsetters[] = {
+       { "default_profile_path", NULL, NULL },
+       { "profile_name", NULL, NULL },
+       { "message_store", NULL, NULL },
+       { NULL }
+};
+
+PyTypeObject PyMapiSessionType = {
+       PyObject_HEAD_INIT(NULL) 0,
+       .tp_name = "Session",
+       .tp_basicsize = sizeof(PyMapiSessionObject),
+       .tp_methods = session_methods,
+       .tp_getset = session_getsetters,
+       .tp_doc = "MAPI Session",
+       .tp_new = py_session_create,
+};
+