Update of /cvsroot/pywin32/pywin32/com/win32comext/mapi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21294/com/win32comext/mapi/src
Modified Files:
exchange.i
Added Files:
PyIExchangeManageStore.i
Log Message:
Support for IExchangeManageStore from Nick Czeczulin - thanks!
Index: exchange.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/src/exchange.i,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** exchange.i 22 Jan 2004 04:51:57 -0000 1.2
--- exchange.i 18 Jun 2009 10:22:59 -0000 1.3
***************
*** 33,36 ****
--- 33,43 ----
#include "EDKUTILS.H"
+ #define INITGUID
+ #define USES_IID_IExchangeManageStore
+ #include <edkguid.h>
+
+ #include "PyIExchangeManageStore.h"
+
+
// What is the correct story here?? The Exchange SDK story sucks - it seems
// certain functions in the stand-alone version are simply commented out.
***************
*** 47,50 ****
--- 54,74 ----
#endif
+ static int AddIID(PyObject *dict, const char *key, REFGUID guid)
+ {
+ PyObject *obiid = PyWinObject_FromIID(guid);
+ if (!obiid) return 1;
+ int rc = PyDict_SetItemString(dict, (char*)key, obiid);
+ Py_DECREF(obiid);
+ return rc;
+ }
+
+
+ #define ADD_IID(tok) AddIID(d, #tok, tok)
+
+ %}
+
+ %init %{
+ if ( PyCom_RegisterClientType(&PyIExchangeManageStore::type, &IID_IExchangeManageStore) != 0 ) return;
+ ADD_IID(IID_IExchangeManageStore);
%}
--- NEW FILE: PyIExchangeManageStore.i ---
/* File : PyIExchangeManageStore.i */
%module IExchangeManageStore
%include "typemaps.i"
%include "pywin32.i"
%include "pythoncom.i"
%include "mapilib.i"
%{
#include <edkmdb.h>
#define INITGUID
#define USES_IID_IExchangeManageStore
#include <edkguid.h>
%}
%typemap(python,ignore) IExchangeManageStore **OUTPUT(IExchangeManageStore *temp)
{
$target = &temp;
}
%typemap(python,argout) IExchangeManageStore **OUTPUT {
MAKE_OUTPUT_INTERFACE($source, $target, IID_IExchangeManageStore)
}
%typemap(python,freearg) IExchangeManageStore *INPUT,
IExchangeManageStore *INPUT_NULLOK
{
if ($source) $source->Release();
}
%typemap(python,in) IExchangeManageStore *INPUT {
if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IExchangeManageStore, (void **)&$target, 0))
return NULL;
}
%typemap(python,in) IExchangeManageStore *INPUT_NULLOK {
if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IExchangeManageStore, (void **)&$target, 1))
return NULL;
}
%{
#include "PyIExchangeManageStore.h"
PyIExchangeManageStore::PyIExchangeManageStore(IUnknown *pDisp) :
PyIUnknown(pDisp)
{
ob_type = &type;
}
/*static*/ IExchangeManageStore *PyIExchangeManageStore::GetI(PyObject *self)
{
return (IExchangeManageStore *)PyIUnknown::GetI(self);
}
PyIExchangeManageStore::~PyIExchangeManageStore()
{
}
PyObject *PyIExchangeManageStore::CreateStoreEntryID(PyObject *self, PyObject *args)
{
HRESULT hRes;
char *serverDN;
char *userDN;
unsigned long flags = 0;
SBinary sbEID = {0, NULL};
PyObject *result = NULL;
IExchangeManageStore *_swig_self;
if ((_swig_self=GetI(self))==NULL) return NULL;
if (!PyArg_ParseTuple(args, "ss|l:CreateStoreEntryID", &serverDN, &userDN, &flags))
return NULL;
Py_BEGIN_ALLOW_THREADS
hRes = _swig_self->CreateStoreEntryID(serverDN, userDN, flags, &sbEID.cb, (LPENTRYID *) &sbEID.lpb);
Py_END_ALLOW_THREADS
if (FAILED(hRes))
{
OleSetOleError(hRes);
goto error;
}
result = Py_BuildValue("s#", sbEID.lpb, sbEID.cb);
error:
MAPIFreeBuffer((LPENTRYID)sbEID.lpb);
return result;
}
%}
%native(CreateStoreEntryID) CreateStoreEntryID;
|