[pywin32-checkins] /hgroot/pywin32/pywin32: 8 new changesets
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2016-02-27 05:54:41
|
changeset 27792ff20dbe in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=27792ff20dbe summary: Add mapi exchange module PyIExchangeManageStoreEx::CreateStoreEntryID2 changeset d932f03be686 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=d932f03be686 summary: Add PyIMAPIAdviseSink, PyIMsgStore::Advise, PyIMsgStore::Unadvise, HrAllocAdviseSink, HrThisThreadAdviseSink, and HrDispatchNotifications changeset 40baafca4b98 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=40baafca4b98 summary: Add support for PT_MV_CLSID and PT_MV_I8 in FromSPropValue() changeset fd1a36d09647 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=fd1a36d09647 summary: Fixes PyIExchangeManageStore::CreateStoreEntryID for public folders and py3 changeset e0bd94265138 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=e0bd94265138 summary: Add MAPI SPropProblemArray support for SetProps, DeleteProps, CopyProps,and CopyTo changeset ce6ef8c690c7 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=ce6ef8c690c7 summary: removed unused variable to avoid compiler warning changeset e32aa302e540 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=e32aa302e540 summary: Add MAPI_UNICODE flag option to GetLastError changeset cc08f2559b15 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=cc08f2559b15 summary: Change mapi string handling to be influenced by the the MAPI_UNICODE flag setting. diffstat: CHANGES.txt | 4 + com/win32comext/mapi/mapitags.py | 4 + com/win32comext/mapi/src/PyIAttach.i | 34 +- com/win32comext/mapi/src/PyIExchangeManageStore.i | 27 +- com/win32comext/mapi/src/PyIExchangeManageStoreEx.i | 102 ++++++ com/win32comext/mapi/src/PyIMAPIAdviseSink.cpp | 140 ++++++++- com/win32comext/mapi/src/PyIMAPIAdviseSink.h | 32 + com/win32comext/mapi/src/PyIMAPIFolder.i | 98 +++++- com/win32comext/mapi/src/PyIMAPIProp.i | 123 ++++++- com/win32comext/mapi/src/PyIMAPISession.i | 34 ++- com/win32comext/mapi/src/PyIMAPITable.i | 33 +- com/win32comext/mapi/src/PyIMsgServiceAdmin.i | 85 ++++- com/win32comext/mapi/src/PyIMsgStore.i | 110 +++++- com/win32comext/mapi/src/PyIProfAdmin.i | 325 +++++++++++++++++-- com/win32comext/mapi/src/PyIProviderAdmin.i | 34 +- com/win32comext/mapi/src/PyMAPIUtil.h | 6 + com/win32comext/mapi/src/exchange.i | 5 + com/win32comext/mapi/src/mapi.i | 134 +++++++- com/win32comext/mapi/src/mapiutil.cpp | 104 ++++- setup.py | 3 + 20 files changed, 1294 insertions(+), 143 deletions(-) diffs (truncated from 1895 to 300 lines): diff -r 8c70bcb663b9 -r cc08f2559b15 CHANGES.txt --- a/CHANGES.txt Sat Feb 27 13:13:05 2016 +1100 +++ b/CHANGES.txt Thu Oct 22 08:54:40 2015 -0700 @@ -8,6 +8,10 @@ ---------------- * A null SPropTagArray will now return None instead of crashing. +* New mapi/exchange interfaces PyIExchangeManageStoreEx, PyIMAPIAdviseSink, + PyIMsgStore::Advise, PyIMsgStore::Unadvise, HrAllocAdviseSink, + HrThisThreadAdviseSink, and HrDispatchNotifications (Nick Czeczulin) + Since build 219: ---------------- * win32com - sys.argv[0] may be set to a bytes object instead of a string on diff -r 8c70bcb663b9 -r cc08f2559b15 com/win32comext/mapi/mapitags.py --- a/com/win32comext/mapi/mapitags.py Sat Feb 27 13:13:05 2016 +1100 +++ b/com/win32comext/mapi/mapitags.py Thu Oct 22 08:54:40 2015 -0700 @@ -1001,3 +1001,7 @@ PR_MESSAGE_SIZE_EXTENDED = PROP_TAG(PT_I8, PROP_ID(PR_MESSAGE_SIZE)) PR_USERFIELDS = PROP_TAG(PT_BINARY, 0x36e3) + +# IExchangeManageStoreEx::CreateStoreEntryID2 +PR_FORCE_USE_ENTRYID_SERVER = PROP_TAG(PT_BOOLEAN, 0x7CFE) +PR_PROFILE_MDB_DN = PROP_TAG(PT_STRING8, 0x7CFF) diff -r 8c70bcb663b9 -r cc08f2559b15 com/win32comext/mapi/src/PyIAttach.i --- a/com/win32comext/mapi/src/PyIAttach.i Sat Feb 27 13:13:05 2016 +1100 +++ b/com/win32comext/mapi/src/PyIAttach.i Thu Oct 22 08:54:40 2015 -0700 @@ -30,7 +30,35 @@ %} +%native(GetLastError) GetLastError; +%{ +// @pyswig <o MAPIERROR>|GetLastError|Returns the last error code for the object. +PyObject *PyIAttach::GetLastError(PyObject *self, PyObject *args) +{ + HRESULT hr, hRes; + ULONG flags = 0; + MAPIERROR *me = NULL; + + IAttach *_swig_self; + if ((_swig_self=GetI(self))==NULL) return NULL; + + if(!PyArg_ParseTuple(args,"l|l:GetLastError", + &hr, // @pyparm int|hr||Contains the error code generated in the previous method call. + &flags)) // @pyparm int|flags||Indicates for format for the output. + return NULL; + + Py_BEGIN_ALLOW_THREADS + hRes = _swig_self->GetLastError(hr, flags, &me); + Py_END_ALLOW_THREADS -// GetLastError|Returns a MAPIERROR structure containing information about the previous error on the table. -HRESULT GetLastError(HRESULT hr, unsigned long flags, MAPIERROR **OUTPUT); - + if (FAILED(hRes)) + return OleSetOleError(hRes); + + if (me == NULL) + { + Py_INCREF(Py_None); + return Py_None; + } + return PyObject_FromMAPIERROR(me, flags & MAPI_UNICODE, TRUE); +} +%} diff -r 8c70bcb663b9 -r cc08f2559b15 com/win32comext/mapi/src/PyIExchangeManageStore.i --- a/com/win32comext/mapi/src/PyIExchangeManageStore.i Sat Feb 27 13:13:05 2016 +1100 +++ b/com/win32comext/mapi/src/PyIExchangeManageStore.i Thu Oct 22 08:54:40 2015 -0700 @@ -59,8 +59,10 @@ PyObject *PyIExchangeManageStore::CreateStoreEntryID(PyObject *self, PyObject *args) { HRESULT hRes; - char *serverDN; - char *userDN; + PyObject *obServerDN; + PyObject *obUserDN; + char *serverDN = NULL; + char *userDN = NULL; unsigned long flags = 0; SBinary sbEID = {0, NULL}; PyObject *result = NULL; @@ -68,9 +70,17 @@ IExchangeManageStore *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if (!PyArg_ParseTuple(args, "ss|l:CreateStoreEntryID", &serverDN, &userDN, &flags)) + if (!PyArg_ParseTuple(args, "OO|l:CreateStoreEntryID", + &obServerDN, + &obUserDN, + &flags)) return NULL; + if (!PyWinObject_AsString(obServerDN, &serverDN, FALSE)) + goto done; + if (!PyWinObject_AsString(obUserDN, &userDN, TRUE)) + goto done; + Py_BEGIN_ALLOW_THREADS hRes = _swig_self->CreateStoreEntryID(serverDN, userDN, flags, &sbEID.cb, (LPENTRYID *) &sbEID.lpb); Py_END_ALLOW_THREADS @@ -78,9 +88,18 @@ if (FAILED(hRes)) result = OleSetOleError(hRes); else - result = Py_BuildValue("s#", sbEID.lpb, sbEID.cb); + result = Py_BuildValue( +#if PY_MAJOR_VERSION >= 3 + "y#", +#else + "s#", +#endif + sbEID.lpb, sbEID.cb); +done: MAPIFreeBuffer((LPENTRYID)sbEID.lpb); + PyWinObject_FreeString(serverDN); + PyWinObject_FreeString(userDN); return result; } diff -r 8c70bcb663b9 -r cc08f2559b15 com/win32comext/mapi/src/PyIExchangeManageStoreEx.i --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/mapi/src/PyIExchangeManageStoreEx.i Thu Oct 22 08:54:40 2015 -0700 @@ -0,0 +1,102 @@ +/* File : PyIExchangeManageStoreEx.i */ + +%module IExchangeManageStoreEx + +%include "typemaps.i" +%include "pywin32.i" +%include "pythoncom.i" +%include "mapilib.i" + +%typemap(python,ignore) IExchangeManageStoreEx **OUTPUT(IExchangeManageStoreEx *temp) +{ + $target = &temp; +} +%typemap(python,argout) IExchangeManageStoreEx **OUTPUT { + MAKE_OUTPUT_INTERFACE($source, $target, IID_IExchangeManageStoreEx) +} +%typemap(python,freearg) IExchangeManageStoreEx *INPUT, + IExchangeManageStoreEx *INPUT_NULLOK +{ + if ($source) $source->Release(); +} + +%typemap(python,in) IExchangeManageStoreEx *INPUT { + if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IExchangeManageStoreEx, (void **)&$target, 0)) + return NULL; +} +%typemap(python,in) IExchangeManageStoreEx *INPUT_NULLOK { + if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IExchangeManageStoreEx, (void **)&$target, 1)) + return NULL; +} + +%{ +#include <initguid.h> +#include "IExchangeManageStoreEx.h" +#include "PyIExchangeManageStoreEx.h" + +PyIExchangeManageStoreEx::PyIExchangeManageStoreEx(IUnknown *pDisp) : + PyIUnknown(pDisp) +{ + ob_type = &type; +} + +IExchangeManageStoreEx *PyIExchangeManageStoreEx::GetI(PyObject *self) +{ + return (IExchangeManageStoreEx *)PyIUnknown::GetI(self); +} + +PyIExchangeManageStoreEx::~PyIExchangeManageStoreEx() {} +%} + +/* +** See http://blogs.msdn.com/b/dvespa/archive/2014/01/15/new-mapi-interface-ignore-home-server.aspx +*/ + +%native(CreateStoreEntryID2) CreateStoreEntryID2; +%{ +PyObject *PyIExchangeManageStoreEx::CreateStoreEntryID2(PyObject *self, PyObject *args) +{ + PyObject *result = NULL; + HRESULT hRes; + PyObject *obs = NULL; + ULONG flags = 0; + SPropValue *pPV; + ULONG seqLen; + SBinary sbEID = {0, NULL}; + + IExchangeManageStoreEx *_swig_self; + if ((_swig_self=GetI(self))==NULL) return NULL; + + if (!PyArg_ParseTuple(args, "O|l:CreateStoreEntryID2", &obs, &flags)) + return NULL; + + if (!PySequence_Check(obs)) + { + PyErr_SetString(PyExc_TypeError, "Properties must be a sequence of tuples"); + return NULL; + } + + if (!PyMAPIObject_AsSPropValueArray(obs, &pPV, &seqLen)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + hRes = _swig_self->CreateStoreEntryID2(seqLen, pPV, flags, &sbEID.cb, (LPENTRYID *) &sbEID.lpb); + Py_END_ALLOW_THREADS + + if (FAILED(hRes)) + result = OleSetOleError(hRes); + else + result = Py_BuildValue( +#if PY_MAJOR_VERSION >= 3 + "y#", +#else + "s#", +#endif + sbEID.lpb, sbEID.cb); + + MAPIFreeBuffer((LPENTRYID)sbEID.lpb); + MAPIFreeBuffer(pPV); + + return result; +} +%} diff -r 8c70bcb663b9 -r cc08f2559b15 com/win32comext/mapi/src/PyIMAPIAdviseSink.cpp --- a/com/win32comext/mapi/src/PyIMAPIAdviseSink.cpp Sat Feb 27 13:13:05 2016 +1100 +++ b/com/win32comext/mapi/src/PyIMAPIAdviseSink.cpp Thu Oct 22 08:54:40 2015 -0700 @@ -17,7 +17,12 @@ switch (n->ulEventType) { case fnevCriticalError: { ERROR_NOTIFICATION &err = n->info.err; - ret = Py_BuildValue("k(s#iiN)", + ret = Py_BuildValue( +#if PY_MAJOR_VERSION >= 3 + "k(y#iiN)", +#else + "k(s#iiN)", +#endif n->ulEventType, err.lpEntryID, err.cbEntryID, err.scode, @@ -27,7 +32,13 @@ } case fnevExtended: { EXTENDED_NOTIFICATION &ext = n->info.ext; - ret = Py_BuildValue("k(ks#)", n->ulEventType, ext.ulEvent, + ret = Py_BuildValue( +#if PY_MAJOR_VERSION >= 3 + "k(ky#)", +#else + "k(ks#)", +#endif + n->ulEventType, ext.ulEvent, ext.pbEventParameters, ext.cb); break; } @@ -38,7 +49,12 @@ PyString_FromString((const char *)newmail.lpszMessageClass); if (!msg_class) return NULL; - ret = Py_BuildValue("k(s#s#kNk)", + ret = Py_BuildValue( +#if PY_MAJOR_VERSION >= 3 + "k(y#y#kNk)", +#else + "k(s#s#kNk)", +#endif n->ulEventType, newmail.lpEntryID, newmail.cbEntryID, newmail.lpParentID, newmail.cbParentID, @@ -57,7 +73,12 @@ PyObject *obArray = PyMAPIObject_FromSPropTagArray(obj.lpPropTagArray); if (!obArray) return NULL; - ret = Py_BuildValue("k(s#is#s#s#N)", + ret = Py_BuildValue( +#if PY_MAJOR_VERSION >= 3 + "k(y#iy#y#y#N)", +#else + "k(s#is#s#s#N)", +#endif n->ulEventType, obj.lpEntryID, obj.cbEntryID, obj.ulObjType, @@ -80,7 +101,12 @@ } case fnevStatusObjectModified: { STATUS_OBJECT_NOTIFICATION &statobj = n->info.statobj; - ret = Py_BuildValue("k(s#N)", + ret = Py_BuildValue( +#if PY_MAJOR_VERSION >= 3 + "k(y#N)", +#else + "k(s#N)", +#endif n->ulEventType, |