From cbe3cb21f5bca61a03bbd4ae811ee906e09b3f4f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 13 Jun 2015 16:55:17 +0000 Subject: - miranda32.exe now does nothing bug extends PATH to %miranda_root%\libs and loads mir_app.dll; - everything that was in miranda32.exe (including resources) moved to mir_app.dll; - exports from mir_app.dll now available for using directly, without perversions; - src/stdplug.h deleted; git-svn-id: http://svn.miranda-ng.org/main/trunk@14143 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/ui.cpp | 651 ++++++++++++++++++------------------------ 1 file changed, 276 insertions(+), 375 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 7830e6fa46..597501892f 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -26,45 +26,40 @@ COLORREF custColours[16]={0}; static int CALLBACK EnumFontsProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX* /*lpntme*/, int /*FontType*/, LPARAM lParam) { - if (!IsWindow((HWND) lParam)) + if (!IsWindow((HWND)lParam)) return FALSE; - if (SendMessage((HWND) lParam, CB_FINDSTRINGEXACT, 1, (LPARAM) lpelfe->elfLogFont.lfFaceName) == CB_ERR) - SendMessage((HWND) lParam, CB_ADDSTRING, 0, (LPARAM) lpelfe->elfLogFont.lfFaceName); + if (SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, 1, (LPARAM)lpelfe->elfLogFont.lfFaceName) == CB_ERR) + SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)lpelfe->elfLogFont.lfFaceName); return TRUE; } void DrawMyControl(HDC hDC, HWND /*hwndButton*/, HANDLE hTheme, UINT iState, RECT rect) { BOOL bIsPressed = (iState & ODS_SELECTED); - BOOL bIsFocused = (iState & ODS_FOCUS); - if (hTheme) - { - DWORD state = (bIsPressed)?PBS_PRESSED:PBS_NORMAL; - if (state == PBS_NORMAL) - { + BOOL bIsFocused = (iState & ODS_FOCUS); + if (hTheme) { + DWORD state = (bIsPressed) ? PBS_PRESSED : PBS_NORMAL; + if (state == PBS_NORMAL) { if (bIsFocused) state = PBS_DEFAULTED; } - rect.top-=1; - rect.left-=1; - DrawThemeBackground(hTheme, hDC, BP_PUSHBUTTON,state, &rect, NULL); + rect.top -= 1; + rect.left -= 1; + DrawThemeBackground(hTheme, hDC, BP_PUSHBUTTON, state, &rect, NULL); } - else - { - if (bIsFocused) - { - HBRUSH br = CreateSolidBrush(RGB(0,0,0)); + else { + if (bIsFocused) { + HBRUSH br = CreateSolidBrush(RGB(0, 0, 0)); FrameRect(hDC, &rect, br); InflateRect(&rect, -1, -1); DeleteObject(br); } // if COLORREF crColor = GetSysColor(COLOR_BTNFACE); HBRUSH brBackground = CreateSolidBrush(crColor); - FillRect(hDC,&rect, brBackground); + FillRect(hDC, &rect, brBackground); DeleteObject(brBackground); // Draw pressed button - if (bIsPressed) - { + if (bIsPressed) { HBRUSH brBtnShadow = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW)); FrameRect(hDC, &rect, brBtnShadow); DeleteObject(brBtnShadow); @@ -84,19 +79,18 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L { CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) - { + switch (msg) { case WM_INITDIALOG: { SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASPUSHBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETEVENTMASK, 0, ENM_CHANGE|ENM_SELCHANGE|ENM_REQUESTRESIZE); + SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETEVENTMASK, 0, ENM_CHANGE | ENM_SELCHANGE | ENM_REQUESTRESIZE); SendDlgItemMessage(hwndDlg, IDC_BACKGROUNDCOLORPICKER, CPM_SETCOLOUR, 0, 0x00ffffff); - LOGFONT lf ={0}; + LOGFONT lf = { 0 }; HDC hdc = GetDC(hwndDlg); lf.lfCharSet = DEFAULT_CHARSET; lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontsProc, (LPARAM) GetDlgItem(hwndDlg, IDC_TYPEFACE), 0); + EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontsProc, (LPARAM)GetDlgItem(hwndDlg, IDC_TYPEFACE), 0); ReleaseDC(hwndDlg, hdc); SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM)TEXT("8")); SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM)TEXT("10")); @@ -106,21 +100,19 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM)TEXT("24")); SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM)TEXT("36")); SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SETCURSEL, 2, 0); - if (SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_SELECTSTRING, 1, (LPARAM)TEXT("Arial"))!=CB_ERR) - { + if (SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_SELECTSTRING, 1, (LPARAM)TEXT("Arial")) != CB_ERR) { CHARFORMAT2 cf; cf.cbSize = sizeof(cf); - cf.yHeight=12*20; - cf.dwMask=CFM_SIZE|CFM_FACE; + cf.yHeight = 12 * 20; + cf.dwMask = CFM_SIZE | CFM_FACE; mir_tstrcpy(cf.szFaceName, TEXT("Arial")); SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } - else - { + else { CHARFORMAT2 cf; cf.cbSize = sizeof(cf); - cf.yHeight=12*20; - cf.dwMask=CFM_SIZE; + cf.yHeight = 12 * 20; + cf.dwMask = CFM_SIZE; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } break; @@ -131,57 +123,50 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_SIZING: { - RECT* rect=(RECT*)lParam; + RECT* rect = (RECT*)lParam; #define MIN_HEIGHT 200 #define MIN_WIDTH 400 - if (WMSZ_RIGHT==wParam||WMSZ_TOPRIGHT==wParam||WMSZ_BOTTOMRIGHT==wParam) - { - if (rect->right-rect->leftright=rect->left+MIN_WIDTH; + if (WMSZ_RIGHT == wParam || WMSZ_TOPRIGHT == wParam || WMSZ_BOTTOMRIGHT == wParam) { + if (rect->right - rect->left < MIN_WIDTH) + rect->right = rect->left + MIN_WIDTH; } - if (WMSZ_LEFT==wParam||WMSZ_TOPLEFT==wParam||WMSZ_BOTTOMLEFT==wParam) - { - if (rect->right-rect->leftleft=rect->right-MIN_WIDTH; + if (WMSZ_LEFT == wParam || WMSZ_TOPLEFT == wParam || WMSZ_BOTTOMLEFT == wParam) { + if (rect->right - rect->left < MIN_WIDTH) + rect->left = rect->right - MIN_WIDTH; } - if (WMSZ_TOP==wParam||WMSZ_TOPRIGHT==wParam||WMSZ_TOPLEFT==wParam) - { - if (rect->bottom-rect->toptop=rect->bottom-MIN_HEIGHT; + if (WMSZ_TOP == wParam || WMSZ_TOPRIGHT == wParam || WMSZ_TOPLEFT == wParam) { + if (rect->bottom - rect->top < MIN_HEIGHT) + rect->top = rect->bottom - MIN_HEIGHT; } - if (WMSZ_BOTTOM==wParam||WMSZ_BOTTOMLEFT==wParam||WMSZ_BOTTOMRIGHT==wParam) - { - if (rect->bottom-rect->topbottom=rect->top+MIN_HEIGHT; + if (WMSZ_BOTTOM == wParam || WMSZ_BOTTOMLEFT == wParam || WMSZ_BOTTOMRIGHT == wParam) { + if (rect->bottom - rect->top < MIN_HEIGHT) + rect->bottom = rect->top + MIN_HEIGHT; } break; } case WM_SIZE: { - int width=LOWORD(lParam); - int height=HIWORD(lParam); - SetWindowPos(GetDlgItem(hwndDlg, IDC_PROFILE),HWND_TOP,6,60,width-12,height-67,0); // this 'case' should go away - SetWindowPos(GetDlgItem(hwndDlg, IDC_SETPROFILE),HWND_TOP,width-97,height-224,0,0,SWP_NOSIZE); // since there's no profile window resize anymore + int width = LOWORD(lParam); + int height = HIWORD(lParam); + SetWindowPos(GetDlgItem(hwndDlg, IDC_PROFILE), HWND_TOP, 6, 60, width - 12, height - 67, 0); // this 'case' should go away + SetWindowPos(GetDlgItem(hwndDlg, IDC_SETPROFILE), HWND_TOP, width - 97, height - 224, 0, 0, SWP_NOSIZE); // since there's no profile window resize anymore break; } case WM_NOTIFY: - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case IDC_PROFILE: - if (((LPNMHDR)lParam)->code==EN_SELCHANGE) - { + if (((LPNMHDR)lParam)->code == EN_SELCHANGE) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_FACE | CFM_SIZE; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); - if (SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_SELECTSTRING, 1, (LPARAM)cfOld.szFaceName)==-1) - { + if (SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_SELECTSTRING, 1, (LPARAM)cfOld.szFaceName) == -1) { SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_ADDSTRING, 0, (LPARAM)cfOld.szFaceName); SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_SELECTSTRING, 1, (LPARAM)cfOld.szFaceName); } char size[10]; - _itoa(cfOld.yHeight/20,size,sizeof(size)); + _itoa(cfOld.yHeight / 20, size, sizeof(size)); //SetDlgItemText(hwndDlg, IDC_FONTSIZE, size); SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SELECTSTRING, 1, (LPARAM)size); InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE); @@ -191,22 +176,19 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L InvalidateRect(GetDlgItem(hwndDlg, IDC_ITALIC), NULL, FALSE); InvalidateRect(GetDlgItem(hwndDlg, IDC_UNDERLINE), NULL, FALSE); } - else if (((LPNMHDR)lParam)->code==EN_REQUESTRESIZE) - { + else if (((LPNMHDR)lParam)->code == EN_REQUESTRESIZE) { // REQRESIZE* rr= (REQRESIZE*)lParam; //SetWindowPos(GetDlgItem(hwndDlg, IDC_PROFILE),HWND_TOP,rr->rc.left,rr->rc.top,rr->rc.right,rr->rc.bottom,0); } break; default: - if (((LPNMHDR)lParam)->code == PSN_PARAMCHANGED) - { + if (((LPNMHDR)lParam)->code == PSN_PARAMCHANGED) { ppro = (CAimProto*)((PSHNOTIFY*)lParam)->lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)ppro); DBVARIANT dbv; - if (!db_get_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv)) - { + if (!db_get_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv)) { html_decode(dbv.pszVal); TCHAR *txt = mir_utf8decodeT(dbv.pszVal); SetDlgItemText(hwndDlg, IDC_PROFILE, txt); @@ -221,197 +203,175 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L { CloseThemeData(hThemeButton); hThemeButton = OpenThemeData(GetDlgItem(hwndDlg, IDC_BOLD), L"Button"); - LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) lParam; - if (lpDIS->CtlID == IDC_SUPERSCRIPT) - { + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)lParam; + if (lpDIS->CtlID == IDC_SUPERSCRIPT) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_SUPERSCRIPT; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT); - if (isSuper) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem); + if (isSuper) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sup_scrpt"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("sup_scrpt"); } - else - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + else { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsup_scrpt"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("nsup_scrpt"); } } - else if (lpDIS->CtlID == IDC_NORMALSCRIPT) - { + else if (lpDIS->CtlID == IDC_NORMALSCRIPT) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); - cfOld.dwMask = CFM_SUBSCRIPT|CFM_SUPERSCRIPT; + cfOld.dwMask = CFM_SUBSCRIPT | CFM_SUPERSCRIPT; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isSub = (cfOld.dwEffects & CFE_SUBSCRIPT) && (cfOld.dwMask & CFM_SUBSCRIPT); BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT); - if (!isSub&&!isSuper) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem); + if (!isSub&&!isSuper) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("norm_scrpt"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("norm_scrpt"); } - else - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + else { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nnorm_scrpt"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("nnorm_scrpt"); } } - else if (lpDIS->CtlID == IDC_SUBSCRIPT) - { + else if (lpDIS->CtlID == IDC_SUBSCRIPT) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_SUBSCRIPT; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isSub = (cfOld.dwEffects & CFE_SUBSCRIPT) && (cfOld.dwMask & CFM_SUBSCRIPT); - if (isSub) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem); + if (isSub) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sub_scrpt"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("sub_scrpt"); } - else - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + else { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nsub_scrpt"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("nsub_scrpt"); } } - else if (lpDIS->CtlID == IDC_BOLD) - { + else if (lpDIS->CtlID == IDC_BOLD) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_BOLD; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isBold = (cfOld.dwEffects & CFE_BOLD) && (cfOld.dwMask & CFM_BOLD); - if (!isBold) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + if (!isBold) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nbold"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("nbold"); } - else - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem); + else { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BOLD), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("bold"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("bold"); } } - else if (lpDIS->CtlID == IDC_ITALIC) - { + else if (lpDIS->CtlID == IDC_ITALIC) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_ITALIC; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isItalic = (cfOld.dwEffects & CFE_ITALIC) && (cfOld.dwMask & CFM_ITALIC); - if (!isItalic) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_ITALIC),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + if (!isItalic) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_ITALIC), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nitalic"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("nitalic"); } - else - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_ITALIC),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem); + else { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_ITALIC), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("italic"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("italic"); } } - else if (lpDIS->CtlID == IDC_UNDERLINE) - { + else if (lpDIS->CtlID == IDC_UNDERLINE) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_UNDERLINE; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isUnderline = (cfOld.dwEffects & CFE_UNDERLINE) && (cfOld.dwMask & CFM_UNDERLINE); - if (!isUnderline) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_UNDERLINE),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + if (!isUnderline) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_UNDERLINE), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nundrln"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("nundrln"); } - else - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_UNDERLINE),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem); + else { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_UNDERLINE), hThemeButton, lpDIS->itemState | ODS_SELECTED, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("undrln"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("undrln"); } } - else if (lpDIS->CtlID == IDC_FOREGROUNDCOLOR) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + else if (lpDIS->CtlID == IDC_FOREGROUNDCOLOR) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("foreclr"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("foreclr"); HBRUSH hbr = CreateSolidBrush(foreground); - HPEN hp = CreatePen(PS_SOLID, 1, ~foreground&0x00ffffff); - SelectObject(lpDIS->hDC,hp); - RECT rect=lpDIS->rcItem; - rect.top+=18; - rect.bottom-=4; - rect.left+=5; - rect.right-=5; - Rectangle(lpDIS->hDC,rect.left-1,rect.top-1,rect.right+1,rect.bottom+1); - FillRect(lpDIS->hDC,&rect, hbr); + HPEN hp = CreatePen(PS_SOLID, 1, ~foreground & 0x00ffffff); + SelectObject(lpDIS->hDC, hp); + RECT rect = lpDIS->rcItem; + rect.top += 18; + rect.bottom -= 4; + rect.left += 5; + rect.right -= 5; + Rectangle(lpDIS->hDC, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1); + FillRect(lpDIS->hDC, &rect, hbr); DeleteObject(hbr); DeleteObject(hp); } - else if (lpDIS->CtlID == IDC_FOREGROUNDCOLORPICKER) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLORPICKER),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + else if (lpDIS->CtlID == IDC_FOREGROUNDCOLORPICKER) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLORPICKER), hThemeButton, lpDIS->itemState, lpDIS->rcItem); HBRUSH hbr = CreateSolidBrush(foreground); - HPEN hp = CreatePen(PS_SOLID, 1,~foreground&0x00ffffff); - SelectObject(lpDIS->hDC,hbr); - SelectObject(lpDIS->hDC,hp); + HPEN hp = CreatePen(PS_SOLID, 1, ~foreground & 0x00ffffff); + SelectObject(lpDIS->hDC, hbr); + SelectObject(lpDIS->hDC, hp); POINT tri[3]; - tri[0].x=3; - tri[0].y=10; - tri[1].x=9; - tri[1].y=10; - tri[2].x=6; - tri[2].y=15; - Polygon(lpDIS->hDC,tri,3); + tri[0].x = 3; + tri[0].y = 10; + tri[1].x = 9; + tri[1].y = 10; + tri[2].x = 6; + tri[2].y = 15; + Polygon(lpDIS->hDC, tri, 3); DeleteObject(hbr); DeleteObject(hp); } - else if (lpDIS->CtlID == IDC_BACKGROUNDCOLOR) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + else if (lpDIS->CtlID == IDC_BACKGROUNDCOLOR) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), hThemeButton, lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 2, LoadIconEx("backclr"), 16, 16, 0, 0, DI_NORMAL); ReleaseIconEx("backclr"); HBRUSH hbr = CreateSolidBrush(background); - HPEN hp = CreatePen(PS_SOLID, 1, ~background&0x00ffffff); - SelectObject(lpDIS->hDC,hp); - RECT rect=lpDIS->rcItem; - rect.top+=18; - rect.bottom-=4; - rect.left+=5; - rect.right-=5; - Rectangle(lpDIS->hDC,rect.left-1,rect.top-1,rect.right+1,rect.bottom+1); - FillRect(lpDIS->hDC,&rect, hbr); + HPEN hp = CreatePen(PS_SOLID, 1, ~background & 0x00ffffff); + SelectObject(lpDIS->hDC, hp); + RECT rect = lpDIS->rcItem; + rect.top += 18; + rect.bottom -= 4; + rect.left += 5; + rect.right -= 5; + Rectangle(lpDIS->hDC, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1); + FillRect(lpDIS->hDC, &rect, hbr); DeleteObject(hbr); DeleteObject(hp); } - else if (lpDIS->CtlID == IDC_BACKGROUNDCOLORPICKER) - { - DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLORPICKER),hThemeButton,lpDIS->itemState, lpDIS->rcItem); + else if (lpDIS->CtlID == IDC_BACKGROUNDCOLORPICKER) { + DrawMyControl(lpDIS->hDC, GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLORPICKER), hThemeButton, lpDIS->itemState, lpDIS->rcItem); HBRUSH hbr = CreateSolidBrush(background); - HPEN hp = CreatePen(PS_SOLID, 1,~background&0x00ffffff); - SelectObject(lpDIS->hDC,hbr); - SelectObject(lpDIS->hDC,hp); + HPEN hp = CreatePen(PS_SOLID, 1, ~background & 0x00ffffff); + SelectObject(lpDIS->hDC, hbr); + SelectObject(lpDIS->hDC, hp); POINT tri[3]; - tri[0].x=3; - tri[0].y=10; - tri[1].x=9; - tri[1].y=10; - tri[2].x=6; - tri[2].y=15; - Polygon(lpDIS->hDC,tri,3); + tri[0].x = 3; + tri[0].y = 10; + tri[1].x = 9; + tri[1].y = 10; + tri[2].x = 6; + tri[2].y = 15; + Polygon(lpDIS->hDC, tri, 3); DeleteObject(hbr); DeleteObject(hp); } @@ -419,8 +379,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L } case WM_COMMAND: - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case IDC_PROFILE: if (HIWORD(wParam) == EN_CHANGE) EnableWindow(GetDlgItem(hwndDlg, IDC_SETPROFILE), TRUE); @@ -430,7 +389,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L { char* buf = rtf_to_html(hwndDlg, IDC_PROFILE); db_set_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, buf); - if (ppro->state==1) + if (ppro->state == 1) ppro->aim_set_profile(ppro->hServerConn, ppro->seqno, buf);//also see set caps for profile setting mir_free(buf); @@ -439,12 +398,11 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_SUPERSCRIPT: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask=CFM_SUPERSCRIPT; - cf.dwEffects=CFE_SUPERSCRIPT; + cf.dwMask = CFM_SUPERSCRIPT; + cf.dwEffects = CFE_SUPERSCRIPT; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); InvalidateRect(GetDlgItem(hwndDlg, IDC_NORMALSCRIPT), NULL, FALSE); @@ -453,11 +411,10 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_NORMALSCRIPT: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask=CFM_SUPERSCRIPT; + cf.dwMask = CFM_SUPERSCRIPT; cf.dwEffects &= ~CFE_SUPERSCRIPT; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); @@ -467,12 +424,11 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_SUBSCRIPT: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask=CFM_SUBSCRIPT; - cf.dwEffects=CFE_SUBSCRIPT; + cf.dwMask = CFM_SUBSCRIPT; + cf.dwEffects = CFE_SUBSCRIPT; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); InvalidateRect(GetDlgItem(hwndDlg, IDC_SUPERSCRIPT), NULL, FALSE); @@ -481,8 +437,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_BOLD: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_BOLD; @@ -499,8 +454,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_ITALIC: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_ITALIC; @@ -517,8 +471,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_UNDERLINE: - if (HIWORD(wParam)==BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cfOld; cfOld.cbSize = sizeof(CHARFORMAT2); cfOld.dwMask = CFM_UNDERLINE; @@ -535,33 +488,30 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_FOREGROUNDCOLOR: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask=CFM_COLOR; - cf.dwEffects=0; - cf.crTextColor=foreground; + cf.dwMask = CFM_COLOR; + cf.dwEffects = 0; + cf.crTextColor = foreground; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); - SetWindowPos(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLORPICKER),GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR),0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + SetWindowPos(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLORPICKER), GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); } break; case IDC_FOREGROUNDCOLORPICKER: - if (HIWORD(wParam) == BN_CLICKED) - { - CHOOSECOLOR cc={0}; - custColours[0]=foreground; - custColours[1]=background; - cc.lStructSize=sizeof(CHOOSECOLOR); - cc.hwndOwner=hwndDlg; - cc.hInstance=(HWND)GetModuleHandle(NULL); - cc.lpCustColors=custColours; - cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT; - if (ChooseColor(&cc)) - { - foreground=cc.rgbResult; + if (HIWORD(wParam) == BN_CLICKED) { + CHOOSECOLOR cc = { 0 }; + custColours[0] = foreground; + custColours[1] = background; + cc.lStructSize = sizeof(CHOOSECOLOR); + cc.hwndOwner = hwndDlg; + cc.hInstance = (HWND)GetModuleHandleA("mir_app.dll"); + cc.lpCustColors = custColours; + cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT; + if (ChooseColor(&cc)) { + foreground = cc.rgbResult; InvalidateRect(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), NULL, FALSE); } SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); @@ -569,32 +519,29 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_BACKGROUNDCOLOR: - if (HIWORD(wParam) == BN_CLICKED) - { + if (HIWORD(wParam) == BN_CLICKED) { CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask=CFM_BACKCOLOR; - cf.dwEffects=0; - cf.crBackColor=background; + cf.dwMask = CFM_BACKCOLOR; + cf.dwEffects = 0; + cf.crBackColor = background; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); } break; case IDC_BACKGROUNDCOLORPICKER: - if (HIWORD(wParam)==BN_CLICKED) - { - CHOOSECOLOR cc={0}; - custColours[0]=foreground; - custColours[1]=background; - cc.lStructSize=sizeof(CHOOSECOLOR); - cc.hwndOwner=hwndDlg; - cc.hInstance=(HWND)GetModuleHandle(NULL); - cc.lpCustColors=custColours; - cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT; - if (ChooseColor(&cc)) - { - background=cc.rgbResult; + if (HIWORD(wParam) == BN_CLICKED) { + CHOOSECOLOR cc = { 0 }; + custColours[0] = foreground; + custColours[1] = background; + cc.lStructSize = sizeof(CHOOSECOLOR); + cc.hwndOwner = hwndDlg; + cc.hInstance = (HWND)GetModuleHandle(NULL); + cc.lpCustColors = custColours; + cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT; + if (ChooseColor(&cc)) { + background = cc.rgbResult; InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), NULL, FALSE); } SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); @@ -602,13 +549,12 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_TYPEFACE: - if (HIWORD(wParam)==CBN_SELENDOK) - { + if (HIWORD(wParam) == CBN_SELENDOK) { CHARFORMAT2A cf; cf.cbSize = sizeof(cf); - cf.dwMask=CFM_FACE; - cf.dwEffects=0; - SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_GETCURSEL, 0, 0),(LPARAM)cf.szFaceName); + cf.dwMask = CFM_FACE; + cf.dwEffects = 0; + SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_TYPEFACE, CB_GETCURSEL, 0, 0), (LPARAM)cf.szFaceName); SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); break; @@ -616,16 +562,15 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_FONTSIZE: - if (HIWORD(wParam)==CBN_SELENDOK) - { + if (HIWORD(wParam) == CBN_SELENDOK) { CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask=CFM_SIZE; - cf.dwEffects=0; + cf.dwMask = CFM_SIZE; + cf.dwEffects = 0; char chsize[5] = ""; - SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0),(LPARAM)chsize); + SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0), (LPARAM)chsize); //strlcpy(cf.szFaceName,size,mir_strlen(size)+1); - cf.yHeight=atoi(chsize)*20; + cf.yHeight = atoi(chsize) * 20; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); SetFocus(GetDlgItem(hwndDlg, IDC_PROFILE)); break; @@ -645,8 +590,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); DBVARIANT dbv; - switch (msg) - { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_FNAME, EM_LIMITTEXT, 63, 0); @@ -657,26 +601,23 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar break; case WM_NOTIFY: - switch (((LPNMHDR)lParam)->code) - { + switch (((LPNMHDR)lParam)->code) { case PSN_PARAMCHANGED: ppro = (CAimProto*)((LPPSHNOTIFY)lParam)->lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)ppro); if (ppro->wait_conn(ppro->hAdminConn, ppro->hAdminEvent, 0x07)) // Make a connection { - ppro->aim_admin_request_info(ppro->hAdminConn,ppro->admin_seqno,0x01); // Get our screenname - ppro->aim_admin_request_info(ppro->hAdminConn,ppro->admin_seqno,0x11); // Get our email + ppro->aim_admin_request_info(ppro->hAdminConn, ppro->admin_seqno, 0x01); // Get our screenname + ppro->aim_admin_request_info(ppro->hAdminConn, ppro->admin_seqno, 0x11); // Get our email } case PSN_INFOCHANGED: - if (!ppro->getString(AIM_KEY_SN, &dbv)) - { + if (!ppro->getString(AIM_KEY_SN, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_FNAME, dbv.pszVal); db_free(&dbv); } - if (!ppro->getString(AIM_KEY_EM, &dbv)) - { + if (!ppro->getString(AIM_KEY_EM, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_CEMAIL, dbv.pszVal); db_free(&dbv); } @@ -685,17 +626,15 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar break; case WM_COMMAND: - if (LOWORD(wParam) == IDC_SAVECHANGES) - { + if (LOWORD(wParam) == IDC_SAVECHANGES) { if (!ppro->wait_conn(ppro->hAdminConn, ppro->hAdminEvent, 0x07)) // Make a connection break; char name[64]; GetDlgItemTextA(hwndDlg, IDC_FNAME, name, SIZEOF(name)); - if (mir_strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv)) - { + if (mir_strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv)) { if (mir_strcmp(name, dbv.pszVal)) - ppro->aim_admin_format_name(ppro->hAdminConn,ppro->admin_seqno,name); + ppro->aim_admin_format_name(ppro->hAdminConn, ppro->admin_seqno, name); db_free(&dbv); } @@ -704,7 +643,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (mir_strlen(trim_str(email)) > 1 && !ppro->getString(AIM_KEY_EM, &dbv)) // Must be greater than 1 or a SNAC error is thrown. { if (mir_strcmp(email, dbv.pszVal)) - ppro->aim_admin_change_email(ppro->hAdminConn,ppro->admin_seqno,email); + ppro->aim_admin_change_email(ppro->hAdminConn, ppro->admin_seqno, email); db_free(&dbv); } @@ -714,17 +653,14 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, SIZEOF(cpw)); GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, SIZEOF(npw1)); GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, SIZEOF(npw2)); - if (cpw[0] != 0 && npw1[0] != 0 && npw2[0] != 0) - { + if (cpw[0] != 0 && npw1[0] != 0 && npw2[0] != 0) { // AOL only requires that you send the current password and a (single) new password. // Let's allow the client to type (two) new passwords incase they make a mistake so we // can handle any input error locally. - if (mir_strcmp(npw1,npw2) == 0) - { - ppro->aim_admin_change_password(ppro->hAdminConn,ppro->admin_seqno,cpw,npw1); + if (mir_strcmp(npw1, npw2) == 0) { + ppro->aim_admin_change_password(ppro->hAdminConn, ppro->admin_seqno, cpw, npw1); } - else - { + else { SetDlgItemTextA(hwndDlg, IDC_CPW, ""); SetDlgItemTextA(hwndDlg, IDC_NPW1, ""); SetDlgItemTextA(hwndDlg, IDC_NPW2, ""); @@ -735,14 +671,14 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar else if (LOWORD(wParam) == IDC_CONFIRM) // Confirmation { if (ppro->wait_conn(ppro->hAdminConn, ppro->hAdminEvent, 0x07)) // Make a connection - ppro->aim_admin_account_confirm(ppro->hAdminConn,ppro->admin_seqno); + ppro->aim_admin_account_confirm(ppro->hAdminConn, ppro->admin_seqno); } break; } return FALSE; } -int CAimProto::OnUserInfoInit(WPARAM wParam,LPARAM lParam) +int CAimProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) { if (!lParam)//hContact { @@ -829,8 +765,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_COMMAND: - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case IDC_DSSL: { bool dssl = IsDlgButtonChecked(hwndDlg, IDC_DSSL) != 0; @@ -842,7 +777,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_SVRRESET: SetDlgItemTextA(hwndDlg, IDC_HN, IsDlgButtonChecked(hwndDlg, IDC_DSSL) ? AIM_DEFAULT_SERVER_NS : AIM_DEFAULT_SERVER); - SetDlgItemInt(hwndDlg, IDC_PN,ppro->get_default_port(), FALSE); + SetDlgItemInt(hwndDlg, IDC_PN, ppro->get_default_port(), FALSE); break; case IDC_SN: @@ -850,7 +785,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_NK: case IDC_PW: case IDC_HN: - if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) + if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; break; } @@ -858,8 +793,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_NOTIFY: - switch (((LPNMHDR) lParam)->code) - { + switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { char str[128]; @@ -874,8 +808,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //NK if (GetDlgItemTextA(hwndDlg, IDC_NK, str, SIZEOF(str))) ppro->setString(AIM_KEY_NK, str); - else - { + else { GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str)); ppro->setString(AIM_KEY_NK, str); } @@ -926,15 +859,13 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //END PN //Disable Account Type Icons - if (IsDlgButtonChecked(hwndDlg, IDC_AT)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_AT)) { int acc_disabled = ppro->getByte(AIM_KEY_AT, 0); if (!acc_disabled) remove_AT_icons(ppro); ppro->setByte(AIM_KEY_AT, 1); } - else - { + else { int acc_disabled = ppro->getByte(AIM_KEY_AT, 0); if (acc_disabled) add_AT_icons(ppro); @@ -942,15 +873,13 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP } //END //Disable Extra Status Icons - if (IsDlgButtonChecked(hwndDlg, IDC_ES)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_ES)) { int es_disabled = ppro->getByte(AIM_KEY_ES, 0); ppro->setByte(AIM_KEY_ES, 1); if (!es_disabled) remove_ES_icons(ppro); } - else - { + else { int es_disabled = ppro->getByte(AIM_KEY_ES, 0); ppro->setByte(AIM_KEY_ES, 0); if (es_disabled) @@ -959,15 +888,13 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //End //Fake Hiptop - if (IsDlgButtonChecked(hwndDlg, IDC_HF)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_HF)) { int hf = ppro->getByte(AIM_KEY_HF, 0); if (!hf) ShowWindow(GetDlgItem(hwndDlg, IDC_MASQ), SW_SHOW); ppro->setByte(AIM_KEY_HF, 1); } - else - { + else { int hf = ppro->getByte(AIM_KEY_HF, 0); if (hf) ShowWindow(GetDlgItem(hwndDlg, IDC_MASQ), SW_SHOW); @@ -1011,45 +938,40 @@ static INT_PTR CALLBACK privacy_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); int i; - switch (msg) - { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); ppro = (CAimProto*)lParam; - CheckRadioButton(hwndDlg, IDC_ALLOWALL, IDC_BLOCKBELOW, btns[ppro->pd_mode-1]); + CheckRadioButton(hwndDlg, IDC_ALLOWALL, IDC_BLOCKBELOW, btns[ppro->pd_mode - 1]); - for (i=0; iallow_list.getCount(); ++i) + for (i = 0; i < ppro->allow_list.getCount(); ++i) SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_ADDSTRING, 0, (LPARAM)ppro->allow_list[i].name); - for (i=0; iblock_list.getCount(); ++i) + for (i = 0; i < ppro->block_list.getCount(); ++i) SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_ADDSTRING, 0, (LPARAM)ppro->block_list[i].name); CheckDlgButton(hwndDlg, IDC_SIS, (ppro->pref1_flags & 0x400) ? BST_CHECKED : BST_CHECKED); break; case WM_COMMAND: - if (LOWORD(wParam) == IDC_ALLOWADD) - { + if (LOWORD(wParam) == IDC_ALLOWADD) { char nick[80]; GetDlgItemTextA(hwndDlg, IDC_ALLOWEDIT, nick, SIZEOF(nick)); SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick)); } - else if (LOWORD(wParam) == IDC_BLOCKADD) - { + else if (LOWORD(wParam) == IDC_BLOCKADD) { char nick[80]; GetDlgItemTextA(hwndDlg, IDC_BLOCKEDIT, nick, SIZEOF(nick)); SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick)); } - else if (LOWORD(wParam) == IDC_ALLOWREMOVE) - { + else if (LOWORD(wParam) == IDC_ALLOWREMOVE) { i = SendDlgItemMessage(hwndDlg, IDC_ALLOWLIST, LB_GETCURSEL, 0, 0); SendDlgItemMessage(hwndDlg, IDC_ALLOWLIST, LB_DELETESTRING, i, 0); } - else if (LOWORD(wParam) == IDC_BLOCKREMOVE) - { + else if (LOWORD(wParam) == IDC_BLOCKREMOVE) { i = SendDlgItemMessage(hwndDlg, IDC_BLOCKLIST, LB_GETCURSEL, 0, 0); SendDlgItemMessage(hwndDlg, IDC_BLOCKLIST, LB_DELETESTRING, i, 0); } @@ -1058,64 +980,52 @@ static INT_PTR CALLBACK privacy_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_NOTIFY: - if (((LPNMHDR) lParam)->code == PSN_APPLY) - { + if (((LPNMHDR)lParam)->code == PSN_APPLY) { ppro->aim_ssi_update(ppro->hServerConn, ppro->seqno, true); - for (i=0; i<5; ++i) - { - if (IsDlgButtonChecked(hwndDlg, btns[i]) && ppro->pd_mode != i + 1) - { + for (i = 0; i < 5; ++i) { + if (IsDlgButtonChecked(hwndDlg, btns[i]) && ppro->pd_mode != i + 1) { ppro->pd_mode = (char)(i + 1); ppro->pd_flags = 1; ppro->aim_set_pd_info(ppro->hServerConn, ppro->seqno); break; } } - for (i=0; iblock_list.getCount(); ++i) - { + for (i = 0; i < ppro->block_list.getCount(); ++i) { BdListItem& pd = ppro->block_list[i]; - if (SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)pd.name) == LB_ERR) - { + if (SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)pd.name) == LB_ERR) { ppro->aim_delete_contact(ppro->hServerConn, ppro->seqno, pd.name, pd.item_id, 0, 3, false); ppro->block_list.remove(i--); } } i = SendDlgItemMessage(hwndDlg, IDC_BLOCKLIST, LB_GETCOUNT, 0, 0); - for (; i--;) - { + for (; i--;) { char nick[80]; SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_GETTEXT, i, (LPARAM)nick); - if (ppro->block_list.find_id(nick) == 0) - { + if (ppro->block_list.find_id(nick) == 0) { unsigned short id = ppro->block_list.add(nick); ppro->aim_add_contact(ppro->hServerConn, ppro->seqno, nick, id, 0, 3); } } - for (i=0; iallow_list.getCount(); ++i) - { + for (i = 0; i < ppro->allow_list.getCount(); ++i) { BdListItem& pd = ppro->allow_list[i]; - if (SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)pd.name) == LB_ERR) - { + if (SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)pd.name) == LB_ERR) { ppro->aim_delete_contact(ppro->hServerConn, ppro->seqno, pd.name, pd.item_id, 0, 2, false); ppro->allow_list.remove(i--); } } i = SendDlgItemMessage(hwndDlg, IDC_ALLOWLIST, LB_GETCOUNT, 0, 0); - for (; i--;) - { + for (; i--;) { char nick[80]; SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_GETTEXT, i, (LPARAM)nick); - if (ppro->allow_list.find_id(nick) == 0) - { + if (ppro->allow_list.find_id(nick) == 0) { unsigned short id = ppro->allow_list.add(nick); ppro->aim_add_contact(ppro->hServerConn, ppro->seqno, nick, id, 0, 2); } } unsigned mask = (IsDlgButtonChecked(hwndDlg, IDC_SIS) == BST_CHECKED) << 10; - if ((ppro->pref1_flags & 0x400) ^ mask) - { + if ((ppro->pref1_flags & 0x400) ^ mask) { ppro->pref1_flags = (ppro->pref1_flags & ~0x400) | mask; ppro->aim_ssi_update_preferences(ppro->hServerConn, ppro->seqno); } @@ -1138,14 +1048,14 @@ int CAimProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.dwInitParam = LPARAM(this); odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; - odp.ptszTab = LPGENT("Basic"); + odp.ptszTab = LPGENT("Basic"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_AIM); odp.pfnDlgProc = options_dialog; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Privacy"); + odp.ptszTab = LPGENT("Privacy"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_PRIVACY); - odp.pfnDlgProc = privacy_dialog; + odp.pfnDlgProc = privacy_dialog; Options_AddPage(wParam, &odp); return 0; } @@ -1185,7 +1095,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_SN: case IDC_PW: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -1211,8 +1121,8 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM INT_PTR CAimProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) { - return (INT_PTR)CreateDialogParam (hInstance, MAKEINTRESOURCE(IDD_AIMACCOUNT), - (HWND)lParam, first_run_dialog, (LPARAM)this); + return (INT_PTR)CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_AIMACCOUNT), + (HWND)lParam, first_run_dialog, (LPARAM)this); } @@ -1234,8 +1144,8 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR unsigned long it = ppro->getDword(AIM_KEY_IIT, 0); unsigned long hours = it / 60; unsigned long minutes = it % 60; - SetDlgItemInt(hwndDlg, IDC_IIH, hours,0); - SetDlgItemInt(hwndDlg, IDC_IIM, minutes,0); + SetDlgItemInt(hwndDlg, IDC_IIH, hours, 0); + SetDlgItemInt(hwndDlg, IDC_IIM, minutes, 0); } break; @@ -1249,25 +1159,25 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_COMMAND: { - unsigned long hours=GetDlgItemInt(hwndDlg, IDC_IIH,0,0); - unsigned short minutes=(unsigned short)GetDlgItemInt(hwndDlg, IDC_IIM,0,0); + unsigned long hours = GetDlgItemInt(hwndDlg, IDC_IIH, 0, 0); + unsigned short minutes = (unsigned short)GetDlgItemInt(hwndDlg, IDC_IIM, 0, 0); if (minutes > 59) minutes = 59; - ppro->setDword(AIM_KEY_IIT, hours*60+minutes); + ppro->setDword(AIM_KEY_IIT, hours * 60 + minutes); switch (LOWORD(wParam)) { case IDOK: //Instant Idle if (ppro->state == 1) { - ppro->aim_set_idle(ppro->hServerConn,ppro->seqno,hours * 60 * 60 + minutes * 60); - ppro->instantidle=1; + ppro->aim_set_idle(ppro->hServerConn, ppro->seqno, hours * 60 * 60 + minutes * 60); + ppro->instantidle = 1; } EndDialog(hwndDlg, IDOK); break; case IDCANCEL: - ppro->aim_set_idle(ppro->hServerConn,ppro->seqno,0); - ppro->instantidle=0; + ppro->aim_set_idle(ppro->hServerConn, ppro->seqno, 0); + ppro->instantidle = 0; EndDialog(hwndDlg, IDCANCEL); break; } @@ -1366,7 +1276,7 @@ static void clist_chat_invite_send(MCONTACT hItem, HWND hwndList, chat_list_item static void clist_validate_contact(MCONTACT hItem, HWND hwndList, CAimProto* ppro) { if (!ppro->is_my_contact(hItem) || ppro->isChatRoom(hItem) || - ppro->getWord(hItem, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) + ppro->getWord(hItem, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } @@ -1386,7 +1296,7 @@ static void clist_chat_prepare(MCONTACT hItem, HWND hwndList, CAimProto* ppro) clist_validate_contact(hItem, hwndList, ppro); hItem = hItemN; - } + } } INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -1415,37 +1325,33 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_NOTIFY: - { - NMCLISTCONTROL* nmc = (NMCLISTCONTROL*)lParam; - if (nmc->hdr.idFrom == IDC_CCLIST) { - switch (nmc->hdr.code) - { - case CLN_NEWCONTACT: - if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - clist_validate_contact((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); - break; + NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam; + if (nmc->hdr.idFrom == IDC_CCLIST) { + switch (nmc->hdr.code) { + case CLN_NEWCONTACT: + if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) + clist_validate_contact((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); + break; - case CLN_LISTREBUILT: - if (param) - clist_chat_prepare(NULL, nmc->hdr.hwndFrom, param->ppro); - break; + case CLN_LISTREBUILT: + if (param) + clist_chat_prepare(NULL, nmc->hdr.hwndFrom, param->ppro); + break; + } } } - } - break; + break; case WM_COMMAND: { - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case IDC_ADDSCR: - if (param->ppro->state == 1) - { + if (param->ppro->state == 1) { TCHAR sn[64]; GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, SIZEOF(sn)); - CLCINFOITEM cii = {0}; + CLCINFOITEM cii = { 0 }; cii.cbSize = sizeof(cii); cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS; cii.pszText = sn; @@ -1458,8 +1364,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDOK: { chat_list_item* item = param->ppro->find_chat_by_id(param->id); - if (item) - { + if (item) { char msg[1024]; GetDlgItemTextA(hwndDlg, IDC_MSG, msg, SIZEOF(msg)); @@ -1487,8 +1392,7 @@ INT_PTR CALLBACK chat_request_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { invite_chat_req_param* param = (invite_chat_req_param*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) - { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -1497,8 +1401,8 @@ INT_PTR CALLBACK chat_request_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR WindowSetIcon(hwndDlg, "aol"); - SetDlgItemTextA(hwndDlg, IDC_ROOMNAME, strrchr(param->cnp->id, '-')+1); - SetDlgItemTextA(hwndDlg, IDC_SCREENNAME, param->name); + SetDlgItemTextA(hwndDlg, IDC_ROOMNAME, strrchr(param->cnp->id, '-') + 1); + SetDlgItemTextA(hwndDlg, IDC_SCREENNAME, param->name); SetDlgItemTextA(hwndDlg, IDC_MSG, param->message); break; @@ -1512,20 +1416,17 @@ INT_PTR CALLBACK chat_request_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDOK: - param->ppro->ForkThread(&CAimProto::chatnav_request_thread, param->cnp); - EndDialog(hwndDlg, IDOK); - break; + switch (LOWORD(wParam)) { + case IDOK: + param->ppro->ForkThread(&CAimProto::chatnav_request_thread, param->cnp); + EndDialog(hwndDlg, IDOK); + break; - case IDCANCEL: - param->ppro->aim_chat_deny(param->ppro->hServerConn,param->ppro->seqno,param->name,param->icbm_cookie); - delete param->cnp; - EndDialog(hwndDlg, IDCANCEL); - break; - } + case IDCANCEL: + param->ppro->aim_chat_deny(param->ppro->hServerConn, param->ppro->seqno, param->name, param->icbm_cookie); + delete param->cnp; + EndDialog(hwndDlg, IDCANCEL); + break; } break; } @@ -1535,6 +1436,6 @@ INT_PTR CALLBACK chat_request_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR void CALLBACK chat_request_cb(PVOID dwParam) { - CreateDialogParam (hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE_REQ), - NULL, chat_request_dialog, (LPARAM)dwParam); + CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE_REQ), + NULL, chat_request_dialog, (LPARAM)dwParam); } -- cgit v1.2.3