diff options
Diffstat (limited to 'plugins/Exchange/src')
-rw-r--r-- | plugins/Exchange/src/MirandaExchange.cpp | 18 | ||||
-rw-r--r-- | plugins/Exchange/src/emails.cpp | 6 | ||||
-rw-r--r-- | plugins/Exchange/src/utils.cpp | 91 |
3 files changed, 46 insertions, 69 deletions
diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index 9c2dabe005..9f9b77881d 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -556,7 +556,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) if ( !(FAILED(hr)) || (pMsgSvcAdmin) )
{
- hr = pMsgSvcAdmin->CreateMsgService((LPTSTR)"MSEMS", (LPTSTR)""/*"Microsoft Exchange Server"*/, NULL, 0);
+ hr = pMsgSvcAdmin->CreateMsgService(_T("MSEMS"), _T("")/*"Microsoft Exchange Server"*/, NULL, 0);
if (!FAILED(hr))
{
@@ -601,10 +601,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) (LPMAPIUID) pRows->aRow->lpProps[iSvcUID].Value.bin.lpb,
0, NULL, 2, spval);
- if (NULL!=szUniqName)
- {
- delete[] szUniqName;
- }
+ delete[] szUniqName;
}
}
}
@@ -741,16 +738,13 @@ HRESULT CMirandaExchange::MarkAsRead( LPTSTR szEntryID ) HexToBin(szEntryID, ulC, lpData);
- HRESULT hr = CallOpenEntry( m_lpMDB, NULL, NULL, m_lpMAPISession, ulC, (LPENTRYID) lpData, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&lpMessage);
- if (NULL != lpData)
- {
- delete lpData;
- }
+ CallOpenEntry( m_lpMDB, NULL, NULL, m_lpMAPISession, ulC, (LPENTRYID) lpData, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&lpMessage);
+ delete lpData;
if ( NULL != lpMessage)
{
- hr = lpMessage->SetReadFlag( 0 );
- hr = lpMessage->SaveChanges(FORCE_SAVE);
+ lpMessage->SetReadFlag( 0 );
+ lpMessage->SaveChanges(FORCE_SAVE);
lpMessage->Release();
lpMessage = NULL;
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 25261a4ea2..96b85764a5 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -161,7 +161,7 @@ int CExchangeServer::IsServerAvailable() // if connected then close smtp connection by sending a quit message
bAvailable = 1;
char message[] = "quit\n";
- send(sServer, message, strlen(message), 0);
+ send(sServer, message, (int)strlen(message), 0);
}
res = closesocket(sServer); //close the socket
return bAvailable;
@@ -307,8 +307,8 @@ int ShowPopupMessage(TCHAR *title, TCHAR *message, int cUnreadEmails) popup.colorBack = NULL;
popup.colorText = NULL;
popup.lchIcon = hiMailIcon;
- _tcsncpy(popup.lptzContactName, title, MAX_CONTACTNAME);
- _tcsncpy(popup.lptzText, message, MAX_SECONDLINE);
+ _tcsncpy_s(popup.lptzContactName, MAX_CONTACTNAME, title, _TRUNCATE);
+ _tcsncpy_s(popup.lptzText, MAX_SECONDLINE, message, _TRUNCATE);
popup.PluginWindowProc = DlgProcPopup;
popup.PluginData = (int *) cUnreadEmails;
return PUAddPopupT(&popup);
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index 2d89cd267e..21b3643df2 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -71,9 +71,8 @@ int Info(char *title, char *format, ...) va_start(vararg, format);
tBytes = mir_vsnprintf(str, sizeof(str), format, vararg);
if (tBytes > 0)
- {
- str[tBytes] = 0;
- }
+ str[tBytes] = 0;
+
va_end(vararg);
return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION);
}
@@ -83,7 +82,6 @@ int Info(char *title, char *format, ...) char *BinToHex(int size, PBYTE data)
{
char *szresult = NULL;
- char buffer[32] = {0}; //should be more than enough
int maxSize = size * 2 + HEX_SIZE + 1;
szresult = (char *) new char[ maxSize ];
mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size);
@@ -98,16 +96,13 @@ void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData) _tcsncpy(buffer + 2, inData, HEX_SIZE);
_stscanf(buffer, _T("%x"), &size);
outData = (unsigned char*)new char[size*2];
- UINT i;
- //size = i;
+
TCHAR *tmp = inData + HEX_SIZE;
buffer[4] = '\0'; //mark the end of the string
- for (i = 0; i < size; i++)
- {
- _tcsncpy(buffer + 2, &tmp[i * 2], 2);
- _stscanf(buffer, _T("%x"), &outData[i]);
- }
- i = size;
+ for (UINT i = 0; i < size; i++) {
+ _tcsncpy(buffer + 2, &tmp[i * 2], 2);
+ _stscanf(buffer, _T("%x"), &outData[i]);
+ }
}
int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, int size)
@@ -116,22 +111,21 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, int res = 1;
int len;
dbv.type = DBVT_ASCIIZ;
- if (db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0)
- {
- res = 0;
- int tmp = _tcslen(dbv.ptszVal);
- len = (tmp < size - 1) ? tmp : size - 1;
- _tcsncpy(szResult, dbv.ptszVal, len);
- szResult[len] = '\0';
- mir_free(dbv.ptszVal);
- }
- else{
- res = 1;
- int tmp = _tcslen(szError);
- len = (tmp < size - 1) ? tmp : size - 1;
- _tcsncpy(szResult, szError, len);
- szResult[len] = '\0';
- }
+ if (db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) {
+ res = 0;
+ int tmp = _tcslen(dbv.ptszVal);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ _tcsncpy(szResult, dbv.ptszVal, len);
+ szResult[len] = '\0';
+ mir_free(dbv.ptszVal);
+ }
+ else {
+ res = 1;
+ int tmp = _tcslen(szError);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ _tcsncpy(szResult, szError, len);
+ szResult[len] = '\0';
+ }
return res;
}
@@ -155,9 +149,8 @@ void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) RECT rChild;
if (parentPos->flags & SWP_NOSIZE)
- {
- return;
- }
+ return;
+
GetWindowRect(parentPos->hwnd, &rParent);
rChild = AnchorCalcPos(window, &rParent, parentPos, anchors);
MoveWindow(window, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, FALSE);
@@ -174,13 +167,10 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int cx = rParent->right - rParent->left;
int cy = rParent->bottom - rParent->top;
if ((cx == parentPos->cx) && (cy == parentPos->cy))
- {
- return rChild;
- }
+ return rChild;
+
if (parentPos->flags & SWP_NOSIZE)
- {
- return rChild;
- }
+ return rChild;
rTmp.left = parentPos->x - rParent->left;
rTmp.right = (parentPos->x + parentPos->cx) - rParent->right;
@@ -194,21 +184,17 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, rChild.bottom += cy;
//expanded the window accordingly, now we need to enforce the anchors
if ((anchors & ANCHOR_LEFT) && (!(anchors & ANCHOR_RIGHT)))
- {
- rChild.right -= cx;
- }
+ rChild.right -= cx;
+
if ((anchors & ANCHOR_TOP) && (!(anchors & ANCHOR_BOTTOM)))
- {
- rChild.bottom -= cy;
- }
+ rChild.bottom -= cy;
+
if ((anchors & ANCHOR_RIGHT) && (!(anchors & ANCHOR_LEFT)))
- {
- rChild.left += cx;
- }
+ rChild.left += cx;
+
if ((anchors & ANCHOR_BOTTOM) && (!(anchors & ANCHOR_TOP)))
- {
- rChild.top += cy;
- }
+ rChild.top += cy;
+
return rChild;
}
@@ -219,9 +205,8 @@ DWORD WINAPI CheckEmailWorkerThread(LPVOID data) int bForceAttempt = (int) data;
if (!exchangeServer.IsConnected())
- {
- exchangeServer.Connect(bForceAttempt);
- }
+ exchangeServer.Connect(bForceAttempt);
+
exchangeServer.Check(bForceAttempt);
LeaveCriticalSection(&csCheck);
@@ -245,6 +230,4 @@ void _popupUtil(char* szMsg) _tcscpy(ppd.lptzContactName, _T("Exchange notifier"));
_tcscpy(ppd.lptzText, mir_a2t(szMsg));
PUAddPopupT(&ppd); //show a popup to tell the user what we're doing.
-
-
}
|