Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unbuildable exchange methods #2375

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 7 additions & 88 deletions com/win32comext/mapi/src/exchange.i
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File : exchdapi.i */
/* File : exchange.i */

/*
This is designed to be an interface to the Exchange specific
Expand Down Expand Up @@ -38,30 +38,6 @@

%}

/*
Only include Ex2KSdk.lib functions for 32-bit builds.
*/
#ifdef SWIG_PY32BIT
%{
#include "EDKMAPI.H"
#include "EDKCFG.H"
#include "EDKUTILS.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.
#if defined(EXCHANGE_RE)
# define DONT_HAVE_MBLOGON
# define DONT_HAVE_ADDRLKUP
#endif

#if !defined(DONT_HAVE_ADDRLKUP)
# include "ADDRLKUP.H"
#endif
#if !defined(DONT_HAVE_MBLOGON)
# include "MBLOGON.H"
#endif
%}
#endif

%{
static int AddIID(PyObject *dict, const char *key, REFGUID guid)
Expand Down Expand Up @@ -98,6 +74,12 @@ static int AddIID(PyObject *dict, const char *key, REFGUID guid)
Only include Ex2KSdk.lib functions for 32-bit builds.
*/
#ifdef SWIG_PY32BIT
%{
#include "EDKMAPI.H"
#include "EDKCFG.H"
#include "EDKUTILS.H"
%}

// @pyswig int, int|HrGetExchangeStatus|Obtains the current state of the server on a computer.
// @rdesc The result is a tuple of serviceState, serverState
HRESULT HrGetExchangeStatus(
Expand Down Expand Up @@ -407,55 +389,6 @@ done:
%}


%native (HrFindExchangeGlobalAddressList) PyHrFindExchangeGlobalAddressList;
%{
// @pyswig string|HrFindExchangeGlobalAddressList|Retrieves the entry identifier of the global address list (GAL) container in the address book.
static PyObject *PyHrFindExchangeGlobalAddressList(PyObject *self, PyObject *args)
{
#ifdef DONT_HAVE_ADDRLKUP
return PyErr_Format(PyExc_NotImplementedError, "Not available with this version of the Exchange SDK");
#else
PyObject *obAddrBook;
// @pyparm <o PyIAddrBook>|addrBook||The interface containing the address book
if (!PyArg_ParseTuple(args, "O:HrFindExchangeGlobalAddressList", &obAddrBook))
return NULL;

IAddrBook *pAB;
ULONG cb;
LPENTRYID peid;
if (!PyCom_InterfaceFromPyInstanceOrObject(obAddrBook, IID_IAddrBook, (void **)&pAB, 0))
return NULL;
HRESULT _result = HrFindExchangeGlobalAddressList(pAB, &cb, &peid);
if (FAILED(_result)) {
return OleSetOleError(_result);
}

PyObject *rc = PyBytes_FromStringAndSize((char *)peid, cb);
MAPIFreeBuffer(peid);
return rc;
#endif
}
%}

%{
HRESULT MyHrMailboxLogon(
IN LPMAPISESSION lplhSession, // ptr to MAPI session handle
IN LPMDB lpMDB, // ptr to message store
IN LPSTR lpszMsgStoreDN, // ptr to message store DN
IN LPSTR lpszMailboxDN, // ptr to mailbox DN
OUT LPMDB *lppMailboxMDB) // ptr to mailbox message store ptr
{
#if defined(DONT_HAVE_MBLOGON)
PyGILState_STATE gstate = PyGILState_Ensure();
PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK");
PyGILState_Release(gstate);
return E_NOTIMPL;
#else
return HrMailboxLogon(lplhSession, lpMDB, lpszMsgStoreDN, lpszMailboxDN, lppMailboxMDB);
#endif
}
%}

// @pyswig <o PyIMsgStore>|HrMailboxLogon|Logs on a server and mailbox.
%name(HrMailboxLogon) HRESULT MyHrMailboxLogon(
IMAPISession *INPUT, // @pyparm <o PyIMAPISession>|session||The session object
Expand All @@ -465,20 +398,6 @@ HRESULT MyHrMailboxLogon(
IMsgStore **OUTPUT
);

%{
HRESULT MyHrMailboxLogoff(IMsgStore **pp)
{
#if defined(DONT_HAVE_MBLOGON)
PyGILState_STATE gstate = PyGILState_Ensure();
PyErr_Warn(PyExc_RuntimeWarning, "Not available with this version of the Exchange SDK");
PyGILState_Release(gstate);
return E_NOTIMPL;
#else
return HrMailboxLogoff(pp);
#endif
}
%}

// @pyswig |HrMailboxLogoff|Logs off a server and mailbox.
%name(HrMailboxLogoff) HRESULT MyHrMailboxLogoff(
IMsgStore **INPUT // @pyparm <o PyIMsgStore>|inbox||The open inbox.
Expand Down
Loading