diff options
Diffstat (limited to 'plugins/Exchange/src')
-rw-r--r-- | plugins/Exchange/src/MirandaExchange.cpp | 40 | ||||
-rw-r--r-- | plugins/Exchange/src/dlg_handlers.cpp | 12 | ||||
-rw-r--r-- | plugins/Exchange/src/emails.cpp | 32 | ||||
-rw-r--r-- | plugins/Exchange/src/emails.h | 16 | ||||
-rw-r--r-- | plugins/Exchange/src/hooked_events.cpp | 6 | ||||
-rw-r--r-- | plugins/Exchange/src/utils.cpp | 28 | ||||
-rw-r--r-- | plugins/Exchange/src/utils.h | 6 |
7 files changed, 70 insertions, 70 deletions
diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index 43a87b679a..ebca794f89 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -117,15 +117,15 @@ CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) if (NULL != szSender) {
m_nSizeSender = (UINT)mir_tstrlen(szSender)+1;
- m_szSender = new TCHAR[ m_nSizeSender ];
- memset(m_szSender, 0, m_nSizeSender * sizeof(TCHAR));
+ m_szSender = new wchar_t[ m_nSizeSender ];
+ memset(m_szSender, 0, m_nSizeSender * sizeof(wchar_t));
mir_tstrcpy(m_szSender, szSender);
}
if (NULL != szSubject) {
m_nSizeSubject = (UINT)mir_tstrlen(szSubject) +1;
- m_szSubject = new TCHAR[m_nSizeSubject];
- memset(m_szSubject, 0, m_nSizeSubject * sizeof(TCHAR));
+ m_szSubject = new wchar_t[m_nSizeSubject];
+ memset(m_szSubject, 0, m_nSizeSubject * sizeof(wchar_t));
mir_tstrcpy(m_szSubject, szSubject);
}
@@ -389,13 +389,13 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass {
_popupUtil(TranslateT("Connecting to Exchange ..."));
UINT nSize = 0;
- short nSizeOfTCHAR = sizeof( TCHAR );
+ short nSizeOfTCHAR = sizeof( wchar_t );
if (m_szUsername == NULL && NULL != szUsername) {
nSize = (UINT)mir_tstrlen(szUsername);
if (nSize > 0) {
nSize++;
- m_szUsername = new TCHAR[nSize];
+ m_szUsername = new wchar_t[nSize];
memset ( m_szUsername, 0, nSize * nSizeOfTCHAR );
mir_tstrcpy( m_szUsername, szUsername );
}
@@ -405,7 +405,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass nSize = (UINT)mir_tstrlen(szPassword);
if (nSize > 0) {
nSize++;
- m_szPassword = new TCHAR[nSize];
+ m_szPassword = new wchar_t[nSize];
memset(m_szPassword, 0, nSize * nSizeOfTCHAR);
mir_tstrcpy(m_szPassword, szPassword);
}
@@ -415,7 +415,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass nSize = (UINT)mir_tstrlen(szExchangeServer);
if (nSize > 0) {
nSize++;
- m_szExchangeServer = new TCHAR[nSize];
+ m_szExchangeServer = new wchar_t[nSize];
memset(m_szExchangeServer, 0, nSize * nSizeOfTCHAR);
mir_tstrcpy(m_szExchangeServer, szExchangeServer);
}
@@ -431,11 +431,11 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass }
if ( SUCCEEDED(hr)) {
- TCHAR szPIDandName[128];
- TCHAR szPID[20];
+ wchar_t szPIDandName[128];
+ wchar_t szPID[20];
_tstrtime(szPID);
- _tcsncpy(szPIDandName, m_szUsername, _countof(szPIDandName)-1);
+ wcsncpy(szPIDandName, m_szUsername, _countof(szPIDandName)-1);
mir_tstrncat(szPIDandName, szPID, _countof(szPIDandName) - mir_tstrlen(szPIDandName));
hr = CreateProfile(szPIDandName);
@@ -514,7 +514,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) ULONG ulFlags = 0;
SRestriction sres;
SIZE_T nSize;
- TCHAR* szUniqName;
+ wchar_t* szUniqName;
enum {iSvcName, iSvcUID, cptaSvc};
SizedSPropTagArray(cptaSvc, sptCols) =
@@ -563,10 +563,10 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) if (FAILED(hr))
return hr;
nSize = mir_tstrlen(m_szUsername);
- szUniqName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (nSize + 4));
+ szUniqName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (nSize + 4));
if (szUniqName != NULL) {
- memcpy(szUniqName, L"=", sizeof(TCHAR));
- memcpy((szUniqName + 1), m_szUsername, (sizeof(TCHAR) * (nSize + 1)));
+ memcpy(szUniqName, L"=", sizeof(wchar_t));
+ memcpy((szUniqName + 1), m_szUsername, (sizeof(wchar_t) * (nSize + 1)));
// Set values for PR_PROFILE_UNRESOLVED_NAME and PR_PROFILE_UNRESOLVED_SERVER
SPropValue spval[2];
spval[0].ulPropTag = PR_PROFILE_UNRESOLVED_NAME;
@@ -716,8 +716,8 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) LPSRowSet lpRow = NULL;
LPSPropValue lpRowProp = NULL;
ULONG i = 0L;
- TCHAR* szSenderName = NULL;
- TCHAR* szSubject = NULL;
+ wchar_t* szSenderName = NULL;
+ wchar_t* szSubject = NULL;
LPSTR szEntryID = NULL;
if ( lpFolder == NULL || !m_bFolderInboxOK )
@@ -842,7 +842,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) HKEY hTheKey;
HRESULT hRes = E_FAIL;
- TCHAR szRegValue[ 512 ];
+ wchar_t szRegValue[ 512 ];
DWORD dwLength = 512 ;
DWORD dwType = REG_SZ;
@@ -863,11 +863,11 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) else
{
- TCHAR* szTheEnd = _tcsstr( szRegValue,L".EXE" );
+ wchar_t* szTheEnd = wcsstr( szRegValue,L".EXE" );
if ( NULL != szTheEnd )
{
- szRegValue[ mir_tstrlen(szRegValue) - mir_tstrlen(szTheEnd) +5 ] = _T('\0');
+ szRegValue[ mir_tstrlen(szRegValue) - mir_tstrlen(szTheEnd) +5 ] = '\0';
mir_tstrcat( szRegValue, L" /recycle" );
STARTUPINFO si;
PROCESS_INFORMATION pi;
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index a134dafa10..4032a748e6 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -40,7 +40,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara int bCheck = db_get_b(NULL, ModuleName, "Check", 1);
- TCHAR buffer[4096];
+ wchar_t buffer[4096];
GetStringFromDatabase("Username", L"", buffer, _countof(buffer));
SetDlgItemText(hWnd, IDC_USER_EDIT, buffer);
@@ -110,7 +110,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case PSN_APPLY:
db_set_b(NULL, ModuleName, "Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS));
- TCHAR buffer[4096];
+ wchar_t buffer[4096];
GetDlgItemText(hWnd, IDC_USER_EDIT, buffer, _countof(buffer));
db_set_ts(NULL, ModuleName, "Username", buffer);
@@ -173,7 +173,7 @@ int CALLBACK ListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) int count = ListView_GetItemCount(hWnd);
for (int i = 0; i < count; i++) {
if (ListView_GetItemState(hWnd, i, LVIS_SELECTED)) {
- TCHAR emailID[4096]; //uhh
+ wchar_t emailID[4096]; //uhh
ListView_GetItemText(hWnd, i, 2, emailID, _countof(emailID));
exchangeServer.OpenMessage(emailID);
}
@@ -226,8 +226,8 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam LVITEM item = { 0 };
TEmailHeader email = { 0 };
email.cbSize = sizeof(TEmailHeader);
- TCHAR sender[1024] = L"";
- TCHAR subject[1024] = L"";
+ wchar_t sender[1024] = L"";
+ wchar_t subject[1024] = L"";
//char buffer[4096];
email.cSender = sizeof(sender);
email.cSubject = sizeof(subject);
@@ -297,7 +297,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam int count = ListView_GetItemCount(hList);
for (int i = 0; i < count; i++) {
if (ListView_GetCheckState(hList, i)) {
- TCHAR emailID[2048]; //uhh ohh
+ wchar_t emailID[2048]; //uhh ohh
LVITEM item = { 0 };
item.iItem = i;
item.mask = LVIF_TEXT;
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 496d8969eb..f38bc7335c 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -57,12 +57,12 @@ int CExchangeServer::Connect(int bForceConnect) }
if ( !IsConnected() && bTryConnect) {
- TCHAR user[1024]; //lovely
- TCHAR password[1024]; //i know
- TCHAR server[1024];
+ wchar_t user[1024]; //lovely
+ wchar_t password[1024]; //i know
+ wchar_t server[1024];
GetStringFromDatabase("Username", L"", user, _countof(user));
- _tcsncpy_s(user, VARST(user), _TRUNCATE);
+ wcsncpy_s(user, VARST(user), _TRUNCATE);
GetStringFromDatabase("Password", L"", password, _countof(password));
GetStringFromDatabase("Server", L"", server, _countof(server));
@@ -92,7 +92,7 @@ int CExchangeServer::Disconnect() // return -1; //0 on success, != 0 otherwise
}
-int CExchangeServer::DoConnect(TCHAR *user, TCHAR *password, TCHAR *server, int)
+int CExchangeServer::DoConnect(wchar_t *user, wchar_t *password, wchar_t *server, int)
{
if (bTryConnect)
@@ -152,7 +152,7 @@ int CExchangeServer::IsServerAvailable() if (sServer == INVALID_SOCKET)
return 0; //server is not available
- TCHAR szServer[1024];
+ wchar_t szServer[1024];
GetStringFromDatabase("Server", L"", szServer, sizeof(szServer));
sockaddr_in addrServer;
InitSocketAddr(&addrServer, mir_t2a(szServer));
@@ -205,8 +205,8 @@ int CExchangeServer::GetEmailHeader(int iUnreadEmail, TEmailHeader *emailInfo) #ifndef NO_EXCHANGE_TEST
if (NULL != m_HeadersKeeper[iUnreadEmail]) {
- TCHAR* szSender = m_HeadersKeeper[iUnreadEmail]->m_szSender;
- TCHAR* szSubject = m_HeadersKeeper[iUnreadEmail]->m_szSubject;
+ wchar_t* szSender = m_HeadersKeeper[iUnreadEmail]->m_szSender;
+ wchar_t* szSubject = m_HeadersKeeper[iUnreadEmail]->m_szSubject;
if (NULL == szSender)
szSender = L"";
@@ -229,7 +229,7 @@ int CExchangeServer::GetEmailHeader(int iUnreadEmail, TEmailHeader *emailInfo) return 0;
}
-int CExchangeServer::MarkEmailAsRead(TCHAR *emailID)
+int CExchangeServer::MarkEmailAsRead(wchar_t *emailID)
{
if (!IsConnected())
return -1;
@@ -241,7 +241,7 @@ int CExchangeServer::MarkEmailAsRead(TCHAR *emailID) return 0;
}
-int CExchangeServer::OpenMessage(TCHAR *emailID)
+int CExchangeServer::OpenMessage(wchar_t *emailID)
{
if (!IsConnected())
return -1;
@@ -277,7 +277,7 @@ int CExchangeServer::Check(int bNoEmailsNotify) }
if (((count > 0) || ((bNoEmailsNotify) && (count >= 0))) && (count != -1)) {
- TCHAR buffer[1024];
+ wchar_t buffer[1024];
if (count != 1)
mir_sntprintf(buffer, TranslateT("You have %d unread emails..."), count);
else
@@ -292,7 +292,7 @@ int CExchangeServer::Check(int bNoEmailsNotify) return count;
}
-int ShowMessage(TCHAR *message, int cUnreadEmails)
+int ShowMessage(wchar_t *message, int cUnreadEmails)
{
int usePopups = ServiceExists(MS_POPUP_ADDPOPUPT) ? db_get_b(NULL, ModuleName, "UsePopups", 0) : 0;
if (usePopups)
@@ -301,21 +301,21 @@ int ShowMessage(TCHAR *message, int cUnreadEmails) return ShowMessageBoxMessage(TranslateT("Do you want to see the email headers?"), message, cUnreadEmails);
}
-int ShowPopupMessage(TCHAR *title, TCHAR *message, int cUnreadEmails)
+int ShowPopupMessage(wchar_t *title, wchar_t *message, int cUnreadEmails)
{
POPUPDATAT popup = {0};
popup.lchContact = NULL;
popup.colorBack = NULL;
popup.colorText = NULL;
popup.lchIcon = hiMailIcon;
- _tcsncpy_s(popup.lptzContactName, MAX_CONTACTNAME, title, _TRUNCATE);
- _tcsncpy_s(popup.lptzText, MAX_SECONDLINE, message, _TRUNCATE);
+ wcsncpy_s(popup.lptzContactName, MAX_CONTACTNAME, title, _TRUNCATE);
+ wcsncpy_s(popup.lptzText, MAX_SECONDLINE, message, _TRUNCATE);
popup.PluginWindowProc = DlgProcPopup;
popup.PluginData = (int *) cUnreadEmails;
return PUAddPopupT(&popup);
}
-int ShowMessageBoxMessage(TCHAR *title, TCHAR *message, int cUnreadEmails)
+int ShowMessageBoxMessage(wchar_t *title, wchar_t *message, int cUnreadEmails)
{
if (MessageBox(0, message, title, MB_YESNO) == IDYES)
ShowEmailsWindow(cUnreadEmails);
diff --git a/plugins/Exchange/src/emails.h b/plugins/Exchange/src/emails.h index 6dedbd24ce..2a624b8262 100644 --- a/plugins/Exchange/src/emails.h +++ b/plugins/Exchange/src/emails.h @@ -33,9 +33,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct TEmailHeader{
int cbSize;
DWORD flags; //flags
- TCHAR *szSender; //pointer to string that receives the sender name
+ wchar_t *szSender; //pointer to string that receives the sender name
int cSender; //size of szSender buffer
- TCHAR *szSubject; //pointer to string that receives the email subject
+ wchar_t *szSubject; //pointer to string that receives the email subject
int cSubject; //size of szSubject buffer
char *emailID;
};
@@ -50,7 +50,7 @@ class CExchangeServer{ int cConnections; //number of connection attempts
int bTryConnect;
- int DoConnect(TCHAR *user, TCHAR *password, TCHAR *server, int port);
+ int DoConnect(wchar_t *user, wchar_t *password, wchar_t *server, int port);
int DoDisconnect();
public:
@@ -76,18 +76,18 @@ class CExchangeServer{ /*
*/
- int MarkEmailAsRead(TCHAR *emailID);
+ int MarkEmailAsRead(wchar_t *emailID);
- int OpenMessage(TCHAR *emailID);
+ int OpenMessage(wchar_t *emailID);
int Check(int bNoEmailsNotify = FALSE);
};
extern CExchangeServer exchangeServer;
-int ShowMessage(TCHAR *message, int cUnreadEmails);
-int ShowPopupMessage(TCHAR *title, TCHAR *message, int cUnreadEmails);
-int ShowMessageBoxMessage(TCHAR *title, TCHAR *message, int cUnreadEmails);
+int ShowMessage(wchar_t *message, int cUnreadEmails);
+int ShowPopupMessage(wchar_t *title, wchar_t *message, int cUnreadEmails);
+int ShowMessageBoxMessage(wchar_t *title, wchar_t *message, int cUnreadEmails);
int ShowEmailsWindow(int cUnreadEmails);
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index ecf569ef70..c484e976c3 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -66,7 +66,7 @@ int OnModulesLoaded(WPARAM, LPARAM) mi.position = 10000000;
mi.pszService = MS_EXCHANGE_CHECKEMAIL;
mi.flags = CMIF_TCHAR;
- mi.name.t = LPGENT("Check exchange mailbox");
+ mi.name.w = LPGENW("Check exchange mailbox");
Menu_AddMainMenuItem(&mi);
hEmailsDlg = NULL; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
@@ -82,8 +82,8 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM) odp.position = 100000000;
odp.hInstance = hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXCHANGE);
- odp.ptszTitle = LPGENT("Exchange notify");
- odp.ptszGroup = LPGENT("Plugins");
+ odp.pwszTitle = LPGENW("Exchange notify");
+ odp.pwszGroup = LPGENW("Plugins");
odp.groupPosition = 910000000;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = DlgProcOptions;
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index c1b297f164..9b5204a0cb 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -92,23 +92,23 @@ char *BinToHex(int size, PBYTE data) return szresult;
}
-void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData)
+void HexToBin(wchar_t *inData, ULONG &size, LPBYTE &outData)
{
- TCHAR buffer[32] = { 0 };
- _tcsncpy(buffer, L"0x", _countof(L"0x"));
- _tcsncpy(buffer + 2, inData, HEX_SIZE);
- _stscanf(buffer, L"%x", &size);
+ wchar_t buffer[32] = { 0 };
+ wcsncpy(buffer, L"0x", _countof(L"0x"));
+ wcsncpy(buffer + 2, inData, HEX_SIZE);
+ swscanf(buffer, L"%x", &size);
outData = (unsigned char*)new char[size * 2];
- TCHAR *tmp = inData + HEX_SIZE;
+ wchar_t *tmp = inData + HEX_SIZE;
buffer[4] = '\0'; //mark the end of the string
for (UINT i = 0; i < size; i++) {
- _tcsncpy(buffer + 2, &tmp[i * 2], 2);
- _stscanf(buffer, L"%hhx", &outData[i]);
+ wcsncpy(buffer + 2, &tmp[i * 2], 2);
+ swscanf(buffer, L"%hhx", &outData[i]);
}
}
-int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, int size)
+int GetStringFromDatabase(char *szSettingName, wchar_t *szError, wchar_t *szResult, int size)
{
DBVARIANT dbv = { 0 };
int res = 1;
@@ -117,7 +117,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, res = 0;
size_t tmp = mir_tstrlen(dbv.ptszVal);
size_t len = (tmp < size - 1) ? tmp : size - 1;
- _tcsncpy(szResult, dbv.ptszVal, len);
+ wcsncpy(szResult, dbv.ptszVal, len);
szResult[len] = '\0';
mir_free(dbv.ptszVal);
}
@@ -125,7 +125,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, res = 1;
size_t tmp = mir_tstrlen(szError);
size_t len = (tmp < size - 1) ? tmp : size - 1;
- _tcsncpy(szResult, szError, len);
+ wcsncpy(szResult, szError, len);
szResult[len] = '\0';
}
return res;
@@ -220,11 +220,11 @@ int ThreadCheckEmail(int bForceAttempt) return 0;
}
-void _popupUtil(TCHAR* szMsg)
+void _popupUtil(wchar_t* szMsg)
{
POPUPDATAT ppd = { 0 };
ppd.lchIcon = hiMailIcon;
- _tcsncpy(ppd.lptzContactName, L"Exchange notifier", MAX_CONTACTNAME - 1);
- _tcsncpy(ppd.lptzText, szMsg, MAX_SECONDLINE - 1);
+ wcsncpy(ppd.lptzContactName, L"Exchange notifier", MAX_CONTACTNAME - 1);
+ wcsncpy(ppd.lptzText, szMsg, MAX_SECONDLINE - 1);
PUAddPopupT(&ppd); //show a popup to tell the user what we're doing.
}
diff --git a/plugins/Exchange/src/utils.h b/plugins/Exchange/src/utils.h index c430a5f995..efc7942b95 100644 --- a/plugins/Exchange/src/utils.h +++ b/plugins/Exchange/src/utils.h @@ -34,16 +34,16 @@ int Log(char *format, ...); int Info(char *title, char *format, ...);
char *BinToHex(int size, PBYTE data);
-void HexToBin(TCHAR *inData, ULONG &size, PBYTE &outData);
+void HexToBin(wchar_t *inData, ULONG &size, PBYTE &outData);
void ScreenToClient(HWND hWnd, LPRECT rect);
void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors);
RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors);
-int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, int size);
+int GetStringFromDatabase(char *szSettingName, wchar_t *szError, wchar_t *szResult, int size);
int ThreadCheckEmail(int bForceAttempt);
-void _popupUtil(TCHAR *szMsg);
+void _popupUtil(wchar_t *szMsg);
#endif
\ No newline at end of file |