From e58823d961a630eb62e60d2ccb443761ba5f1704 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 Jun 2012 15:51:34 +0000 Subject: - all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs. - massive cleanup of the menu-related code git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/userinfo/contactinfo.cpp | 318 +++++++++++++++++------------------ src/modules/userinfo/stdinfo.cpp | 220 ++++++++++++------------ src/modules/userinfo/userinfo.cpp | 162 +++++++++--------- 3 files changed, 350 insertions(+), 350 deletions(-) (limited to 'src/modules/userinfo') diff --git a/src/modules/userinfo/contactinfo.cpp b/src/modules/userinfo/contactinfo.cpp index 8b8c7ae66d..42658c8fd1 100644 --- a/src/modules/userinfo/contactinfo.cpp +++ b/src/modules/userinfo/contactinfo.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -29,22 +29,22 @@ static INT_PTR CALLBACK EditUserEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar { switch(msg) { case WM_INITDIALOG: - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam); - if (*(char*)lParam) SetWindowText(hwndDlg,TranslateT("Edit E-Mail Address")); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); + if (*(char*)lParam) SetWindowText(hwndDlg, TranslateT("Edit E-Mail Address")); TranslateDialogDefault(hwndDlg); - SetDlgItemTextA(hwndDlg,IDC_EMAIL,(char*)lParam); - EnableWindow(GetDlgItem(hwndDlg,IDOK),*(char*)lParam); + SetDlgItemTextA(hwndDlg, IDC_EMAIL, (char*)lParam); + EnableWindow(GetDlgItem(hwndDlg, IDOK), *(char*)lParam); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: - GetDlgItemTextA(hwndDlg,IDC_EMAIL,(char*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA),256); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, (char*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA), 256); //fall through case IDCANCEL: - EndDialog(hwndDlg,wParam); + EndDialog(hwndDlg, wParam); case IDC_EMAIL: if (HIWORD(wParam) == EN_CHANGE) - EnableWindow(GetDlgItem(hwndDlg,IDOK),GetWindowTextLength(GetDlgItem(hwndDlg,IDC_EMAIL))); + EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(GetDlgItem(hwndDlg, IDC_EMAIL))); break; } break; @@ -59,57 +59,57 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar switch(msg) { case WM_INITDIALOG: { char *szText=(char*)lParam; - int i,item,countryCount; + int i, item, countryCount; struct CountryListEntry *countries; - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam); - if (szText[0]) SetWindowText(hwndDlg,TranslateT("Edit Phone Number")); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); + if (szText[0]) SetWindowText(hwndDlg, TranslateT("Edit Phone Number")); TranslateDialogDefault(hwndDlg); - if (lstrlenA(szText)>4 && !lstrcmpA(szText+lstrlenA(szText)-4," SMS")) { - CheckDlgButton(hwndDlg,IDC_SMS,BST_CHECKED); + if (lstrlenA(szText)>4 && !lstrcmpA(szText+lstrlenA(szText)-4, " SMS")) { + CheckDlgButton(hwndDlg, IDC_SMS, BST_CHECKED); szText[lstrlenA(szText)-4]='\0'; } - EnableWindow(GetDlgItem(hwndDlg,IDOK),szText[0]); - SendDlgItemMessage(hwndDlg,IDC_AREA,EM_LIMITTEXT,31,0); - SendDlgItemMessage(hwndDlg,IDC_NUMBER,EM_LIMITTEXT,63,0); - CallService(MS_UTILS_GETCOUNTRYLIST,(WPARAM)&countryCount,(LPARAM)&countries); + EnableWindow(GetDlgItem(hwndDlg, IDOK), szText[0]); + SendDlgItemMessage(hwndDlg, IDC_AREA, EM_LIMITTEXT, 31, 0); + SendDlgItemMessage(hwndDlg, IDC_NUMBER, EM_LIMITTEXT, 63, 0); + CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries); for (i=0;i= 0; i-- ) - if ( country == SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_GETITEMDATA,i,0)) { - SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_SETCURSEL,i,0); + if ( country == SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, i, 0)) { + SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_SETCURSEL, i, 0); break; } if ( i < 0 ) @@ -139,23 +139,23 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar } } if ( isValid ) { - pArea = pText+strcspn(pText,"0123456789"); - pText = pArea+strspn(pArea,"0123456789"); + pArea = pText+strcspn(pText, "0123456789"); + pText = pArea+strspn(pArea, "0123456789"); if (*pText) { *pText='\0'; - pNumber = pText+1+strcspn(pText+1,"0123456789"); - SetDlgItemTextA(hwndDlg,IDC_NUMBER,pNumber); + pNumber = pText+1+strcspn(pText+1, "0123456789"); + SetDlgItemTextA(hwndDlg, IDC_NUMBER, pNumber); } - SetDlgItemTextA(hwndDlg,IDC_AREA,pArea); + SetDlgItemTextA(hwndDlg, IDC_AREA, pArea); } if ( !isValid ) { - SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_SETCURSEL,-1,0); - SetDlgItemTextA(hwndDlg,IDC_AREA,""); - SetDlgItemTextA(hwndDlg,IDC_NUMBER,""); + SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_SETCURSEL, -1, 0); + SetDlgItemTextA(hwndDlg, IDC_AREA, ""); + SetDlgItemTextA(hwndDlg, IDC_NUMBER, ""); } } noRecursion=0; - EnableWindow(GetDlgItem(hwndDlg,IDOK),GetWindowTextLength(GetDlgItem(hwndDlg,IDC_PHONE))); + EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(GetDlgItem(hwndDlg, IDC_PHONE))); break; } break; @@ -163,7 +163,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar return FALSE; } -static int IsOverEmail(HWND hwndDlg,TCHAR* szEmail,int cchEmail) +static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail) { RECT rc; HWND hwndEmails; @@ -172,23 +172,23 @@ static int IsOverEmail(HWND hwndDlg,TCHAR* szEmail,int cchEmail) SIZE textSize; LVHITTESTINFO hti; - hwndEmails=GetDlgItem(hwndDlg,IDC_EMAILS); + hwndEmails=GetDlgItem(hwndDlg, IDC_EMAILS); GetCursorPos(&hti.pt); - ScreenToClient(hwndEmails,&hti.pt); - GetClientRect(hwndEmails,&rc); - if (!PtInRect(&rc,hti.pt)) return 0; - if (ListView_SubItemHitTest(hwndEmails,&hti) == -1) return 0; + ScreenToClient(hwndEmails, &hti.pt); + GetClientRect(hwndEmails, &rc); + if (!PtInRect(&rc, hti.pt)) return 0; + if (ListView_SubItemHitTest(hwndEmails, &hti) == -1) return 0; if (hti.iSubItem != 1) return 0; if (!(hti.flags&LVHT_ONITEMLABEL)) return 0; - ListView_GetSubItemRect(hwndEmails,hti.iItem,1,LVIR_LABEL,&rc); + ListView_GetSubItemRect(hwndEmails, hti.iItem, 1, LVIR_LABEL, &rc); szText[0] = 0; - ListView_GetItemText(hwndEmails,hti.iItem,1,szText,SIZEOF(szText)); + ListView_GetItemText(hwndEmails, hti.iItem, 1, szText, SIZEOF(szText)); hdc=GetDC(hwndEmails); - SelectObject(hdc,hEmailFont); - GetTextExtentPoint32(hdc,szText,lstrlen(szText),&textSize); - ReleaseDC(hwndEmails,hdc); + SelectObject(hdc, hEmailFont); + GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textSize); + ReleaseDC(hwndEmails, hdc); if (hti.pt.x4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4," SMS")) { - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,2,_T("y")); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi); + if (lstrlenA(dbv.pszVal)>4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4, " SMS")) { + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y")); dbv.ptszVal[lstrlen(dbv.ptszVal)-4]='\0'; } - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal); DBFreeVariant(&dbv); lvi.iItem++; } - if (!DBGetContactSettingTString(hContact,szProto,"CompanyPhone",&dbv)) { + if (!DBGetContactSettingTString(hContact, szProto, "CompanyPhone", &dbv)) { lvi.pszText=TranslateT("Work Phone"); - ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi); - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal); DBFreeVariant(&dbv); lvi.iItem++; } - if (!DBGetContactSettingTString(hContact,szProto,"CompanyFax",&dbv)) { + if (!DBGetContactSettingTString(hContact, szProto, "CompanyFax", &dbv)) { lvi.pszText=TranslateT("Work Fax"); - ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi); - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal); DBFreeVariant(&dbv); lvi.iItem++; } lvi.iSubItem=0; for (i=0;;i++) { lvi.lParam=i; - mir_snprintf(idstr, SIZEOF(idstr), "MyPhone%d",i); - if (DBGetContactSettingTString(hContact,"UserInfo",idstr,&dbv)) + mir_snprintf(idstr, SIZEOF(idstr), "MyPhone%d", i); + if (DBGetContactSettingTString(hContact, "UserInfo", idstr, &dbv)) break; lvi.pszText=idstr2; - mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"),i+1); - ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi); - if (lstrlen(dbv.ptszVal)>4 && !lstrcmp(dbv.ptszVal+lstrlen(dbv.ptszVal)-4,_T(" SMS"))) { - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,2,_T("y")); + mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi); + if (lstrlen(dbv.ptszVal)>4 && !lstrcmp(dbv.ptszVal+lstrlen(dbv.ptszVal)-4, _T(" SMS"))) { + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y")); dbv.ptszVal[lstrlen(dbv.ptszVal)-4]='\0'; } - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal); DBFreeVariant(&dbv); lvi.iItem++; } lvi.mask=LVIF_PARAM; lvi.lParam=(LPARAM)(-2); - ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi); } break; } @@ -360,7 +360,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case 0: switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: - SendMessage(hwndDlg,M_REMAKELISTS,0,0); + SendMessage(hwndDlg, M_REMAKELISTS, 0, 0); break; } break; @@ -372,21 +372,21 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP switch(nm->nmcd.dwDrawStage) { case CDDS_PREPAINT: case CDDS_ITEMPREPAINT: - SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_NOTIFYSUBITEMDRAW); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW); return TRUE; case CDDS_SUBITEM|CDDS_ITEMPREPAINT: { RECT rc; - ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,LVIR_LABEL,&rc); + ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc); if (nm->iSubItem == 1 && nm->nmcd.hdr.idFrom == IDC_EMAILS) { HFONT hoFont; TCHAR szText[256] = {0}; - ListView_GetItemText(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,szText,SIZEOF(szText)); - hoFont=(HFONT)SelectObject(nm->nmcd.hdc,hEmailFont); - SetTextColor(nm->nmcd.hdc,RGB(0,0,255)); - DrawText(nm->nmcd.hdc,szText,-1,&rc,DT_END_ELLIPSIS|DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_TOP); - SelectObject(nm->nmcd.hdc,hoFont); - SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_SKIPDEFAULT); + ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText)); + hoFont=(HFONT)SelectObject(nm->nmcd.hdc, hEmailFont); + SetTextColor(nm->nmcd.hdc, RGB(0, 0, 255)); + DrawText(nm->nmcd.hdc, szText, -1, &rc, DT_END_ELLIPSIS|DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_TOP); + SelectObject(nm->nmcd.hdc, hoFont); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT); return TRUE; } @@ -394,18 +394,18 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (nm->nmcd.lItemlParam == (LPARAM)(-2) && nm->iSubItem-3 == (nm->nmcd.hdr.idFrom == IDC_PHONES)) hIcon = LoadSkinIcon( SKINICON_OTHER_ADDCONTACT ); else if (nm->iSubItem>1 && nm->nmcd.lItemlParam != (LPARAM)(-1) && nm->nmcd.lItemlParam != (LPARAM)(-2)) { - static int iconResources[3]={SKINICON_OTHER_RENAME,SKINICON_OTHER_DELETE}; + static int iconResources[3]={SKINICON_OTHER_RENAME, SKINICON_OTHER_DELETE}; if (nm->iSubItem == 2 && nm->nmcd.hdr.idFrom == IDC_PHONES) { TCHAR szText[2]; - ListView_GetItemText(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,szText,SIZEOF(szText)); + ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText)); if (szText[0]) hIcon = LoadSkinIcon( SKINICON_OTHER_SMS ); } else hIcon = LoadSkinIcon( iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom == IDC_EMAILS)] ); } else break; - DrawIconEx(nm->nmcd.hdc,(rc.left+rc.right-GetSystemMetrics(SM_CXSMICON))/2,(rc.top+rc.bottom-GetSystemMetrics(SM_CYSMICON))/2,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + DrawIconEx(nm->nmcd.hdc, (rc.left+rc.right-GetSystemMetrics(SM_CXSMICON))/2, (rc.top+rc.bottom-GetSystemMetrics(SM_CYSMICON))/2, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); IconLib_ReleaseIcon(hIcon, 0); - SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_SKIPDEFAULT); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT); return TRUE; } } @@ -415,41 +415,41 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { NMLISTVIEW *nm=(NMLISTVIEW*)lParam; LVITEM lvi; TCHAR szEmail[256]; - HANDLE hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + HANDLE hContact=(HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char *szIdTemplate=nm->hdr.idFrom == IDC_PHONES?"MyPhone%d":"Mye-mail%d"; LVHITTESTINFO hti; - if (IsOverEmail(hwndDlg,szEmail,SIZEOF(szEmail))) { + if (IsOverEmail(hwndDlg, szEmail, SIZEOF(szEmail))) { TCHAR szExec[264]; mir_sntprintf(szExec, SIZEOF(szExec), _T("mailto:%s"), szEmail); - ShellExecute(hwndDlg,_T("open"),szExec,NULL,NULL,SW_SHOW); + ShellExecute(hwndDlg, _T("open"), szExec, NULL, NULL, SW_SHOW); break; } if (nm->iSubItem<2) break; hti.pt.x=(short)LOWORD(GetMessagePos()); hti.pt.y=(short)HIWORD(GetMessagePos()); - ScreenToClient(nm->hdr.hwndFrom,&hti.pt); - if (ListView_SubItemHitTest(nm->hdr.hwndFrom,&hti) == -1) break; + ScreenToClient(nm->hdr.hwndFrom, &hti.pt); + if (ListView_SubItemHitTest(nm->hdr.hwndFrom, &hti) == -1) break; lvi.mask=LVIF_PARAM; lvi.iItem=hti.iItem; lvi.iSubItem=0; - ListView_GetItem(nm->hdr.hwndFrom,&lvi); + ListView_GetItem(nm->hdr.hwndFrom, &lvi); if (lvi.lParam == (LPARAM)(-1)) break; if (lvi.lParam == (LPARAM)(-2)) { if (hti.iSubItem-3 == (nm->hdr.idFrom == IDC_PHONES)) { //add - char szNewData[256]="",idstr[33]; + char szNewData[256]="", idstr[33]; int i; DBVARIANT dbv; - if (IDOK != DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szNewData)) + if (IDOK != DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szNewData)) break; for (i=0;;i++) { - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i); - if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; + mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i); + if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break; DBFreeVariant(&dbv); } - DBWriteContactSettingString(hContact,"UserInfo",idstr,szNewData); - SendMessage(hwndDlg,M_REMAKELISTS,0,0); + DBWriteContactSettingString(hContact, "UserInfo", idstr, szNewData); + SendMessage(hwndDlg, M_REMAKELISTS, 0, 0); } } else { @@ -459,28 +459,28 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char idstr[33]; DBVARIANT dbv; for (i=lvi.lParam;;i++) { - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i+1); - if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i); - DBWriteContactSettingString(hContact,"UserInfo",idstr,dbv.pszVal); + mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i+1); + if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break; + mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i); + DBWriteContactSettingString(hContact, "UserInfo", idstr, dbv.pszVal); DBFreeVariant(&dbv); } - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i); - DBDeleteContactSetting(hContact,"UserInfo",idstr); - SendMessage(hwndDlg,M_REMAKELISTS,0,0); + mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i); + DBDeleteContactSetting(hContact, "UserInfo", idstr); + SendMessage(hwndDlg, M_REMAKELISTS, 0, 0); } else if (hti.iSubItem-2 == (nm->hdr.idFrom == IDC_PHONES)) { //edit - char szText[256],idstr[33]; + char szText[256], idstr[33]; DBVARIANT dbv; - mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,lvi.lParam); - if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; - lstrcpynA(szText,dbv.pszVal,SIZEOF(szText)); + mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, lvi.lParam); + if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break; + lstrcpynA(szText, dbv.pszVal, SIZEOF(szText)); DBFreeVariant(&dbv); - if (IDOK != DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szText)) + if (IDOK != DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText)) break; - DBWriteContactSettingString(hContact,"UserInfo",idstr,szText); - SendMessage(hwndDlg,M_REMAKELISTS,0,0); + DBWriteContactSettingString(hContact, "UserInfo", idstr, szText); + SendMessage(hwndDlg, M_REMAKELISTS, 0, 0); } } break; @@ -494,19 +494,19 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (GetForegroundWindow() == GetParent(hwndDlg)) { POINT pt; GetCursorPos(&pt); - ScreenToClient(hwndDlg,&pt); -// SetFocus(ChildWindowFromPoint(hwndDlg,pt)); //ugly hack because listviews ignore their first click + ScreenToClient(hwndDlg, &pt); +// SetFocus(ChildWindowFromPoint(hwndDlg, pt)); //ugly hack because listviews ignore their first click } - if (IsOverEmail(hwndDlg,NULL,0)) { + if (IsOverEmail(hwndDlg, NULL, 0)) { SetCursor(hHandCursor); - SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,TRUE); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE); return TRUE; } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: - SendMessage(GetParent(hwndDlg),msg,wParam,lParam); + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; } break; diff --git a/src/modules/userinfo/stdinfo.cpp b/src/modules/userinfo/stdinfo.cpp index 7af6334a9b..be7863f358 100644 --- a/src/modules/userinfo/stdinfo.cpp +++ b/src/modules/userinfo/stdinfo.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -33,12 +33,12 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP #define SVS_SIGNED 6 #define SVS_TIMEZONE 7 -static int Proto_GetContactInfoSetting(HANDLE hContact,const char *szProto,const char *szModule,const char *szSetting,DBVARIANT *dbv, const int nType) +static int Proto_GetContactInfoSetting(HANDLE hContact, const char *szProto, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType) { - DBCONTACTGETSETTING cgs={szModule,szSetting,dbv}; + DBCONTACTGETSETTING cgs={szModule, szSetting, dbv}; dbv->type=(BYTE)nType; - return CallProtoService(szProto,PS_GETINFOSETTING,(WPARAM)hContact,(LPARAM)&cgs); + return CallProtoService(szProto, PS_GETINFOSETTING, (WPARAM)hContact, (LPARAM)&cgs); } static void Proto_FreeInfoVariant(DBVARIANT *dbv) @@ -62,10 +62,10 @@ static void Proto_FreeInfoVariant(DBVARIANT *dbv) dbv->type=0; } -static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char *szSetting,int special) +static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, char *szSetting, int special) { DBVARIANT dbv = { 0 }; - char str[80],*pstr = NULL; + char str[80], *pstr = NULL; TCHAR* ptstr = NULL; int unspecified=0; char* szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); @@ -73,8 +73,8 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char dbv.type=DBVT_DELETED; if (szModule == NULL) unspecified=1; - else if (proto_service) unspecified=Proto_GetContactInfoSetting(hContact,szProto,szModule,szSetting,&dbv,0); - else unspecified=DBGetContactSettingW(hContact,szModule,szSetting,&dbv); + else if (proto_service) unspecified=Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0); + else unspecified=DBGetContactSettingW(hContact, szModule, szSetting, &dbv); if (!unspecified) { switch(dbv.type) { case DBVT_BYTE: @@ -86,7 +86,7 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char else if (special == SVS_MONTH) { if (dbv.bVal>0 && dbv.bVal<=12) { pstr=str; - GetLocaleInfoA(LOCALE_USER_DEFAULT,LOCALE_SABBREVMONTHNAME1-1+dbv.bVal,str,SIZEOF(str)); + GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1-1+dbv.bVal, str, SIZEOF(str)); } else unspecified=1; } @@ -94,12 +94,12 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char if (dbv.cVal == -100) unspecified=1; else { pstr=str; - mir_snprintf(str, SIZEOF(str), dbv.cVal?"UTC%+d:%02d":"UTC",-dbv.cVal/2,(dbv.cVal&1)*30); + mir_snprintf(str, SIZEOF(str), dbv.cVal?"UTC%+d:%02d":"UTC", -dbv.cVal/2, (dbv.cVal&1)*30); } } else { unspecified=(special == SVS_ZEROISUNSPEC && dbv.bVal == 0); - pstr=_itoa(special == SVS_SIGNED?dbv.cVal:dbv.bVal,str,10); + pstr=_itoa(special == SVS_SIGNED?dbv.cVal:dbv.bVal, str, 10); } break; case DBVT_WORD: @@ -108,19 +108,19 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char if (wSave == ( WORD )-1) { char szSettingName[100]; mir_snprintf( szSettingName, SIZEOF(szSettingName), "%sName", szSetting ); - if ( !DBGetContactSettingTString(hContact,szModule,szSettingName,&dbv)) { + if ( !DBGetContactSettingTString(hContact, szModule, szSettingName, &dbv)) { ptstr = dbv.ptszVal; unspecified = false; break; } } - pstr = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,wSave,0)); + pstr = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, wSave, 0)); unspecified=pstr == NULL; } else { unspecified=(special == SVS_ZEROISUNSPEC && dbv.wVal == 0); - pstr=_itoa(special == SVS_SIGNED?dbv.sVal:dbv.wVal,str,10); + pstr=_itoa(special == SVS_SIGNED?dbv.sVal:dbv.wVal, str, 10); } break; case DBVT_DWORD: @@ -131,7 +131,7 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char pstr=inet_ntoa(ia); if (dbv.dVal == 0) unspecified=1; } - else pstr=_itoa(special == SVS_SIGNED?dbv.lVal:dbv.dVal,str,10); + else pstr=_itoa(special == SVS_SIGNED?dbv.lVal:dbv.dVal, str, 10); break; case DBVT_ASCIIZ: unspecified=(special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); @@ -151,7 +151,7 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char pstr=dbv.pszVal; Utf8Decode( dbv.pszVal, NULL ); break; - default: pstr=str; lstrcpyA(str,"???"); break; + default: pstr=str; lstrcpyA(str, "???"); break; } } if (unspecified) @@ -185,18 +185,18 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP { char *szProto; HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto == NULL) break; - SetValue(hwndDlg,IDC_NICK,hContact,szProto,"Nick",0); - SetValue(hwndDlg,IDC_FIRSTNAME,hContact,szProto,"FirstName",0); - SetValue(hwndDlg,IDC_LASTNAME,hContact,szProto,"LastName",0); - SetValue(hwndDlg,IDC_EMAIL,hContact,szProto,"e-mail",0); - SetValue(hwndDlg,IDC_AGE,hContact,szProto,"Age",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_GENDER,hContact,szProto,"Gender",SVS_GENDER); - SetValue(hwndDlg,IDC_DOBDAY,hContact,szProto,"BirthDay",0); - SetValue(hwndDlg,IDC_DOBMONTH,hContact,szProto,"BirthMonth",SVS_MONTH); - SetValue(hwndDlg,IDC_DOBYEAR,hContact,szProto,"BirthYear",0); - SetValue(hwndDlg,IDC_MARITAL,hContact,szProto,"MaritalStatus",0); + SetValue(hwndDlg, IDC_NICK, hContact, szProto, "Nick", 0); + SetValue(hwndDlg, IDC_FIRSTNAME, hContact, szProto, "FirstName", 0); + SetValue(hwndDlg, IDC_LASTNAME, hContact, szProto, "LastName", 0); + SetValue(hwndDlg, IDC_EMAIL, hContact, szProto, "e-mail", 0); + SetValue(hwndDlg, IDC_AGE, hContact, szProto, "Age", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_GENDER, hContact, szProto, "Gender", SVS_GENDER); + SetValue(hwndDlg, IDC_DOBDAY, hContact, szProto, "BirthDay", 0); + SetValue(hwndDlg, IDC_DOBMONTH, hContact, szProto, "BirthMonth", SVS_MONTH); + SetValue(hwndDlg, IDC_DOBYEAR, hContact, szProto, "BirthYear", 0); + SetValue(hwndDlg, IDC_MARITAL, hContact, szProto, "MaritalStatus", 0); } } break; } @@ -204,10 +204,10 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: - SendMessage(GetParent(hwndDlg),msg,wParam,lParam); + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; case IDC_EMAIL: - if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_EMAIL))) { + if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EMAIL))) { TCHAR szExec[264], szEmail[256]; GetDlgItemText(hwndDlg, IDC_EMAIL, szEmail, SIZEOF(szEmail)); mir_sntprintf(szExec, SIZEOF(szExec), _T("mailto:%s"), szEmail); @@ -225,12 +225,12 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L switch(msg) { case WM_INITDIALOG: - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,lParam); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); TranslateDialogDefault(hwndDlg); - SetTimer(hwndDlg,1,1000,NULL); + SetTimer(hwndDlg, 1, 1000, NULL); tmi.prepareList((HANDLE)lParam, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB); - SendMessage(hwndDlg,WM_TIMER,0,0); + SendMessage(hwndDlg, WM_TIMER, 0, 0); break; case WM_TIMER: @@ -243,12 +243,12 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (tmi.printDateTimeByContact(hContact, _T("s"), szTime, SIZEOF(szTime), TZF_KNOWNONLY)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_LOCALTIME),FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_LOCALTIME), FALSE); SetDlgItemText(hwndDlg, IDC_LOCALTIME, TranslateT("")); } else { - EnableWindow(GetDlgItem(hwndDlg,IDC_LOCALTIME), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_LOCALTIME), TRUE); SetDlgItemText(hwndDlg, IDC_LOCALTIME, szTime); } } @@ -261,17 +261,17 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L { char *szProto; HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto == NULL) break; - SetValue(hwndDlg,IDC_STREET,hContact,szProto,"Street",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_CITY,hContact,szProto,"City",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_STATE,hContact,szProto,"State",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_ZIP,hContact,szProto,"ZIP",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_COUNTRY,hContact,szProto,"Country",SVS_COUNTRY); - SetValue(hwndDlg,IDC_LANGUAGE1,hContact,szProto,"Language1",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_LANGUAGE2,hContact,szProto,"Language2",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_LANGUAGE3,hContact,szProto,"Language3",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_TIMEZONE,hContact,szProto,"Timezone",SVS_TIMEZONE); + SetValue(hwndDlg, IDC_STREET, hContact, szProto, "Street", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_CITY, hContact, szProto, "City", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_STATE, hContact, szProto, "State", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_ZIP, hContact, szProto, "ZIP", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_COUNTRY, hContact, szProto, "Country", SVS_COUNTRY); + SetValue(hwndDlg, IDC_LANGUAGE1, hContact, szProto, "Language1", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_LANGUAGE2, hContact, szProto, "Language2", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_LANGUAGE3, hContact, szProto, "Language3", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_TIMEZONE, hContact, szProto, "Timezone", SVS_TIMEZONE); } } break; @@ -280,13 +280,13 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: - SendMessage(GetParent(hwndDlg),msg,wParam,lParam); + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; case IDC_TIMEZONESELECT: if (HIWORD(wParam) == CBN_SELCHANGE) { HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - SendMessage(GetParent(hwndDlg),PSM_CHANGED, 0,0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); tmi.storeListResults(hContact, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB); } break; @@ -309,17 +309,17 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { char *szProto; HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto == NULL) break; - SetValue(hwndDlg,IDC_COMPANY,hContact,szProto,"Company",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_DEPARTMENT,hContact,szProto,"CompanyDepartment",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_POSITION,hContact,szProto,"CompanyPosition",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_STREET,hContact,szProto,"CompanyStreet",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_CITY,hContact,szProto,"CompanyCity",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_STATE,hContact,szProto,"CompanyState",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_ZIP,hContact,szProto,"CompanyZIP",SVS_ZEROISUNSPEC); - SetValue(hwndDlg,IDC_COUNTRY,hContact,szProto,"CompanyCountry",SVS_COUNTRY); - SetValue(hwndDlg,IDC_WEBPAGE,hContact,szProto,"CompanyHomepage",SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_COMPANY, hContact, szProto, "Company", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_DEPARTMENT, hContact, szProto, "CompanyDepartment", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_POSITION, hContact, szProto, "CompanyPosition", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_STREET, hContact, szProto, "CompanyStreet", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_CITY, hContact, szProto, "CompanyCity", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_STATE, hContact, szProto, "CompanyState", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_ZIP, hContact, szProto, "CompanyZIP", SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_COUNTRY, hContact, szProto, "CompanyCountry", SVS_COUNTRY); + SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "CompanyHomepage", SVS_ZEROISUNSPEC); } } break; } @@ -327,13 +327,13 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: - SendMessage(GetParent(hwndDlg),msg,wParam,lParam); + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; case IDC_WEBPAGE: - if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_WEBPAGE))) { + if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) { char szPage[256]; - GetDlgItemTextA(hwndDlg,IDC_WEBPAGE,szPage,SIZEOF(szPage)); - CallService(MS_UTILS_OPENURL,1,(LPARAM)szPage); + GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, SIZEOF(szPage)); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)szPage); } break; } @@ -359,18 +359,18 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, TranslateDialogDefault(hwndDlg); { LVCOLUMN lvc; RECT rc; - GetClientRect(GetDlgItem(hwndDlg,IDC_PAST),&rc); + GetClientRect(GetDlgItem(hwndDlg, IDC_PAST), &rc); rc.right-=GetSystemMetrics(SM_CXVSCROLL); lvc.mask=LVCF_WIDTH; lvc.cx=rc.right/3; - ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_PAST),0,&lvc); - ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_INTERESTS),0,&lvc); + ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PAST), 0, &lvc); + ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_INTERESTS), 0, &lvc); lvc.cx=rc.right-rc.right/3; - ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_PAST),1,&lvc); - ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_INTERESTS),1,&lvc); + ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PAST), 1, &lvc); + ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_INTERESTS), 1, &lvc); } - ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg,IDC_PAST),LVS_EX_LABELTIP,LVS_EX_LABELTIP); - ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg,IDC_INTERESTS),LVS_EX_LABELTIP,LVS_EX_LABELTIP); + ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg, IDC_PAST), LVS_EX_LABELTIP, LVS_EX_LABELTIP); + ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg, IDC_INTERESTS), LVS_EX_LABELTIP, LVS_EX_LABELTIP); break; case WM_NOTIFY: @@ -380,31 +380,31 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, { LVITEM lvi; int i; char idstr[33]; - DBVARIANT dbv,dbvText; + DBVARIANT dbv, dbvText; HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { - char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto == NULL) break; bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC; - SetValue(hwndDlg,IDC_WEBPAGE,hContact,szProto,"Homepage",SVS_ZEROISUNSPEC); + SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "Homepage", SVS_ZEROISUNSPEC); //past - ListView_DeleteAllItems(GetDlgItem(hwndDlg,IDC_PAST)); + ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_PAST)); lvi.mask=LVIF_TEXT; lvi.iSubItem=0; lvi.iItem=0; for (i=0;;i++) { - mir_snprintf(idstr, SIZEOF(idstr), "Past%d",i); - if ((proto_service && Proto_GetContactInfoSetting(hContact,szProto,szProto,idstr,&dbv,DBVT_TCHAR)) || - (!proto_service && DBGetContactSettingTString(hContact,szProto,idstr,&dbv))) + mir_snprintf(idstr, SIZEOF(idstr), "Past%d", i); + if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) || + (!proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv))) break; - mir_snprintf(idstr, SIZEOF(idstr), "Past%dText",i); - if (DBGetContactSettingTString(hContact,szProto,idstr,&dbvText)) + mir_snprintf(idstr, SIZEOF(idstr), "Past%dText", i); + if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText)) {if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;} lvi.pszText=dbv.ptszVal; - ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PAST),&lvi); - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PAST),lvi.iItem,1,dbvText.ptszVal); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal); DBFreeVariant(&dbvText); if (proto_service) Proto_FreeInfoVariant(&dbv); @@ -415,15 +415,15 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, for (i=0;;i++) { mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i); - if ((proto_service && Proto_GetContactInfoSetting(hContact,szProto,szProto,idstr,&dbv,DBVT_TCHAR)) || - (!proto_service && DBGetContactSettingTString(hContact,szProto,idstr,&dbv))) + if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) || + (!proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv))) break; - mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText",i); - if (DBGetContactSettingTString(hContact,szProto,idstr,&dbvText)) + mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText", i); + if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText)) {if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;} lvi.pszText=dbv.ptszVal; - ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PAST),&lvi); - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PAST),lvi.iItem,1,dbvText.ptszVal); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal); DBFreeVariant(&dbvText); if (proto_service) Proto_FreeInfoVariant(&dbv); @@ -432,24 +432,24 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem++; } - ResizeColumns(GetDlgItem(hwndDlg,IDC_PAST)); + ResizeColumns(GetDlgItem(hwndDlg, IDC_PAST)); //interests - ListView_DeleteAllItems(GetDlgItem(hwndDlg,IDC_INTERESTS)); + ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_INTERESTS)); lvi.mask=LVIF_TEXT; lvi.iSubItem=0; lvi.iItem=0; for (i=0;;i++) { mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i); - if ((proto_service && Proto_GetContactInfoSetting(hContact,szProto,szProto,idstr,&dbv,DBVT_TCHAR)) || - (!proto_service && DBGetContactSettingTString(hContact,szProto,idstr,&dbv))) + if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) || + (!proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv))) break; mir_snprintf(idstr, SIZEOF(idstr), "Interest%dText", i); - if (DBGetContactSettingTString(hContact,szProto,idstr,&dbvText)) + if (DBGetContactSettingTString(hContact, szProto, idstr, &dbvText)) {if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;} lvi.pszText=dbv.ptszVal; - ListView_InsertItem(GetDlgItem(hwndDlg,IDC_INTERESTS),&lvi); - ListView_SetItemText(GetDlgItem(hwndDlg,IDC_INTERESTS),lvi.iItem,1,dbvText.ptszVal); + ListView_InsertItem(GetDlgItem(hwndDlg, IDC_INTERESTS), &lvi); + ListView_SetItemText(GetDlgItem(hwndDlg, IDC_INTERESTS), lvi.iItem, 1, dbvText.ptszVal); DBFreeVariant(&dbvText); if (proto_service) Proto_FreeInfoVariant(&dbv); @@ -457,7 +457,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, DBFreeVariant(&dbv); lvi.iItem++; } - ResizeColumns(GetDlgItem(hwndDlg,IDC_INTERESTS)); + ResizeColumns(GetDlgItem(hwndDlg, IDC_INTERESTS)); } } break; } @@ -465,13 +465,13 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: - SendMessage(GetParent(hwndDlg),msg,wParam,lParam); + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; case IDC_WEBPAGE: - if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_WEBPAGE))) { + if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) { char szPage[256]; - GetDlgItemTextA(hwndDlg,IDC_WEBPAGE,szPage,SIZEOF(szPage)); - CallService(MS_UTILS_OPENURL,1,(LPARAM)szPage); + GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, SIZEOF(szPage)); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)szPage); } break; } @@ -508,12 +508,12 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hFont = CreateFontIndirect(&lf); SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(TRUE, 0)); - if (!DBGetContactSettingString((HANDLE)lParam,"UserInfo","MyNotes",&dbv)) { - SetDlgItemTextA(hwndDlg,IDC_MYNOTES,dbv.pszVal); + if (!DBGetContactSettingString((HANDLE)lParam, "UserInfo", "MyNotes", &dbv)) { + SetDlgItemTextA(hwndDlg, IDC_MYNOTES, dbv.pszVal); DBFreeVariant(&dbv); } } - SendDlgItemMessage(hwndDlg,IDC_MYNOTES,EM_LIMITTEXT,2048,0); + SendDlgItemMessage(hwndDlg, IDC_MYNOTES, EM_LIMITTEXT, 2048, 0); break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { @@ -523,20 +523,20 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { char *szProto; HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto == NULL) break; - SetValue(hwndDlg,IDC_ABOUT,hContact,szProto,"About",0); + SetValue(hwndDlg, IDC_ABOUT, hContact, szProto, "About", 0); } break; } case PSN_APPLY: { HANDLE hContact=(HANDLE)((LPPSHNOTIFY)lParam)->lParam; - if (GetWindowTextLength(GetDlgItem(hwndDlg,IDC_MYNOTES))) { + if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MYNOTES))) { char text[2048]; - GetDlgItemTextA(hwndDlg,IDC_MYNOTES,text,SIZEOF(text)); - DBWriteContactSettingString(hContact,"UserInfo","MyNotes",text); + GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, SIZEOF(text)); + DBWriteContactSettingString(hContact, "UserInfo", "MyNotes", text); } - else DBDeleteContactSetting(hContact,"UserInfo","MyNotes"); + else DBDeleteContactSetting(hContact, "UserInfo", "MyNotes"); break; } } @@ -544,10 +544,10 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } break; case WM_COMMAND: - if (wParam == MAKEWPARAM(IDC_MYNOTES,EN_CHANGE)) - SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); + if (wParam == MAKEWPARAM(IDC_MYNOTES, EN_CHANGE)) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); else if (LOWORD(wParam) == IDCANCEL) - SendMessage(GetParent(hwndDlg),msg,wParam,lParam); + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); break; case WM_DESTROY: { @@ -559,7 +559,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return FALSE; } -int DetailsInit(WPARAM wParam,LPARAM lParam) +int DetailsInit(WPARAM wParam, LPARAM lParam) { OPTIONSDIALOGPAGE odp; diff --git a/src/modules/userinfo/userinfo.cpp b/src/modules/userinfo/userinfo.cpp index 7dd3a1a121..0f07ea5ba3 100644 --- a/src/modules/userinfo/userinfo.cpp +++ b/src/modules/userinfo/userinfo.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h" #define UPDATEANIMFRAMES 20 -int DetailsInit(WPARAM wParam,LPARAM lParam); +int DetailsInit(WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static HANDLE hWindowList=NULL; static HANDLE hDetailsInitEvent; @@ -58,7 +58,7 @@ struct DetailsData { int *infosUpdated; }; -static int PageSortProc(OPTIONSDIALOGPAGE *item1,OPTIONSDIALOGPAGE *item2) +static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2) { int res; if (!lstrcmp(item1->ptszTitle, TranslateT("Summary"))) return -1; @@ -72,14 +72,14 @@ static int PageSortProc(OPTIONSDIALOGPAGE *item1,OPTIONSDIALOGPAGE *item2) return lstrcmp(item1->ptszTab, item2->ptszTab); } -static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) +static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM) { HWND hwnd; PROPSHEETHEADER psh; struct DetailsPageInit opi; int i; - if (hwnd=WindowList_Find(hWindowList,(HANDLE)wParam)) { + if (hwnd=WindowList_Find(hWindowList, (HANDLE)wParam)) { SetForegroundWindow(hwnd); SetFocus(hwnd); return 0; @@ -87,11 +87,11 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) opi.pageCount=0; opi.odp=NULL; - NotifyEventHooks(hDetailsInitEvent,(WPARAM)&opi,wParam); + NotifyEventHooks(hDetailsInitEvent, (WPARAM)&opi, wParam); if (opi.pageCount == 0) return 0; - qsort(opi.odp,opi.pageCount,sizeof(OPTIONSDIALOGPAGE),(int (*)(const void*,const void*))PageSortProc); + qsort(opi.odp, opi.pageCount, sizeof(OPTIONSDIALOGPAGE), (int (*)(const void*, const void*))PageSortProc); - ZeroMemory(&psh,sizeof(psh)); + ZeroMemory(&psh, sizeof(psh)); psh.dwSize = sizeof(psh); psh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW; psh.hwndParent = NULL; @@ -100,7 +100,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) psh.pszCaption = (TCHAR*)wParam; //more abuses of structure: this is hContact psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh); for (i=0;icbSize != OPTIONPAGE_OLD_SIZE3) return 1; - opi->odp=(OPTIONSDIALOGPAGE*)mir_realloc(opi->odp,sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1)); + opi->odp=(OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1)); dst = opi->odp + opi->pageCount; dst->cbSize = sizeof(OPTIONSDIALOGPAGE); dst->hInstance = odp->hInstance; @@ -178,11 +178,11 @@ static void CreateDetailsTabs( HWND hwndDlg, struct DetailsData* dat, struct Det tie.pszText = TranslateTS(dat->opd[i].ptszTab); tie.lParam = i; TabCtrl_InsertItem(hwndTab, pages, &tie); - if (!lstrcmp(dat->opd[i].ptszTab,ppg->ptszTab)) + if (!lstrcmp(dat->opd[i].ptszTab, ppg->ptszTab)) sel = pages; pages++; } - TabCtrl_SetCurSel(hwndTab,sel); + TabCtrl_SetCurSel(hwndTab, sel); LONG style = GetWindowLongPtr(hwndTab, GWL_STYLE); SetWindowLongPtr(hwndTab, GWL_STYLE, pages > 1 ? style | WS_TABSTOP : style & ~WS_TABSTOP); @@ -191,7 +191,7 @@ static void CreateDetailsTabs( HWND hwndDlg, struct DetailsData* dat, struct Det static void CreateDetailsPageWindow( HWND hwndDlg, struct DetailsData* dat, struct DetailsPageData* ppg ) { RECT *rc = ppg->ptszTab ? &dat->rcDisplayTab : &dat->rcDisplay; - ppg->hwnd=CreateDialogIndirectParam(ppg->hInst,ppg->pTemplate,hwndDlg,ppg->dlgProc,(LPARAM)dat->hContact); + ppg->hwnd=CreateDialogIndirectParam(ppg->hInst, ppg->pTemplate, hwndDlg, ppg->dlgProc, (LPARAM)dat->hContact); ThemeDialogBackground(ppg->hwnd); SetWindowPos(ppg->hwnd, HWND_TOP, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, 0); SetWindowPos(ppg->hwnd, HWND_TOP, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, 0); @@ -201,20 +201,20 @@ static void CreateDetailsPageWindow( HWND hwndDlg, struct DetailsData* dat, stru pshn.hdr.hwndFrom = ppg->hwnd; pshn.hdr.idFrom = 0; pshn.lParam = (LPARAM)ppg->dlgParam; - SendMessage(ppg->hwnd,WM_NOTIFY,0,(LPARAM)&pshn); + SendMessage(ppg->hwnd, WM_NOTIFY, 0, (LPARAM)&pshn); pshn.hdr.code=PSN_INFOCHANGED; pshn.hdr.hwndFrom=ppg->hwnd; pshn.hdr.idFrom=0; pshn.lParam=(LPARAM)dat->hContact; - SendMessage(ppg->hwnd,WM_NOTIFY,0,(LPARAM)&pshn); + SendMessage(ppg->hwnd, WM_NOTIFY, 0, (LPARAM)&pshn); } } -static int UserInfoContactDelete(WPARAM wParam,LPARAM) +static int UserInfoContactDelete(WPARAM wParam, LPARAM) { HWND hwnd; - hwnd=WindowList_Find(hWindowList,(HANDLE)wParam); + hwnd=WindowList_Find(hWindowList, (HANDLE)wParam); if (hwnd != NULL) DestroyWindow(hwnd); return 0; } @@ -223,7 +223,7 @@ static int UserInfoContactDelete(WPARAM wParam,LPARAM) #define M_CHECKONLINE (WM_USER+11) static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - struct DetailsData *dat =(struct DetailsData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + struct DetailsData *dat =(struct DetailsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: @@ -234,8 +234,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat = (DetailsData*)mir_calloc(sizeof(DetailsData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->hContact = (HANDLE)psh->pszCaption; - dat->hProtoAckEvent = HookEventMessage(ME_PROTO_ACK,hwndDlg,HM_PROTOACK); - WindowList_Add(hWindowList,hwndDlg,dat->hContact); + dat->hProtoAckEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_PROTOACK); + WindowList_Add(hWindowList, hwndDlg, dat->hContact); { TCHAR *name, oldTitle[256], newTitle[256]; if (dat->hContact == NULL) @@ -252,11 +252,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText( hwndDlg, IDC_HEADERBAR, newTitle ); } { LOGFONT lf; - HFONT hNormalFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_NAME,WM_GETFONT,0,0); - GetObject(hNormalFont,sizeof(lf),&lf); + HFONT hNormalFont=(HFONT)SendDlgItemMessage(hwndDlg, IDC_NAME, WM_GETFONT, 0, 0); + GetObject(hNormalFont, sizeof(lf), &lf); lf.lfWeight=FW_BOLD; dat->hBoldFont=CreateFontIndirect(&lf); - SendDlgItemMessage(hwndDlg,IDC_NAME,WM_SETFONT,(WPARAM)dat->hBoldFont,0); + SendDlgItemMessage(hwndDlg, IDC_NAME, WM_SETFONT, (WPARAM)dat->hBoldFont, 0); } { OPTIONSDIALOGPAGE *odp; int i; @@ -273,7 +273,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP odp = (OPTIONSDIALOGPAGE*)psh->ppsp; for ( i=0; i < dat->pageCount; i++ ) { - dat->opd[i].pTemplate = (LPDLGTEMPLATE)LockResource(LoadResource(odp[i].hInstance, + dat->opd[i].pTemplate = (LPDLGTEMPLATE)LockResource(LoadResource(odp[i].hInstance, FindResourceA(odp[i].hInstance, odp[i].pszTemplate, MAKEINTRESOURCEA(5)))); dat->opd[i].dlgProc = odp[i].pfnDlgProc; dat->opd[i].dlgParam = odp[i].dwInitParam; @@ -309,11 +309,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP tci.mask = TCIF_TEXT | TCIF_IMAGE; tci.iImage = -1; tci.pszText = _T("X"); - TabCtrl_InsertItem(hwndTab,0,&tci); + TabCtrl_InsertItem(hwndTab, 0, &tci); GetWindowRect(hwndTab, &dat->rcDisplayTab); TabCtrl_AdjustRect(hwndTab, FALSE, &dat->rcDisplayTab); - { POINT pt={0,0}; + { POINT pt={0, 0}; ClientToScreen(hwndDlg, &pt); OffsetRect(&dat->rcDisplayTab, -pt.x, -pt.y); } @@ -322,7 +322,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetWindowRect(hwndTab, &dat->rcDisplay); TabCtrl_AdjustRect(hwndTab, FALSE, &dat->rcDisplay); - { POINT pt={0,0}; + { POINT pt={0, 0}; ClientToScreen(hwndDlg, &pt); OffsetRect(&dat->rcDisplay, -pt.x, -pt.y); } } @@ -330,13 +330,13 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_PAGETREE), dat->opd[dat->currentPage].hItem); dat->updateAnimFrame = 0; - GetDlgItemText(hwndDlg,IDC_UPDATING,dat->szUpdating,SIZEOF(dat->szUpdating)); - SendMessage(hwndDlg,M_CHECKONLINE,0,0); - if (!CallContactService(dat->hContact,PSS_GETINFO,SGIF_ONOPEN,0)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),FALSE); - SetTimer(hwndDlg,1,100,NULL); + GetDlgItemText(hwndDlg, IDC_UPDATING, dat->szUpdating, SIZEOF(dat->szUpdating)); + SendMessage(hwndDlg, M_CHECKONLINE, 0, 0); + if (!CallContactService(dat->hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + SetTimer(hwndDlg, 1, 100, NULL); } else - ShowWindow(GetDlgItem(hwndDlg,IDC_UPDATING),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_HIDE); SetFocus(GetDlgItem(hwndDlg, IDC_PAGETREE)); @@ -345,8 +345,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_TIMER: { TCHAR str[128]; - mir_sntprintf(str,SIZEOF(str), _T("%.*s%s%.*s"),dat->updateAnimFrame%10,_T("........."),dat->szUpdating,dat->updateAnimFrame%10,_T(".........")); - SetDlgItemText(hwndDlg,IDC_UPDATING,str); + mir_sntprintf(str, SIZEOF(str), _T("%.*s%s%.*s"), dat->updateAnimFrame%10, _T("........."), dat->szUpdating, dat->updateAnimFrame%10, _T(".........")); + SetDlgItemText(hwndDlg, IDC_UPDATING, str); if (++dat->updateAnimFrame == UPDATEANIMFRAMES) dat->updateAnimFrame=0; break; } @@ -357,20 +357,20 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); case IDC_UPDATING: { - COLORREF textCol,bgCol,newCol; + COLORREF textCol, bgCol, newCol; int ratio; textCol=GetSysColor(COLOR_BTNTEXT); bgCol=GetSysColor(COLOR_3DFACE); ratio=abs(UPDATEANIMFRAMES/2-dat->updateAnimFrame)*510/UPDATEANIMFRAMES; - newCol=RGB(GetRValue(bgCol)+(GetRValue(textCol)-GetRValue(bgCol))*ratio/256, - GetGValue(bgCol)+(GetGValue(textCol)-GetGValue(bgCol))*ratio/256, + newCol=RGB(GetRValue(bgCol)+(GetRValue(textCol)-GetRValue(bgCol))*ratio/256, + GetGValue(bgCol)+(GetGValue(textCol)-GetGValue(bgCol))*ratio/256, GetBValue(bgCol)+(GetBValue(textCol)-GetBValue(bgCol))*ratio/256); - SetTextColor((HDC)wParam,newCol); - SetBkColor((HDC)wParam,GetSysColor(COLOR_3DFACE)); + SetTextColor((HDC)wParam, newCol); + SetBkColor((HDC)wParam, GetSysColor(COLOR_3DFACE)); return (INT_PTR)GetSysColorBrush(COLOR_3DFACE); } default: - SetBkMode((HDC)wParam,TRANSPARENT); + SetBkMode((HDC)wParam, TRANSPARENT); return (INT_PTR)GetStockObject(NULL_BRUSH); } break; @@ -389,7 +389,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0;ipageCount;i++) { pshn.hdr.hwndFrom=dat->opd[i].hwnd; if (dat->opd[i].hwnd != NULL) - SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn); + SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn); } break; } @@ -397,10 +397,10 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP { char *szProto; if (dat->hContact != NULL) { - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); - if (szProto == NULL) {EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),FALSE); break;} - if (CallProtoService(szProto,PS_GETSTATUS,0,0)hContact, 0); + if (szProto == NULL) {EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); break;} + if (CallProtoService(szProto, PS_GETSTATUS, 0, 0)hContact == NULL && ack->type == ACKTYPE_STATUS) { - SendMessage(hwndDlg,M_CHECKONLINE,0,0); + SendMessage(hwndDlg, M_CHECKONLINE, 0, 0); break; } if (ack->hContact != dat->hContact) break; if (ack->type != ACKTYPE_GETINFO) break; - SendMessage(hwndDlg,PSM_FORCECHANGED,0,0); + SendMessage(hwndDlg, PSM_FORCECHANGED, 0, 0); /* if they're not gonna send any more ACK's don't let that mean we should crash */ if (!ack->hProcess && !ack->lParam) { - ShowWindow(GetDlgItem(hwndDlg,IDC_UPDATING),SW_HIDE); - KillTimer(hwndDlg,1); - SendMessage(hwndDlg,M_CHECKONLINE,0,0); + ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_HIDE); + KillTimer(hwndDlg, 1); + SendMessage(hwndDlg, M_CHECKONLINE, 0, 0); break; } //if if (dat->infosUpdated == NULL) dat->infosUpdated=(int*)mir_calloc(sizeof(int)*(INT_PTR)ack->hProcess); @@ -428,9 +428,9 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0;i<(int)ack->hProcess;i++) if (dat->infosUpdated[i] == 0) break; if (i == (int)ack->hProcess) { - ShowWindow(GetDlgItem(hwndDlg,IDC_UPDATING),SW_HIDE); - KillTimer(hwndDlg,1); - SendMessage(hwndDlg,M_CHECKONLINE,0,0); + ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_HIDE); + KillTimer(hwndDlg, 1); + SendMessage(hwndDlg, M_CHECKONLINE, 0, 0); } } break; @@ -470,10 +470,10 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &tie); dat->currentPage = tie.lParam; - tvi.hItem = TreeView_GetNextItem(GetDlgItem(hwndDlg,IDC_PAGETREE), NULL, TVGN_CARET); + tvi.hItem = TreeView_GetNextItem(GetDlgItem(hwndDlg, IDC_PAGETREE), NULL, TVGN_CARET); tvi.mask = TVIF_PARAM; tvi.lParam = dat->currentPage; - TreeView_SetItem(GetDlgItem(hwndDlg,IDC_PAGETREE), &tvi); + TreeView_SetItem(GetDlgItem(hwndDlg, IDC_PAGETREE), &tvi); if (dat->currentPage != -1) { @@ -520,7 +520,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0;ipageCount;i++) { if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue; pshn.hdr.hwndFrom=dat->opd[i].hwnd; - SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn); + SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn); } DestroyWindow(hwndDlg); break; @@ -534,7 +534,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->currentPage != -1) { pshn.hdr.code=PSN_KILLACTIVE; pshn.hdr.hwndFrom=dat->opd[dat->currentPage].hwnd; - if (SendMessage(dat->opd[dat->currentPage].hwnd,WM_NOTIFY,0,(LPARAM)&pshn)) + if (SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn)) break; } @@ -542,11 +542,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0;ipageCount;i++) { if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue; pshn.hdr.hwndFrom=dat->opd[i].hwnd; - if (SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) { - TreeView_Select(GetDlgItem(hwndDlg,IDC_PAGETREE), dat->opd[i].hItem, TVGN_CARET); - if (dat->currentPage != -1) ShowWindow(dat->opd[dat->currentPage].hwnd,SW_HIDE); + if (SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) { + TreeView_Select(GetDlgItem(hwndDlg, IDC_PAGETREE), dat->opd[i].hItem, TVGN_CARET); + if (dat->currentPage != -1) ShowWindow(dat->opd[dat->currentPage].hwnd, SW_HIDE); dat->currentPage=i; - ShowWindow(dat->opd[dat->currentPage].hwnd,SW_SHOW); + ShowWindow(dat->opd[dat->currentPage].hwnd, SW_SHOW); return 0; } } @@ -556,10 +556,10 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_UPDATE: if (dat->infosUpdated != NULL) {mir_free(dat->infosUpdated); dat->infosUpdated=NULL;} if (dat->hContact != NULL) { - if (!CallContactService(dat->hContact,PSS_GETINFO,0,0)) { - EnableWindow(GetDlgItem(hwndDlg,IDC_UPDATE),FALSE); - ShowWindow(GetDlgItem(hwndDlg,IDC_UPDATING),SW_SHOW); - SetTimer(hwndDlg,1,100,NULL); + if (!CallContactService(dat->hContact, PSS_GETINFO, 0, 0)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_SHOW); + SetTimer(hwndDlg, 1, 100, NULL); } } break; @@ -567,7 +567,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_CLOSE: - SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDOK,BN_CLICKED),(LPARAM)GetDlgItem(hwndDlg,IDOK)); + SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK)); break; case WM_DESTROY: @@ -579,12 +579,12 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP tvi.pszText=name; tvi.cchTextMax=SIZEOF(name); TreeView_GetItem(GetDlgItem(hwndDlg, IDC_PAGETREE), &tvi); - DBWriteContactSettingTString(NULL,"UserInfo","LastTab", name); + DBWriteContactSettingTString(NULL, "UserInfo", "LastTab", name); } Window_FreeIcon_IcoLib(hwndDlg); - SendDlgItemMessage(hwndDlg,IDC_NAME,WM_SETFONT,SendDlgItemMessage(hwndDlg,IDC_WHITERECT,WM_GETFONT,0,0),0); + SendDlgItemMessage(hwndDlg, IDC_NAME, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_WHITERECT, WM_GETFONT, 0, 0), 0); DeleteObject(dat->hBoldFont); - WindowList_Remove(hWindowList,hwndDlg); + WindowList_Remove(hWindowList, hwndDlg); UnhookEvent(dat->hProtoAckEvent); { int i; for (i=0;ipageCount;i++) @@ -604,7 +604,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP int ShutdownUserInfo(WPARAM, LPARAM) { - WindowList_BroadcastAsync(hWindowList,WM_DESTROY,0,0); + WindowList_BroadcastAsync(hWindowList, WM_DESTROY, 0, 0); return 0; } @@ -612,12 +612,12 @@ int LoadUserInfoModule(void) { CLISTMENUITEM mi = { 0 }; - CreateServiceFunction(MS_USERINFO_SHOWDIALOG,ShowDetailsDialogCommand); + CreateServiceFunction(MS_USERINFO_SHOWDIALOG, ShowDetailsDialogCommand); hDetailsInitEvent=CreateHookableEvent(ME_USERINFO_INITIALISE); - HookEvent(ME_USERINFO_INITIALISE,DetailsInit); - HookEvent(ME_DB_CONTACT_DELETED,UserInfoContactDelete); - HookEvent(ME_SYSTEM_PRESHUTDOWN,ShutdownUserInfo); - CreateServiceFunction(MS_USERINFO_ADDPAGE,AddDetailsPage); + HookEvent(ME_USERINFO_INITIALISE, DetailsInit); + HookEvent(ME_DB_CONTACT_DELETED, UserInfoContactDelete); + HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownUserInfo); + CreateServiceFunction(MS_USERINFO_ADDPAGE, AddDetailsPage); mi.cbSize = sizeof(mi); mi.flags = CMIF_ICONFROMICOLIB; @@ -625,12 +625,12 @@ int LoadUserInfoModule(void) mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_USERDETAILS ); mi.pszName = LPGEN("User &Details"); mi.pszService = MS_USERINFO_SHOWDIALOG; - CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi); + Menu_AddContactMenuItem(&mi); mi.position = 500050000; mi.pszName = LPGEN("View/Change My &Details..."); - CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + Menu_AddMainMenuItem(&mi); - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0); + hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); return 0; } -- cgit v1.2.3