Applied patch [ 778716 ] Fix resolve in smapi.cpp for UNICODE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
196be0f137
commit
9409aa35b8
@ -141,15 +141,12 @@ bool wxMapiSession::Logon(const wxString& sProfileName, const wxString& sPasswor
|
|||||||
|
|
||||||
//Setup the ascii versions of the profile name and password
|
//Setup the ascii versions of the profile name and password
|
||||||
int nProfileLength = sProfileName.Length();
|
int nProfileLength = sProfileName.Length();
|
||||||
int nPasswordLength = sPassword.Length();
|
|
||||||
|
|
||||||
LPSTR pszProfileName = NULL;
|
LPSTR pszProfileName = NULL;
|
||||||
LPSTR pszPassword = NULL;
|
LPSTR pszPassword = NULL;
|
||||||
wxCharBuffer cbProfile(1),cbPassword(1);
|
wxCharBuffer cbProfile(1),cbPassword(1);
|
||||||
if (nProfileLength)
|
if (nProfileLength)
|
||||||
{
|
{
|
||||||
// pszProfileName = T2A((LPTSTR) (LPCTSTR) sProfileName);
|
|
||||||
// pszPassword = T2A((LPTSTR) (LPCTSTR) sPassword);
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
pszProfileName = (LPSTR) sProfileName.c_str();
|
pszProfileName = (LPSTR) sProfileName.c_str();
|
||||||
pszPassword = (LPSTR) sPassword.c_str();
|
pszPassword = (LPSTR) sPassword.c_str();
|
||||||
@ -197,7 +194,7 @@ bool wxMapiSession::Logon(const wxString& sProfileName, const wxString& sPasswor
|
|||||||
}
|
}
|
||||||
else
|
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;
|
m_data->m_nLastError = nError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,7 +231,7 @@ bool wxMapiSession::Logoff()
|
|||||||
ULONG nError = m_data->m_lpfnMAPILogoff(m_data->m_hSession, 0, 0, 0);
|
ULONG nError = m_data->m_lpfnMAPILogoff(m_data->m_hSession, 0, 0, 0);
|
||||||
if (nError != SUCCESS_SUCCESS)
|
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;
|
m_data->m_nLastError = nError;
|
||||||
bSuccess = TRUE;
|
bSuccess = TRUE;
|
||||||
}
|
}
|
||||||
@ -259,7 +256,6 @@ bool wxMapiSession::Resolve(const wxString& sName, void* lppRecip1)
|
|||||||
wxASSERT(m_data->m_hSession); //MAPI session handle must be valid
|
wxASSERT(m_data->m_hSession); //MAPI session handle must be valid
|
||||||
|
|
||||||
//Call the MAPIResolveName function
|
//Call the MAPIResolveName function
|
||||||
// LPSTR lpszAsciiName = T2A((LPTSTR) (LPCTSTR) sName);
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
LPSTR lpszAsciiName = (LPSTR) sName.c_str();
|
LPSTR lpszAsciiName = (LPSTR) sName.c_str();
|
||||||
#else
|
#else
|
||||||
@ -270,7 +266,8 @@ bool wxMapiSession::Resolve(const wxString& sName, void* lppRecip1)
|
|||||||
ULONG nError = m_data->m_lpfnMAPIResolveName(m_data->m_hSession, 0, lpszAsciiName, 0, 0, lppRecip);
|
ULONG nError = m_data->m_lpfnMAPIResolveName(m_data->m_hSession, 0, lpszAsciiName, 0, 0, lppRecip);
|
||||||
if (nError != SUCCESS_SUCCESS)
|
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;
|
m_data->m_nLastError = nError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,8 +298,6 @@ bool wxMapiSession::Send(wxMailMessage& message)
|
|||||||
mapiMessage.lpszSubject = cbSubject.data();
|
mapiMessage.lpszSubject = cbSubject.data();
|
||||||
mapiMessage.lpszNoteText = cbBody.data();
|
mapiMessage.lpszNoteText = cbBody.data();
|
||||||
#endif
|
#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();
|
mapiMessage.nRecipCount = message.m_to.GetCount() + message.m_cc.GetCount() + message.m_bcc.GetCount();
|
||||||
wxASSERT(mapiMessage.nRecipCount); //Must have at least 1 recipient!
|
wxASSERT(mapiMessage.nRecipCount); //Must have at least 1 recipient!
|
||||||
|
|
||||||
@ -341,12 +336,11 @@ bool wxMapiSession::Send(wxMailMessage& message)
|
|||||||
if (Resolve(sName, (void*) &lpTempRecip))
|
if (Resolve(sName, (void*) &lpTempRecip))
|
||||||
{
|
{
|
||||||
//Resolve worked, put the resolved name back into the sName
|
//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
|
//Don't forget to free up the memory MAPI allocated for us
|
||||||
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
|
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
|
||||||
}
|
}
|
||||||
//recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
recip.lpszName = (LPSTR) sName.c_str();
|
recip.lpszName = (LPSTR) sName.c_str();
|
||||||
#else
|
#else
|
||||||
@ -370,12 +364,11 @@ bool wxMapiSession::Send(wxMailMessage& message)
|
|||||||
if (Resolve(sName, (void*) &lpTempRecip))
|
if (Resolve(sName, (void*) &lpTempRecip))
|
||||||
{
|
{
|
||||||
//Resolve worked, put the resolved name back into the sName
|
//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
|
//Don't forget to free up the memory MAPI allocated for us
|
||||||
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
|
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
|
||||||
}
|
}
|
||||||
//recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
recip.lpszName = (LPSTR) sName.c_str();
|
recip.lpszName = (LPSTR) sName.c_str();
|
||||||
#else
|
#else
|
||||||
@ -404,7 +397,6 @@ bool wxMapiSession::Send(wxMailMessage& message)
|
|||||||
//Don't forget to free up the memory MAPI allocated for us
|
//Don't forget to free up the memory MAPI allocated for us
|
||||||
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
|
m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
|
||||||
}
|
}
|
||||||
//recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
recip.lpszName = (LPSTR) sName.c_str();
|
recip.lpszName = (LPSTR) sName.c_str();
|
||||||
#else
|
#else
|
||||||
@ -432,7 +424,6 @@ bool wxMapiSession::Send(wxMailMessage& message)
|
|||||||
ZeroMemory(&file, sizeof(MapiFileDesc));
|
ZeroMemory(&file, sizeof(MapiFileDesc));
|
||||||
file.nPosition = 0xFFFFFFFF;
|
file.nPosition = 0xFFFFFFFF;
|
||||||
wxString& sFilename = message.m_attachments[i];
|
wxString& sFilename = message.m_attachments[i];
|
||||||
//file.lpszPathName = T2A((LPTSTR) (LPCTSTR) sFilename);
|
|
||||||
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
file.lpszPathName = (LPSTR) sFilename.c_str();
|
file.lpszPathName = (LPSTR) sFilename.c_str();
|
||||||
@ -445,7 +436,6 @@ bool wxMapiSession::Send(wxMailMessage& message)
|
|||||||
if (nTitleSize && !message.m_attachmentTitles[i].IsEmpty())
|
if (nTitleSize && !message.m_attachmentTitles[i].IsEmpty())
|
||||||
{
|
{
|
||||||
wxString& sTitle = message.m_attachmentTitles[i];
|
wxString& sTitle = message.m_attachmentTitles[i];
|
||||||
//file.lpszFileName = T2A((LPTSTR) (LPCTSTR) sTitle);
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
file.lpszFileName = (LPSTR) sTitle.c_str();
|
file.lpszFileName = (LPSTR) sTitle.c_str();
|
||||||
#else
|
#else
|
||||||
@ -464,7 +454,7 @@ bool wxMapiSession::Send(wxMailMessage& message)
|
|||||||
}
|
}
|
||||||
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;
|
m_data->m_nLastError = nError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user