#pragma hdrstop
#endif
+#ifdef __WXMSW__
+
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/net/smapi.h"
-class wxMapiData
+class WXDLLIMPEXP_NETUTILS wxMapiData
{
public:
wxMapiData()
//Setup the ascii versions of the profile name and password
int nProfileLength = sProfileName.Length();
- int nPasswordLength = sPassword.Length();
LPSTR pszProfileName = NULL;
LPSTR pszPassword = NULL;
wxCharBuffer cbProfile(1),cbPassword(1);
if (nProfileLength)
{
-// pszProfileName = T2A((LPTSTR) (LPCTSTR) sProfileName);
-// pszPassword = T2A((LPTSTR) (LPCTSTR) sPassword);
#ifndef UNICODE
pszProfileName = (LPSTR) sProfileName.c_str();
pszPassword = (LPSTR) sPassword.c_str();
}
else
{
- wxLogDebug(_T("Failed to logon to MAPI using a shared session, Error:%d\n"), nError);
+ wxLogDebug(_T("Failed to logon to MAPI using a shared session, Error:%ld\n"), nError);
m_data->m_nLastError = nError;
}
}
ULONG nError = m_data->m_lpfnMAPILogoff(m_data->m_hSession, 0, 0, 0);
if (nError != SUCCESS_SUCCESS)
{
- wxLogDebug(_T("Failed in call to MapiLogoff, Error:%d"), nError);
+ wxLogDebug(_T("Failed in call to MapiLogoff, Error:%ld"), nError);
m_data->m_nLastError = nError;
bSuccess = TRUE;
}
wxASSERT(m_data->m_hSession); //MAPI session handle must be valid
//Call the MAPIResolveName function
-// LPSTR lpszAsciiName = T2A((LPTSTR) (LPCTSTR) sName);
#ifndef UNICODE
LPSTR lpszAsciiName = (LPSTR) sName.c_str();
#else
ULONG nError = m_data->m_lpfnMAPIResolveName(m_data->m_hSession, 0, lpszAsciiName, 0, 0, lppRecip);
if (nError != SUCCESS_SUCCESS)
{
- wxLogDebug(_T("Failed to resolve the name: %s, Error:%d\n"), sName, nError);
+ wxLogDebug(_T("Failed to resolve the name: %s, Error:%ld\n"),
+ sName.c_str(), nError);
m_data->m_nLastError = nError;
}
mapiMessage.lpszSubject = cbSubject.data();
mapiMessage.lpszNoteText = cbBody.data();
#endif
-// mapiMessage.lpszSubject = T2A((LPTSTR) (LPCTSTR) message.m_subject);
-// mapiMessage.lpszNoteText = T2A((LPTSTR) (LPCTSTR) message.m_body);
mapiMessage.nRecipCount = message.m_to.GetCount() + message.m_cc.GetCount() + message.m_bcc.GetCount();
wxASSERT(mapiMessage.nRecipCount); //Must have at least 1 recipient!
if (Resolve(sName, (void*) &lpTempRecip))
{
//Resolve worked, put the resolved name back into the sName
- sName = wxString(lpTempRecip->lpszName,wxConvCurrent);
+ sName = wxString(lpTempRecip->lpszName,*wxConvCurrent);
//Don't forget to free up the memory MAPI allocated for us
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
}
- //recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
#ifndef UNICODE
recip.lpszName = (LPSTR) sName.c_str();
#else
if (Resolve(sName, (void*) &lpTempRecip))
{
//Resolve worked, put the resolved name back into the sName
- sName = wxString(lpTempRecip->lpszName,wxConvCurrent);
+ sName = wxString(lpTempRecip->lpszName,*wxConvCurrent);
//Don't forget to free up the memory MAPI allocated for us
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
}
- //recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
#ifndef UNICODE
recip.lpszName = (LPSTR) sName.c_str();
#else
//Don't forget to free up the memory MAPI allocated for us
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
}
- //recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
#ifndef UNICODE
recip.lpszName = (LPSTR) sName.c_str();
#else
ZeroMemory(&file, sizeof(MapiFileDesc));
file.nPosition = 0xFFFFFFFF;
wxString& sFilename = message.m_attachments[i];
- //file.lpszPathName = T2A((LPTSTR) (LPCTSTR) sFilename);
#ifndef UNICODE
file.lpszPathName = (LPSTR) sFilename.c_str();
if (nTitleSize && !message.m_attachmentTitles[i].IsEmpty())
{
wxString& sTitle = message.m_attachmentTitles[i];
- //file.lpszFileName = T2A((LPTSTR) (LPCTSTR) sTitle);
#ifndef UNICODE
file.lpszFileName = (LPSTR) sTitle.c_str();
#else
}
else
{
- wxLogDebug(_T("Failed to send mail message, Error:%d\n"), nError);
+ wxLogDebug(_T("Failed to send mail message, Error:%ld\n"), nError);
m_data->m_nLastError = nError;
}
if (nAttachmentSize)
{
#ifdef UNICODE
- for (int i = 0;i < nAttachmentSize;i++)
+ for (i = 0;i < nAttachmentSize;i++)
{
free(mapiMessage.lpFiles[i].lpszPathName);
free(mapiMessage.lpFiles[i].lpszFileName);
//Free up the Recipients and Originator memory
#ifdef UNICODE
- for (int i = 0;i < nRecipIndex;i++)
+ for (i = 0;i < nRecipIndex;i++)
free(mapiMessage.lpRecips[i].lpszName);
#endif
delete [] mapiMessage.lpRecips;
{
return m_data->m_nLastError;
}
+
+#endif // __WXMSW__