From 5e686292c537275c8ea1399f311c082d905e8a63 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 13 Jun 2012 17:26:45 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@398 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/findadd/findadd.cpp | 64 +++++++++++++++++------------------ src/modules/findadd/searchresults.cpp | 18 +++++----- 2 files changed, 41 insertions(+), 41 deletions(-) (limited to 'src/modules/findadd') diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 18d4c28670..380e644228 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -191,8 +191,8 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) { char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0); - if (szProto==NULL) return; - if (dat->hwndAdvSearch==NULL) { + if (szProto == NULL) return; + if (dat->hwndAdvSearch == NULL) { RECT rc; dat->hwndAdvSearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)hwndDlg); GetWindowRect(GetDlgItem(hwndDlg,IDC_RESULTS),&rc); @@ -223,8 +223,8 @@ static void ReposTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) static void ShowTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) { char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0); - if (szProto==NULL) return; - if (dat->hwndTinySearch==NULL) { + if (szProto == NULL) return; + if (dat->hwndTinySearch == NULL) { dat->hwndTinySearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)/*GetDlgItem(*/hwndDlg/*,IDC_TINYEXTENDEDGROUP)*/); if (dat->hwndTinySearch) ReposTinySearchDlg(hwndDlg, dat); @@ -236,7 +236,7 @@ static void ShowTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) static void HideAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) { - if (dat->hwndAdvSearch==NULL) return; + if (dat->hwndAdvSearch == NULL) return; if (animateWindow && IsWinVerXPPlus()) //blending is quite slow on win2k animateWindow(dat->hwndAdvSearch,150,AW_HIDE|AW_BLEND); else ShowWindow(dat->hwndAdvSearch,SW_HIDE); @@ -254,7 +254,7 @@ static void CheckSearchTypeRadioButton(HWND hwndDlg,int idControl) int i; static const int controls[]={IDC_BYPROTOID,IDC_BYEMAIL,IDC_BYNAME,IDC_BYADVANCED,IDC_BYCUSTOM}; for ( i=0; i < SIZEOF(controls); i++ ) - CheckDlgButton(hwndDlg,controls[i],idControl==controls[i]?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,controls[i],idControl == controls[i]?BST_CHECKED:BST_UNCHECKED); } #define sttErrMsg TranslateT("You haven't filled in the search field. Please enter a search term and try again.") @@ -522,7 +522,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; } case WM_TIMER: - if (wParam==TIMERID_THROBBER) { + if (wParam == TIMERID_THROBBER) { RECT rc; HDC hdc; int borders[3]; @@ -536,7 +536,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_DRAWITEM: { DRAWITEMSTRUCT *dis=(DRAWITEMSTRUCT*)lParam; - if (dis->CtlID==IDC_STATUSBAR && dis->itemID==1) { + if (dis->CtlID == IDC_STATUSBAR && dis->itemID == 1) { RenderThrobber(dis->hDC,&dis->rcItem,&dat->throbbing,&dat->pivot); return TRUE; } @@ -560,7 +560,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP hdi.fmt=HDF_LEFT|HDF_STRING; Header_SetItem(ListView_GetHeader(hwndList),dat->iLastColumnSortIndex,&hdi); - if (nmlv->iSubItem!=dat->iLastColumnSortIndex) + if (nmlv->iSubItem != dat->iLastColumnSortIndex) { dat->bSortAscending=TRUE; dat->iLastColumnSortIndex=nmlv->iSubItem; @@ -580,7 +580,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_PROTOLIST: - if (HIWORD(wParam)==CBN_SELCHANGE) { + if (HIWORD(wParam) == CBN_SELCHANGE) { HideAdvancedSearchDlg(hwndDlg,dat); if (dat->hwndAdvSearch) { DestroyWindow(dat->hwndAdvSearch); @@ -603,14 +603,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP HideAdvancedSearchDlg(hwndDlg,dat); break; case IDC_PROTOID: - if (HIWORD(wParam)==EN_CHANGE) { + if (HIWORD(wParam) == EN_CHANGE) { HideAdvancedSearchDlg(hwndDlg,dat); CheckSearchTypeRadioButton(hwndDlg,IDC_BYPROTOID); EnableWindow(GetDlgItem(hwndDlg,IDC_ADD),TRUE); } break; case IDC_EMAIL: - if (HIWORD(wParam)==EN_CHANGE) { + if (HIWORD(wParam) == EN_CHANGE) { HideAdvancedSearchDlg(hwndDlg,dat); CheckSearchTypeRadioButton(hwndDlg,IDC_BYEMAIL); } @@ -618,7 +618,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_NAMENICK: case IDC_NAMEFIRST: case IDC_NAMELAST: - if (HIWORD(wParam)==EN_CHANGE) { + if (HIWORD(wParam) == EN_CHANGE) { HideAdvancedSearchDlg(hwndDlg,dat); CheckSearchTypeRadioButton(hwndDlg,IDC_BYNAME); } @@ -658,7 +658,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR str[256]; GetDlgItemText(hwndDlg,IDC_PROTOID,str,SIZEOF(str)); rtrim(str); - if (str[0]==0) + if (str[0] == 0) MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); else BeginSearch(hwndDlg,dat,szProto,PS_BASICSEARCHT,PF1_BASICSEARCH,str); @@ -667,7 +667,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR str[256]; GetDlgItemText(hwndDlg,IDC_EMAIL,str,SIZEOF(str)); rtrim(str); - if (str[0]==0) + if (str[0] == 0) MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); else BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYEMAILT,PF1_SEARCHBYEMAIL,str); @@ -681,19 +681,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP psbn.pszFirstName = first; psbn.pszLastName = last; psbn.pszNick = nick; - if (nick[0]==0 && first[0]==0 && last[0]==0) + if (nick[0] == 0 && first[0] == 0 && last[0] == 0) MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); else BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYNAMET,PF1_SEARCHBYNAME,&psbn); } else if (IsDlgButtonChecked(hwndDlg,IDC_BYADVANCED)) { - if (dat->hwndAdvSearch==NULL) + if (dat->hwndAdvSearch == NULL) MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); else BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYADVANCED,PF1_EXTSEARCHUI,dat->hwndAdvSearch); } - if (dat->searchCount==0) { + if (dat->searchCount == 0) { if (dat->hResultHook) {UnhookEvent(dat->hResultHook); dat->hResultHook=NULL;} break; } @@ -749,8 +749,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; } } - if (lParam && dat->hwndTinySearch==(HWND)lParam - && HIWORD(wParam)==EN_SETFOCUS && LOWORD(wParam)==0 + if (lParam && dat->hwndTinySearch == (HWND)lParam + && HIWORD(wParam) == EN_SETFOCUS && LOWORD(wParam) == 0 && !IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) { CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM); } @@ -776,14 +776,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP { ACKDATA *ack=(ACKDATA*)lParam; int i; - if (ack->type!=ACKTYPE_SEARCH) break; + if (ack->type != ACKTYPE_SEARCH) break; for (i=0;isearchCount;i++) - if (dat->search[i].hProcess==ack->hProcess && dat->search[i].hProcess != NULL && !lstrcmpA(dat->search[i].szProto,ack->szModule)) break; - if (i==dat->searchCount) break; - if (ack->result==ACKRESULT_SUCCESS || ack->result==ACKRESULT_FAILED) { + if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != NULL && !lstrcmpA(dat->search[i].szProto,ack->szModule)) break; + if (i == dat->searchCount) break; + if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED) { dat->searchCount--; memmove(dat->search+i,dat->search+i+1,sizeof(struct ProtoSearchInfo)*(dat->searchCount-i)); - if (dat->searchCount==0) { + if (dat->searchCount == 0) { mir_free(dat->search); dat->search=NULL; UnhookEvent(dat->hResultHook); @@ -794,14 +794,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg); SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat); } - else if (ack->result==ACKRESULT_SEARCHRESULT && ack->lParam) { + else if (ack->result == ACKRESULT_SEARCHRESULT && ack->lParam) { PROTOSEARCHRESULT *psr; CUSTOMSEARCHRESULTS * csr=(CUSTOMSEARCHRESULTS*)ack->lParam; dat->bFlexSearchResult=TRUE; psr=&(csr->psr); - // check if this is column names data (psr->cbSize==0) - if ( psr->cbSize==0 ) { // blob contain info about columns + // check if this is column names data (psr->cbSize == 0) + if ( psr->cbSize == 0 ) { // blob contain info about columns int iColumn; LVCOLUMN lvc={0}; @@ -856,7 +856,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--; ) { szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); - if (szComboProto==NULL) continue; + if (szComboProto == NULL) continue; if (!lstrcmpA(szComboProto,ack->szModule)) { cbei.mask = CBEIF_IMAGE; @@ -876,7 +876,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP } break; } - else if (ack->result==ACKRESULT_DATA) { + else if (ack->result == ACKRESULT_DATA) { LVITEM lvi={0}; int i,col; PROTOSEARCHRESULT *psr=(PROTOSEARCHRESULT*)ack->lParam; @@ -900,7 +900,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i = SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCOUNT,0,0); i--; ) { szComboProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,i,0); - if (szComboProto==NULL) continue; + if (szComboProto == NULL) continue; if (!lstrcmpA(szComboProto,ack->szModule)) { cbei.mask=CBEIF_IMAGE; cbei.iItem=i; @@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP DBWriteContactSettingTString(NULL, "FindAdd", "LastSearched", szProto?szProto:_T("")); } SaveColumnSizes(hwndList); - if (dat->hResultHook!=NULL) UnhookEvent(dat->hResultHook); + if (dat->hResultHook != NULL) UnhookEvent(dat->hResultHook); FreeSearchResults(hwndList); ImageList_Destroy(dat->himlComboIcons); mir_free(dat->search); diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 868cd1f126..cc3622609f 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -183,7 +183,7 @@ void FreeSearchResults(HWND hwndResults) lvi.mask=LVIF_PARAM; ListView_GetItem(hwndResults,&lvi); lsr=(struct ListSearchResult*)lvi.lParam; - if (lsr==NULL) continue; + if (lsr == NULL) continue; mir_free(lsr->psr.id); mir_free(lsr->psr.email); mir_free(lsr->psr.nick); @@ -229,7 +229,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * } if (failures) { //infuriatingly vague error message. fixme. - if (dat->searchCount==0) { + if (dat->searchCount == 0) { forkthread(BeginSearchFailed,0,NULL); mir_free(dat->search); dat->search=NULL; @@ -241,7 +241,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * dat->searchCount=1; dat->search[0].hProcess=(HANDLE)CallProtoService(szProto,szSearchService,0,(LPARAM)pvSearchParams); dat->search[0].szProto=szProto; - if (dat->search[0].hProcess==NULL) { + if (dat->search[0].hProcess == NULL) { //infuriatingly vague error message. fixme. PROTOACCOUNT* pa = Proto_GetAccount(szProto); forkthread(BeginSearchFailed, 0, mir_tstrdup(pa->tszAccountName)); @@ -296,14 +296,14 @@ void SetStatusBarResultInfo(HWND hwndDlg) lvi.mask=LVIF_PARAM; ListView_GetItem(hwndResults,&lvi); lsr=(struct ListSearchResult*)lvi.lParam; - if (lsr==NULL) continue; + if (lsr == NULL) continue; for (i=0;iszProto) { + if (subtotal[i].szProto == lsr->szProto) { subtotal[i].count++; break; } } - if (i==subtotalCount) { + if (i == subtotalCount) { subtotal=(struct ProtoResultsSummary*)mir_realloc(subtotal,sizeof(struct ProtoResultsSummary)*(subtotalCount+1)); subtotal[subtotalCount].szProto=lsr->szProto; subtotal[subtotalCount++].count=1; @@ -316,7 +316,7 @@ void SetStatusBarResultInfo(HWND hwndDlg) return; if ( subtotalCount == 1 ) { - if (total==1) mir_sntprintf( str, SIZEOF(str), TranslateT("1 %s user found"), pa->tszAccountName ); + if (total == 1) mir_sntprintf( str, SIZEOF(str), TranslateT("1 %s user found"), pa->tszAccountName ); else mir_sntprintf( str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName ); } else { @@ -341,7 +341,7 @@ void SetStatusBarResultInfo(HWND hwndDlg) void CreateResultsColumns(HWND hwndResults,struct FindAddDlgData *dat,char *szProto) { SaveColumnSizes(hwndResults); - while(ListView_DeleteColumn(hwndResults,0)); + while (ListView_DeleteColumn(hwndResults,0)); ListView_SetImageList(hwndResults,dat->himlComboIcons,LVSIL_SMALL); LoadColumnSizes(hwndResults,szProto); } @@ -356,7 +356,7 @@ void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y) dat=(struct FindAddDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); { LVITEM lvi; - if (ListView_GetSelectedCount(GetDlgItem(hwndDlg,IDC_RESULTS))!=1) return; + if (ListView_GetSelectedCount(GetDlgItem(hwndDlg,IDC_RESULTS)) != 1) return; lvi.mask=LVIF_PARAM; lvi.iItem=ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_RESULTS),-1,LVNI_ALL|LVNI_SELECTED); ListView_GetItem(GetDlgItem(hwndDlg,IDC_RESULTS),&lvi); -- cgit v1.2.3