Update of /cvsroot/pywin32/pywin32/com/win32comext/mapi/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27565/com/win32comext/mapi/src
Modified Files:
PyIMsgServiceAdmin.i mapiguids.cpp mapilib.i
Added Files:
PyIProviderAdmin.i
Log Message:
Support for IProviderAdmin from John Nielsen, and at the same time remove
the use of the .dsp file for the MAPI projects.
--- NEW FILE: PyIProviderAdmin.i ---
/* File : PyIProviderAdmin.i */
%module IProviderAdmin // A COM interface to MAPI
%include "typemaps.i"
%include "pywin32.i"
%include "pythoncom.i"
%include "mapilib.i"
%{
#include "PyIProviderAdmin.h"
PyIProviderAdmin::PyIProviderAdmin(IUnknown *pDisp) :
PyIUnknown(pDisp)
{
ob_type = &type;
}
PyIProviderAdmin::~PyIProviderAdmin()
{
}
/*static*/ IProviderAdmin *PyIProviderAdmin::GetI(PyObject *self)
{
return (IProviderAdmin *)PyIUnknown::GetI(self);
}
%}
// @pyswig |GetLastError|Returns a MAPIERROR structure containing information about the previous error on the table.
HRESULT GetLastError(HRESULT hr, unsigned long flags, MAPIERROR **OUTPUT);
// @pyswig <o PyIMAPITable>|GetProviderTable|Retrieves a table of service providers.
HRESULT GetProviderTable(
unsigned long ulFlags, // @pyparm int|flags||
IMAPITable **OUTPUT
);
// @pyswig |DeleteProvider|Deletes the service provider from message service
HRESULT DeleteProvider(
MAPIUID *INPUT // @pyparm <o PyIID>|uuid||The ID of the provider
);
// @pyswig <o PyIProfSect>|OpenProfileSection|
HRESULT OpenProfileSection(
MAPIUID *INPUT, // @pyparm <o PyIID>|uuid||The ID of the service
IID *INPUT_NULLOK, // @pyparm <o PyIID>|iid||The IID of the resulting object, or None for the default
unsigned long ulFlags, // @pyparm int|flags||
IProfSect **OUTPUT
);
%{
// as defined in MSDN, exerything [in] except last arg is [out]
// HRESULT CreateProvider(LPTSTR lpszProvider,ULONG cValues,LPSPropValue lpProps,ULONG ulUIParam,ULONG ulFlags,MAPIUID FAR * lpUID);
// @pyswig <o PyIID>|CreateProvider|Add a service provider to a message service.
PyObject *PyIProviderAdmin::CreateProvider(PyObject *self, PyObject *args)
{
HRESULT hr;IProviderAdmin *_swig_self;
//Handle the 5 input variables
TCHAR * lpszProvider;unsigned long cValues;PyObject *py_props;unsigned long ulUIParam;unsigned long ulFlags;
//Parse the 5 input variables from Python input
if(!PyArg_ParseTuple(args,"slOll",&lpszProvider,&cValues,&py_props,&ulUIParam,&ulFlags)) { return NULL; }
//handle spropvalue structure
SPropValue *pPropValue;ULONG len;
if (py_props==Py_None) {
pPropValue = NULL;
cValues = 0;
} else {
if (!PyMAPIObject_AsSPropValueArray(py_props, &pPropValue, &len))
return NULL;
}
//Setup output variable
CLSID iid;
MAPIUID *pMAPIUID = (MAPIUID *)&iid;
if ((_swig_self=GetI(self))==NULL) return NULL;
Py_BEGIN_ALLOW_THREADS
hr = (HRESULT )_swig_self->CreateProvider(lpszProvider,cValues,pPropValue,ulUIParam,ulFlags,pMAPIUID);
Py_END_ALLOW_THREADS
MAPIFreeBuffer(pPropValue);
if (FAILED(hr)) { return NULL;}
GUID *pTemp = (GUID *)&iid;
PyObject *obiid = PyWinObject_FromIID(*pTemp);
if (!obiid) return NULL;
return obiid;
}
%}
%native (CreateProvider) CreateProvider;
Index: PyIMsgServiceAdmin.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/src/PyIMsgServiceAdmin.i,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIMsgServiceAdmin.i 1 Sep 1999 23:17:16 -0000 1.1
--- PyIMsgServiceAdmin.i 11 Feb 2006 03:47:02 -0000 1.2
***************
*** 1,4 ****
/* File : PyIMsgServiceAdmin.i */
!
%module IMsgServiceAdmin // An COM interface to MAPI's IMsgServiceAdmin interface.
--- 1,4 ----
/* File : PyIMsgServiceAdmin.i */
!
%module IMsgServiceAdmin // An COM interface to MAPI's IMsgServiceAdmin interface.
***************
*** 113,115 ****
unsigned long ulFlags, // @pyparm int|flags||
IProfSect **OUTPUT
! );
\ No newline at end of file
--- 113,123 ----
unsigned long ulFlags, // @pyparm int|flags||
IProfSect **OUTPUT
! );
!
! // @pyswig <o PyIProfSect>|AdminProviders|Returns an object providing access
! // to a provider administration object.
! HRESULT AdminProviders(
! MAPIUID *INPUT, // @pyparm <o PyIID>|uuid||The ID of the service
! unsigned long ulFlags, // @pyparm int|flags||
! IProviderAdmin **OUTPUT
! );
Index: mapilib.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/src/mapilib.i,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** mapilib.i 1 Sep 2003 08:05:36 -0000 1.2
--- mapilib.i 11 Feb 2006 03:47:02 -0000 1.3
***************
*** 67,70 ****
--- 67,74 ----
$target = &temp;
}
+ %typemap(python,ignore) IProviderAdmin **OUTPUT(IProviderAdmin *temp)
+ {
+ $target = &temp;
+ }
%typemap(python,ignore) IMAPIAdviseSink **OUTPUT(IMAPIAdviseSink *temp)
{
***************
*** 115,118 ****
--- 119,125 ----
MAKE_OUTPUT_INTERFACE($source, $target, IID_IProfSect)
}
+ %typemap(python,argout) IProviderAdmin **OUTPUT {
+ MAKE_OUTPUT_INTERFACE($source, $target, IID_IProviderAdmin)
+ }
%typemap(python,argout) IMAPIAdviseSink **OUTPUT {
MAKE_OUTPUT_INTERFACE($source, $target, IID_IMAPIAdviseSink)
***************
*** 149,152 ****
--- 156,161 ----
IProfSect *INPUT,
IProfSect *INPUT_NULLOK,
+ IProviderAdmin *INPUT,
+ IProviderAdmin *INPUT_NULLOK,
IMAPIAdviseSink *INPUT,
IMAPIAdviseSink *INPUT_NULLOK,
***************
*** 258,261 ****
--- 267,280 ----
}
+ %typemap(python,in) IProviderAdmin *INPUT {
+ if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IProviderAdmin, (void **)&$target, 0))
+ return NULL;
+ }
+
+ %typemap(python,in) IProviderAdmin *INPUT_NULLOK {
+ if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IProviderAdmin, (void **)&$target, 1))
+ return NULL;
+ }
+
%typemap(python,in) IAddrBook *INPUT {
if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IAddrBook, (void **)&$target, 0))
Index: mapiguids.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/src/mapiguids.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** mapiguids.cpp 1 Sep 1999 23:17:16 -0000 1.1
--- mapiguids.cpp 11 Feb 2006 03:47:02 -0000 1.2
***************
*** 19,22 ****
--- 19,23 ----
#define USES_IID_IProfSect
#define USES_IID_IMsgServiceAdmin
+ #define USES_IID_IProviderAdmin
|