From 46a53191c1ad11a41c948594e972568e62d155b4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Jun 2012 13:58:20 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@332 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/userinfo/contactinfo.cpp | 126 +++++++++++++++++------------------ src/modules/userinfo/stdinfo.cpp | 74 ++++++++++---------- src/modules/userinfo/userinfo.cpp | 70 +++++++++---------- 3 files changed, 135 insertions(+), 135 deletions(-) (limited to 'src/modules/userinfo') diff --git a/src/modules/userinfo/contactinfo.cpp b/src/modules/userinfo/contactinfo.cpp index c8fcc9de0c..b8dd841835 100644 --- a/src/modules/userinfo/contactinfo.cpp +++ b/src/modules/userinfo/contactinfo.cpp @@ -30,7 +30,7 @@ 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")); + if (*(char*)lParam) SetWindowText(hwndDlg,TranslateT("Edit E-Mail Address")); TranslateDialogDefault(hwndDlg); SetDlgItemTextA(hwndDlg,IDC_EMAIL,(char*)lParam); EnableWindow(GetDlgItem(hwndDlg,IDOK),*(char*)lParam); @@ -43,7 +43,7 @@ static INT_PTR CALLBACK EditUserEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDCANCEL: EndDialog(hwndDlg,wParam); case IDC_EMAIL: - if(HIWORD(wParam)==EN_CHANGE) + if (HIWORD(wParam)==EN_CHANGE) EnableWindow(GetDlgItem(hwndDlg,IDOK),GetWindowTextLength(GetDlgItem(hwndDlg,IDC_EMAIL))); break; } @@ -62,9 +62,9 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar int i,item,countryCount; struct CountryListEntry *countries; SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam); - if(szText[0]) SetWindowText(hwndDlg,TranslateT("Edit Phone Number")); + if (szText[0]) SetWindowText(hwndDlg,TranslateT("Edit Phone Number")); TranslateDialogDefault(hwndDlg); - if(lstrlenA(szText)>4 && !lstrcmpA(szText+lstrlenA(szText)-4," SMS")) { + if (lstrlenA(szText)>4 && !lstrcmpA(szText+lstrlenA(szText)-4," SMS")) { CheckDlgButton(hwndDlg,IDC_SMS,BST_CHECKED); szText[lstrlenA(szText)-4]='\0'; } @@ -72,8 +72,8 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar 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;i4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4," SMS")) { + 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'; } @@ -318,14 +318,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP 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); 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); @@ -333,15 +333,15 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.iItem++; } lvi.iSubItem=0; - for(i=0;;i++) { + for (i=0;;i++) { lvi.lParam=i; mir_snprintf(idstr, SIZEOF(idstr), "MyPhone%d",i); - if(DBGetContactSettingTString(hContact,"UserInfo",idstr,&dbv)) + 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"))) { + 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'; } @@ -378,7 +378,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { RECT 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) { + 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)); @@ -391,14 +391,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } HICON hIcon = NULL; - if(nm->nmcd.lItemlParam==(LPARAM)(-2) && nm->iSubItem-3==(nm->nmcd.hdr.idFrom==IDC_PHONES)) + 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)) { + 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}; - if(nm->iSubItem==2 && nm->nmcd.hdr.idFrom==IDC_PHONES) { + 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)); - if(szText[0]) hIcon = LoadSkinIcon( SKINICON_OTHER_SMS ); + if (szText[0]) hIcon = LoadSkinIcon( SKINICON_OTHER_SMS ); } else hIcon = LoadSkinIcon( iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom==IDC_EMAILS)] ); } @@ -419,33 +419,33 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP 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); break; } - if(nm->iSubItem<2) 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; + 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); - if(lvi.lParam==(LPARAM)(-1)) break; - if(lvi.lParam==(LPARAM)(-2)) { - if(hti.iSubItem-3==(nm->hdr.idFrom==IDC_PHONES)) { + 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]; 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++) { + for (i=0;;i++) { mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i); - if(DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; + if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; DBFreeVariant(&dbv); } DBWriteContactSettingString(hContact,"UserInfo",idstr,szNewData); @@ -453,14 +453,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } } else { - if(hti.iSubItem-3==(nm->hdr.idFrom==IDC_PHONES)) { + if (hti.iSubItem-3==(nm->hdr.idFrom==IDC_PHONES)) { //delete int i; char idstr[33]; DBVARIANT dbv; - for(i=lvi.lParam;;i++) { + for (i=lvi.lParam;;i++) { mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i+1); - if(DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; + if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i); DBWriteContactSettingString(hContact,"UserInfo",idstr,dbv.pszVal); DBFreeVariant(&dbv); @@ -469,15 +469,15 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBDeleteContactSetting(hContact,"UserInfo",idstr); SendMessage(hwndDlg,M_REMAKELISTS,0,0); } - else if(hti.iSubItem-2==(nm->hdr.idFrom==IDC_PHONES)) { + else if (hti.iSubItem-2==(nm->hdr.idFrom==IDC_PHONES)) { //edit char szText[256],idstr[33]; DBVARIANT dbv; mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,lvi.lParam); - if(DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break; + 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); @@ -490,14 +490,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } break; case WM_SETCURSOR: - if(LOWORD(lParam)!=HTCLIENT) break; - if(GetForegroundWindow()==GetParent(hwndDlg)) { + if (LOWORD(lParam)!=HTCLIENT) break; + if (GetForegroundWindow()==GetParent(hwndDlg)) { POINT pt; GetCursorPos(&pt); 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); return TRUE; diff --git a/src/modules/userinfo/stdinfo.cpp b/src/modules/userinfo/stdinfo.cpp index 68de7a531d..976c590ac4 100644 --- a/src/modules/userinfo/stdinfo.cpp +++ b/src/modules/userinfo/stdinfo.cpp @@ -72,26 +72,26 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC); dbv.type=DBVT_DELETED; - if(szModule==NULL) unspecified=1; + 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); - if(!unspecified) { + if (!unspecified) { switch(dbv.type) { case DBVT_BYTE: - if(special==SVS_GENDER) { - if(dbv.cVal=='M') ptstr=TranslateT("Male"); - else if(dbv.cVal=='F') ptstr=TranslateT("Female"); + if (special==SVS_GENDER) { + if (dbv.cVal=='M') ptstr=TranslateT("Male"); + else if (dbv.cVal=='F') ptstr=TranslateT("Female"); else unspecified=1; } - else if(special==SVS_MONTH) { - if(dbv.bVal>0 && dbv.bVal<=12) { + 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)); } else unspecified=1; } - else if(special==SVS_TIMEZONE) { - if(dbv.cVal==-100) unspecified=1; + else if (special==SVS_TIMEZONE) { + 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); @@ -103,7 +103,7 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char } break; case DBVT_WORD: - if(special==SVS_COUNTRY) { + if (special==SVS_COUNTRY) { WORD wSave = dbv.wVal; if (wSave == ( WORD )-1) { char szSettingName[100]; @@ -125,20 +125,20 @@ static void SetValue(HWND hwndDlg,int idCtrl,HANDLE hContact,char *szModule,char break; case DBVT_DWORD: unspecified=(special==SVS_ZEROISUNSPEC && dbv.dVal==0); - if(special==SVS_IP) { + if (special==SVS_IP) { struct in_addr ia; ia.S_un.S_addr=htonl(dbv.dVal); pstr=inet_ntoa(ia); - if(dbv.dVal==0) unspecified=1; + if (dbv.dVal==0) unspecified=1; } else pstr=_itoa(special==SVS_SIGNED?dbv.lVal:dbv.dVal,str,10); break; case DBVT_ASCIIZ: - unspecified=(special==SVS_ZEROISUNSPEC && dbv.pszVal[0]=='\0'); + unspecified=(special==SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); pstr=dbv.pszVal; break; case DBVT_UTF8: - unspecified=(special==SVS_ZEROISUNSPEC && dbv.pszVal[0]=='\0'); + unspecified=(special==SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); #if defined( _UNICODE ) if ( !unspecified ) { WCHAR* wszStr; @@ -207,7 +207,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP 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); @@ -283,7 +283,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(GetParent(hwndDlg),msg,wParam,lParam); break; case IDC_TIMEZONESELECT: - if(HIWORD(wParam) == CBN_SELCHANGE) { + if (HIWORD(wParam) == CBN_SELCHANGE) { HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); SendMessage(GetParent(hwndDlg),PSM_CHANGED, 0,0); @@ -330,7 +330,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA 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); @@ -394,38 +394,38 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask=LVIF_TEXT; lvi.iSubItem=0; lvi.iItem=0; - for(i=0;;i++) { + for (i=0;;i++) { mir_snprintf(idstr, SIZEOF(idstr), "Past%d",i); - if((proto_service && Proto_GetContactInfoSetting(hContact,szProto,szProto,idstr,&dbv,DBVT_TCHAR)) || + 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)) - {if(proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;} + 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); DBFreeVariant(&dbvText); - if(proto_service) + if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); lvi.iItem++; } - for(i=0;;i++) { + for (i=0;;i++) { mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i); - if((proto_service && Proto_GetContactInfoSetting(hContact,szProto,szProto,idstr,&dbv,DBVT_TCHAR)) || + 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)) - {if(proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;} + 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); DBFreeVariant(&dbvText); - if(proto_service) + if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); @@ -439,19 +439,19 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.mask=LVIF_TEXT; lvi.iSubItem=0; lvi.iItem=0; - for(i=0;;i++) { + for (i=0;;i++) { mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i); - if((proto_service && Proto_GetContactInfoSetting(hContact,szProto,szProto,idstr,&dbv,DBVT_TCHAR)) || + 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(proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); break;} + 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); DBFreeVariant(&dbvText); - if(proto_service) + if (proto_service) Proto_FreeInfoVariant(&dbv); else DBFreeVariant(&dbv); @@ -468,7 +468,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, 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); @@ -508,7 +508,7 @@ 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)) { + if (!DBGetContactSettingString((HANDLE)lParam,"UserInfo","MyNotes",&dbv)) { SetDlgItemTextA(hwndDlg,IDC_MYNOTES,dbv.pszVal); DBFreeVariant(&dbv); } @@ -531,7 +531,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } 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); @@ -544,9 +544,9 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } break; case WM_COMMAND: - if(wParam==MAKEWPARAM(IDC_MYNOTES,EN_CHANGE)) + if (wParam==MAKEWPARAM(IDC_MYNOTES,EN_CHANGE)) SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); - else if(LOWORD(wParam)==IDCANCEL) + else if (LOWORD(wParam)==IDCANCEL) SendMessage(GetParent(hwndDlg),msg,wParam,lParam); break; case WM_DESTROY: diff --git a/src/modules/userinfo/userinfo.cpp b/src/modules/userinfo/userinfo.cpp index 77729dd416..9a8daf0266 100644 --- a/src/modules/userinfo/userinfo.cpp +++ b/src/modules/userinfo/userinfo.cpp @@ -79,7 +79,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) 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; @@ -88,7 +88,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) opi.pageCount=0; opi.odp=NULL; NotifyEventHooks(hDetailsInitEvent,(WPARAM)&opi,wParam); - if(opi.pageCount==0) return 0; + if (opi.pageCount==0) return 0; qsort(opi.odp,opi.pageCount,sizeof(OPTIONSDIALOGPAGE),(int (*)(const void*,const void*))PageSortProc); ZeroMemory(&psh,sizeof(psh)); @@ -101,12 +101,12 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam,LPARAM) psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh); - for(i=0;icbSize!=sizeof(OPTIONSDIALOGPAGE) + if (odp==NULL||opi==NULL) return 1; + if (odp->cbSize!=sizeof(OPTIONSDIALOGPAGE) && odp->cbSize != OPTIONPAGE_OLD_SIZE2 && odp->cbSize != OPTIONPAGE_OLD_SIZE3) return 1; @@ -129,7 +129,7 @@ static INT_PTR AddDetailsPage(WPARAM wParam,LPARAM lParam) dst->hInstance = odp->hInstance; dst->pfnDlgProc = odp->pfnDlgProc; dst->position = odp->position; - if((DWORD_PTR)odp->pszTemplate&0xFFFF0000) dst->pszTemplate = mir_strdup(odp->pszTemplate); + if ((DWORD_PTR)odp->pszTemplate&0xFFFF0000) dst->pszTemplate = mir_strdup(odp->pszTemplate); else dst->pszTemplate = odp->pszTemplate; #if defined(_UNICODE) @@ -215,7 +215,7 @@ static int UserInfoContactDelete(WPARAM wParam,LPARAM) { HWND hwnd; hwnd=WindowList_Find(hWindowList,(HANDLE)wParam); - if(hwnd!=NULL) DestroyWindow(hwnd); + if (hwnd!=NULL) DestroyWindow(hwnd); return 0; } @@ -347,7 +347,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP 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); - if(++dat->updateAnimFrame==UPDATEANIMFRAMES) dat->updateAnimFrame=0; + if (++dat->updateAnimFrame==UPDATEANIMFRAMES) dat->updateAnimFrame=0; break; } case WM_CTLCOLORSTATIC: @@ -386,9 +386,9 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.hdr.code=PSN_INFOCHANGED; pshn.hdr.idFrom=0; pshn.lParam=(LPARAM)dat->hContact; - for(i=0;ipageCount;i++) { + for (i=0;ipageCount;i++) { pshn.hdr.hwndFrom=dat->opd[i].hwnd; - if(dat->opd[i].hwnd!=NULL) + if (dat->opd[i].hwnd!=NULL) SendMessage(dat->opd[i].hwnd,WM_NOTIFY,0,(LPARAM)&pshn); } break; @@ -398,8 +398,8 @@ 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==NULL && ack->type==ACKTYPE_STATUS) { + if (ack->hContact==NULL && ack->type==ACKTYPE_STATUS) { SendMessage(hwndDlg,M_CHECKONLINE,0,0); break; } - if(ack->hContact!=dat->hContact) break; - if(ack->type!=ACKTYPE_GETINFO) break; + if (ack->hContact!=dat->hContact) break; + if (ack->type!=ACKTYPE_GETINFO) break; 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) { @@ -423,11 +423,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(hwndDlg,M_CHECKONLINE,0,0); break; } //if - if(dat->infosUpdated==NULL) dat->infosUpdated=(int*)mir_calloc(sizeof(int)*(INT_PTR)ack->hProcess); - if(ack->result==ACKRESULT_SUCCESS || ack->result==ACKRESULT_FAILED) dat->infosUpdated[ack->lParam]=1; - for(i=0;i<(int)ack->hProcess;i++) - if(dat->infosUpdated[i]==0) break; - if(i==(int)ack->hProcess) { + if (dat->infosUpdated==NULL) dat->infosUpdated=(int*)mir_calloc(sizeof(int)*(INT_PTR)ack->hProcess); + if (ack->result==ACKRESULT_SUCCESS || ack->result==ACKRESULT_FAILED) dat->infosUpdated[ack->lParam]=1; + 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); @@ -493,7 +493,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP TVITEM tvi = pnmtv->itemNew; dat->currentPage = tvi.lParam; - if(dat->currentPage != -1) + if (dat->currentPage != -1) { CreateDetailsTabs(hwndDlg, dat, &dat->opd[dat->currentPage]); if (dat->opd[dat->currentPage].hwnd == NULL) @@ -517,8 +517,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.hdr.idFrom=0; pshn.lParam=(LPARAM)dat->hContact; pshn.hdr.code=PSN_RESET; - for(i=0;ipageCount;i++) { - if(dat->opd[i].hwnd==NULL || !dat->opd[i].changed) continue; + 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); } @@ -531,20 +531,20 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP PSHNOTIFY pshn; pshn.hdr.idFrom=0; pshn.lParam=(LPARAM)dat->hContact; - if(dat->currentPage!=-1) { + 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; } pshn.hdr.code=PSN_APPLY; - for(i=0;ipageCount;i++) { - if(dat->opd[i].hwnd==NULL || !dat->opd[i].changed) continue; + 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) { + 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 (dat->currentPage!=-1) ShowWindow(dat->opd[dat->currentPage].hwnd,SW_HIDE); dat->currentPage=i; ShowWindow(dat->opd[dat->currentPage].hwnd,SW_SHOW); return 0; @@ -554,8 +554,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; } case IDC_UPDATE: - if(dat->infosUpdated!=NULL) {mir_free(dat->infosUpdated); dat->infosUpdated=NULL;} - if(dat->hContact != NULL) { + 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); @@ -587,9 +587,9 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP WindowList_Remove(hWindowList,hwndDlg); UnhookEvent(dat->hProtoAckEvent); { int i; - for(i=0;ipageCount;i++) + for (i=0;ipageCount;i++) { - if(dat->opd[i].hwnd!=NULL) DestroyWindow(dat->opd[i].hwnd); + if (dat->opd[i].hwnd!=NULL) DestroyWindow(dat->opd[i].hwnd); mir_free(dat->opd[i].ptszTitle); mir_free(dat->opd[i].ptszTab); } -- cgit v1.2.3