summaryrefslogtreecommitdiff
path: root/plugins/Exchange/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Exchange/src')
-rw-r--r--plugins/Exchange/src/dlg_handlers.cpp50
-rw-r--r--plugins/Exchange/src/utils.cpp18
2 files changed, 32 insertions, 36 deletions
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp
index badc63fc33..0839e0a5d2 100644
--- a/plugins/Exchange/src/dlg_handlers.cpp
+++ b/plugins/Exchange/src/dlg_handlers.cpp
@@ -29,13 +29,13 @@ static WNDPROC OldListProc;
INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing; //true when dialog is being created
-
+
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWnd);
{
bInitializing = 1;
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
dbv.type = DBVT_ASCIIZ;
int bCheck = db_get_b(NULL, ModuleName, "Check", 1);
@@ -57,7 +57,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
CheckDlgButton(hWnd, IDC_RECONNECT, (db_get_b(NULL, ModuleName, "Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, db_get_dw(NULL, ModuleName, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE);
- CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL) db_get_b(NULL, ModuleName, "UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL)db_get_b(NULL, ModuleName, "UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), ServiceExists(MS_POPUP_ADDPOPUPT)); //disable the popups checkbox if no popup module is present
CheckDlgButton(hWnd, IDC_CHECK_EMAILS, (bCheck) ? BST_CHECKED : BST_UNCHECKED);
@@ -68,7 +68,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hWnd, IDC_PORT_EDIT), portCheck);
int retries = db_get_b(NULL, ModuleName, "MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
- SetDlgItemInt(hWnd,IDC_MAX_RETRIES,retries,FALSE);
+ SetDlgItemInt(hWnd, IDC_MAX_RETRIES, retries, FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_RECONNECT_INTERVAL), IsDlgButtonChecked(hWnd, IDC_RECONNECT));
@@ -104,7 +104,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
@@ -121,17 +121,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
db_set_ts(NULL, ModuleName, "Server", buffer);
GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer));
- db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd,IDC_PORT_EDIT,NULL,FALSE));
+ db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, NULL, FALSE));
- db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd,IDC_INTERVAL_EDIT,NULL,FALSE));
- db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd,IDC_RECONNECT_INTERVAL,NULL,FALSE));
+ db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, NULL, FALSE));
+ db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, NULL, FALSE));
db_set_b(NULL, ModuleName, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
db_set_b(NULL, ModuleName, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
db_set_b(NULL, ModuleName, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
- db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd,IDC_MAX_RETRIES,NULL,FALSE));
+ db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, NULL, FALSE));
exchangeServer.Reconnect(); //login info may be changed
UpdateTimers(); //interval might get changed
@@ -165,7 +165,7 @@ int CALLBACK ListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYDOWN:
if (wParam == 'X')
- SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
+ SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
break;
@@ -192,9 +192,9 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
{
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hiMailIcon);
- LVCOLUMN col = {0};
+ LVCOLUMN col = { 0 };
HWND hList = GetDlgItem(hWnd, IDC_EMAILS_LIST);
- OldListProc = (WNDPROC) SetWindowLongPtr(hList, GWLP_WNDPROC, (LONG_PTR) ListSubclassProc);
+ OldListProc = (WNDPROC)SetWindowLongPtr(hList, GWLP_WNDPROC, (LONG_PTR)ListSubclassProc);
ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.cx = 100;
@@ -223,8 +223,8 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
HWND hList = GetDlgItem(hWnd, IDC_EMAILS_LIST);
ListView_DeleteAllItems(hList);
int count = GetWindowLongPtr(hWnd, GWLP_USERDATA);
- LVITEM item = {0};
- TEmailHeader email = {0};
+ LVITEM item = { 0 };
+ TEmailHeader email = { 0 };
email.cbSize = sizeof(TEmailHeader);
TCHAR sender[1024] = _T("");
TCHAR subject[1024] = _T("");
@@ -235,8 +235,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
email.szSubject = subject;
item.mask = LVIF_TEXT;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
exchangeServer.GetEmailHeader(i, &email);
item.iItem = i;
item.iSubItem = 0;
@@ -268,7 +267,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
{
HDWP hdWnds = BeginDeferWindowPos(3);
RECT rParent;
- WINDOWPOS *wndPos = (WINDOWPOS *) lParam;
+ WINDOWPOS *wndPos = (WINDOWPOS *)lParam;
if ((!wndPos) || (wndPos->flags & SWP_NOSIZE))
break;
@@ -299,7 +298,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
for (int i = 0; i < count; i++) {
if (ListView_GetCheckState(hList, i)) {
TCHAR emailID[2048]; //uhh ohh
- LVITEM item = {0};
+ LVITEM item = { 0 };
item.iItem = i;
item.mask = LVIF_TEXT;
item.iSubItem = 2;
@@ -310,8 +309,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
}
}
count = exchangeServer.GetUnreadEmailsCount();
- if (count > 0)
- {
+ if (count > 0) {
SetWindowLongPtr(hWnd, GWLP_USERDATA, count);
SendMessage(hWnd, EXM_UPDATE_EMAILS, 0, 0);
}
@@ -330,12 +328,10 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
switch (HIWORD(wParam)) {
case STN_CLICKED:
- {
- int count = (int) PUGetPluginData(hWnd);
- ShowEmailsWindow(count);
- PUDeletePopup(hWnd);
- break;
- }
+ int count = (INT_PTR)PUGetPluginData(hWnd);
+ ShowEmailsWindow(count);
+ PUDeletePopup(hWnd);
+ break;
}
break;
@@ -344,4 +340,4 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
-} \ No newline at end of file
+}
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp
index 32a7a79c01..97589f181f 100644
--- a/plugins/Exchange/src/utils.cpp
+++ b/plugins/Exchange/src/utils.cpp
@@ -86,7 +86,7 @@ char *BinToHex(int size, PBYTE data)
{
char *szresult = NULL;
int maxSize = size * 2 + HEX_SIZE + 1;
- szresult = (char *) new char[ maxSize ];
+ szresult = (char *) new char[maxSize];
mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size);
bin2hex(data, size, szresult + HEX_SIZE);
return szresult;
@@ -94,11 +94,11 @@ char *BinToHex(int size, PBYTE data)
void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData)
{
- TCHAR buffer[32] = {0};
- _tcsncpy(buffer, _T("0x"),_countof(_T("0x")));
+ TCHAR buffer[32] = { 0 };
+ _tcsncpy(buffer, _T("0x"), _countof(_T("0x")));
_tcsncpy(buffer + 2, inData, HEX_SIZE);
_stscanf(buffer, _T("%x"), &size);
- outData = (unsigned char*)new char[size*2];
+ outData = (unsigned char*)new char[size * 2];
TCHAR *tmp = inData + HEX_SIZE;
buffer[4] = '\0'; //mark the end of the string
@@ -110,7 +110,7 @@ void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData)
int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, int size)
{
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
int res = 1;
dbv.type = DBVT_ASCIIZ;
if (db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) {
@@ -204,7 +204,7 @@ void __cdecl CheckEmailWorkerThread(void *data)
{
mir_cslock lck(csCheck);
- int bForceAttempt = (int) data;
+ int bForceAttempt = (INT_PTR)data;
if (!exchangeServer.IsConnected())
exchangeServer.Connect(bForceAttempt);
@@ -222,9 +222,9 @@ int ThreadCheckEmail(int bForceAttempt)
void _popupUtil(TCHAR* szMsg)
{
- POPUPDATAT ppd = {0};
+ POPUPDATAT ppd = { 0 };
ppd.lchIcon = hiMailIcon;
- _tcsncpy(ppd.lptzContactName, _T("Exchange notifier"), MAX_CONTACTNAME-1);
- _tcsncpy(ppd.lptzText, szMsg,MAX_SECONDLINE-1);
+ _tcsncpy(ppd.lptzContactName, _T("Exchange notifier"), MAX_CONTACTNAME - 1);
+ _tcsncpy(ppd.lptzText, szMsg, MAX_SECONDLINE - 1);
PUAddPopupT(&ppd); //show a popup to tell the user what we're doing.
}