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/addcontact/addcontact.cpp | 74 ++-- src/modules/autoaway/autoaway.cpp | 2 +- src/modules/button/button.cpp | 36 +- src/modules/clist/Docking.cpp | 6 +- src/modules/clist/clc.cpp | 46 +- src/modules/clist/clc.h | 12 +- src/modules/clist/clcfiledrop.cpp | 2 +- src/modules/clist/clcidents.cpp | 2 +- src/modules/clist/clcitems.cpp | 10 +- src/modules/clist/clcmsgs.cpp | 12 +- src/modules/clist/clcutils.cpp | 8 +- src/modules/clist/clistcore.cpp | 8 +- src/modules/clist/clistevents.cpp | 18 +- src/modules/clist/clistmenus.cpp | 172 ++++---- src/modules/clist/clistmod.cpp | 6 +- src/modules/clist/clistsettings.cpp | 8 +- src/modules/clist/clisttray.cpp | 30 +- src/modules/clist/clui.cpp | 48 +-- src/modules/clist/cluiservices.cpp | 6 +- src/modules/clist/contact.cpp | 28 +- src/modules/clist/genmenu.cpp | 72 ++-- src/modules/clist/genmenu.h | 16 +- src/modules/clist/genmenuopt.cpp | 166 ++++---- src/modules/clist/groups.cpp | 4 +- src/modules/clist/keyboard.cpp | 48 +-- src/modules/clist/movetogroup.cpp | 16 +- src/modules/clist/protocolorder.cpp | 10 +- src/modules/contacts/contacts.cpp | 112 ++--- src/modules/database/database.cpp | 40 +- src/modules/database/dbini.cpp | 146 +++---- src/modules/database/dblists.cpp | 4 +- src/modules/database/dblists.h | 6 +- src/modules/database/dbutils.cpp | 12 +- src/modules/database/profilemanager.cpp | 66 +-- src/modules/database/profilemanager.h | 2 +- src/modules/findadd/findadd.cpp | 444 +++++++++---------- src/modules/findadd/findadd.h | 16 +- src/modules/findadd/searchresults.cpp | 118 +++--- src/modules/fonts/FontOptions.cpp | 66 +-- src/modules/fonts/FontService.cpp | 4 +- src/modules/fonts/FontService.h | 4 +- src/modules/fonts/services.cpp | 16 +- src/modules/help/about.cpp | 32 +- src/modules/help/help.cpp | 32 +- src/modules/history/history.cpp | 128 +++--- src/modules/icolib/IcoLib.h | 2 +- src/modules/icolib/extracticon.cpp | 6 +- src/modules/icolib/skin2icons.cpp | 90 ++-- src/modules/idle/idle.cpp | 62 +-- src/modules/ignore/ignore.cpp | 324 +++++++------- src/modules/langpack/langpack.cpp | 30 +- src/modules/langpack/lpservices.cpp | 32 +- src/modules/netlib/netlib.cpp | 158 +++---- src/modules/netlib/netlib.h | 78 ++-- src/modules/netlib/netlibautoproxy.cpp | 20 +- src/modules/netlib/netlibbind.cpp | 20 +- src/modules/netlib/netlibhttp.cpp | 30 +- src/modules/netlib/netlibhttpproxy.cpp | 16 +- src/modules/netlib/netliblog.cpp | 150 +++---- src/modules/netlib/netlibopenconn.cpp | 100 ++--- src/modules/netlib/netlibopts.cpp | 268 ++++++------ src/modules/netlib/netlibpktrecver.cpp | 16 +- src/modules/netlib/netlibsecurity.cpp | 32 +- src/modules/netlib/netlibsock.cpp | 14 +- src/modules/netlib/netlibssl.cpp | 100 ++--- src/modules/netlib/netlibupnp.cpp | 32 +- src/modules/options/descbutton.cpp | 22 +- src/modules/options/filter.cpp | 10 +- src/modules/options/filter.h | 4 +- src/modules/options/headerbar.cpp | 26 +- src/modules/options/iconheader.cpp | 46 +- src/modules/options/options.cpp | 2 +- src/modules/plugins/newplugins.cpp | 2 +- src/modules/protocols/protoaccs.cpp | 4 +- src/modules/protocols/protochains.cpp | 84 ++-- src/modules/protocols/protocols.cpp | 20 +- src/modules/protocols/protoint.cpp | 8 +- src/modules/protocols/protoopts.cpp | 18 +- src/modules/skin/hotkeys.cpp | 24 +- src/modules/skin/skinicons.cpp | 130 +++--- src/modules/skin/sounds.cpp | 52 +-- src/modules/srauth/auth.cpp | 8 +- src/modules/srauth/authdialogs.cpp | 22 +- src/modules/srawaymsg/awaymsg.cpp | 36 +- src/modules/srawaymsg/sendmsg.cpp | 48 +-- src/modules/sremail/email.cpp | 28 +- src/modules/srfile/file.cpp | 94 ++-- src/modules/srfile/file.h | 20 +- src/modules/srfile/fileexistsdlg.cpp | 128 +++--- src/modules/srfile/fileopts.cpp | 118 +++--- src/modules/srfile/filerecvdlg.cpp | 186 ++++---- src/modules/srfile/filesenddlg.cpp | 118 +++--- src/modules/srfile/filexferdlg.cpp | 166 ++++---- src/modules/srfile/ftmanager.cpp | 8 +- src/modules/srurl/url.cpp | 62 +-- src/modules/srurl/url.h | 2 +- src/modules/srurl/urldialogs.cpp | 306 +++++++------- src/modules/updatenotify/updatenotify.cpp | 16 +- src/modules/userinfo/contactinfo.cpp | 318 +++++++------- src/modules/userinfo/stdinfo.cpp | 220 +++++----- src/modules/userinfo/userinfo.cpp | 162 +++---- src/modules/useronline/useronline.cpp | 34 +- src/modules/utils/bmpfilter.cpp | 108 ++--- src/modules/utils/colourpicker.cpp | 50 +-- src/modules/utils/hyperlink.cpp | 82 ++-- src/modules/utils/imgconv.cpp | 2 +- src/modules/utils/md5.cpp | 26 +- src/modules/utils/openurl.cpp | 82 ++-- src/modules/utils/path.cpp | 14 +- src/modules/utils/resizer.cpp | 18 +- src/modules/utils/sha1.cpp | 16 +- src/modules/utils/timeutils.cpp | 12 +- src/modules/utils/timezones.cpp | 4 +- src/modules/utils/utf.cpp | 20 +- src/modules/utils/utils.cpp | 568 ++++++++++++------------- src/modules/utils/windowlist.cpp | 32 +- src/modules/visibility/visibility.cpp | 152 +++---- src/modules/xml/xmlApi.cpp | 4 +- src/modules/xml/xmlParser.cpp | 682 +++++++++++++++--------------- src/modules/xml/xmlParser.h | 140 +++--- 120 files changed, 4126 insertions(+), 4132 deletions(-) (limited to 'src/modules') diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index 5a72b7b6e9..b9c3fbb683 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.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. @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "..\..\core\commonheaders.h" -INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) +INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) { ADDCONTACTSTRUCT *acs; @@ -31,7 +31,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara { char szUin[10]; acs=(ADDCONTACTSTRUCT *)lparam; - SetWindowLongPtr(hdlg,GWLP_USERDATA,(LONG_PTR)acs); + SetWindowLongPtr(hdlg, GWLP_USERDATA, (LONG_PTR)acs); TranslateDialogDefault(hdlg); Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_ADDCONTACT); @@ -41,8 +41,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara dbei.cbSize=sizeof(dbei); dbei.cbBlob=sizeof(DWORD); dbei.pBlob=(PBYTE)&dwUin; - CallService(MS_DB_EVENT_GET,(WPARAM)acs->handle,(LPARAM)&dbei); - _ltoa(dwUin,szUin,10); + CallService(MS_DB_EVENT_GET, (WPARAM)acs->handle, (LPARAM)&dbei); + _ltoa(dwUin, szUin, 10); acs->szProto = dbei.szModule; } { @@ -56,11 +56,11 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara DBEVENTINFO dbei; HANDLE hcontact; - ZeroMemory(&dbei,sizeof(dbei)); + ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize=sizeof(dbei); - dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)acs->handle,0); + dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)acs->handle, 0); dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob); - CallService(MS_DB_EVENT_GET,(WPARAM)acs->handle,(LPARAM)&dbei); + CallService(MS_DB_EVENT_GET, (WPARAM)acs->handle, (LPARAM)&dbei); hcontact=*((PHANDLE)(dbei.pBlob+sizeof(DWORD))); mir_free(dbei.pBlob); if (hcontact != INVALID_HANDLE_VALUE) { @@ -84,7 +84,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara if ( acs->handleType == HANDLE_CONTACT && acs->handle ) if ( acs->szProto == NULL || (acs->szProto != NULL && *acs->szProto == 0 )) - acs->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)acs->handle,0); + acs->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)acs->handle, 0); { int groupId; @@ -92,36 +92,36 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara DBVARIANT dbv; char idstr[4]; int id; - _itoa(groupId,idstr,10); - if (DBGetContactSettingTString(NULL,"CListGroups",idstr,&dbv)) break; - id = SendDlgItemMessage(hdlg,IDC_GROUP,CB_ADDSTRING,0,(LPARAM)(dbv.ptszVal+1)); - SendDlgItemMessage(hdlg,IDC_GROUP,CB_SETITEMDATA ,id,groupId+1); + _itoa(groupId, idstr, 10); + if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv)) break; + id = SendDlgItemMessage(hdlg, IDC_GROUP, CB_ADDSTRING, 0, (LPARAM)(dbv.ptszVal+1)); + SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETITEMDATA , id, groupId+1); DBFreeVariant(&dbv); } } - SendDlgItemMessage(hdlg,IDC_GROUP,CB_INSERTSTRING,0,(LPARAM)TranslateT("None")); - SendDlgItemMessage(hdlg,IDC_GROUP,CB_SETCURSEL,0,0); + SendDlgItemMessage(hdlg, IDC_GROUP, CB_INSERTSTRING, 0, (LPARAM)TranslateT("None")); + SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETCURSEL, 0, 0); /* acs->szProto may be NULL don't expect it */ { // By default check both checkboxes - CheckDlgButton(hdlg,IDC_ADDED,BST_CHECKED); - CheckDlgButton(hdlg,IDC_AUTH,BST_CHECKED); + CheckDlgButton(hdlg, IDC_ADDED, BST_CHECKED); + CheckDlgButton(hdlg, IDC_AUTH, BST_CHECKED); - DWORD flags = (acs->szProto) ? CallProtoService(acs->szProto,PS_GETCAPS,PFLAGNUM_4,0) : 0; + DWORD flags = (acs->szProto) ? CallProtoService(acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0; if (flags&PF4_FORCEADDED) { // force you were added requests for this protocol - EnableWindow(GetDlgItem(hdlg,IDC_ADDED),FALSE); + EnableWindow(GetDlgItem(hdlg, IDC_ADDED), FALSE); } if (flags&PF4_FORCEAUTH) { // force auth requests for this protocol - EnableWindow(GetDlgItem(hdlg,IDC_AUTH),FALSE); + EnableWindow(GetDlgItem(hdlg, IDC_AUTH), FALSE); } if (flags&PF4_NOCUSTOMAUTH) { - EnableWindow(GetDlgItem(hdlg,IDC_AUTHREQ),FALSE); - EnableWindow(GetDlgItem(hdlg,IDC_AUTHGB),FALSE); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHREQ), FALSE); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHGB), FALSE); } else { - EnableWindow(GetDlgItem(hdlg,IDC_AUTHREQ),IsDlgButtonChecked(hdlg,IDC_AUTH)); - EnableWindow(GetDlgItem(hdlg,IDC_AUTHGB),IsDlgButtonChecked(hdlg,IDC_AUTH)); - SetDlgItemText(hdlg,IDC_AUTHREQ,TranslateT("Please authorize my request and add me to your contact list.")); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHREQ), IsDlgButtonChecked(hdlg, IDC_AUTH)); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHGB), IsDlgButtonChecked(hdlg, IDC_AUTH)); + SetDlgItemText(hdlg, IDC_AUTHREQ, TranslateT("Please authorize my request and add me to your contact list.")); } } break; @@ -133,14 +133,14 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara { case IDC_AUTH: { - DWORD flags = CallProtoService(acs->szProto,PS_GETCAPS,PFLAGNUM_4,0); + DWORD flags = CallProtoService(acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0); if (flags & PF4_NOCUSTOMAUTH) { - EnableWindow(GetDlgItem(hdlg,IDC_AUTHREQ),FALSE); - EnableWindow(GetDlgItem(hdlg,IDC_AUTHGB),FALSE); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHREQ), FALSE); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHGB), FALSE); } else { - EnableWindow(GetDlgItem(hdlg,IDC_AUTHREQ),IsDlgButtonChecked(hdlg,IDC_AUTH)); - EnableWindow(GetDlgItem(hdlg,IDC_AUTHGB),IsDlgButtonChecked(hdlg,IDC_AUTH)); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHREQ), IsDlgButtonChecked(hdlg, IDC_AUTH)); + EnableWindow(GetDlgItem(hdlg, IDC_AUTHGB), IsDlgButtonChecked(hdlg, IDC_AUTH)); } } break; @@ -219,7 +219,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara case WM_DESTROY: Window_FreeIcon_IcoLib(hdlg); - acs = ( ADDCONTACTSTRUCT* )GetWindowLongPtr(hdlg,GWLP_USERDATA); + acs = ( ADDCONTACTSTRUCT* )GetWindowLongPtr(hdlg, GWLP_USERDATA); if (acs) { if (acs->psr) { mir_free(acs->psr->nick); @@ -236,7 +236,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpara return FALSE; } -INT_PTR AddContactDialog(WPARAM wParam,LPARAM lParam) +INT_PTR AddContactDialog(WPARAM wParam, LPARAM lParam) { if (lParam) { ADDCONTACTSTRUCT* acs = ( ADDCONTACTSTRUCT* )mir_alloc(sizeof(ADDCONTACTSTRUCT)); @@ -245,7 +245,7 @@ INT_PTR AddContactDialog(WPARAM wParam,LPARAM lParam) PROTOSEARCHRESULT *psr; /* bad! structures that are bigger than psr will cause crashes if they define pointers within unreachable structural space */ psr = (PROTOSEARCHRESULT *)mir_alloc(acs->psr->cbSize); - memmove(psr,acs->psr,acs->psr->cbSize); + memmove(psr, acs->psr, acs->psr->cbSize); psr->nick = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick); psr->firstName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName); psr->lastName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName); @@ -256,9 +256,9 @@ INT_PTR AddContactDialog(WPARAM wParam,LPARAM lParam) } if ( wParam ) - DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_ADDCONTACT),(HWND)wParam,AddContactDlgProc,(LPARAM)acs); + DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs); else - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_ADDCONTACT),(HWND)wParam,AddContactDlgProc,(LPARAM)acs); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs); return 0; } return 1; @@ -266,6 +266,6 @@ INT_PTR AddContactDialog(WPARAM wParam,LPARAM lParam) int LoadAddContactModule(void) { - CreateServiceFunction(MS_ADDCONTACT_SHOW,AddContactDialog); + CreateServiceFunction(MS_ADDCONTACT_SHOW, AddContactDialog); return 0; } diff --git a/src/modules/autoaway/autoaway.cpp b/src/modules/autoaway/autoaway.cpp index 46bc9c917b..af774200d9 100644 --- a/src/modules/autoaway/autoaway.cpp +++ b/src/modules/autoaway/autoaway.cpp @@ -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. diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 5bbc752d5d..86282fe47f 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.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. @@ -146,8 +146,8 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) HDC dc = GetDC(hwndParent); HBRUSH oldBrush = (HBRUSH)GetCurrentObject( dc, OBJ_BRUSH ); hbr = (HBRUSH)SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM)dc, (LPARAM)hwndParent); - SelectObject(dc,oldBrush); - ReleaseDC(hwndParent,dc); + SelectObject(dc, oldBrush); + ReleaseDC(hwndParent, dc); } if (hbr) { FillRect(hdcMem, &rcClient, hbr); @@ -155,11 +155,11 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) } if (ctl->stateId == PBS_HOT||ctl->focus) { if (ctl->pbState) - DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT); - else DrawEdge(hdcMem,&rcClient, BDR_RAISEDOUTER,BF_RECT|BF_SOFT|BF_FLAT); + DrawEdge(hdcMem, &rcClient, EDGE_ETCHED, BF_RECT|BF_SOFT); + else DrawEdge(hdcMem, &rcClient, BDR_RAISEDOUTER, BF_RECT|BF_SOFT|BF_FLAT); } else if (ctl->stateId == PBS_PRESSED) - DrawEdge(hdcMem, &rcClient, BDR_SUNKENOUTER,BF_RECT|BF_SOFT); + DrawEdge(hdcMem, &rcClient, BDR_SUNKENOUTER, BF_RECT|BF_SOFT); } } else { @@ -197,10 +197,10 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) HIMAGELIST hImageList; HICON hIconNew; - hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); + hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); ImageList_AddIcon(hImageList, ctl->hIcon); hIconNew = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); - DrawState(hdcMem,NULL,NULL,(LPARAM)hIconNew,0,ix,iy,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWindowEnabled(ctl->hwnd)?DST_ICON|DSS_NORMAL:DST_ICON|DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM)hIconNew, 0, ix, iy, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWindowEnabled(ctl->hwnd)?DST_ICON|DSS_NORMAL:DST_ICON|DSS_DISABLED); ImageList_RemoveAll(hImageList); ImageList_Destroy(hImageList); DestroyIcon(hIconNew); @@ -208,7 +208,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) } else if (ctl->hBitmap) { BITMAP bminfo; - int ix,iy; + int ix, iy; GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo); ix = (rcClient.right-rcClient.left)/2 - (bminfo.bmWidth/2); @@ -217,7 +217,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) ix++; iy++; } - DrawState(hdcMem,NULL,NULL,(LPARAM)ctl->hBitmap,0,ix,iy,bminfo.bmWidth,bminfo.bmHeight,IsWindowEnabled(ctl->hwnd)?DST_BITMAP:DST_BITMAP|DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd)?DST_BITMAP:DST_BITMAP|DSS_DISABLED); } else if (GetWindowTextLength(ctl->hwnd)) { // Draw the text and optinally the arrow @@ -240,10 +240,10 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) sz.cx -= szHot.cx; } if (ctl->arrow) { - DrawState(hdcMem,NULL,NULL,(LPARAM)ctl->arrow,0,rcClient.right-rcClient.left-5-GetSystemMetrics(SM_CXSMICON)+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0),(rcClient.bottom-rcClient.top)/2-GetSystemMetrics(SM_CYSMICON)/2+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right-rcClient.left-5-GetSystemMetrics(SM_CXSMICON)+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), (rcClient.bottom-rcClient.top)/2-GetSystemMetrics(SM_CYSMICON)/2+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED); } SelectObject(hdcMem, ctl->hFont); - DrawState(hdcMem,NULL,NULL,(LPARAM)szText,0,(rcText.right-rcText.left-sz.cx)/2+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0),ctl->hThemeButton?(rcText.bottom-rcText.top-sz.cy)/2:(rcText.bottom-rcText.top-sz.cy)/2-(ctl->stateId == PBS_PRESSED?0:1),sz.cx,sz.cy,IsWindowEnabled(ctl->hwnd)||ctl->hThemeButton?DST_PREFIXTEXT|DSS_NORMAL:DST_PREFIXTEXT|DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0, (rcText.right-rcText.left-sz.cx)/2+(!ctl->hThemeButton&&ctl->stateId == PBS_PRESSED?1:0), ctl->hThemeButton?(rcText.bottom-rcText.top-sz.cy)/2:(rcText.bottom-rcText.top-sz.cy)/2-(ctl->stateId == PBS_PRESSED?0:1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd)||ctl->hThemeButton?DST_PREFIXTEXT|DSS_NORMAL:DST_PREFIXTEXT|DSS_DISABLED); SelectObject(hdcMem, hOldFont); } BitBlt(hdcPaint, 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, hdcMem, 0, 0, SRCCOPY); @@ -566,17 +566,17 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L InvalidateRect(bct->hwnd, NULL, TRUE); } // Call timer, used to start cheesy TrackMouseEvent faker - SetTimer(hwndDlg,BUTTON_POLLID,BUTTON_POLLDELAY,NULL); + SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); break; case WM_TIMER: // use a timer to check if they have did a mouseout if (wParam == BUTTON_POLLID) { RECT rc; POINT pt; - GetWindowRect(hwndDlg,&rc); + GetWindowRect(hwndDlg, &rc); GetCursorPos(&pt); - if (!PtInRect(&rc,pt)) { // mouse must be gone, trigger mouse leave - PostMessage(hwndDlg,WM_MOUSELEAVE,0,0L); - KillTimer(hwndDlg,BUTTON_POLLID); + if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave + PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); + KillTimer(hwndDlg, BUTTON_POLLID); } } break; diff --git a/src/modules/clist/Docking.cpp b/src/modules/clist/Docking.cpp index 4c32b7335e..95bffa718f 100644 --- a/src/modules/clist/Docking.cpp +++ b/src/modules/clist/Docking.cpp @@ -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. @@ -349,9 +349,9 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) GetCursorPos(&pt); PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, - pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, + pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, DBGetContactSettingDword(NULL, "CList", "Width", 0), - DBGetContactSettingDword(NULL, "CList", "Height", 0), + DBGetContactSettingDword(NULL, "CList", "Height", 0), SWP_NOZORDER); Docking_Command(msg->hwnd, ABM_REMOVE); } diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index f260a8c452..1a9e32617f 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.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. @@ -151,7 +151,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) int i; if (ack->type == ACKTYPE_STATUS) { - WindowList_BroadcastAsync(hClcWindowList,INTM_INVALIDATE,0,0); + WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0); if (ack->result == ACKRESULT_SUCCESS) { for (i = 0; i < cli.hClcProtoCount; i++) { if (!lstrcmpA(cli.clcProto[i].szProto, ack->szModule)) { @@ -166,25 +166,25 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) static int ClcContactAdded(WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(hClcWindowList,INTM_CONTACTADDED,wParam,lParam); + WindowList_BroadcastAsync(hClcWindowList, INTM_CONTACTADDED, wParam, lParam); return 0; } static int ClcContactDeleted(WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(hClcWindowList,INTM_CONTACTDELETED,wParam,lParam); + WindowList_BroadcastAsync(hClcWindowList, INTM_CONTACTDELETED, wParam, lParam); return 0; } static int ClcContactIconChanged(WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(hClcWindowList,INTM_ICONCHANGED,wParam,lParam); + WindowList_BroadcastAsync(hClcWindowList, INTM_ICONCHANGED, wParam, lParam); return 0; } static int ClcIconsChanged(WPARAM, LPARAM) { - WindowList_BroadcastAsync(hClcWindowList,INTM_INVALIDATE,0,0); + WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0); return 0; } @@ -287,10 +287,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->needsResort = 1; cli.pfnLoadClcOptions(hwnd, dat); if (!IsWindowVisible(hwnd)) - SetTimer(hwnd,TIMERID_REBUILDAFTER,10,NULL); + SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL); else { - cli.pfnRebuildEntireList(hwnd,dat); + cli.pfnRebuildEntireList(hwnd, dat); NMCLISTCONTROL nm; nm.hdr.code = CLN_LISTREBUILT; nm.hdr.hwndFrom = hwnd; @@ -321,7 +321,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnRecalcScrollBar(hwnd, dat); { // creating imagelist containing blue line for highlight HBITMAP hBmp, hBmpMask, hoBmp, hoMaskBmp; - HDC hdc,hdcMem; + HDC hdc, hdcMem; RECT rc; int depth; HBRUSH hBrush; @@ -509,7 +509,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); dat->needsResort = 1; } - SetTimer(hwnd,TIMERID_REBUILDAFTER,1,NULL); + SetTimer(hwnd, TIMERID_REBUILDAFTER, 1, NULL); break; } case INTM_ICONCHANGED: @@ -579,7 +579,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) break; - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam,0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); dat->needsResort = 1; SortClcByTimer(hwnd); break; @@ -591,7 +591,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; contact->proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam,0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); SortClcByTimer(hwnd); break; } @@ -680,7 +680,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, HDC hdc; PAINTSTRUCT ps; hdc = BeginPaint(hwnd, &ps); - /* we get so many cli.pfnInvalidateRect()'s that there is no point painting, + /* we get so many cli.pfnInvalidateRect()'s that there is no point painting, Windows in theory shouldn't queue up WM_PAINTs in this case but it does so we'll just ignore them */ if (IsWindowVisible(hwnd)) @@ -909,16 +909,16 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } case TIMERID_REBUILDAFTER: - KillTimer(hwnd,TIMERID_REBUILDAFTER); - cli.pfnInvalidateRect(hwnd,NULL,FALSE); - cli.pfnSaveStateAndRebuildList(hwnd,dat); + KillTimer(hwnd, TIMERID_REBUILDAFTER); + cli.pfnInvalidateRect(hwnd, NULL, FALSE); + cli.pfnSaveStateAndRebuildList(hwnd, dat); break; case TIMERID_DELAYEDRESORTCLC: - KillTimer(hwnd,TIMERID_DELAYEDRESORTCLC); - cli.pfnInvalidateRect(hwnd,NULL,FALSE); - cli.pfnSortCLC(hwnd,dat,1); - cli.pfnRecalcScrollBar(hwnd,dat); + KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC); + cli.pfnInvalidateRect(hwnd, NULL, FALSE); + cli.pfnSortCLC(hwnd, dat, 1); + cli.pfnRecalcScrollBar(hwnd, dat); break; } break; @@ -958,7 +958,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1); if (dat->selection != -1) { dat->selection = - cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl,selcontact)); + cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); if (dat->selection == -1) dat->selection = cli.pfnGetRowsPriorTo(&dat->list, contact->group, -1); } @@ -1321,7 +1321,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case POPUP_GROUPHIDEOFFLINE: if (contact->type != CLCIT_GROUP) break; - CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, + CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE)); break; } diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 0bbf197b44..f9ac61e634 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -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. @@ -103,7 +103,7 @@ struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct void fnFreeContact( struct ClcContact *p ); void fnFreeGroup( struct ClcGroup *group ); int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText); -int fnAddItemToGroup( struct ClcGroup *group,int iAboveItem ); +int fnAddItemToGroup( struct ClcGroup *group, int iAboveItem ); void fnAddContactToTree( HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline); int fnAddContactToGroup( struct ClcData *dat, struct ClcGroup *group, HANDLE hContact); void fnDeleteItemFromTree( HWND hwnd, HANDLE hItem ); @@ -149,9 +149,9 @@ int fnGetRowTotalHeight(struct ClcData *dat); int fnRowHitTest(struct ClcData *dat, int y); /* clcopts.c */ -int ClcOptInit(WPARAM wParam,LPARAM lParam); +int ClcOptInit(WPARAM wParam, LPARAM lParam); DWORD GetDefaultExStyle(void); -void GetFontSetting(int i,LOGFONTA *lf,COLORREF *colour); +void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour); /* clistmenus.c */ HGENMENU fnGetProtocolMenu( const char* ); @@ -224,7 +224,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND hwnd, UINT message, UINT_PTR idEvent, DW /* clui.c */ LRESULT CALLBACK fnContactListWndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); void fnLoadCluiGlobalOpts( void ); -void fnCluiProtocolStatusChanged(int,const char*); +void fnCluiProtocolStatusChanged(int, const char*); void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon); /* contact.c */ diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index beff769bce..54660267c9 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -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. diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp index 37a7bb7f0e..1256ad4c8b 100644 --- a/src/modules/clist/clcidents.cpp +++ b/src/modules/clist/clcidents.cpp @@ -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. diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index f5c0e87300..261710c078 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -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. @@ -205,7 +205,7 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon idleMode = szProto != NULL ? DBGetContactSettingDword(hContact, szProto, "IdleTS", 0) : 0; if (idleMode) group->cl.items[i]->flags |= CONTACTF_IDLE; - lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact,0), SIZEOF(group->cl.items[i]->szText)); + lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText)); { ClcCacheEntryBase* p = cli.pfnGetCacheEntry(hContact); if ( p != NULL ) { @@ -573,7 +573,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) } if (hSelItem) if (cli.pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl,selcontact)); + dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); cli.pfnRecalcScrollBar(hwnd, dat); } @@ -637,7 +637,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { SavedContactState_t* p = new SavedContactState_t; p->hContact = group->cl.items[group->scanIndex]->hContact; - CopyMemory( p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, + CopyMemory( p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(group->cl.items[group->scanIndex]->iExtraImage)); p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED; saveContact.insert( p ); @@ -676,7 +676,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) SavedContactState_t tmp, *p; tmp.hContact = group->cl.items[group->scanIndex]->hContact; if (( p = saveContact.find( &tmp )) != NULL ) { - CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage, + CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage, SIZEOF(group->cl.items[group->scanIndex]->iExtraImage)); if (p->checked) group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED; diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index 17bf8834e7..116beb3486 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.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. @@ -76,7 +76,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR } case CLM_AUTOREBUILD: - KillTimer(hwnd,TIMERID_REBUILDAFTER); + KillTimer(hwnd, TIMERID_REBUILDAFTER); cli.pfnSaveStateAndRebuildList(hwnd, dat); break; @@ -103,7 +103,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); - cli.pfnEnsureVisible(hwnd, dat, cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl,contact)), 0); + cli.pfnEnsureVisible(hwnd, dat, cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl, contact)), 0); break; } @@ -219,7 +219,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (!cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL)) return NULL; - int i = List_IndexOf((SortedList*)&group->cl,contact); + int i = List_IndexOf((SortedList*)&group->cl, contact); switch (wParam) { case CLGN_CHILD: if (contact->type != CLCIT_GROUP) @@ -324,7 +324,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); - dat->selection = cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl,contact)); + dat->selection = cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl, contact)); cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0); break; } diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 40b923d78e..054657878f 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.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. @@ -410,7 +410,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save) if (contact->type == CLCIT_GROUP) { if (contact->group->parent && contact->group->parent->parent) { TCHAR szFullName[256]; - mir_sntprintf(szFullName, SIZEOF(szFullName), _T("%s\\%s"), + mir_sntprintf(szFullName, SIZEOF(szFullName), _T("%s\\%s"), cli.pfnGetGroupName(contact->group->parent->groupId, NULL), text); cli.pfnRenameGroup(contact->groupId, szFullName); } @@ -734,7 +734,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->fontInfo[i].hFont = CreateFontIndirect(&lf); dat->fontInfo[i].changed = 0; - HFONT holdfont = (HFONT)SelectObject(hdc,dat->fontInfo[i].hFont); + HFONT holdfont = (HFONT)SelectObject(hdc, dat->fontInfo[i].hFont); GetTextExtentPoint32(hdc, _T("x"), 1, &fontSize); SelectObject(hdc, holdfont); diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index 6821b3a577..ad3f6832de 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.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. @@ -44,7 +44,7 @@ static struct ClcContact* fnCreateClcContact( void ) return ( struct ClcContact* )mir_calloc( sizeof( struct ClcContact )); } -static BOOL fnInvalidateRect( HWND hwnd, CONST RECT* lpRect,BOOL bErase ) +static BOOL fnInvalidateRect( HWND hwnd, CONST RECT* lpRect, BOOL bErase ) { return InvalidateRect( hwnd, lpRect, bErase ); } @@ -58,7 +58,7 @@ static void fnReloadProtoMenus( void ) RebuildMenuOrder(); if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE)) BuildProtoMenus(); - cli.pfnCluiProtocolStatusChanged(0,0); + cli.pfnCluiProtocolStatusChanged(0, 0); } static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam ) diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 6f8b0c4049..9ccaa40c09 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.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. @@ -113,7 +113,7 @@ static void ShowEventsInTray() { int j; for (j=0; j=nTrayProtoCnt ) j=0; //event was not found so assume first icon if ( pTrayProtos[j] ) //if not already set @@ -218,8 +218,8 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) // Update contact's icon szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - cli.pfnChangeContactIcon(cli.events.items[i]->cle.hContact, - CallService(MS_CLIST_GETCONTACTICON, (WPARAM)cli.events.items[i]->cle.hContact, 1), + cli.pfnChangeContactIcon(cli.events.items[i]->cle.hContact, + CallService(MS_CLIST_GETCONTACTICON, (WPARAM)cli.events.items[i]->cle.hContact, 1), 0); // Free any memory allocated to the event @@ -236,7 +236,7 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) szEventProto=(char *) cli.events.items[i]->cle.lpszProtocol; else szEventProto = NULL; - if (szEventProto && szProto && !lstrcmpA(szEventProto,szProto)) + if (szEventProto && szProto && !lstrcmpA(szEventProto, szProto)) nSameProto++; } @@ -391,10 +391,10 @@ static int CListEventSettingsChanged(WPARAM wParam, LPARAM lParam) /***************************************************************************************/ -INT_PTR AddEventSyncStub(WPARAM wParam, LPARAM lParam) { return CallServiceSync(MS_CLIST_ADDEVENT"_SYNC",wParam, lParam); } +INT_PTR AddEventSyncStub(WPARAM wParam, LPARAM lParam) { return CallServiceSync(MS_CLIST_ADDEVENT"_SYNC", wParam, lParam); } INT_PTR AddEventStub(WPARAM, LPARAM lParam) { return cli.pfnAddEvent((CLISTEVENT*)lParam ) == NULL; } -INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HANDLE)wParam,(HANDLE)lParam ); } -INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent((HANDLE)wParam,(int)lParam); } +INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HANDLE)wParam, (HANDLE)lParam ); } +INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent((HANDLE)wParam, (int)lParam); } int InitCListEvents(void) { diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 051cc4cee6..2a77fbb731 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 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. @@ -40,7 +40,7 @@ typedef struct { int iconId; CLISTMENUITEM mi; } - CListIntMenuItem,*lpCListIntMenuItem; + CListIntMenuItem, *lpCListIntMenuItem; //new menu sys HANDLE hMainMenuObject = 0; @@ -57,22 +57,22 @@ HANDLE hPreBuildMainMenuEvent, hStatusModeChangeEvent, hPreBuildContactMenuEvent static HANDLE hAckHook; -static HMENU hMainMenu,hStatusMenu = 0; +static HMENU hMainMenu, hStatusMenu = 0; static const int statusModeList[ MAX_STATUS_COUNT ] = { - ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, + ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE, ID_STATUS_ONTHEPHONE, ID_STATUS_OUTTOLUNCH }; static const int skinIconStatusList[ MAX_STATUS_COUNT ] = { - SKINICON_STATUS_OFFLINE, SKINICON_STATUS_ONLINE, SKINICON_STATUS_AWAY, SKINICON_STATUS_NA, SKINICON_STATUS_OCCUPIED, + SKINICON_STATUS_OFFLINE, SKINICON_STATUS_ONLINE, SKINICON_STATUS_AWAY, SKINICON_STATUS_NA, SKINICON_STATUS_OCCUPIED, SKINICON_STATUS_DND, SKINICON_STATUS_FREE4CHAT, SKINICON_STATUS_INVISIBLE, SKINICON_STATUS_ONTHEPHONE, SKINICON_STATUS_OUTTOLUNCH }; static const int statusModePf2List[ MAX_STATUS_COUNT ] = { - 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, + 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT, PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH }; @@ -87,7 +87,7 @@ typedef struct int protostatus[ MAX_STATUS_COUNT ]; PMO_IntMenuItem menuhandle[ MAX_STATUS_COUNT ]; } - tStatusMenuHandles,*lpStatusMenuHandles; + tStatusMenuHandles, *lpStatusMenuHandles; lpStatusMenuHandles hStatusMenuHandles; int hStatusMenuHandlesCnt; @@ -99,7 +99,7 @@ typedef struct TCHAR *szMenuName; int Param1; } - MainMenuExecParam,*lpMainMenuExecParam; + MainMenuExecParam, *lpMainMenuExecParam; //contactmenu exec param(ownerdata) //also used in checkservice @@ -109,7 +109,7 @@ typedef struct char *pszContactOwner;//for check proc int param; } - ContactMenuExecParam,*lpContactMenuExecParam; + ContactMenuExecParam, *lpContactMenuExecParam; typedef struct { @@ -129,7 +129,7 @@ typedef struct char *svc; HANDLE hMenuItem; } - StatusMenuExecParam,*lpStatusMenuExecParam; + StatusMenuExecParam, *lpStatusMenuExecParam; typedef struct _MenuItemHandles { @@ -192,7 +192,7 @@ return 0 on success. static INT_PTR RemoveMainMenuItem(WPARAM wParam, LPARAM) { - CallService(MO_REMOVEMENUITEM,wParam,0); + CallService(MO_REMOVEMENUITEM, wParam, 0); return 0; } @@ -201,10 +201,10 @@ static INT_PTR BuildMainMenu(WPARAM, LPARAM) ListParam param = { 0 }; param.MenuObjectHandle = hMainMenuObject; - NotifyEventHooks(hPreBuildMainMenuEvent,(WPARAM)0,(LPARAM)0); + NotifyEventHooks(hPreBuildMainMenuEvent, (WPARAM)0, (LPARAM)0); - CallService(MO_BUILDMENU,(WPARAM)hMainMenu,(LPARAM)¶m); - DrawMenuBar((HWND)CallService("CLUI/GetHwnd",(WPARAM)0,(LPARAM)0)); + CallService(MO_BUILDMENU, (WPARAM)hMainMenu, (LPARAM)¶m); + DrawMenuBar((HWND)CallService("CLUI/GetHwnd", (WPARAM)0, (LPARAM)0)); return (INT_PTR)hMainMenu; } @@ -270,11 +270,11 @@ INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam) { lpMainMenuExecParam mmep = ( lpMainMenuExecParam )wParam; if ( mmep != NULL ) { - // bug in help.c,it used wparam as parent window handle without reason. - if ( !lstrcmpA(mmep->szServiceName,"Help/AboutCommand")) + // bug in help.c, it used wparam as parent window handle without reason. + if ( !lstrcmpA(mmep->szServiceName, "Help/AboutCommand")) mmep->Param1 = 0; - CallService(mmep->szServiceName,mmep->Param1,lParam); + CallService(mmep->szServiceName, mmep->Param1, lParam); } return 1; } @@ -294,7 +294,7 @@ INT_PTR FreeOwnerDataMainMenu(WPARAM, LPARAM lParam) static INT_PTR RemoveContactMenuItem(WPARAM wParam, LPARAM) { - CallService(MO_REMOVEMENUITEM,wParam,0); + CallService(MO_REMOVEMENUITEM, wParam, 0); return 0; } @@ -351,21 +351,21 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) { HANDLE hContact = ( HANDLE )wParam; - NotifyEventHooks(hPreBuildContactMenuEvent,(WPARAM)hContact,0); + NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0); - char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); BuildContactParam bcp; bcp.szProto = szProto; - bcp.isOnList = ( DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 0 ); - bcp.isOnline = ( szProto != NULL && ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE)); + bcp.isOnList = ( DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 0 ); + bcp.isOnline = ( szProto != NULL && ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)); ListParam param = { 0 }; param.MenuObjectHandle = hContactMenuObject; param.wParam = (WPARAM)&bcp; HMENU hMenu = CreatePopupMenu(); - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m); return (INT_PTR)hMenu; } @@ -373,18 +373,18 @@ static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) //called with: //wparam - ownerdata //lparam - lparam from winproc -INT_PTR ContactMenuExecService(WPARAM wParam,LPARAM lParam) +INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam) { if (wParam != 0) { lpContactMenuExecParam cmep=(lpContactMenuExecParam)wParam; - //call with wParam=(WPARAM)(HANDLE)hContact,lparam=popupposition - CallService(cmep->szServiceName,lParam,cmep->param); + //call with wParam=(WPARAM)(HANDLE)hContact, lparam=popupposition + CallService(cmep->szServiceName, lParam, cmep->param); } return 0; } -//true - ok,false ignore -INT_PTR ContactMenuCheckService(WPARAM wParam,LPARAM) +//true - ok, false ignore +INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM) { PCheckProcParam pcpp = ( PCheckProcParam )wParam; BuildContactParam *bcp=NULL; @@ -442,7 +442,7 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itd mii.cbSize = MENUITEMINFO_V4_SIZE; mii.fMask = MIIM_SUBMENU | MIIM_DATA; for ( i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) { - GetMenuItemInfo(hMenu,i,TRUE,&mii); + GetMenuItemInfo(hMenu, i, TRUE, &mii); if ( mii.fType == MFT_SEPARATOR ) continue; if ( mii.hSubMenu ) @@ -543,7 +543,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) } } } } else if ( smep && smep->status && !smep->custom ) { - int curProtoStatus = ( smep->proto ) ? CallProtoService(smep->proto,PS_GETSTATUS,0,0) : GetAverageMode(); + int curProtoStatus = ( smep->proto ) ? CallProtoService(smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode(); if ( smep->status == curProtoStatus ) timi->mi.flags |= CMIF_CHECKED; else @@ -568,13 +568,13 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if ( Proto_GetAccount( prot ) == NULL ) return TRUE; - if (( curProtoStatus = CallProtoService(prot,PS_GETSTATUS,0,0)) == CALLSERVICE_NOTFOUND ) + if (( curProtoStatus = CallProtoService(prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND ) curProtoStatus = 0; if ( curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE ) - timi->mi.hIcon = LoadSkinProtoIcon(prot,curProtoStatus); + timi->mi.hIcon = LoadSkinProtoIcon(prot, curProtoStatus); else { - timi->mi.hIcon=(HICON)CallProtoService(prot,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0); + timi->mi.hIcon=(HICON)CallProtoService(prot, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); if ( timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND ) timi->mi.hIcon = NULL; else @@ -588,7 +588,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) DestroyIcon( timi->mi.hIcon ); timi->mi.hIcon = NULL; } - else IconLib_ReleaseIcon(timi->mi.hIcon,0); + else IconLib_ReleaseIcon(timi->mi.hIcon, 0); } } return TRUE; @@ -608,8 +608,8 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) char *prot = smep->proto; char szHumanName[64]={0}; PROTOACCOUNT * acc = Proto_GetAccount( smep->proto ); - int i=(DBGetContactSettingByte(NULL,prot,"LockMainStatus",0)?0:1); - DBWriteContactSettingByte(NULL,prot,"LockMainStatus",(BYTE)i); + int i=(DBGetContactSettingByte(NULL, prot, "LockMainStatus", 0)?0:1); + DBWriteContactSettingByte(NULL, prot, "LockMainStatus", (BYTE)i); CallProtoService( smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName ); pimi = MO_GetIntMenuItem(( HGENMENU )smep->protoindex ); @@ -620,7 +620,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) TCHAR buf[256]; pimi->mi.flags|=CMIF_CHECKED; if ( cli.bDisplayLocked ) { - mir_sntprintf(buf,SIZEOF(buf),TranslateT("%s (locked)"),acc->tszAccountName); + mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s (locked)"), acc->tszAccountName); pimi->mi.ptszName = mir_tstrdup( buf ); root->mi.ptszName = mir_tstrdup( buf ); } @@ -683,7 +683,7 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam) // Other menu functions //wparam MenuItemHandle -static INT_PTR ModifyCustomMenuItem(WPARAM wParam,LPARAM lParam) +static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam) { CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam; TMO_MenuItem tmi; @@ -701,7 +701,7 @@ static INT_PTR ModifyCustomMenuItem(WPARAM wParam,LPARAM lParam) return MO_ModifyMenuItem(( PMO_IntMenuItem )wParam, &tmi ); } -INT_PTR MenuProcessCommand(WPARAM wParam,LPARAM lParam) +INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam) { WORD cmd = LOWORD(wParam); @@ -774,7 +774,7 @@ static int MenuIconsChanged(WPARAM, LPARAM) { //just rebuild menu RebuildMenuOrder(); - cli.pfnCluiProtocolStatusChanged(0,0); + cli.pfnCluiProtocolStatusChanged(0, 0); return 0; } @@ -802,7 +802,7 @@ int RecursiveDeleteMenu(HMENU hMenu) static INT_PTR MenuGetMain(WPARAM, LPARAM) { RecursiveDeleteMenu(hMainMenu); - BuildMainMenu(0,0); + BuildMainMenu(0, 0); return (INT_PTR)hMainMenu; } @@ -812,7 +812,7 @@ static INT_PTR BuildStatusMenu(WPARAM, LPARAM) param.MenuObjectHandle = hStatusMenuObject; RecursiveDeleteMenu(hStatusMenu); - CallService(MO_BUILDMENU,(WPARAM)hStatusMenu,(LPARAM)¶m); + CallService(MO_BUILDMENU, (WPARAM)hStatusMenu, (LPARAM)¶m); return (INT_PTR)hStatusMenu; } @@ -867,7 +867,7 @@ int fnGetAccountIndexByPos(int Pos) void RebuildMenuOrder( void ) { - int i,j,s; + int i, j, s; DWORD flags; BYTE bHideStatusMenu = DBGetContactSettingByte( NULL, "CLUI", "DontHideStatusMenu", 0 ); // cool perversion, though @@ -877,7 +877,7 @@ void RebuildMenuOrder( void ) //status menu if ( hStatusMenuObject != 0 ) { - CallService(MO_REMOVEMENUOBJECT,(WPARAM)hStatusMenuObject,0); + CallService(MO_REMOVEMENUOBJECT, (WPARAM)hStatusMenuObject, 0); mir_free( hStatusMainMenuHandles ); mir_free( hStatusMenuHandles ); } @@ -888,7 +888,7 @@ void RebuildMenuOrder( void ) tmp.CheckService = "StatusMenuCheckService"; tmp.name = "StatusMenu"; - hStatusMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + hStatusMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp); MO_SetOptionsMenuObject( hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu" ); hStatusMainMenuHandles = ( PMO_IntMenuItem* )mir_calloc( SIZEOF(statusModeList) * sizeof( PMO_IntMenuItem* )); @@ -935,7 +935,7 @@ void RebuildMenuOrder( void ) } PMO_IntMenuItem rootmenu = MO_AddNewMenuItem( hStatusMenuObject, &tmi ); - memset(&tmi,0,sizeof(tmi)); + memset(&tmi, 0, sizeof(tmi)); tmi.cbSize = sizeof(tmi); tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED; tmi.root = rootmenu; @@ -963,7 +963,7 @@ void RebuildMenuOrder( void ) MO_ModifyMenuItem( menuHandle, &tmi ); cli.menuProtos=(MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount+1)); - memset(&(cli.menuProtos[cli.menuProtoCount]),0,sizeof(MenuProto)); + memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto)); cli.menuProtos[cli.menuProtoCount].pMenu = rootmenu; cli.menuProtos[cli.menuProtoCount].szProto = mir_strdup(pa->szModuleName); @@ -1005,10 +1005,10 @@ void RebuildMenuOrder( void ) hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem( hStatusMenuObject, &tmi ); { char buf[ 256 ]; - mir_snprintf(buf, SIZEOF(buf), "ProtocolIcon_%s_%s",pa->szModuleName,tmi.pszName); + mir_snprintf(buf, SIZEOF(buf), "ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName); MO_SetOptionsMenuItem( hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf ); } - IconLib_ReleaseIcon(tmi.hIcon,0); + IconLib_ReleaseIcon(tmi.hIcon, 0); } } NotifyEventHooks(cli.hPreBuildStatusMenuEvent, 0, 0); @@ -1033,7 +1033,7 @@ void RebuildMenuOrder( void ) tmi.hIcon = LoadSkinIcon( skinIconStatusList[j] ); tmi.position = pos++; - tmi.hotKey = MAKELPARAM(MOD_CONTROL,'0'+j); + tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0'+j); { //owner data lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam )); @@ -1047,7 +1047,7 @@ void RebuildMenuOrder( void ) TCHAR buf[ 256 ], hotkeyName[ 100 ]; WORD hotKey = GetHotkeyValue( statusHotkeys[j] ); HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey)); - mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), + mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName ); tmi.ptszName = buf; tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey)); @@ -1062,7 +1062,7 @@ void RebuildMenuOrder( void ) break; } } - BuildStatusMenu(0,0); + BuildStatusMenu(0, 0); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1077,7 +1077,7 @@ static int sttRebuildHotkeys( WPARAM, LPARAM ) TCHAR buf[ 256 ], hotkeyName[ 100 ]; WORD hotKey = GetHotkeyValue( statusHotkeys[j] ); HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey)); - mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), + mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName ); tmi.ptszName = buf; tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey)); @@ -1114,7 +1114,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) overallStatus = GetAverageMode(); - memset(&tmi,0,sizeof(tmi)); + memset(&tmi, 0, sizeof(tmi)); tmi.cbSize=sizeof(tmi); if (overallStatus >= ID_STATUS_OFFLINE) { int pos = statustopos(cli.currentStatusMenuItem); @@ -1144,7 +1144,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE; MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi ); } - //SetMenuDefaultItem(hStatusMenu,-1,FALSE); + //SetMenuDefaultItem(hStatusMenu, -1, FALSE); cli.currentStatusMenuItem=0; } @@ -1169,7 +1169,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) break; } } - //BuildStatusMenu(0,0); + //BuildStatusMenu(0, 0); return 0; } @@ -1195,7 +1195,7 @@ HGENMENU fnGetProtocolMenu( const char* proto ) return NULL; } -static INT_PTR AddStatusMenuItem(WPARAM wParam,LPARAM lParam) +static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) { CLISTMENUITEM *mi = ( CLISTMENUITEM* )lParam; if ( mi->cbSize != sizeof( CLISTMENUITEM )) @@ -1284,7 +1284,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam,LPARAM lParam) return ( INT_PTR )menuHandle; } -static INT_PTR HotkeySetStatus(WPARAM wParam,LPARAM lParam) +static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam) { return SetStatusMode( lParam, 0 ); } @@ -1292,7 +1292,7 @@ static INT_PTR HotkeySetStatus(WPARAM wParam,LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // PROTOCOL MENU -static INT_PTR AddProtoMenuItem(WPARAM wParam,LPARAM lParam) +static INT_PTR AddProtoMenuItem(WPARAM wParam, LPARAM lParam) { if ( DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE )) return AddStatusMenuItem( wParam, lParam ); @@ -1304,47 +1304,47 @@ static INT_PTR AddProtoMenuItem(WPARAM wParam,LPARAM lParam) void InitCustomMenus(void) { - CreateServiceFunction("MainMenuExecService",MainMenuExecService); + CreateServiceFunction("MainMenuExecService", MainMenuExecService); - CreateServiceFunction("ContactMenuExecService",ContactMenuExecService); - CreateServiceFunction("ContactMenuCheckService",ContactMenuCheckService); + CreateServiceFunction("ContactMenuExecService", ContactMenuExecService); + CreateServiceFunction("ContactMenuCheckService", ContactMenuCheckService); - CreateServiceFunction("StatusMenuExecService",StatusMenuExecService); - CreateServiceFunction("StatusMenuCheckService",StatusMenuCheckService); + CreateServiceFunction("StatusMenuExecService", StatusMenuExecService); + CreateServiceFunction("StatusMenuCheckService", StatusMenuCheckService); //free services - CreateServiceFunction("CLISTMENUS/FreeOwnerDataMainMenu",FreeOwnerDataMainMenu); - CreateServiceFunction("CLISTMENUS/FreeOwnerDataContactMenu",FreeOwnerDataContactMenu); - CreateServiceFunction("CLISTMENUS/FreeOwnerDataStatusMenu",FreeOwnerDataStatusMenu); + CreateServiceFunction("CLISTMENUS/FreeOwnerDataMainMenu", FreeOwnerDataMainMenu); + CreateServiceFunction("CLISTMENUS/FreeOwnerDataContactMenu", FreeOwnerDataContactMenu); + CreateServiceFunction("CLISTMENUS/FreeOwnerDataStatusMenu", FreeOwnerDataStatusMenu); CreateServiceFunction(MS_CLIST_SETSTATUSMODE, SetStatusMode); - CreateServiceFunction(MS_CLIST_ADDMAINMENUITEM,AddMainMenuItem); - CreateServiceFunction(MS_CLIST_ADDSTATUSMENUITEM,AddStatusMenuItem); - CreateServiceFunction(MS_CLIST_MENUGETMAIN,MenuGetMain); - CreateServiceFunction(MS_CLIST_REMOVEMAINMENUITEM,RemoveMainMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDMAIN,BuildMainMenu); + CreateServiceFunction("CList/AddMainMenuItem", AddMainMenuItem); + CreateServiceFunction("CList/AddStatusMenuItem", AddStatusMenuItem); + CreateServiceFunction(MS_CLIST_MENUGETMAIN, MenuGetMain); + CreateServiceFunction(MS_CLIST_REMOVEMAINMENUITEM, RemoveMainMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDMAIN, BuildMainMenu); - CreateServiceFunction(MS_CLIST_ADDCONTACTMENUITEM,AddContactMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT,BuildContactMenu); - CreateServiceFunction(MS_CLIST_REMOVECONTACTMENUITEM,RemoveContactMenuItem); + CreateServiceFunction("CList/AddContactMenuItem", AddContactMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT, BuildContactMenu); + CreateServiceFunction(MS_CLIST_REMOVECONTACTMENUITEM, RemoveContactMenuItem); - CreateServiceFunction(MS_CLIST_MODIFYMENUITEM,ModifyCustomMenuItem); - CreateServiceFunction(MS_CLIST_MENUMEASUREITEM,MeasureMenuItem); - CreateServiceFunction(MS_CLIST_MENUDRAWITEM,DrawMenuItem); + CreateServiceFunction(MS_CLIST_MODIFYMENUITEM, ModifyCustomMenuItem); + CreateServiceFunction(MS_CLIST_MENUMEASUREITEM, MeasureMenuItem); + CreateServiceFunction(MS_CLIST_MENUDRAWITEM, DrawMenuItem); - CreateServiceFunction(MS_CLIST_MENUGETSTATUS,BuildStatusMenu); - CreateServiceFunction(MS_CLIST_MENUPROCESSCOMMAND,MenuProcessCommand); - CreateServiceFunction(MS_CLIST_MENUPROCESSHOTKEY,MenuProcessHotkey); + CreateServiceFunction(MS_CLIST_MENUGETSTATUS, BuildStatusMenu); + CreateServiceFunction(MS_CLIST_MENUPROCESSCOMMAND, MenuProcessCommand); + CreateServiceFunction(MS_CLIST_MENUPROCESSHOTKEY, MenuProcessHotkey); - CreateServiceFunction(MS_CLIST_ADDPROTOMENUITEM,AddProtoMenuItem); + CreateServiceFunction("CList/AddProtoMenuItem", AddProtoMenuItem); hPreBuildContactMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDCONTACTMENU); hPreBuildMainMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDMAINMENU); cli.hPreBuildStatusMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSTATUSMENU); hStatusModeChangeEvent = CreateHookableEvent( ME_CLIST_STATUSMODECHANGE ); - hAckHook=(HANDLE)HookEvent(ME_PROTO_ACK,MenuProtoAck); + hAckHook=(HANDLE)HookEvent(ME_PROTO_ACK, MenuProtoAck); hMainMenu = CreatePopupMenu(); hStatusMenu = CreatePopupMenu(); @@ -1365,7 +1365,7 @@ void InitCustomMenus(void) tmp.CheckService=NULL; tmp.ExecService="MainMenuExecService"; tmp.name="MainMenu"; - hMainMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + hMainMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp); } MO_SetOptionsMenuObject( hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE ); @@ -1378,7 +1378,7 @@ void InitCustomMenus(void) tmp.CheckService="ContactMenuCheckService"; tmp.ExecService="ContactMenuExecService"; tmp.name="ContactMenu"; - hContactMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + hContactMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp); } MO_SetOptionsMenuObject( hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE ); diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index ab8ca13965..ff667bcb38 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.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. @@ -194,7 +194,7 @@ static INT_PTR GetContactIcon(WPARAM wParam, LPARAM) char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); HANDLE hContact = (HANDLE)wParam; - return cli.pfnIconFromStatusMode(szProto, + return cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact); } diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 0efc919ba8..f8a0501358 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -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. @@ -317,9 +317,9 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) szProto = NULL; else szProto = cws->value.pszVal; - cli.pfnChangeContactIcon(hContact, - cli.pfnIconFromStatusMode(szProto, - szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", + cli.pfnChangeContactIcon(hContact, + cli.pfnIconFromStatusMode(szProto, + szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 0); } } diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 00d4074b33..519cf0f875 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.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. @@ -161,7 +161,7 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) if ( DBGetContactSettingByte( NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT )) { if ( mToolTipTrayTips ) { if ( ProtoXStatus ) - mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s%-12.12s\t%s%s%-24.24s"), szPrefix, szSeparator, pa->tszAccountName, szStatus,szSeparator,ProtoXStatus); + mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s%-12.12s\t%s%s%-24.24s"), szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus); else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s%-12.12s\t%s"), szPrefix, szSeparator, pa->tszAccountName, szStatus); } @@ -172,7 +172,7 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) else { if ( mToolTipTrayTips ) { if ( ProtoXStatus ) - mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("%-12.12s\t%s\n%-24.24s"), pa->tszAccountName, szStatus,ProtoXStatus); + mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("%-12.12s\t%s\n%-24.24s"), pa->tszAccountName, szStatus, ProtoXStatus); else mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("%-12.12s\t%s"), pa->tszAccountName, szStatus); } @@ -357,7 +357,7 @@ static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD) { int i; if ( RefreshTimerId ) { - KillTimer(NULL,RefreshTimerId); + KillTimer(NULL, RefreshTimerId); RefreshTimerId=0; } for (i=0; i < accounts.getCount(); i++) { @@ -422,13 +422,13 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer SetTaskBarIcon(NULL, NULL); cli.trayIcon[i].isBase = isBase; - if (DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) + if (DBGetContactSettingByte(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) { - DWORD time1=DBGetContactSettingWord(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT)*200; - DWORD time2=DBGetContactSettingWord(NULL,"CList","IconFlashTime",550)+1000; - DWORD time=max(max(2000,time1),time2); - if (RefreshTimerId) {KillTimer(NULL,RefreshTimerId); RefreshTimerId=0;} - RefreshTimerId=SetTimer(NULL,0,time,RefreshTimerProc); // if unknown base was changed - than show preffered proto icon for 2 sec and reset it to original one after timeout + DWORD time1=DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT)*200; + DWORD time2=DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550)+1000; + DWORD time=max(max(2000, time1), time2); + if (RefreshTimerId) {KillTimer(NULL, RefreshTimerId); RefreshTimerId=0;} + RefreshTimerId=SetTimer(NULL, 0, time, RefreshTimerProc); // if unknown base was changed - than show preffered proto icon for 2 sec and reset it to original one after timeout } { ulock; return i; } } @@ -455,8 +455,8 @@ int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto) } if ((cli.pfnGetProtocolVisibility(szPreferredProto)) && (GetAverageMode() == -1) - && (DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) - && !(DBGetContactSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT))) + && (DBGetContactSettingByte(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) + && !(DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) goto LBL_Error; } @@ -555,7 +555,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) szProto = NULL; else szProto = dbv.pszVal; - changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0,0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto ); + changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto ); DBFreeVariant(&dbv); break; } @@ -564,7 +564,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc); changed = cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon - (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), NULL), + (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), NULL), ILD_NORMAL), NULL); break; case SETTING_TRAYICON_MULTI: diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index a9619b6302..d5bceade30 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* - Copyright 2000-2010 Miranda ICQ/IM project, + Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ 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. @@ -52,7 +52,7 @@ void fnLoadCluiGlobalOpts() { cluiopt.showsbar = DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1); cluiopt.showgrip = DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1); - cluiopt.transparent = DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT); + cluiopt.transparent = DBGetContactSettingByte(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT); cluiopt.alpha = DBGetContactSettingByte(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT); } @@ -205,8 +205,8 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) { // Set a flag so we remember to delete the contact when the protocol goes online the next time DBWriteContactSettingByte((HANDLE) wParam, "CList", "Delete", 1); - MessageBox( NULL, - TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), + MessageBox( NULL, + TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), TranslateT("Delete Contact"), MB_OK); return 0; } } } @@ -322,13 +322,13 @@ int LoadCLUIModule(void) Utils_AssertInsideScreen(&pos); cli.hwndContactList = CreateWindowEx( - (DBGetContactSettingByte(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW), - _T(MIRANDACLASS), - titleText, + (DBGetContactSettingByte(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW), + _T(MIRANDACLASS), + titleText, WS_POPUPWINDOW | WS_THICKFRAME | WS_CLIPCHILDREN | (DBGetContactSettingByte(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? WS_CAPTION | WS_SYSMENU | - (DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0), - pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top, + (DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0), + pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top, NULL, NULL, cli.hInst, NULL); if (DBGetContactSettingByte(NULL, "CList", "OnDesktop", 0)) { @@ -365,7 +365,7 @@ int LoadCLUIModule(void) mi.pszContactOwner = NULL; //on every contact mi.pszName = LPGEN("De&lete"); mi.pszService = "CList/DeleteContactCommand"; - CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); + Menu_AddContactMenuItem(&mi); CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact); mi.position = 2000050000; @@ -373,7 +373,7 @@ int LoadCLUIModule(void) mi.pszContactOwner = NULL; //on every contact mi.pszName = LPGEN("&Rename"); mi.pszService = "CList/RenameContactCommand"; - hRenameMenuItem = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); + hRenameMenuItem = Menu_AddContactMenuItem(&mi); CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList); mi.position = -2050000000; @@ -381,7 +381,7 @@ int LoadCLUIModule(void) mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_ADDCONTACT ); mi.pszName = LPGEN("&Add permanently to list"); mi.pszService = "CList/AddToListContactCommand"; - CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); + Menu_AddContactMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MenuItem_PreBuild); } @@ -527,7 +527,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return FALSE; case M_CREATECLC: - cli.hwndContactTree = CreateWindow( CLISTCONTROL_CLASS, _T(""), + cli.hwndContactTree = CreateWindow( CLISTCONTROL_CLASS, _T(""), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | CLS_CONTACTLIST | (DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0) @@ -637,9 +637,9 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_SETCURSOR: if (cluiopt.transparent) { if (!transparentFocus && GetForegroundWindow() != hwnd && setLayeredWindowAttributes) { - setLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)cluiopt.alpha, LWA_ALPHA); + setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)cluiopt.alpha, LWA_ALPHA); transparentFocus=1; - SetTimer(hwnd, TM_AUTOALPHA,250,NULL); + SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); } } return DefWindowProc(hwnd, msg, wParam, lParam); @@ -711,7 +711,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM thisTick = GetTickCount(); if (thisTick >= startTick + 200) break; - setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), + setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE) (sourceAlpha + (destAlpha - sourceAlpha) * (int) (thisTick - startTick) / 200), LWA_ALPHA); } setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE) destAlpha, LWA_ALPHA); @@ -906,7 +906,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (rcWindow.bottom > rcWorkArea.bottom) rcWindow.bottom = rcWorkArea.bottom; } - SetWindowPos(hwnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, + SetWindowPos(hwnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE); break; } @@ -1004,10 +1004,10 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HMENU hMenu; hMenu = GetSubMenu(LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 1); CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM) hMenu, 0); - CheckMenuItem(hMenu, POPUP_HIDEOFFLINE, + CheckMenuItem(hMenu, POPUP_HIDEOFFLINE, DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu, POPUP_HIDEOFFLINEROOT, SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(hMenu, POPUP_HIDEEMPTYGROUPS, + CheckMenuItem(hMenu, POPUP_HIDEEMPTYGROUPS, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu, POPUP_DISABLEGROUPS, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? MF_UNCHECKED : MF_CHECKED); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); @@ -1047,15 +1047,15 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM x = dis->rcItem.left; if (showOpts & 1) { HICON hIcon = LoadSkinProtoIcon(szProto, status); - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL); - IconLib_ReleaseIcon(hIcon,0); + IconLib_ReleaseIcon(hIcon, 0); if ( Proto_IsAccountLocked( Proto_GetAccount( szProto ))) { hIcon = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED); if (hIcon != NULL) { - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL); - IconLib_ReleaseIcon(hIcon,0); + IconLib_ReleaseIcon(hIcon, 0); } } diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index 2d8f06ab2f..d96f688997 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.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. @@ -135,7 +135,7 @@ static INT_PTR GetCaps(WPARAM wParam, LPARAM) void LoadCluiServices(void) { CreateServiceFunction(MS_CLUI_GETHWND, GetHwnd); - CreateServiceFunction(MS_CLUI_GETHWNDTREE,GetHwndTree); + CreateServiceFunction(MS_CLUI_GETHWNDTREE, GetHwndTree); CreateServiceFunction(MS_CLUI_PROTOCOLSTATUSCHANGED, CluiProtocolStatusChanged); CreateServiceFunction(MS_CLUI_GROUPADDED, GroupAdded); CreateServiceFunction(MS_CLUI_CONTACTSETICON, ContactSetIcon); diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index d122ef4836..c0b1c9e8d1 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -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. @@ -30,18 +30,18 @@ int sortByStatus; int sortByProto; static const struct { - int status,order; + int status, order; } statusModeOrder[]={ - {ID_STATUS_OFFLINE,500}, - {ID_STATUS_ONLINE,10}, - {ID_STATUS_AWAY,200}, - {ID_STATUS_DND,110}, - {ID_STATUS_NA,450}, - {ID_STATUS_OCCUPIED,100}, - {ID_STATUS_FREECHAT,0}, - {ID_STATUS_INVISIBLE,20}, - {ID_STATUS_ONTHEPHONE,150}, - {ID_STATUS_OUTTOLUNCH,425}}; + {ID_STATUS_OFFLINE, 500}, + {ID_STATUS_ONLINE, 10}, + {ID_STATUS_AWAY, 200}, + {ID_STATUS_DND, 110}, + {ID_STATUS_NA, 450}, + {ID_STATUS_OCCUPIED, 100}, + {ID_STATUS_FREECHAT, 0}, + {ID_STATUS_INVISIBLE, 20}, + {ID_STATUS_ONTHEPHONE, 150}, + {ID_STATUS_OUTTOLUNCH, 425}}; static int GetContactStatus(HANDLE hContact) { @@ -167,7 +167,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) grpChg.pszNewName = cli.pfnGetGroupName(lParam, NULL); DBWriteContactSettingTString((HANDLE) wParam, "CList", "Group", grpChg.pszNewName); } - CallService(MS_CLUI_CONTACTADDED, wParam, + CallService(MS_CLUI_CONTACTADDED, wParam, cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0), GetContactStatus((HANDLE) wParam), (HANDLE) wParam)); NotifyEventHooks(hGroupChangeEvent, wParam, (LPARAM)&grpChg); @@ -184,7 +184,7 @@ int fnSetHideOffline(WPARAM wParam, LPARAM) DBWriteContactSettingByte(NULL, "CList", "HideOffline", 1); break; case -1: - DBWriteContactSettingByte(NULL, "CList", "HideOffline", + DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) ! DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); break; } diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 73b3e972d5..13e9d61e46 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 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. @@ -115,7 +115,7 @@ int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis ) if ( pimi->iconId == -1 ) return FALSE; - mis->itemWidth = max(0,GetSystemMetrics(SM_CXSMICON)-GetSystemMetrics(SM_CXMENUCHECK)+4); + mis->itemWidth = max(0, GetSystemMetrics(SM_CXSMICON)-GetSystemMetrics(SM_CXMENUCHECK)+4); mis->itemHeight = GetSystemMetrics(SM_CYSMICON)+2; return TRUE; } @@ -154,16 +154,16 @@ int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis ) RECT rc; rc.left = 0; rc.right = GetSystemMetrics(SM_CXSMICON)+4; rc.top = y-2; rc.bottom = rc.top + GetSystemMetrics(SM_CYSMICON)+4; - DrawEdge(dis->hDC,&rc,BDR_SUNKENOUTER,BF_RECT); - InflateRect(&rc,-1,-1); + DrawEdge(dis->hDC, &rc, BDR_SUNKENOUTER, BF_RECT); + InflateRect(&rc, -1, -1); COLORREF menuCol = GetSysColor(COLOR_MENU); COLORREF hiliteCol = GetSysColor(COLOR_3DHIGHLIGHT); - HBRUSH hBrush = CreateSolidBrush(RGB((GetRValue(menuCol)+GetRValue(hiliteCol))/2,(GetGValue(menuCol)+GetGValue(hiliteCol))/2,(GetBValue(menuCol)+GetBValue(hiliteCol))/2)); - FillRect(dis->hDC,&rc,GetSysColorBrush(COLOR_MENU)); + HBRUSH hBrush = CreateSolidBrush(RGB((GetRValue(menuCol)+GetRValue(hiliteCol))/2, (GetGValue(menuCol)+GetGValue(hiliteCol))/2, (GetBValue(menuCol)+GetBValue(hiliteCol))/2)); + FillRect(dis->hDC, &rc, GetSysColorBrush(COLOR_MENU)); DeleteObject(hBrush); - ImageList_DrawEx(pimi->parent->m_hMenuIcons,pimi->iconId,dis->hDC,2,y,0,0,CLR_NONE,GetSysColor(COLOR_MENU),ILD_BLEND50); + ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, GetSysColor(COLOR_MENU), ILD_BLEND50); } - else ImageList_DrawEx(pimi->parent->m_hMenuIcons,pimi->iconId,dis->hDC,2,y,0,0,CLR_NONE,CLR_NONE,ILD_NORMAL); + else ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); } LeaveCriticalSection( &csMenuHook ); return TRUE; @@ -230,7 +230,7 @@ INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey ) return FALSE; } -INT_PTR MO_GetProtoRootMenu(WPARAM wParam,LPARAM lParam) +INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam) { char* szProto = ( char* )wParam; if ( szProto == NULL ) @@ -257,7 +257,7 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam,LPARAM lParam) //wparam=MenuItemHandle //lparam=PMO_MenuItem -INT_PTR MO_GetMenuItem(WPARAM wParam,LPARAM lParam) +INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam) { PMO_MenuItem mi = (PMO_MenuItem)lParam; if ( !bIsGenMenuInited || mi == NULL ) @@ -316,7 +316,7 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) if ( pmi->flags & CMIM_NAME ) { FreeAndNil(( void** )&pimi->mi.pszName ); -#if defined( _UNICODE ) + if ( pmi->flags & CMIF_UNICODE ) pimi->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName )); else { @@ -328,9 +328,6 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) } else pimi->mi.ptszName = LangPackPcharToTchar( pmi->pszName ); } -#else - pimi->mi.ptszName = mir_strdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : Translate( pmi->ptszName )); -#endif } if ( pmi->flags & CMIM_FLAGS ) { oldflags = pimi->mi.flags & ( CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB ); @@ -364,7 +361,7 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) } //wparam MenuItemHandle -//return ownerdata useful to free ownerdata before delete menu item, +//return ownerdata useful to free ownerdata before delete menu item, //NULL on error. INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM) { @@ -432,7 +429,7 @@ int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam) return -1; } -INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam,LPARAM lParam) +INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam) { if ( !bIsGenMenuInited ) return -1; @@ -656,18 +653,15 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi ) p->iconId = -1; p->OverrideShow = TRUE; p->originalPosition = pmi->position; - #if defined( _UNICODE ) - if ( pmi->flags & CMIF_UNICODE ) - p->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName )); - else { - if ( pmi->flags & CMIF_KEEPUNTRANSLATED ) - p->mi.ptszName = mir_a2u(pmi->pszName); - else - p->mi.ptszName = LangPackPcharToTchar( pmi->pszName ); - } - #else - p->mi.ptszName = mir_strdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : Translate( pmi->ptszName )); - #endif + + if ( pmi->flags & CMIF_UNICODE ) + p->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName )); + else { + if ( pmi->flags & CMIF_KEEPUNTRANSLATED ) + p->mi.ptszName = mir_a2u(pmi->pszName); + else + p->mi.ptszName = LangPackPcharToTchar( pmi->pszName ); + } if ( pmi->hIcon != NULL && !bIconsDisabled ) { if ( pmi->flags & CMIF_ICONFROMICOLIB ) { @@ -733,10 +727,10 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi //is item with popup or not if ( pmi->root == 0 ) { - //yes,this without popup + //yes, this without popup pmi->root = NULL; //first level } - else { // no,search for needed root and create it if need + else { // no, search for needed root and create it if need TCHAR* tszRoot; #if defined( _UNICODE ) if ( pmi->flags & CMIF_UNICODE ) @@ -751,7 +745,7 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi mir_free( tszRoot ); if ( oldroot == NULL ) { - //not found,creating root + //not found, creating root TMO_MenuItem tmi = { 0 }; tmi = *pmi; tmi.flags |= CMIF_ROOTHANDLE; @@ -871,7 +865,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l //wparam started hMenu //lparam ListParam* //result hMenu -INT_PTR MO_BuildMenu(WPARAM wParam,LPARAM lParam) +INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam) { if ( !bIsGenMenuInited ) return -1; @@ -1029,7 +1023,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para #ifdef PUTPOSITIONSONMENU if ( GetKeyState(VK_CONTROL) & 0x8000) { TCHAR str[256]; - mir_sntprintf( str, SIZEOF(str), _T( "%s (%d,id %x)" ), mi->pszName, mi->position, mii.dwItemData ); + mir_sntprintf( str, SIZEOF(str), _T( "%s (%d, id %x)" ), mi->pszName, mi->position, mii.dwItemData ); mii.dwTypeData = str; } #endif @@ -1044,7 +1038,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para #ifdef PUTPOSITIONSONMENU if ( GetKeyState(VK_CONTROL) & 0x8000) { TCHAR str[256]; - mir_sntprintf( str, SIZEOF(str), _T("%s (%d,id %x)"), mi->pszName, mi->position, mii.dwItemData ); + mir_sntprintf( str, SIZEOF(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData ); mii.dwTypeData = str; } #endif @@ -1069,7 +1063,7 @@ static int MO_ReloadIcon( PMO_IntMenuItem pmi, void* ) if ( newIcon ) ImageList_ReplaceIcon( pmi->parent->m_hMenuIcons, pmi->iconId, newIcon ); - IconLib_ReleaseIcon(newIcon,0); + IconLib_ReleaseIcon(newIcon, 0); } return FALSE; @@ -1120,7 +1114,7 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* ) if (( start = strchr( start, '&' )) == NULL ) break; - memmove(start,start+1,strlen(start+1)+1); + memmove(start, start+1, strlen(start+1)+1); if (*start != '\0') start++; else break; } @@ -1170,7 +1164,7 @@ int TryProcessDoubleClick( HANDLE hContact ) { int iMenuID = GetMenuObjbyId( (int)hContactMenuObject ); if ( iMenuID != -1 ) { - NotifyEventHooks(hPreBuildContactMenuEvent,(WPARAM)hContact,0); + NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0); PMO_IntMenuItem pimi = ( PMO_IntMenuItem )MO_GetDefaultMenuItem(( WPARAM )g_menus[ iMenuID ]->m_items.first, 0 ); if ( pimi != NULL ) { @@ -1195,7 +1189,7 @@ static VOID CALLBACK PostRegisterIcons( HWND, UINT, UINT_PTR, DWORD ) static int OnModulesLoaded(WPARAM, LPARAM) { posttimerid = SetTimer(( HWND )NULL, 0, 5, ( TIMERPROC )PostRegisterIcons ); - HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibChanges); + HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibChanges); return 0; } diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h index 63c665b940..14d820575e 100644 --- a/src/modules/clist/genmenu.h +++ b/src/modules/clist/genmenu.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 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. @@ -54,7 +54,7 @@ typedef struct _tagIntMenuItem TMO_LinkedList *owner; TMO_LinkedList submenu; } - TMO_IntMenuItem,*PMO_IntMenuItem; + TMO_IntMenuItem, *PMO_IntMenuItem; struct TIntMenuObject { @@ -118,7 +118,7 @@ INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey ); int MO_SetOptionsMenuItem( PMO_IntMenuItem menuobjecthandle, int setting, INT_PTR value ); int MO_SetOptionsMenuObject( HANDLE menuobjecthandle, int setting, INT_PTR value ); -INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam,LPARAM lParam); +INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam); int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam); // function returns TRUE if the walk should be immediately stopped @@ -138,9 +138,9 @@ BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles int GenMenuOptInit(WPARAM wParam, LPARAM lParam); int GetMenuObjbyId(const int id); -int GetMenuItembyId(const int objpos,const int id); -INT_PTR MO_GetMenuItem(WPARAM wParam,LPARAM lParam); +int GetMenuItembyId(const int objpos, const int id); +INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam); void FreeAndNil(void **p); -static int RemoveFromList(int pos,void **lpList,int *ListElemCount,int ElemSize); -static int RemoveFromList(int pos,void **lpList,int *ListElemCount,int ElemSize); +static int RemoveFromList(int pos, void **lpList, int *ListElemCount, int ElemSize); +static int RemoveFromList(int pos, void **lpList, int *ListElemCount, int ElemSize); #endif diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 84fbaa9e6a..421616b5e5 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 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. @@ -50,7 +50,7 @@ typedef struct tagMenuItemOptData PMO_IntMenuItem pimi; } - MenuItemOptData,*lpMenuItemOptData; + MenuItemOptData, *lpMenuItemOptData; static BOOL GetCurrentMenuObjectID(HWND hwndDlg, int* result) { @@ -130,7 +130,7 @@ static int SaveTree(HWND hwndDlg) static int BuildMenuObjectsTree(HWND hwndDlg) { TVINSERTSTRUCT tvis; - HWND hTree = GetDlgItem(hwndDlg,IDC_MENUOBJECTS); + HWND hTree = GetDlgItem(hwndDlg, IDC_MENUOBJECTS); int i; tvis.hParent = NULL; @@ -153,9 +153,9 @@ static int BuildMenuObjectsTree(HWND hwndDlg) return 1; } -static int sortfunc(const void *a,const void *b) +static int sortfunc(const void *a, const void *b) { - lpMenuItemOptData *sd1,*sd2; + lpMenuItemOptData *sd1, *sd2; sd1=(lpMenuItemOptData *)a; sd2=(lpMenuItemOptData *)b; if ((*sd1)->pos > (*sd2)->pos) @@ -203,7 +203,7 @@ static int InsertSeparator(HWND hwndDlg) static void FreeTreeData( HWND hwndDlg ) { - HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_MENUITEMS)); while ( hItem != NULL ) { TVITEM tvi; tvi.mask = TVIF_HANDLE | TVIF_PARAM; @@ -217,18 +217,18 @@ static void FreeTreeData( HWND hwndDlg ) } tvi.lParam = 0; - TreeView_SetItem(GetDlgItem(hwndDlg,IDC_MENUITEMS), &tvi); + TreeView_SetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi); - hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg,IDC_MENUITEMS), hItem); + hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_MENUITEMS), hItem); } } -static int BuildTree(HWND hwndDlg,int MenuObjectId, BOOL bReread) +static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) { - char menuItemName[256],MenuNameItems[256]; + char menuItemName[256], MenuNameItems[256]; char buf[256]; FreeTreeData( hwndDlg ); - TreeView_DeleteAllItems(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + TreeView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_MENUITEMS)); int menupos = GetMenuObjbyId( MenuObjectId ); if ( menupos == -1 ) @@ -319,7 +319,7 @@ static int BuildTree(HWND hwndDlg,int MenuObjectId, BOOL bReread) HTREEITEM hti = (HTREEITEM)SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis); if ( first ) { - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),hti); + TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti); first=FALSE; } @@ -328,7 +328,7 @@ static int BuildTree(HWND hwndDlg,int MenuObjectId, BOOL bReread) SendDlgItemMessage( hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0 ); mir_free( PDar ); - ShowWindow( GetDlgItem( hwndDlg, IDC_NOTSUPPORTWARNING ),( pimo->m_bUseUserDefinedItems ) ? SW_HIDE : SW_SHOW ); + ShowWindow( GetDlgItem( hwndDlg, IDC_NOTSUPPORTWARNING ), ( pimo->m_bUseUserDefinedItems ) ? SW_HIDE : SW_SHOW ); EnableWindow( GetDlgItem( hwndDlg, IDC_MENUITEMS ), pimo->m_bUseUserDefinedItems ); EnableWindow( GetDlgItem( hwndDlg, IDC_INSERTSEPARATOR ), pimo->m_bUseUserDefinedItems ); return 1; @@ -369,7 +369,7 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert tvis.item.iImage = tvis.item.iSelectedImage = (( MenuItemOptData* )tvi.lParam)->show; if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item)) return NULL; - if (!TreeView_DeleteItem(hTreeWnd,hItem)) + if (!TreeView_DeleteItem(hTreeWnd, hItem)) return NULL; tvis.hParent=NULL; tvis.hInsertAfter=hInsertAfter; @@ -380,16 +380,16 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert WNDPROC MyOldWindowProc=NULL; -LRESULT CALLBACK LBTNDOWNProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_LBUTTONDOWN && !(GetKeyState(VK_CONTROL)&0x8000)) { TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - // ClientToScreen(hwndDlg,&hti.pt); - // ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt); - TreeView_HitTest(hwnd,&hti); + // ClientToScreen(hwndDlg, &hti.pt); + // ScreenToClient(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti.pt); + TreeView_HitTest(hwnd, &hti); if (hti.flags&TVHT_ONITEMLABEL) { /// LabelClicked Set/unset selection TVITEM tvi; @@ -415,36 +415,36 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam) ((MenuItemOptData *)tvi.lParam)->isSelected=1; TreeView_SetItem(tvw, &tvi); } - while (hit=TreeView_GetNextSibling(tvw,hit)); + while (hit=TreeView_GetNextSibling(tvw, hit)); } } } - return CallWindowProc(MyOldWindowProc,hwnd,uMsg,wParam,lParam); + return CallWindowProc(MyOldWindowProc, hwnd, uMsg, wParam, lParam); } static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_USERDATA); + struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA); LPNMHDR hdr; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); dat=(struct OrderData*)mir_alloc(sizeof(struct OrderData)); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_USERDATA,(LONG_PTR)dat); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA, (LONG_PTR)dat); dat->dragging = 0; dat->iInitMenuValue = DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE ); - MyOldWindowProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_WNDPROC); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_WNDPROC,(LONG_PTR)&LBTNDOWNProc); + MyOldWindowProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC, (LONG_PTR)&LBTNDOWNProc); { HIMAGELIST himlCheckBoxes; - himlCheckBoxes=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), + himlCheckBoxes=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 2, 2); ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK); ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK); - TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_MENUOBJECTS),himlCheckBoxes,TVSIL_NORMAL); - TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_MENUITEMS),himlCheckBoxes,TVSIL_NORMAL); + TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUOBJECTS), himlCheckBoxes, TVSIL_NORMAL); + TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUITEMS), himlCheckBoxes, TVSIL_NORMAL); } CheckDlgButton(hwndDlg, dat->iInitMenuValue ? IDC_RADIO2 : IDC_RADIO1, TRUE ); CheckDlgButton(hwndDlg, IDC_DISABLEMENUICONS, bIconsDisabled ); @@ -476,13 +476,13 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM hti; MenuItemOptData *iod; - hti=TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + hti=TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_MENUITEMS)); if (hti == NULL) break; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; tvi.hItem=hti; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),&tvi); + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi); iod = ( MenuItemOptData * )tvi.lParam; if ( iod->name && _tcsstr( iod->name, STR_SEPARATOR )) @@ -504,7 +504,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR buf[256]; MenuItemOptData *iod; - HTREEITEM hti = TreeView_GetSelection( GetDlgItem( hwndDlg,IDC_MENUITEMS )); + HTREEITEM hti = TreeView_GetSelection( GetDlgItem( hwndDlg, IDC_MENUITEMS )); if ( hti == NULL ) break; @@ -516,7 +516,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR )) break; - ZeroMemory(buf,sizeof( buf )); + ZeroMemory(buf, sizeof( buf )); GetDlgItemText( hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF( buf )); if (iod->name) mir_free(iod->name); @@ -557,7 +557,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (hdr->code) { case NM_CUSTOMDRAW: { - int i= handleCustomDraw(GetDlgItem(hwndDlg,IDC_MENUITEMS),(LPNMTVCUSTOMDRAW) lParam); + int i= handleCustomDraw(GetDlgItem(hwndDlg, IDC_MENUITEMS), (LPNMTVCUSTOMDRAW) lParam); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, i); return TRUE; } @@ -566,7 +566,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetCapture(hwndDlg); dat->dragging=1; dat->hDragItem=((LPNMTREEVIEW)lParam)->itemNew.hItem; - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),dat->hDragItem); + TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), dat->hDragItem); break; case NM_CLICK: @@ -574,21 +574,21 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(GetMessagePos()); hti.pt.y=(short)HIWORD(GetMessagePos()); - ScreenToClient(hdr->hwndFrom,&hti.pt); - if (TreeView_HitTest(hdr->hwndFrom,&hti)) { + ScreenToClient(hdr->hwndFrom, &hti.pt); + if (TreeView_HitTest(hdr->hwndFrom, &hti)) { if (hti.flags&TVHT_ONITEMICON) { TVITEM tvi; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; tvi.hItem=hti.hItem; - TreeView_GetItem(hdr->hwndFrom,&tvi); + TreeView_GetItem(hdr->hwndFrom, &tvi); tvi.iImage=tvi.iSelectedImage=!tvi.iImage; ((MenuItemOptData *)tvi.lParam)->show=tvi.iImage; - TreeView_SetItem(hdr->hwndFrom,&tvi); + TreeView_SetItem(hdr->hwndFrom, &tvi); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); //all changes take effect in runtime - //ShowWindow(GetDlgItem(hwndDlg,IDC_BUTTONORDERTREEWARNING),SW_SHOW); + //ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREEWARNING), SW_SHOW); } /*--------MultiSelection----------*/ if (hti.flags&TVHT_ONITEMLABEL) { @@ -597,13 +597,13 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HWND tvw=hdr->hwndFrom; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hti.hItem; - TreeView_GetItem(tvw,&tvi); + TreeView_GetItem(tvw, &tvi); if (GetKeyState(VK_CONTROL)&0x8000) { if (((MenuItemOptData *)tvi.lParam)->isSelected) ((MenuItemOptData *)tvi.lParam)->isSelected=0; else ((MenuItemOptData *)tvi.lParam)->isSelected=1; //current selection order++. - TreeView_SetItem(tvw,&tvi); + TreeView_SetItem(tvw, &tvi); } else if (GetKeyState(VK_SHIFT)&0x8000) { ; // shifted click @@ -617,15 +617,15 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM tvi={0}; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hit; - TreeView_GetItem(tvw,&tvi); + TreeView_GetItem(tvw, &tvi); if (hti.hItem != hit) ((MenuItemOptData *)tvi.lParam)->isSelected=0; else ((MenuItemOptData *)tvi.lParam)->isSelected=1; - TreeView_SetItem(tvw,&tvi); + TreeView_SetItem(tvw, &tvi); } - while (hit=TreeView_GetNextSibling(tvw,hit)); + while (hit=TreeView_GetNextSibling(tvw, hit)); } } } break; } @@ -646,20 +646,20 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM hti; MenuItemOptData *iod; - SetDlgItemTextA(hwndDlg,IDC_GENMENU_CUSTOMNAME,""); - SetDlgItemTextA(hwndDlg,IDC_GENMENU_SERVICE,""); + SetDlgItemTextA(hwndDlg, IDC_GENMENU_CUSTOMNAME, ""); + SetDlgItemTextA(hwndDlg, IDC_GENMENU_SERVICE, ""); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_CUSTOMNAME),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_DEFAULT),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_SET),FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_CUSTOMNAME), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_DEFAULT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_SET), FALSE); - hti=TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + hti=TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_MENUITEMS)); if (hti == NULL) break; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; tvi.hItem=hti; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),&tvi); + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi); if ( tvi.lParam == 0 ) break; @@ -669,14 +669,14 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR)) break; - SetDlgItemText(hwndDlg,IDC_GENMENU_CUSTOMNAME,iod->name); + SetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, iod->name); if (iod->pimi->submenu.first == NULL && iod->uniqname) SetDlgItemTextA(hwndDlg, IDC_GENMENU_SERVICE, iod->uniqname); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_DEFAULT), lstrcmp(iod->name, iod->defname) != 0); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_SET),TRUE); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_CUSTOMNAME),TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_DEFAULT), lstrcmp(iod->name, iod->defname) != 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_SET), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_CUSTOMNAME), TRUE); break; } break; @@ -690,22 +690,22 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt); - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti); + ClientToScreen(hwndDlg, &hti.pt); + ScreenToClient(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti.pt); + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti); if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)) { HTREEITEM it = hti.hItem; - hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_MENUITEMS))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti); + hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_MENUITEMS))/2; + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti); if (!(hti.flags&TVHT_ABOVE)) - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),hti.hItem,1); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti.hItem, 1); else - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),it,0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), it, 0); } else { - if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg,IDC_MENUITEMS,WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),0); - if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg,IDC_MENUITEMS,WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),0); - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),NULL,0); + if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0); + if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0); } } break; @@ -713,17 +713,17 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (!dat->dragging) break; - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),NULL,0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0); dat->dragging=0; ReleaseCapture(); { TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt); - hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_MENUITEMS))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti); + ClientToScreen(hwndDlg, &hti.pt); + ScreenToClient(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti.pt); + hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_MENUITEMS))/2; + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti); if (hti.flags&TVHT_ABOVE) hti.hItem=TVI_FIRST; if (dat->hDragItem == hti.hItem) break; dat->hDragItem=NULL; @@ -731,8 +731,8 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HWND tvw; HTREEITEM * pSIT; HTREEITEM FirstItem=NULL; - UINT uITCnt,uSic ; - tvw=GetDlgItem(hwndDlg,IDC_MENUITEMS); + UINT uITCnt, uSic ; + tvw=GetDlgItem(hwndDlg, IDC_MENUITEMS); uITCnt=TreeView_GetCount(tvw); uSic=0; if (uITCnt) { @@ -745,20 +745,20 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM tvi={0}; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hit; - TreeView_GetItem(tvw,&tvi); + TreeView_GetItem(tvw, &tvi); if (((MenuItemOptData *)tvi.lParam)->isSelected) { pSIT[uSic]=tvi.hItem; uSic++; } - }while (hit=TreeView_GetNextSibling(tvw,hit)); + }while (hit=TreeView_GetNextSibling(tvw, hit)); // Proceed moving { UINT i; HTREEITEM insertAfter; insertAfter=hti.hItem; for (i=0; inmcd.hdc,tvi.pszText,lstrlen(tvi.pszText),&sz); + GetTextExtentPoint32(pNMTVCD->nmcd.hdc, tvi.pszText, lstrlen(tvi.pszText), &sz); if (sz.cx+3>pNMTVCD->nmcd.rc.right-pNMTVCD->nmcd.rc.left) rc=pNMTVCD->nmcd.rc; - else SetRect(&rc,pNMTVCD->nmcd.rc.left,pNMTVCD->nmcd.rc.top,pNMTVCD->nmcd.rc.left+sz.cx+3,pNMTVCD->nmcd.rc.bottom); + else SetRect(&rc, pNMTVCD->nmcd.rc.left, pNMTVCD->nmcd.rc.top, pNMTVCD->nmcd.rc.left+sz.cx+3, pNMTVCD->nmcd.rc.bottom); br=CreateSolidBrush(pNMTVCD->clrTextBk); - SetTextColor(pNMTVCD->nmcd.hdc,pNMTVCD->clrText); - SetBkColor(pNMTVCD->nmcd.hdc,pNMTVCD->clrTextBk); - FillRect(pNMTVCD->nmcd.hdc,&rc,br); + SetTextColor(pNMTVCD->nmcd.hdc, pNMTVCD->clrText); + SetBkColor(pNMTVCD->nmcd.hdc, pNMTVCD->clrTextBk); + FillRect(pNMTVCD->nmcd.hdc, &rc, br); DeleteObject(br); - DrawText(pNMTVCD->nmcd.hdc,tvi.pszText,lstrlen(tvi.pszText),&pNMTVCD->nmcd.rc,DT_LEFT|DT_VCENTER|DT_NOPREFIX); + DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, lstrlen(tvi.pszText), &pNMTVCD->nmcd.rc, DT_LEFT|DT_VCENTER|DT_NOPREFIX); } return CDRF_NEWFONT|(k?CDRF_SKIPDEFAULT:0); diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index ddf7c287b4..c958823ebb 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.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. diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index e02abed203..cb8a428f22 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.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. @@ -26,15 +26,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static INT_PTR hkHideShow(WPARAM, LPARAM) { - cli.pfnShowHide(0,0); + cli.pfnShowHide(0, 0); return 0; } /* -INT_PTR hkSearch(WPARAM wParam,LPARAM lParam) +INT_PTR hkSearch(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv={0}; - if (!DBGetContactSettingString(NULL,"CList","SearchUrl",&dbv)) { - CallService(MS_UTILS_OPENURL,DBGetContactSettingByte(NULL,"CList","HKSearchNewWnd",0),(LPARAM)dbv.pszVal); + if (!DBGetContactSettingString(NULL, "CList", "SearchUrl", &dbv)) { + CallService(MS_UTILS_OPENURL, DBGetContactSettingByte(NULL, "CList", "HKSearchNewWnd", 0), (LPARAM)dbv.pszVal); DBFreeVariant(&dbv); } return 0; @@ -50,17 +50,17 @@ static INT_PTR hkRead(WPARAM, LPARAM) static INT_PTR hkOpts(WPARAM, LPARAM) { - CallService("Options/OptionsCommand",0, 0); + CallService("Options/OptionsCommand", 0, 0); return 0; } /* -static INT_PTR hkCloseMiranda(WPARAM wParam,LPARAM lParam) +static INT_PTR hkCloseMiranda(WPARAM wParam, LPARAM lParam) { CallService("CloseAction", 0, 0); return 0; } -INT_PTR hkRestoreStatus(WPARAM wParam,LPARAM lParam) +INT_PTR hkRestoreStatus(WPARAM wParam, LPARAM lParam) { int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE); CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); @@ -77,12 +77,12 @@ int InitClistHotKeys(void) { HOTKEYDESC shk = {0}; - CreateServiceFunction("CLIST/HK/SHOWHIDE",hkHideShow); - CreateServiceFunction("CLIST/HK/Opts",hkOpts); - CreateServiceFunction("CLIST/HK/Read",hkRead); -// CreateServiceFunction("CLIST/HK/CloseMiranda",hkCloseMiranda); -// CreateServiceFunction("CLIST/HK/RestoreStatus",hkRestoreStatus); -// CreateServiceFunction("CLIST/HK/AllOffline",hkAllOffline); + CreateServiceFunction("CLIST/HK/SHOWHIDE", hkHideShow); + CreateServiceFunction("CLIST/HK/Opts", hkOpts); + CreateServiceFunction("CLIST/HK/Read", hkRead); +// CreateServiceFunction("CLIST/HK/CloseMiranda", hkCloseMiranda); +// CreateServiceFunction("CLIST/HK/RestoreStatus", hkRestoreStatus); +// CreateServiceFunction("CLIST/HK/AllOffline", hkAllOffline); shk.cbSize=sizeof(shk); shk.pszDescription="Show Hide Contact List"; @@ -90,42 +90,42 @@ int InitClistHotKeys(void) shk.pszSection="Main"; shk.pszService="CLIST/HK/SHOWHIDE"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'A'); - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Read Message"; shk.pszName="ReadMessage"; shk.pszSection="Main"; shk.pszService="CLIST/HK/Read"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'I'); - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); /* shk.pszDescription="Search in site"; shk.pszName="SearchInWeb"; shk.pszSection="Main"; shk.pszService="CLIST/HK/Search"; shk.DefHotKey=846; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); */ shk.pszDescription = "Open Options Page"; shk.pszName = "ShowOptions"; shk.pszSection = "Main"; shk.pszService = "CLIST/HK/Opts"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'O') | HKF_MIRANDA_LOCAL; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription = "Open Logging Options"; shk.pszName = "ShowLogOptions"; shk.pszSection = "Main"; shk.pszService = "Netlib/Log/Win"; shk.DefHotKey = 0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Open Find User Dialog"; shk.pszName="FindUsers"; shk.pszSection="Main"; shk.pszService="FindAdd/FindAddCommand"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'F') | HKF_MIRANDA_LOCAL; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); /* shk.pszDescription="Close Miranda"; @@ -133,21 +133,21 @@ int InitClistHotKeys(void) shk.pszSection="Main"; shk.pszService="CLIST/HK/CloseMiranda"; shk.DefHotKey=0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Restore last status"; shk.pszName="RestoreLastStatus"; shk.pszSection="Status"; shk.pszService="CLIST/HK/RestoreStatus"; shk.DefHotKey=0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Set All Offline"; shk.pszName="AllOffline"; shk.pszSection="Status"; shk.pszService="CLIST/HK/AllOffline"; shk.DefHotKey=0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); */ return 0; } diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 4cdda53de8..5fd05e87a0 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 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. @@ -76,13 +76,13 @@ static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, boo if ( checked ) mi.flags |= CMIF_CHECKED; mi.pszService = MTG_MOVE; - HANDLE result = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, param, (LPARAM)&mi); + HANDLE result = Menu_AddContactMenuItem(&mi); mir_free( mi.ptszName ); lphGroupsItems.insert((HANDLE*)result); } -static int OnContactMenuBuild(WPARAM wParam,LPARAM) +static int OnContactMenuBuild(WPARAM wParam, LPARAM) { int i; OBJLIST groups(10, GroupItemSort::compare); @@ -97,7 +97,7 @@ static int OnContactMenuBuild(WPARAM wParam,LPARAM) mi.flags = CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_GROUP); - hMoveToGroupItem = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi); + hMoveToGroupItem = Menu_AddContactMenuItem(&mi); } for (i = 0; i < lphGroupsItems.getCount(); i++) @@ -139,7 +139,7 @@ static int OnContactMenuBuild(WPARAM wParam,LPARAM) return 0; } -static INT_PTR MTG_DOMOVE(WPARAM wParam,LPARAM lParam) +static INT_PTR MTG_DOMOVE(WPARAM wParam, LPARAM lParam) { CallService(MS_CLIST_CONTACTCHANGEGROUP, wParam, lParam < 0 ? 0 : lParam); return 0; @@ -147,8 +147,8 @@ static INT_PTR MTG_DOMOVE(WPARAM wParam,LPARAM lParam) void MTG_OnmodulesLoad() { - hOnCntMenuBuild=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,OnContactMenuBuild); - CreateServiceFunction(MTG_MOVE,MTG_DOMOVE); + hOnCntMenuBuild=HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnContactMenuBuild); + CreateServiceFunction(MTG_MOVE, MTG_DOMOVE); } int UnloadMoveToGroup(void) diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index c40792a095..41a5b5beba 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 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. @@ -254,19 +254,19 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(GetMessagePos()); hti.pt.y=(short)HIWORD(GetMessagePos()); - ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt); + ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt); if ( TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti )) { if ( hti.flags & TVHT_ONITEMICON ) { TVITEMA tvi; tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; tvi.hItem = hti.hItem; - TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); + TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); ProtocolData *pData = ( ProtocolData* )tvi.lParam; if ( pData->enabled ) { tvi.iImage = tvi.iSelectedImage = !tvi.iImage; pData->show = tvi.iImage; - TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); + TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); } } } } } break; diff --git a/src/modules/contacts/contacts.cpp b/src/modules/contacts/contacts.cpp index 562965ad17..1b8041a066 100644 --- a/src/modules/contacts/contacts.cpp +++ b/src/modules/contacts/contacts.cpp @@ -6,7 +6,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. @@ -20,13 +20,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NAMEORDERCOUNT 8 static TCHAR* nameOrderDescr[ NAMEORDERCOUNT ] = { - _T( "My custom name (not moveable)" ), - _T( "Nick" ), - _T( "FirstName" ), - _T( "E-mail" ), - _T( "LastName" ), - _T( "Username" ), - _T( "FirstName LastName" ), + _T( "My custom name (not moveable)" ), + _T( "Nick" ), + _T( "FirstName" ), + _T( "E-mail" ), + _T( "LastName" ), + _T( "Username" ), + _T( "FirstName LastName" ), _T( "'(Unknown Contact)' (not moveable)" ) }; @@ -44,9 +44,9 @@ static int GetDatabaseString( CONTACTINFO *ci, const char* setting, DBVARIANT* d } if ( ci->dwFlag & CNF_UNICODE ) - return DBGetContactSettingWString(ci->hContact,ci->szProto,setting,dbv); + return DBGetContactSettingWString(ci->hContact, ci->szProto, setting, dbv); - return DBGetContactSettingString(ci->hContact,ci->szProto,setting,dbv); + return DBGetContactSettingString(ci->hContact, ci->szProto, setting, dbv); } static int ProcessDatabaseValueDefault(CONTACTINFO *ci, const char* setting) @@ -92,7 +92,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { CONTACTINFO *ci = (CONTACTINFO*)lParam; if (ci == NULL) return 1; - if (ci->szProto == NULL) ci->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT,(WPARAM)ci->hContact,0); + if (ci->szProto == NULL) ci->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)ci->hContact, 0); if (ci->szProto == NULL) return 1; ci->type = 0; switch(ci->dwFlag & 0x7F) { @@ -143,9 +143,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { if ( !DBGetContactSetting( ci->hContact, ci->szProto, (ci->dwFlag & 0x7F) == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv )) { if ( dbv.type == DBVT_WORD ) { - int i,countryCount; + int i, countryCount; struct CountryListEntry *countries; - CallService(MS_UTILS_GETCOUNTRYLIST,(WPARAM)&countryCount,(LPARAM)&countries); + CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries); for (i=0;itype = CNFT_ASCIIZ; if ( ci->dwFlag & CNF_UNICODE ) { size_t len = wcslen(dbv.pwszVal) + wcslen(dbv2.pwszVal) + 2; @@ -197,9 +197,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { case CNF_UNIQUEID: { - char *uid = (char*)CallProtoService(ci->szProto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); + char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid) - if (!ProcessDatabaseValueDefault(ci,uid)) + if (!ProcessDatabaseValueDefault(ci, uid)) return 0; break; @@ -208,9 +208,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { { if (!ProcessDatabaseValueDefault(ci, "display_uid")) return 0; - char *uid = (char*)CallProtoService(ci->szProto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); + char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid) - if (!ProcessDatabaseValueDefault(ci,uid)) + if (!ProcessDatabaseValueDefault(ci, uid)) return 0; break; @@ -226,7 +226,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { // make sure we aren't in CNF_DISPLAYNC mode // don't get custom name for NULL contact char* saveProto = ci->szProto; ci->szProto = "CList"; - if (ci->hContact != NULL && (ci->dwFlag&0x7F) == CNF_DISPLAY && !ProcessDatabaseValueDefault(ci,"MyHandle")) { + if (ci->hContact != NULL && (ci->dwFlag&0x7F) == CNF_DISPLAY && !ProcessDatabaseValueDefault(ci, "MyHandle")) { ci->szProto = saveProto; return 0; } @@ -252,9 +252,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { case 5: // Unique id { // protocol must define a PFLAG_UNIQUEIDSETTING - char *uid = (char*)CallProtoService(ci->szProto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); + char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND&&uid) { - if (!GetDatabaseString(ci,uid,&dbv)) { + if (!GetDatabaseString(ci, uid, &dbv)) { if ( dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD ) { long value = (dbv.type == DBVT_BYTE) ? dbv.bVal:(dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal); if ( ci->dwFlag & CNF_UNICODE ) { @@ -283,9 +283,9 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { break; } case 6: // first + last name - if (!GetDatabaseString(ci,"FirstName",&dbv)) { + if (!GetDatabaseString(ci, "FirstName", &dbv)) { DBVARIANT dbv2; - if (!GetDatabaseString(ci,"LastName",&dbv2)) { + if (!GetDatabaseString(ci, "LastName", &dbv2)) { ci->type = CNFT_ASCIIZ; if ( ci->dwFlag & CNF_UNICODE ) { @@ -338,7 +338,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { } case CNF_MYNOTES: { char* saveProto = ci->szProto; ci->szProto = "UserInfo"; - if (!ProcessDatabaseValueDefault(ci,"MyNotes")) { + if (!ProcessDatabaseValueDefault(ci, "MyNotes")) { ci->szProto = saveProto; return 0; } @@ -357,15 +357,15 @@ struct ContactOptionsData { static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) { struct ContactOptionsData *dat; - dat=(struct ContactOptionsData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + dat=(struct ContactOptionsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); dat=(struct ContactOptionsData*)mir_alloc(sizeof(struct ContactOptionsData)); - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)dat); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->dragging=0; - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NAMEORDER),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_NAMEORDER),GWL_STYLE)|TVS_NOHSCROLL); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NAMEORDER), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NAMEORDER), GWL_STYLE)|TVS_NOHSCROLL); { TVINSERTSTRUCT tvis; int i; tvis.hParent = NULL; @@ -374,7 +374,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara for (i=0; i < SIZEOF(nameOrderDescr); i++ ) { tvis.item.lParam = nameOrder[i]; tvis.item.pszText = TranslateTS( nameOrderDescr[ nameOrder[i]] ); - TreeView_InsertItem( GetDlgItem(hwndDlg,IDC_NAMEORDER), &tvis ); + TreeView_InsertItem( GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvis ); } } return TRUE; } @@ -390,16 +390,16 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara cws.value.type = DBVT_BLOB; cws.value.cpbVal = SIZEOF(nameOrderDescr); cws.value.pbVal = nameOrder; - tvi.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg,IDC_NAMEORDER)); + tvi.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_NAMEORDER)); i=0; while ( tvi.hItem != NULL ) { tvi.mask = TVIF_PARAM | TVIF_HANDLE; - TreeView_GetItem( GetDlgItem(hwndDlg,IDC_NAMEORDER), &tvi ); + TreeView_GetItem( GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvi ); nameOrder[i++] = (BYTE)tvi.lParam; - tvi.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg,IDC_NAMEORDER),tvi.hItem); + tvi.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_NAMEORDER), tvi.hItem); } - CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)(HANDLE)NULL,(LPARAM)&cws); - CallService(MS_CLIST_INVALIDATEDISPLAYNAME,(WPARAM)INVALID_HANDLE_VALUE,0); + CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)(HANDLE)NULL, (LPARAM)&cws); + CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)INVALID_HANDLE_VALUE, 0); } break; case IDC_NAMEORDER: @@ -410,7 +410,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara SetCapture(hwndDlg); dat->dragging=1; dat->hDragItem=((LPNMTREEVIEW)lParam)->itemNew.hItem; - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_NAMEORDER),dat->hDragItem); + TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), dat->hDragItem); } break; } @@ -420,38 +420,38 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara { TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_NAMEORDER),&hti.pt); - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_NAMEORDER),&hti); + ClientToScreen(hwndDlg, &hti.pt); + ScreenToClient(GetDlgItem(hwndDlg, IDC_NAMEORDER), &hti.pt); + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_NAMEORDER), &hti); if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)) { - hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_NAMEORDER))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_NAMEORDER),&hti); - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_NAMEORDER),hti.hItem,1); + hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_NAMEORDER))/2; + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_NAMEORDER), &hti); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_NAMEORDER), hti.hItem, 1); } else { - if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg,IDC_NAMEORDER,WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),0); - if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg,IDC_NAMEORDER,WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),0); - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_NAMEORDER),NULL,0); + if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg, IDC_NAMEORDER, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0); + if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg, IDC_NAMEORDER, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_NAMEORDER), NULL, 0); } } break; case WM_LBUTTONUP: if (!dat->dragging) break; - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_NAMEORDER),NULL,0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_NAMEORDER), NULL, 0); dat->dragging=0; ReleaseCapture(); { TVHITTESTINFO hti; TVITEM tvi; hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_NAMEORDER),&hti.pt); - hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_NAMEORDER))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_NAMEORDER),&hti); + ClientToScreen(hwndDlg, &hti.pt); + ScreenToClient(GetDlgItem(hwndDlg, IDC_NAMEORDER), &hti.pt); + hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_NAMEORDER))/2; + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_NAMEORDER), &hti); if (dat->hDragItem == hti.hItem) break; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hti.hItem; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_NAMEORDER),&tvi); + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvi); if (tvi.lParam == SIZEOF(nameOrderDescr)-1) break; if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)) { TVINSERTSTRUCT tvis; @@ -461,11 +461,11 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara tvis.item.pszText=name; tvis.item.cchTextMax=SIZEOF(name); tvis.item.hItem=dat->hDragItem; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_NAMEORDER),&tvis.item); - TreeView_DeleteItem(GetDlgItem(hwndDlg,IDC_NAMEORDER),dat->hDragItem); + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvis.item); + TreeView_DeleteItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), dat->hDragItem); tvis.hParent=NULL; tvis.hInsertAfter=hti.hItem; - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_NAMEORDER),TreeView_InsertItem(GetDlgItem(hwndDlg,IDC_NAMEORDER),&tvis)); + TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_NAMEORDER), &tvis)); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } @@ -501,13 +501,13 @@ int LoadContactsModule(void) { for (i=0; imakeDatabase(prf, &err)) { - mir_sntprintf(buf, SIZEOF(buf),TranslateT("Unable to create the profile '%s', the error was %x"),file, err); - MessageBox(hwndDlg,buf,TranslateT("Problem creating profile"),MB_ICONERROR|MB_OK); + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Unable to create the profile '%s', the error was %x"), file, err); + MessageBox(hwndDlg, buf, TranslateT("Problem creating profile"), MB_ICONERROR|MB_OK); mir_free(prf); return 0; } @@ -488,7 +488,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) TCHAR classname[256]; ENUMMIRANDAWINDOW * x = (ENUMMIRANDAWINDOW *)lParam; DWORD_PTR res=0; - if ( GetClassName(hwnd,classname,SIZEOF(classname)) && lstrcmp( _T("Miranda"),classname) == 0 ) { + if ( GetClassName(hwnd, classname, SIZEOF(classname)) && lstrcmp( _T("Miranda"), classname) == 0 ) { if ( SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res ) { x->found++; return FALSE; @@ -527,9 +527,9 @@ int LoadDatabaseModule(void) dbe.lParam = (LPARAM)szProfile; if ( _taccess(szProfile, 0) && shouldAutoCreate( szProfile )) - dbe.pfnEnumCallback=( int(*) (const char*,void*,LPARAM) )FindDbPluginAutoCreate; + dbe.pfnEnumCallback=( int(*) (const char*, void*, LPARAM) )FindDbPluginAutoCreate; else - dbe.pfnEnumCallback=( int(*) (const char*,void*,LPARAM) )FindDbPluginForProfile; + dbe.pfnEnumCallback=( int(*) (const char*, void*, LPARAM) )FindDbPluginForProfile; // find a driver to support the given profile bool retry; @@ -541,9 +541,9 @@ int LoadDatabaseModule(void) case -1: { // no plugins at all TCHAR buf[256]; - TCHAR* p = _tcsrchr(szProfile,'\\'); - mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile ); - MessageBox(0,buf,TranslateT("No profile support installed!"),MB_OK | MB_ICONERROR); + TCHAR* p = _tcsrchr(szProfile, '\\'); + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_3x.dll or equivalent."), p ? ++p : szProfile ); + MessageBox(0, buf, TranslateT("No profile support installed!"), MB_OK | MB_ICONERROR); break; } case 1: @@ -551,15 +551,15 @@ int LoadDatabaseModule(void) if (fileExist(szProfile)) { // file isn't locked, just no driver could open it. TCHAR buf[256]; - TCHAR* p = _tcsrchr(szProfile,'\\'); - mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DB-tool which should be installed."), p ? ++p : szProfile); - MessageBox(0,buf,TranslateT("Miranda can't understand that profile"),MB_OK | MB_ICONERROR); + TCHAR* p = _tcsrchr(szProfile, '\\'); + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DB-tool which should be installed."), p ? ++p : szProfile); + MessageBox(0, buf, TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR); } else if (!FindMirandaForProfile(szProfile)) { TCHAR buf[256]; - TCHAR* p = _tcsrchr(szProfile,'\\'); - mir_sntprintf(buf,SIZEOF(buf),TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile); - retry = MessageBox(0,buf,TranslateT("Miranda can't open that profile"),MB_RETRYCANCEL | MB_ICONERROR) == IDRETRY; + TCHAR* p = _tcsrchr(szProfile, '\\'); + mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance"), p ? ++p : szProfile); + retry = MessageBox(0, buf, TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR) == IDRETRY; } break; } diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index cecbef4dd8..ce01d20dc8 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -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. @@ -30,7 +30,7 @@ static HANDLE hIniChangeNotification; extern TCHAR mirandabootini[MAX_PATH]; extern bool dbCreated; -static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: @@ -62,7 +62,7 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg,UINT message,WPARAM wPara case IDOK: case IDCANCEL: case IDC_NOTOALL: - EndDialog(hwndDlg,LOWORD(wParam)); + EndDialog(hwndDlg, LOWORD(wParam)); break; } break; @@ -70,13 +70,13 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg,UINT message,WPARAM wPara return FALSE; } -static bool IsInSpaceSeparatedList(const char *szWord,const char *szList) +static bool IsInSpaceSeparatedList(const char *szWord, const char *szList) { - const char *szItem,*szEnd; + const char *szItem, *szEnd; int wordLen = lstrlenA(szWord); for (szItem = szList;;) { - szEnd = strchr(szItem,' '); + szEnd = strchr(szItem, ' '); if (szEnd == NULL) return !lstrcmpA( szItem, szWord ); if ( szEnd - szItem == wordLen ) { @@ -93,10 +93,10 @@ struct warnSettingChangeInfo_t { char *szUnsafeSections; char *szName; char *szValue; - int warnNoMore,cancel; + int warnNoMore, cancel; }; -static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { static struct warnSettingChangeInfo_t *warnInfo; @@ -108,17 +108,17 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg,UINT message,WPARAM wP TranslateDialogDefault(hwndDlg); SetDlgItemText(hwndDlg, IDC_ININAME, warnInfo->szIniPath); lstrcpyA(szSettingName, warnInfo->szSection); - lstrcatA(szSettingName," / "); - lstrcatA(szSettingName,warnInfo->szName); - SetDlgItemTextA(hwndDlg,IDC_SETTINGNAME,szSettingName); - SetDlgItemTextA(hwndDlg,IDC_NEWVALUE,warnInfo->szValue); - if (IsInSpaceSeparatedList(warnInfo->szSection,warnInfo->szSafeSections)) + lstrcatA(szSettingName, " / "); + lstrcatA(szSettingName, warnInfo->szName); + SetDlgItemTextA(hwndDlg, IDC_SETTINGNAME, szSettingName); + SetDlgItemTextA(hwndDlg, IDC_NEWVALUE, warnInfo->szValue); + if (IsInSpaceSeparatedList(warnInfo->szSection, warnInfo->szSafeSections)) pszSecurityInfo=LPGENT("This change is known to be safe."); - else if (IsInSpaceSeparatedList(warnInfo->szSection,warnInfo->szUnsafeSections)) + else if (IsInSpaceSeparatedList(warnInfo->szSection, warnInfo->szUnsafeSections)) pszSecurityInfo=LPGENT("This change is known to be potentially hazardous."); else pszSecurityInfo=LPGENT("This change is not known to be safe."); - SetDlgItemText(hwndDlg,IDC_SECURITYINFO,TranslateTS(pszSecurityInfo)); + SetDlgItemText(hwndDlg, IDC_SECURITYINFO, TranslateTS(pszSecurityInfo)); return TRUE; } case WM_COMMAND: @@ -127,8 +127,8 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg,UINT message,WPARAM wP warnInfo->cancel=1; case IDYES: case IDNO: - warnInfo->warnNoMore=IsDlgButtonChecked(hwndDlg,IDC_WARNNOMORE); - EndDialog(hwndDlg,LOWORD(wParam)); + warnInfo->warnNoMore=IsDlgButtonChecked(hwndDlg, IDC_WARNNOMORE); + EndDialog(hwndDlg, LOWORD(wParam)); break; } break; @@ -136,22 +136,22 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg,UINT message,WPARAM wP return FALSE; } -static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SetDlgItemText(hwndDlg,IDC_ININAME,(TCHAR*)lParam); - SetDlgItemText(hwndDlg,IDC_NEWNAME,(TCHAR*)lParam); + SetDlgItemText(hwndDlg, IDC_ININAME, (TCHAR*)lParam); + SetDlgItemText(hwndDlg, IDC_NEWNAME, (TCHAR*)lParam); return TRUE; case WM_COMMAND: { TCHAR szIniPath[MAX_PATH]; - GetDlgItemText(hwndDlg,IDC_ININAME,szIniPath,SIZEOF(szIniPath)); + GetDlgItemText(hwndDlg, IDC_ININAME, szIniPath, SIZEOF(szIniPath)); switch(LOWORD(wParam)) { case IDC_DELETE: DeleteFile(szIniPath); case IDC_LEAVE: - EndDialog(hwndDlg,LOWORD(wParam)); + EndDialog(hwndDlg, LOWORD(wParam)); break; case IDC_RECYCLE: { SHFILEOPSTRUCT shfo={0}; @@ -161,14 +161,14 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg,UINT message,WPARAM wP shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; SHFileOperation(&shfo); } - EndDialog(hwndDlg,LOWORD(wParam)); + EndDialog(hwndDlg, LOWORD(wParam)); break; case IDC_MOVE: { TCHAR szNewPath[MAX_PATH]; - GetDlgItemText(hwndDlg,IDC_NEWNAME,szNewPath,SIZEOF(szNewPath)); - MoveFile(szIniPath,szNewPath); + GetDlgItemText(hwndDlg, IDC_NEWNAME, szNewPath, SIZEOF(szNewPath)); + MoveFile(szIniPath, szNewPath); } - EndDialog(hwndDlg,LOWORD(wParam)); + EndDialog(hwndDlg, LOWORD(wParam)); break; } break; @@ -205,7 +205,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf while (!feof(fp)) { char szLine[2048]; - if (fgets(szLine,sizeof(szLine),fp) == NULL) + if (fgets(szLine, sizeof(szLine), fp) == NULL) break; int lineLength = lstrlenA(szLine); @@ -216,14 +216,14 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf continue; if (szLine[0] == '[') { - char *szEnd = strchr(szLine+1,']'); + char *szEnd = strchr(szLine+1, ']'); if (szEnd == NULL) continue; if (szLine[1] == '!') szSection[0] = '\0'; else { - lstrcpynA(szSection,szLine+1,min(sizeof(szSection),(int)(szEnd-szLine))); + lstrcpynA(szSection, szLine+1, min(sizeof(szSection), (int)(szEnd-szLine))); switch (secur) { case 0: warnThisSection = false; @@ -246,10 +246,10 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf if (szLine[1] == '?') { DBCONTACTENUMSETTINGS dbces; dbces.pfnEnumProc=SettingsEnumProc; - lstrcpynA(szSection,szLine+2,min(sizeof(szSection),(int)(szEnd-szLine-1))); + lstrcpynA(szSection, szLine+2, min(sizeof(szSection), (int)(szEnd-szLine-1))); dbces.szModule=szSection; dbces.ofsSettings=0; - CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces); + CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces); while (setting_items) { SettingsList *next = setting_items->next; @@ -269,12 +269,12 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf if (szSection[0] == '\0') continue; - char *szValue=strchr(szLine,'='); + char *szValue=strchr(szLine, '='); if ( szValue == NULL ) continue; char szName[128]; - lstrcpynA(szName,szLine,min(sizeof(szName),(int)(szValue-szLine+1))); + lstrcpynA(szName, szLine, min(sizeof(szName), (int)(szValue-szLine+1))); szValue++; { warnSettingChangeInfo_t warnInfo; @@ -286,7 +286,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf warnInfo.szValue=szValue; warnInfo.warnNoMore=0; warnInfo.cancel=0; - if (warnThisSection && IDNO == DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_WARNINICHANGE),NULL,WarnIniChangeDlgProc,(LPARAM)&warnInfo)) + if (warnThisSection && IDNO == DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_WARNINICHANGE), NULL, WarnIniChangeDlgProc, (LPARAM)&warnInfo)) continue; if (warnInfo.cancel) break; @@ -297,26 +297,26 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf switch(szValue[0]) { case 'b': case 'B': - DBWriteContactSettingByte(NULL,szSection,szName,(BYTE)strtol(szValue+1,NULL,0)); + DBWriteContactSettingByte(NULL, szSection, szName, (BYTE)strtol(szValue+1, NULL, 0)); break; case 'w': case 'W': - DBWriteContactSettingWord(NULL,szSection,szName,(WORD)strtol(szValue+1,NULL,0)); + DBWriteContactSettingWord(NULL, szSection, szName, (WORD)strtol(szValue+1, NULL, 0)); break; case 'd': case 'D': - DBWriteContactSettingDword(NULL,szSection,szName,(DWORD)strtoul(szValue+1,NULL,0)); + DBWriteContactSettingDword(NULL, szSection, szName, (DWORD)strtoul(szValue+1, NULL, 0)); break; case 'l': case 'L': - DBDeleteContactSetting(NULL,szSection,szName); + DBDeleteContactSetting(NULL, szSection, szName); break; case 'e': case 'E': ConvertBackslashes(szValue+1, LangPackGetDefaultCodePage()); case 's': case 'S': - DBWriteContactSettingString(NULL,szSection,szName,szValue+1); + DBWriteContactSettingString(NULL, szSection, szName, szValue+1); break; case 'g': case 'G': @@ -329,11 +329,11 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf case 'r': *pstr='\r'; break; default: *pstr=pstr[1]; break; } - MoveMemory(pstr+1,pstr+2,lstrlenA(pstr+2)+1); + MoveMemory(pstr+1, pstr+2, lstrlenA(pstr+2)+1); } } } case 'u': case 'U': - DBWriteContactSettingStringUtf(NULL,szSection,szName,szValue+1); + DBWriteContactSettingStringUtf(NULL, szSection, szName, szValue+1); break; case 'n': case 'h': @@ -341,12 +341,12 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf case 'H': { PBYTE buf; int len; - char *pszValue,*pszEnd; + char *pszValue, *pszEnd; DBCONTACTWRITESETTING cws; buf=(PBYTE)mir_alloc(lstrlenA(szValue+1)); - for (len=0,pszValue=szValue+1;;len++) { - buf[len]=(BYTE)strtol(pszValue,&pszEnd,0x10); + for (len=0, pszValue=szValue+1;;len++) { + buf[len]=(BYTE)strtol(pszValue, &pszEnd, 0x10); if (pszValue == pszEnd) break; pszValue=pszEnd; } @@ -355,12 +355,12 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf cws.value.type=DBVT_BLOB; cws.value.pbVal=buf; cws.value.cpbVal=len; - CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)(HANDLE)NULL,(LPARAM)&cws); + CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)(HANDLE)NULL, (LPARAM)&cws); mir_free(buf); } break; default: - MessageBox(NULL,TranslateT("Invalid setting type. The first character of every value must be b, w, d, l, s, e, u, g, h or n."),TranslateT("Install Database Settings"),MB_OK); + MessageBox(NULL, TranslateT("Invalid setting type. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), TranslateT("Install Database Settings"), MB_OK); break; } } @@ -375,20 +375,20 @@ static void DoAutoExec(void) char *szSafeSections, *szUnsafeSections; int secur; - GetPrivateProfileString(_T("AutoExec"),_T("Use"),_T("prompt"),szUse,SIZEOF(szUse),mirandabootini); - if (!lstrcmpi(szUse,_T("no"))) return; - GetPrivateProfileString(_T("AutoExec"),_T("Safe"),_T("CLC Icons CLUI CList SkinSounds"),buf,SIZEOF(buf),mirandabootini); + GetPrivateProfileString(_T("AutoExec"), _T("Use"), _T("prompt"), szUse, SIZEOF(szUse), mirandabootini); + if (!lstrcmpi(szUse, _T("no"))) return; + GetPrivateProfileString(_T("AutoExec"), _T("Safe"), _T("CLC Icons CLUI CList SkinSounds"), buf, SIZEOF(buf), mirandabootini); szSafeSections = mir_t2a(buf); - GetPrivateProfileString(_T("AutoExec"),_T("Unsafe"),_T("ICQ MSN"),buf,SIZEOF(buf),mirandabootini); + GetPrivateProfileString(_T("AutoExec"), _T("Unsafe"), _T("ICQ MSN"), buf, SIZEOF(buf), mirandabootini); szUnsafeSections = mir_t2a(buf); - GetPrivateProfileString(_T("AutoExec"),_T("Warn"),_T("notsafe"),szSecurity,SIZEOF(szSecurity),mirandabootini); - if (!lstrcmpi(szSecurity,_T("none"))) secur = 0; - else if (!lstrcmpi(szSecurity,_T("notsafe"))) secur = 1; - else if (!lstrcmpi(szSecurity,_T("onlyunsafe"))) secur = 2; - - GetPrivateProfileString(_T("AutoExec"),_T("OverrideSecurityFilename"),_T(""),szOverrideSecurityFilename,SIZEOF(szOverrideSecurityFilename),mirandabootini); - GetPrivateProfileString(_T("AutoExec"),_T("OnCreateFilename"),_T(""),szOnCreateFilename,SIZEOF(szOnCreateFilename),mirandabootini); - GetPrivateProfileString(_T("AutoExec"),_T("Glob"),_T("autoexec_*.ini"),szFindPath,SIZEOF(szFindPath),mirandabootini); + GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, SIZEOF(szSecurity), mirandabootini); + if (!lstrcmpi(szSecurity, _T("none"))) secur = 0; + else if (!lstrcmpi(szSecurity, _T("notsafe"))) secur = 1; + else if (!lstrcmpi(szSecurity, _T("onlyunsafe"))) secur = 2; + + GetPrivateProfileString(_T("AutoExec"), _T("OverrideSecurityFilename"), _T(""), szOverrideSecurityFilename, SIZEOF(szOverrideSecurityFilename), mirandabootini); + GetPrivateProfileString(_T("AutoExec"), _T("OnCreateFilename"), _T(""), szOnCreateFilename, SIZEOF(szOnCreateFilename), mirandabootini); + GetPrivateProfileString(_T("AutoExec"), _T("Glob"), _T("autoexec_*.ini"), szFindPath, SIZEOF(szFindPath), mirandabootini); if (dbCreated && szOnCreateFilename[0]) { str2 = Utils_ReplaceVarsT(szOnCreateFilename); @@ -415,11 +415,11 @@ static void DoAutoExec(void) else str2[1] = 0; do { - bool secFN = lstrcmpi(fd.cFileName,szOverrideSecurityFilename) == 0; + bool secFN = lstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0; mir_sntprintf(szIniPath, SIZEOF(szIniPath), _T("%s%s"), szFindPath, fd.cFileName); - if (!lstrcmpi(szUse,_T("prompt")) && !secFN) { - int result=DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_INSTALLINI),NULL,InstallIniDlgProc,(LPARAM)szIniPath); + if (!lstrcmpi(szUse, _T("prompt")) && !secFN) { + int result=DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath); if (result == IDC_NOTOALL) break; if (result == IDCANCEL) continue; } @@ -430,10 +430,10 @@ static void DoAutoExec(void) DeleteFile(szIniPath); else { TCHAR szOnCompletion[8]; - GetPrivateProfileString(_T("AutoExec"),_T("OnCompletion"),_T("recycle"),szOnCompletion,SIZEOF(szOnCompletion),mirandabootini); - if (!lstrcmpi(szOnCompletion,_T("delete"))) + GetPrivateProfileString(_T("AutoExec"), _T("OnCompletion"), _T("recycle"), szOnCompletion, SIZEOF(szOnCompletion), mirandabootini); + if (!lstrcmpi(szOnCompletion, _T("delete"))) DeleteFile(szIniPath); - else if (!lstrcmpi(szOnCompletion,_T("recycle"))) { + else if (!lstrcmpi(szOnCompletion, _T("recycle"))) { SHFILEOPSTRUCT shfo={0}; shfo.wFunc=FO_DELETE; shfo.pFrom=szIniPath; @@ -441,17 +441,17 @@ static void DoAutoExec(void) shfo.fFlags=FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; SHFileOperation(&shfo); } - else if (!lstrcmpi(szOnCompletion,_T("rename"))) { + else if (!lstrcmpi(szOnCompletion, _T("rename"))) { TCHAR szRenamePrefix[MAX_PATH]; TCHAR szNewPath[MAX_PATH]; - GetPrivateProfileString(_T("AutoExec"),_T("RenamePrefix"),_T("done_"),szRenamePrefix,SIZEOF(szRenamePrefix),mirandabootini); - lstrcpy(szNewPath,szFindPath); - lstrcat(szNewPath,szRenamePrefix); - lstrcat(szNewPath,fd.cFileName); - MoveFile(szIniPath,szNewPath); + GetPrivateProfileString(_T("AutoExec"), _T("RenamePrefix"), _T("done_"), szRenamePrefix, SIZEOF(szRenamePrefix), mirandabootini); + lstrcpy(szNewPath, szFindPath); + lstrcat(szNewPath, szRenamePrefix); + lstrcat(szNewPath, fd.cFileName); + MoveFile(szIniPath, szNewPath); } - else if (!lstrcmpi(szOnCompletion,_T("ask"))) - DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_INIIMPORTDONE),NULL,IniImportDoneDlgProc,(LPARAM)szIniPath); + else if (!lstrcmpi(szOnCompletion, _T("ask"))) + DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_INIIMPORTDONE), NULL, IniImportDoneDlgProc, (LPARAM)szIniPath); } } while (FindNextFile(hFind, &fd)); FindClose(hFind); @@ -485,6 +485,6 @@ int InitIni(void) void UninitIni(void) { if ( !bModuleInitialized ) return; - CallService(MS_SYSTEM_REMOVEWAIT,(WPARAM)hIniChangeNotification,0); + CallService(MS_SYSTEM_REMOVEWAIT, (WPARAM)hIniChangeNotification, 0); FindCloseChangeNotification(hIniChangeNotification); } diff --git a/src/modules/database/dblists.cpp b/src/modules/database/dblists.cpp index 491a6ed33b..c4dabf8fae 100644 --- a/src/modules/database/dblists.cpp +++ b/src/modules/database/dblists.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. diff --git a/src/modules/database/dblists.h b/src/modules/database/dblists.h index 30886973a4..160e45eca3 100644 --- a/src/modules/database/dblists.h +++ b/src/modules/database/dblists.h @@ -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. @@ -36,4 +36,4 @@ int List_InsertPtr( SortedList* list, void* p ); int List_RemovePtr( SortedList* list, void* p ); void List_Copy( SortedList*, SortedList*, size_t ); -void List_ObjCopy( SortedList*, SortedList*, size_t ); \ No newline at end of file +void List_ObjCopy( SortedList*, SortedList*, size_t ); diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 7d644b02eb..6cbf8ca781 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.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. @@ -337,11 +337,11 @@ int InitUtils() CreateServiceFunction(MS_DB_MODULE_DELETE, DbDeleteModule); - CreateServiceFunction(MS_DB_GETPROFILEPATH,GetProfilePath); - CreateServiceFunction(MS_DB_GETPROFILENAME,GetProfileName); + CreateServiceFunction(MS_DB_GETPROFILEPATH, GetProfilePath); + CreateServiceFunction(MS_DB_GETPROFILENAME, GetProfileName); #if defined( _UNICODE ) - CreateServiceFunction(MS_DB_GETPROFILEPATHW,GetProfilePathW); - CreateServiceFunction(MS_DB_GETPROFILENAMEW,GetProfileNameW); + CreateServiceFunction(MS_DB_GETPROFILEPATHW, GetProfilePathW); + CreateServiceFunction(MS_DB_GETPROFILENAMEW, GetProfileNameW); #endif return 0; } diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index b764a43ff3..cf1521872d 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.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. @@ -110,9 +110,9 @@ static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, if ( msg == WM_CHAR ) { if ( _tcschr( _T(".?/\\#' "), (TCHAR)wParam) != 0 ) return 0; - PostMessage(GetParent(edit),WM_INPUTCHANGED,0,0); + PostMessage(GetParent(edit), WM_INPUTCHANGED, 0, 0); } - return CallWindowProc((WNDPROC)GetWindowLongPtr(edit,GWLP_USERDATA),edit,msg,wParam,lParam); + return CallWindowProc((WNDPROC)GetWindowLongPtr(edit, GWLP_USERDATA), edit, msg, wParam, lParam); } static int FindDbProviders(const char*, DATABASELINK * dblink, LPARAM lParam) @@ -121,7 +121,7 @@ static int FindDbProviders(const char*, DATABASELINK * dblink, LPARAM lParam) HWND hwndCombo = GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS); char szName[64]; - if ( dblink->getFriendlyName(szName,SIZEOF(szName),1) == 0 ) { + if ( dblink->getFriendlyName(szName, SIZEOF(szName), 1) == 0 ) { // add to combo box TCHAR* p = LangPackPcharToTchar( szName ); LRESULT index = SendMessage( hwndCombo, CB_ADDSTRING, 0, (LPARAM)p ); @@ -133,7 +133,7 @@ static int FindDbProviders(const char*, DATABASELINK * dblink, LPARAM lParam) static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - struct DlgProfData * dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + struct DlgProfData * dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault( hwndDlg ); @@ -143,7 +143,7 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA // fill in the db plugins present PLUGIN_DB_ENUM dbe; dbe.cbSize = sizeof(dbe); - dbe.pfnEnumCallback = (int(*)(const char*,void*,LPARAM))FindDbProviders; + dbe.pfnEnumCallback = (int(*)(const char*, void*, LPARAM))FindDbProviders; dbe.lParam = (LPARAM)hwndDlg; if ( CallService( MS_PLUGINS_ENUMDBPLUGINS, 0, ( LPARAM )&dbe ) == -1 ) { // no plugins?! @@ -158,8 +158,8 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA { HWND hwndProfile = GetDlgItem(hwndDlg, IDC_PROFILENAME); WNDPROC proc = (WNDPROC)GetWindowLongPtr(hwndProfile, GWLP_WNDPROC); - SetWindowLongPtr(hwndProfile,GWLP_USERDATA,(LONG_PTR)proc); - SetWindowLongPtr(hwndProfile,GWLP_WNDPROC,(LONG_PTR)ProfileNameValidate); + SetWindowLongPtr(hwndProfile, GWLP_USERDATA, (LONG_PTR)proc); + SetWindowLongPtr(hwndProfile, GWLP_WNDPROC, (LONG_PTR)ProfileNameValidate); } // decide if there is a default profile name given in the INI and if it should be used @@ -202,7 +202,7 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA NMHDR* hdr = ( NMHDR* )lParam; if ( hdr && hdr->code == PSN_APPLY && dat && IsWindowVisible( hwndDlg )) { TCHAR szName[MAX_PATH]; - LRESULT curSel = SendDlgItemMessage(hwndDlg,IDC_PROFILEDRIVERS,CB_GETCURSEL,0,0); + LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_GETCURSEL, 0, 0); if ( curSel == CB_ERR ) break; // should never happen GetDlgItemText(hwndDlg, IDC_PROFILENAME, szName, SIZEOF( szName )); if ( szName[0] == 0 ) @@ -271,11 +271,11 @@ BOOL EnumProfilesForList(TCHAR * fullpath, TCHAR * profile, LPARAM lParam) if ( _tstat(fullpath, &statbuf) == 0) { if ( statbuf.st_size > 1000000 ) { - mir_sntprintf(sizeBuf,SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0 ); + mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0 ); _tcscpy(sizeBuf+5, _T(" MB")); } else { - mir_sntprintf(sizeBuf,SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1024.0 ); + mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1024.0 ); _tcscpy(sizeBuf+5, _T(" KB")); } bFileExists = TRUE; @@ -303,7 +303,7 @@ BOOL EnumProfilesForList(TCHAR * fullpath, TCHAR * profile, LPARAM lParam) item2.iItem = iItem; dbe.cbSize = sizeof(dbe); - dbe.pfnEnumCallback = (int(*)(const char*,void*,LPARAM))DetectDbProvider; + dbe.pfnEnumCallback = (int(*)(const char*, void*, LPARAM))DetectDbProvider; dbe.lParam = (LPARAM)szPath; _tcscpy(szPath, fullpath); if ( CallService( MS_PLUGINS_ENUMDBPLUGINS, 0, ( LPARAM )&dbe ) == 1 ) { @@ -406,7 +406,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, // LV will destroy the image list SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList, GWL_STYLE) | LVS_SORTASCENDING); ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL); - ListView_SetExtendedListViewStyle(hwndList, + ListView_SetExtendedListViewStyle(hwndList, ListView_GetExtendedListViewStyle(hwndList) | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT); // find all the profiles @@ -545,8 +545,8 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, struct DlgProfData * prof = (struct DlgProfData *)lParam; PROPSHEETHEADER *psh = prof->psh; TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0)); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS),IMAGE_ICON,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON),0)); + SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0)); dat = (struct DetailsData*)mir_alloc(sizeof(struct DetailsData)); dat->prof = prof; prof->hwndOK = GetDlgItem( hwndDlg, IDOK ); @@ -571,7 +571,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, tci.mask = TCIF_TEXT; for ( i=0; i < dat->pageCount; i++ ) { - dat->opd[i].pTemplate = (DLGTEMPLATE *)LockResource(LoadResource(odp[i].hInstance,FindResourceA(odp[i].hInstance,odp[i].pszTemplate,MAKEINTRESOURCEA(5)))); + dat->opd[i].pTemplate = (DLGTEMPLATE *)LockResource(LoadResource(odp[i].hInstance, FindResourceA(odp[i].hInstance, odp[i].pszTemplate, MAKEINTRESOURCEA(5)))); dat->opd[i].dlgProc = odp[i].pfnDlgProc; dat->opd[i].hInst = odp[i].hInstance; dat->opd[i].hwnd = NULL; @@ -579,19 +579,19 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, tci.pszText = ( TCHAR* )odp[i].ptszTitle; if (dat->prof->pd->noProfiles || shouldAutoCreate(dat->prof->pd->szProfile)) dat->currentPage = 1; - TabCtrl_InsertItem( GetDlgItem(hwndDlg,IDC_TABS), i, &tci ); + TabCtrl_InsertItem( GetDlgItem(hwndDlg, IDC_TABS), i, &tci ); } } - GetWindowRect(GetDlgItem(hwndDlg,IDC_TABS),&dat->rcDisplay); - TabCtrl_AdjustRect(GetDlgItem(hwndDlg,IDC_TABS),FALSE,&dat->rcDisplay); + GetWindowRect(GetDlgItem(hwndDlg, IDC_TABS), &dat->rcDisplay); + TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_TABS), FALSE, &dat->rcDisplay); { - POINT pt = {0,0}; + POINT pt = {0, 0}; ClientToScreen( hwndDlg, &pt ); OffsetRect( &dat->rcDisplay, -pt.x, -pt.y ); } TabCtrl_SetCurSel( GetDlgItem( hwndDlg, IDC_TABS ), dat->currentPage ); - dat->opd[dat->currentPage].hwnd = CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst,dat->opd[dat->currentPage].pTemplate,hwndDlg,dat->opd[dat->currentPage].dlgProc,(LPARAM)dat->prof); + dat->opd[dat->currentPage].hwnd = CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst, dat->opd[dat->currentPage].pTemplate, hwndDlg, dat->opd[dat->currentPage].dlgProc, (LPARAM)dat->prof); ThemeDialogBackground( dat->opd[dat->currentPage].hwnd ); SetWindowPos( dat->opd[dat->currentPage].hwnd, HWND_TOP, dat->rcDisplay.left, dat->rcDisplay.top, 0, 0, SWP_NOSIZE ); { PSHNOTIFY pshn; @@ -649,7 +649,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, for ( i=0; i < dat->pageCount; 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; } @@ -675,20 +675,20 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, if ( dat->currentPage != -1 && dat->opd[dat->currentPage].hwnd != NULL ) ShowWindow( dat->opd[ dat->currentPage ].hwnd, SW_HIDE ); - dat->currentPage = TabCtrl_GetCurSel(GetDlgItem(hwndDlg,IDC_TABS)); + dat->currentPage = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS)); if ( dat->currentPage != -1 ) { if ( dat->opd[dat->currentPage].hwnd == NULL ) { PSHNOTIFY pshn; - dat->opd[dat->currentPage].hwnd=CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst,dat->opd[dat->currentPage].pTemplate,hwndDlg,dat->opd[dat->currentPage].dlgProc,(LPARAM)dat->prof); + dat->opd[dat->currentPage].hwnd=CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst, dat->opd[dat->currentPage].pTemplate, hwndDlg, dat->opd[dat->currentPage].dlgProc, (LPARAM)dat->prof); ThemeDialogBackground(dat->opd[dat->currentPage].hwnd); - SetWindowPos(dat->opd[dat->currentPage].hwnd,HWND_TOP,dat->rcDisplay.left,dat->rcDisplay.top,0,0,SWP_NOSIZE); + SetWindowPos(dat->opd[dat->currentPage].hwnd, HWND_TOP, dat->rcDisplay.left, dat->rcDisplay.top, 0, 0, SWP_NOSIZE); pshn.hdr.code=PSN_INFOCHANGED; pshn.hdr.hwndFrom=dat->opd[dat->currentPage].hwnd; pshn.hdr.idFrom=0; pshn.lParam=(LPARAM)0; - SendMessage(dat->opd[dat->currentPage].hwnd,WM_NOTIFY,0,(LPARAM)&pshn); + SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn); } - ShowWindow(dat->opd[dat->currentPage].hwnd,SW_SHOW); + ShowWindow(dat->opd[dat->currentPage].hwnd, SW_SHOW); } break; } @@ -707,9 +707,9 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, 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); } - EndDialog(hwndDlg,0); + EndDialog(hwndDlg, 0); } break; @@ -748,14 +748,14 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, ShowWindow( dat->opd[dat->currentPage].hwnd, SW_SHOW ); return 0; } } - EndDialog(hwndDlg,1); + EndDialog(hwndDlg, 1); break; } } break; case WM_DESTROY: { - LRESULT curSel = SendDlgItemMessage(hwndDlg,IDC_SM_COMBO,CB_GETCURSEL,0,0); + LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_SM_COMBO, CB_GETCURSEL, 0, 0); if ( curSel != CB_ERR ) { int idx = SendDlgItemMessage( hwndDlg, IDC_SM_COMBO, CB_GETITEMDATA, ( WPARAM )curSel, 0 ); SetServiceModePlugin(idx); @@ -833,7 +833,7 @@ int getProfileManager(PROFILEMANAGERDATA * pd) DlgProfData prof; prof.pd = pd; prof.psh = &psh; - int rc = DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_PROFILEMANAGER),NULL,DlgProfileManager,(LPARAM)&prof); + int rc = DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_PROFILEMANAGER), NULL, DlgProfileManager, (LPARAM)&prof); if ( rc != -1 ) for ( int i=0; i < opi.pageCount; i++ ) { diff --git a/src/modules/database/profilemanager.h b/src/modules/database/profilemanager.h index fc6bd56020..f132dfad84 100644 --- a/src/modules/database/profilemanager.h +++ b/src/modules/database/profilemanager.h @@ -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. diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 380e644228..d483844f9b 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.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. @@ -31,11 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static HWND hwndFindAdd=NULL; static HANDLE hHookModulesLoaded = 0; static HANDLE hMainMenuItem = NULL; -static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam); +static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam); -static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc) +static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) { - static int y,nextY,oldTop; + static int y, nextY, oldTop; struct FindAddDlgData *dat; dat=(struct FindAddDlgData*)lParam; @@ -58,19 +58,19 @@ static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc) oldTop=urc->rcItem.top; y=nextY; if (dat->showEmail) nextY=y+urc->rcItem.bottom-urc->rcItem.top+7; - OffsetRect(&urc->rcItem,0,y-oldTop); + OffsetRect(&urc->rcItem, 0, y-oldTop); return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM; case IDC_NAMEGROUP: oldTop=urc->rcItem.top; y=nextY; if (dat->showName) nextY=y+urc->rcItem.bottom-urc->rcItem.top+7; - OffsetRect(&urc->rcItem,0,y-oldTop); + OffsetRect(&urc->rcItem, 0, y-oldTop); return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM; case IDC_ADVANCEDGROUP: oldTop=urc->rcItem.top; y=nextY; if (dat->showAdvanced) nextY=y+urc->rcItem.bottom-urc->rcItem.top+7; - OffsetRect(&urc->rcItem,0,y-oldTop); + OffsetRect(&urc->rcItem, 0, y-oldTop); return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM; case IDC_TINYEXTENDEDGROUP: oldTop=urc->rcItem.top; @@ -94,7 +94,7 @@ static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc) case IDC_BYADVANCED: case IDC_BYCUSTOM: case IDC_ADVANCED: - OffsetRect(&urc->rcItem,0,y-oldTop); + OffsetRect(&urc->rcItem, 0, y-oldTop); return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM; case IDC_HEADERBAR: return RD_ANCHORX_LEFT|RD_ANCHORY_TOP|RD_ANCHORX_WIDTH; @@ -102,16 +102,16 @@ static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc) return RD_ANCHORX_LEFT|RD_ANCHORY_TOP; } -static void RenderThrobber(HDC hdc,RECT *rcItem,int *throbbing,int *pivot) +static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) { HBRUSH hBr; HDC hMemDC; HBITMAP hBitmap; HPEN hPen; RECT rc; - int x,width,height,height2; + int x, width, height, height2; - InflateRect(rcItem,-1,0); + InflateRect(rcItem, -1, 0); width=rcItem->right-rcItem->left; height=rcItem->bottom-rcItem->top; height2=height/2; @@ -119,29 +119,29 @@ static void RenderThrobber(HDC hdc,RECT *rcItem,int *throbbing,int *pivot) if (*throbbing) { /* create memdc */ hMemDC=CreateCompatibleDC(0); - hBitmap=( HBITMAP )SelectObject(hMemDC, CreateCompatibleBitmap(hdc,width,height)); + hBitmap=( HBITMAP )SelectObject(hMemDC, CreateCompatibleBitmap(hdc, width, height)); /* flush it */ rc.left=rc.top=0; rc.right=width; rc.bottom=height; hBr=GetSysColorBrush(COLOR_BTNFACE); - FillRect(hMemDC,&rc,hBr); + FillRect(hMemDC, &rc, hBr); DeleteObject(hBr); /* set up the pen */ - hPen=(HPEN)SelectObject(hMemDC,CreatePen(PS_SOLID,4,GetSysColor(COLOR_BTNSHADOW))); + hPen=(HPEN)SelectObject(hMemDC, CreatePen(PS_SOLID, 4, GetSysColor(COLOR_BTNSHADOW))); /* draw everything before the pivot */ x=*pivot; while (x>(-height)) { - MoveToEx(hMemDC,x+height2,0,NULL); - LineTo(hMemDC,x-height2,height); + MoveToEx(hMemDC, x+height2, 0, NULL); + LineTo(hMemDC, x-height2, height); x-=12; } /* draw everything after the pivot */ x = *pivot; while (x < width+height) { - MoveToEx(hMemDC,x+height2,0,NULL); - LineTo(hMemDC,x-height2,height); + MoveToEx(hMemDC, x+height2, 0, NULL); + LineTo(hMemDC, x-height2, height); x+=12; } @@ -150,111 +150,111 @@ static void RenderThrobber(HDC hdc,RECT *rcItem,int *throbbing,int *pivot) /* reset the pivot point if it gets past the rect */ if (*pivot>width) *pivot=0; /* put back the old pen and delete the new one */ - DeleteObject(SelectObject(hMemDC,hPen)); + DeleteObject(SelectObject(hMemDC, hPen)); /* cap the top and bottom */ - hPen=(HPEN)SelectObject(hMemDC,CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNFACE))); - MoveToEx(hMemDC,0,0,NULL); - LineTo(hMemDC,width,0); - MoveToEx(hMemDC,0,height-1,NULL); - LineTo(hMemDC,width,height-1); + hPen=(HPEN)SelectObject(hMemDC, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE))); + MoveToEx(hMemDC, 0, 0, NULL); + LineTo(hMemDC, width, 0); + MoveToEx(hMemDC, 0, height-1, NULL); + LineTo(hMemDC, width, height-1); /* select in the old pen and delete the new pen */ - DeleteObject(SelectObject(hMemDC,hPen)); + DeleteObject(SelectObject(hMemDC, hPen)); /* paint to screen */ - BitBlt(hdc,rcItem->left,rcItem->top,width,height,hMemDC,0,0,SRCCOPY); + BitBlt(hdc, rcItem->left, rcItem->top, width, height, hMemDC, 0, 0, SRCCOPY); /* select back in the old bitmap and delete the created one, as well as freeing the mem dc. */ - hBitmap=( HBITMAP )SelectObject(hMemDC,hBitmap); + hBitmap=( HBITMAP )SelectObject(hMemDC, hBitmap); DeleteObject(hBitmap); DeleteDC(hMemDC); } else { /* just flush the DC */ hBr=GetSysColorBrush(COLOR_BTNFACE); - FillRect(hdc,rcItem,hBr); + FillRect(hdc, rcItem, hBr); DeleteObject(hBr); } } -static void StartThrobber(HWND hwndDlg,struct FindAddDlgData *dat) +static void StartThrobber(HWND hwndDlg, struct FindAddDlgData *dat) { dat->throbbing=1; - SetTimer(hwndDlg,TIMERID_THROBBER,25,NULL); + SetTimer(hwndDlg, TIMERID_THROBBER, 25, NULL); } -static void StopThrobber(HWND hwndDlg,struct FindAddDlgData *dat) +static void StopThrobber(HWND hwndDlg, struct FindAddDlgData *dat) { - KillTimer(hwndDlg,TIMERID_THROBBER); + KillTimer(hwndDlg, TIMERID_THROBBER); dat->throbbing=0; dat->pivot=0; - InvalidateRect(GetDlgItem(hwndDlg,IDC_STATUSBAR),NULL,FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), NULL, FALSE); } -static void ShowAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) +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); + 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) { RECT rc; - dat->hwndAdvSearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)hwndDlg); - GetWindowRect(GetDlgItem(hwndDlg,IDC_RESULTS),&rc); - SetWindowPos(dat->hwndAdvSearch,0,rc.left,rc.top,0,0,SWP_NOZORDER|SWP_NOSIZE); + dat->hwndAdvSearch=(HWND)CallProtoService(szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg); + GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc); + SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); } if (animateWindow) { - animateWindow(dat->hwndAdvSearch,150,AW_ACTIVATE|AW_SLIDE|AW_HOR_POSITIVE); - RedrawWindow(dat->hwndAdvSearch,NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN); - } else ShowWindow(dat->hwndAdvSearch,SW_SHOW); - CheckDlgButton(hwndDlg,IDC_ADVANCED,BST_CHECKED); + animateWindow(dat->hwndAdvSearch, 150, AW_ACTIVATE|AW_SLIDE|AW_HOR_POSITIVE); + RedrawWindow(dat->hwndAdvSearch, NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN); + } else ShowWindow(dat->hwndAdvSearch, SW_SHOW); + CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_CHECKED); } -static void ReposTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) +static void ReposTinySearchDlg(HWND hwndDlg, struct FindAddDlgData *dat) { if ( dat->hwndTinySearch != NULL ) { RECT rc; RECT clientRect; - POINT pt={0,0}; - GetWindowRect(GetDlgItem(hwndDlg,IDC_TINYEXTENDEDGROUP),&rc); - GetWindowRect(dat->hwndTinySearch,&clientRect); + POINT pt={0, 0}; + GetWindowRect(GetDlgItem(hwndDlg, IDC_TINYEXTENDEDGROUP), &rc); + GetWindowRect(dat->hwndTinySearch, &clientRect); pt.x=rc.left; pt.y=rc.top; - ScreenToClient(hwndDlg,&pt); - SetWindowPos(dat->hwndTinySearch,0,pt.x+5,pt.y+15,rc.right-rc.left-10,rc.bottom-rc.top-30,SWP_NOZORDER); - //SetWindowPos(GetDlgItem(hwndDlg,IDC_TINYEXTENDEDGROUP),0,0,0,rc.right-rc.left,clientRect.bottom-clientRect.top+20,SWP_NOMOVE|SWP_NOZORDER); + ScreenToClient(hwndDlg, &pt); + SetWindowPos(dat->hwndTinySearch, 0, pt.x+5, pt.y+15, rc.right-rc.left-10, rc.bottom-rc.top-30, SWP_NOZORDER); + //SetWindowPos(GetDlgItem(hwndDlg, IDC_TINYEXTENDEDGROUP), 0, 0, 0, rc.right-rc.left, clientRect.bottom-clientRect.top+20, SWP_NOMOVE|SWP_NOZORDER); } } -static void ShowTinySearchDlg(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); + 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) { - dat->hwndTinySearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)/*GetDlgItem(*/hwndDlg/*,IDC_TINYEXTENDEDGROUP)*/); + dat->hwndTinySearch=(HWND)CallProtoService(szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/); if (dat->hwndTinySearch) ReposTinySearchDlg(hwndDlg, dat); else dat->showTiny = false; } - ShowWindow(dat->hwndTinySearch,SW_SHOW); + ShowWindow(dat->hwndTinySearch, SW_SHOW); } -static void HideAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat) +static void HideAdvancedSearchDlg(HWND hwndDlg, struct FindAddDlgData *dat) { 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); - CheckDlgButton(hwndDlg,IDC_ADVANCED,BST_UNCHECKED); + animateWindow(dat->hwndAdvSearch, 150, AW_HIDE|AW_BLEND); + else ShowWindow(dat->hwndAdvSearch, SW_HIDE); + CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_UNCHECKED); } -void EnableResultButtons(HWND hwndDlg,int enable) +void EnableResultButtons(HWND hwndDlg, int enable) { - EnableWindow(GetDlgItem(hwndDlg,IDC_ADD), enable || IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)); - EnableWindow(GetDlgItem(hwndDlg,IDC_MOREOPTIONS),enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), enable || IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)); + EnableWindow(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), enable); } -static void CheckSearchTypeRadioButton(HWND hwndDlg,int idControl) +static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl) { int i; - static const int controls[]={IDC_BYPROTOID,IDC_BYEMAIL,IDC_BYNAME,IDC_BYADVANCED,IDC_BYCUSTOM}; + 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.") @@ -280,7 +280,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_INITDIALOG: { - int i,netProtoCount; + int i, netProtoCount; COMBOBOXEXITEM cbei; HICON hIcon; @@ -291,16 +291,16 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->notSearchedYet=1; dat->iLastColumnSortIndex=1; dat->bSortAscending=1; - dat->hBmpSortUp=(HBITMAP)LoadImage(hMirandaInst,MAKEINTRESOURCE(IDB_SORTCOLUP),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS); - dat->hBmpSortDown=(HBITMAP)LoadImage(hMirandaInst,MAKEINTRESOURCE(IDB_SORTCOLDOWN),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS); - SendDlgItemMessage(hwndDlg,IDC_MOREOPTIONS,BUTTONSETARROW,1,0); - ListView_SetExtendedListViewStyle(hwndList,LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP); + dat->hBmpSortUp=(HBITMAP)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDB_SORTCOLUP), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); + dat->hBmpSortDown=(HBITMAP)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDB_SORTCOLDOWN), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); + SendDlgItemMessage(hwndDlg, IDC_MOREOPTIONS, BUTTONSETARROW, 1, 0); + ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP); { LVCOLUMN lvc; RECT rc; LVITEM lvi; - GetClientRect(hwndList,&rc); + GetClientRect(hwndList, &rc); lvc.mask = LVCF_TEXT | LVCF_WIDTH; lvc.pszText = TranslateT("Results"); lvc.cx = rc.right-1; @@ -317,18 +317,18 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SIZE textSize; HDC hdc; - hdc=GetDC(GetDlgItem(hwndDlg,IDC_STATUSBAR)); - SelectObject(hdc,(HFONT)SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,WM_GETFONT,0,0)); - GetTextExtentPoint32(hdc,TranslateT("Searching"),lstrlen(TranslateT("Searching")),&textSize); + hdc=GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR)); + SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0)); + GetTextExtentPoint32(hdc, TranslateT("Searching"), lstrlen(TranslateT("Searching")), &textSize); partWidth[0]=textSize.cx; - GetTextExtentPoint32(hdc,_T("01234567890123456789"), 20, &textSize ); + GetTextExtentPoint32(hdc, _T("01234567890123456789"), 20, &textSize ); partWidth[0]+=textSize.cx; - ReleaseDC(GetDlgItem(hwndDlg,IDC_STATUSBAR),hdc); + ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc); partWidth[1]=partWidth[0]+150; partWidth[2]=-1; - SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,SB_SETPARTS,SIZEOF(partWidth),(LPARAM)partWidth); - SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,SB_SETTEXT,1|SBT_OWNERDRAW,0); - SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat); + SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETPARTS, SIZEOF(partWidth), (LPARAM)partWidth); + SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1|SBT_OWNERDRAW, 0); + SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); } { TCHAR *szProto = NULL; @@ -348,19 +348,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (caps & PF1_BASICSEARCH || caps & PF1_EXTSEARCH || caps & PF1_SEARCHBYEMAIL || caps & PF1_SEARCHBYNAME) netProtoCount++; } - dat->himlComboIcons=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),(IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK,netProtoCount+1,netProtoCount+1); - SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_SETIMAGELIST,0,(LPARAM)dat->himlComboIcons); + dat->himlComboIcons=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, netProtoCount+1, netProtoCount+1); + SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_SETIMAGELIST, 0, (LPARAM)dat->himlComboIcons); cbei.mask=CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_TEXT|CBEIF_LPARAM; cbei.iItem=0; hdc=GetDC(hwndDlg); - SelectObject(hdc,(HFONT)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,WM_GETFONT,0,0)); + SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, WM_GETFONT, 0, 0)); if (netProtoCount>1) { cbei.pszText=TranslateT("All Networks"); - GetTextExtentPoint32(hdc,cbei.pszText,lstrlen(cbei.pszText),&textSize); + GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize); if (textSize.cx>cbwidth) cbwidth = textSize.cx; cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon_IconLibLoaded(dat->himlComboIcons, SKINICON_OTHER_SEARCHALL); cbei.lParam=0; - SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_INSERTITEM,0,(LPARAM)&cbei); + SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei); cbei.iItem++; } for ( i=0; i < accounts.getCount(); i++ ) { @@ -371,26 +371,26 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP continue; cbei.pszText = pa->tszAccountName; - GetTextExtentPoint32(hdc,cbei.pszText,lstrlen(cbei.pszText),&textSize); + GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize); if (textSize.cx>cbwidth) cbwidth = textSize.cx; - hIcon=(HICON)CallProtoService( pa->szModuleName,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0); - cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon(dat->himlComboIcons,hIcon); + hIcon=(HICON)CallProtoService( pa->szModuleName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); + cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon(dat->himlComboIcons, hIcon); DestroyIcon(hIcon); cbei.lParam=(LPARAM)pa->szModuleName; - SendDlgItemMessageA(hwndDlg,IDC_PROTOLIST,CBEM_INSERTITEM,0,(LPARAM)&cbei); + SendDlgItemMessageA(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei); if (szProto && cbei.pszText && !lstrcmp( szProto, pa->tszAccountName )) index = cbei.iItem; cbei.iItem++; } cbwidth+=32; - SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETDROPPEDCONTROLRECT,0,(LPARAM)&rect); + SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rect); if ((rect.right-rect.left)notSearchedYet) { RECT rc; - GetClientRect(hwndList,&rc); - ListView_SetColumnWidth(hwndList,0,rc.right); + GetClientRect(hwndList, &rc); + ListView_SetColumnWidth(hwndList, 0, rc.right); } } //fall through @@ -416,23 +416,23 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat && dat->hwndAdvSearch) { RECT rc; - GetWindowRect(hwndList,&rc); - SetWindowPos(dat->hwndAdvSearch,0,rc.left,rc.top,0,0,SWP_NOZORDER|SWP_NOSIZE); + GetWindowRect(hwndList, &rc); + SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); } break; case WM_GETMINMAXINFO: { MINMAXINFO *mmi=(MINMAXINFO*)lParam; - RECT rc,rc2; - GetWindowRect(hwndList,&rc); - GetWindowRect(hwndDlg,&rc2); + RECT rc, rc2; + GetWindowRect(hwndList, &rc); + GetWindowRect(hwndDlg, &rc2); mmi->ptMinTrackSize.x=rc.left-rc2.left+10+GetSystemMetrics(SM_CXFRAME); - GetClientRect(GetDlgItem(hwndDlg,IDC_MOREOPTIONS),&rc); + GetClientRect(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc); mmi->ptMinTrackSize.x+=rc.right+5; - GetClientRect(GetDlgItem(hwndDlg,IDC_ADD),&rc); + GetClientRect(GetDlgItem(hwndDlg, IDC_ADD), &rc); mmi->ptMinTrackSize.x+=rc.right+5; - GetClientRect(GetDlgItem(hwndDlg,IDC_STATUSBAR),&rc); + GetClientRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), &rc); mmi->ptMinTrackSize.y=dat->minDlgHeight+20+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYFRAME); - GetClientRect(GetDlgItem(hwndDlg,IDC_STATUSBAR),&rc); + GetClientRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), &rc); mmi->ptMinTrackSize.y+=rc.bottom; return 0; } @@ -445,20 +445,20 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP int checkmarkVisible; dat->showAdvanced = dat->showEmail = dat->showName = dat->showProtoId = dat->showTiny = 0; - szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0); + szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); if ( szProto == (char *)CB_ERR ) break; if ( szProto == NULL ) { for ( i=0; i < accounts.getCount(); i++ ) { PROTOACCOUNT* pa = accounts[i]; if (!Proto_IsAccountEnabled(pa)) continue; - protoCaps=(DWORD)CallProtoService(pa->szModuleName,PS_GETCAPS,PFLAGNUM_1,0); + protoCaps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps&PF1_SEARCHBYEMAIL) dat->showEmail=1; if (protoCaps&PF1_SEARCHBYNAME) dat->showName=1; } } else { - protoCaps=(DWORD)CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0); + protoCaps=(DWORD)CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps&PF1_BASICSEARCH) dat->showProtoId=1; if (protoCaps&PF1_SEARCHBYEMAIL) dat->showEmail=1; if (protoCaps&PF1_SEARCHBYNAME) dat->showName=1; @@ -467,19 +467,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (protoCaps&PF1_USERIDISEMAIL && dat->showProtoId) {dat->showProtoId=0; dat->showEmail=1;} if (dat->showProtoId) { char *szUniqueId; - szUniqueId=(char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0); + szUniqueId=(char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); if (szUniqueId) { #if defined( _UNICODE ) TCHAR* p = mir_a2u(szUniqueId); - SetDlgItemText(hwndDlg,IDC_BYPROTOID,p); + SetDlgItemText(hwndDlg, IDC_BYPROTOID, p); mir_free(p); #else - SetDlgItemTextA(hwndDlg,IDC_BYPROTOID,szUniqueId); + SetDlgItemTextA(hwndDlg, IDC_BYPROTOID, szUniqueId); #endif } - else SetDlgItemText(hwndDlg,IDC_BYPROTOID,TranslateT("Handle")); - if (protoCaps&PF1_NUMERICUSERID) SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE)|ES_NUMBER); - else SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE)&~ES_NUMBER); + else SetDlgItemText(hwndDlg, IDC_BYPROTOID, TranslateT("Handle")); + if (protoCaps&PF1_NUMERICUSERID) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE)|ES_NUMBER); + else SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE)&~ES_NUMBER); } } @@ -491,34 +491,34 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->hwndTinySearch=NULL; } } -#define en(id,t) ShowWindow(GetDlgItem(hwndDlg,IDC_##id),dat->show##t?SW_SHOW:SW_HIDE) - en(PROTOIDGROUP,ProtoId); en(BYPROTOID,ProtoId); en(PROTOID,ProtoId); - en(EMAILGROUP,Email); en(BYEMAIL,Email); en(EMAIL,Email); - en(NAMEGROUP,Name); en(BYNAME,Name); - en(STNAMENICK,Name); en(NAMENICK,Name); - en(STNAMEFIRST,Name); en(NAMEFIRST,Name); - en(STNAMELAST,Name); en(NAMELAST,Name); - en(ADVANCEDGROUP,Advanced); en(BYADVANCED,Advanced); en(ADVANCED,Advanced); +#define en(id, t) ShowWindow(GetDlgItem(hwndDlg, IDC_##id), dat->show##t?SW_SHOW:SW_HIDE) + en(PROTOIDGROUP, ProtoId); en(BYPROTOID, ProtoId); en(PROTOID, ProtoId); + en(EMAILGROUP, Email); en(BYEMAIL, Email); en(EMAIL, Email); + en(NAMEGROUP, Name); en(BYNAME, Name); + en(STNAMENICK, Name); en(NAMENICK, Name); + en(STNAMEFIRST, Name); en(NAMEFIRST, Name); + en(STNAMELAST, Name); en(NAMELAST, Name); + en(ADVANCEDGROUP, Advanced); en(BYADVANCED, Advanced); en(ADVANCED, Advanced); en(BYCUSTOM, Tiny); en(TINYEXTENDEDGROUP, Tiny); #undef en - checkmarkVisible=(dat->showAdvanced && IsDlgButtonChecked(hwndDlg,IDC_BYADVANCED)) || - (dat->showEmail && IsDlgButtonChecked(hwndDlg,IDC_BYEMAIL)) || - (dat->showTiny && IsDlgButtonChecked(hwndDlg,IDC_BYCUSTOM)) || - (dat->showName && IsDlgButtonChecked(hwndDlg,IDC_BYNAME)) || - (dat->showProtoId && IsDlgButtonChecked(hwndDlg,IDC_BYPROTOID)); + checkmarkVisible=(dat->showAdvanced && IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) || + (dat->showEmail && IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) || + (dat->showTiny && IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) || + (dat->showName && IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) || + (dat->showProtoId && IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)); if (!checkmarkVisible) { - if (dat->showProtoId) CheckSearchTypeRadioButton(hwndDlg,IDC_BYPROTOID); - else if (dat->showEmail) CheckSearchTypeRadioButton(hwndDlg,IDC_BYEMAIL); - else if (dat->showName) CheckSearchTypeRadioButton(hwndDlg,IDC_BYNAME); - else if (dat->showAdvanced) CheckSearchTypeRadioButton(hwndDlg,IDC_BYADVANCED); - else if (dat->showTiny) CheckSearchTypeRadioButton(hwndDlg,IDC_BYCUSTOM); + if (dat->showProtoId) CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID); + else if (dat->showEmail) CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL); + else if (dat->showName) CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME); + else if (dat->showAdvanced) CheckSearchTypeRadioButton(hwndDlg, IDC_BYADVANCED); + else if (dat->showTiny) CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM); } - SendMessage(hwndDlg,WM_SIZE,0,0); - SendMessage(hwndDlg,WM_GETMINMAXINFO,0,(LPARAM)&mmi); - GetWindowRect(hwndDlg,&rc); - if (rc.bottom-rc.topthrobbing,&dat->pivot); - ReleaseDC(GetDlgItem(hwndDlg,IDC_STATUSBAR),hdc); + SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_GETBORDERS, 0, (LPARAM)borders); + SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_GETRECT, 1, (LPARAM)&rc); + InflateRect(&rc, -borders[2]/2, -borders[1]/2); + hdc=GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR)); + RenderThrobber(hdc, &rc, &dat->throbbing, &dat->pivot); + ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc); } break; case WM_DRAWITEM: { DRAWITEMSTRUCT *dis=(DRAWITEMSTRUCT*)lParam; if (dis->CtlID == IDC_STATUSBAR && dis->itemID == 1) { - RenderThrobber(dis->hDC,&dis->rcItem,&dat->throbbing,&dat->pivot); + RenderThrobber(dis->hDC, &dis->rcItem, &dat->throbbing, &dat->pivot); return TRUE; } break; @@ -548,7 +548,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case LVN_ITEMCHANGED: { int count=ListView_GetSelectedCount(hwndList); if (dat->notSearchedYet) count=0; - EnableResultButtons(hwndDlg,count); + EnableResultButtons(hwndDlg, count); break; } case LVN_COLUMNCLICK: @@ -558,7 +558,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP hdi.mask=HDI_BITMAP|HDI_FORMAT; hdi.fmt=HDF_LEFT|HDF_STRING; - Header_SetItem(ListView_GetHeader(hwndList),dat->iLastColumnSortIndex,&hdi); + Header_SetItem(ListView_GetHeader(hwndList), dat->iLastColumnSortIndex, &hdi); if (nmlv->iSubItem != dat->iLastColumnSortIndex) { @@ -569,7 +569,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP hdi.fmt=HDF_LEFT|HDF_BITMAP|HDF_STRING|HDF_BITMAP_ON_RIGHT; hdi.hbm=dat->bSortAscending?dat->hBmpSortDown:dat->hBmpSortUp; - Header_SetItem(ListView_GetHeader(hwndList),dat->iLastColumnSortIndex,&hdi); + Header_SetItem(ListView_GetHeader(hwndList), dat->iLastColumnSortIndex, &hdi); ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg); } @@ -581,7 +581,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch(LOWORD(wParam)) { case IDC_PROTOLIST: if (HIWORD(wParam) == CBN_SELCHANGE) { - HideAdvancedSearchDlg(hwndDlg,dat); + HideAdvancedSearchDlg(hwndDlg, dat); if (dat->hwndAdvSearch) { DestroyWindow(dat->hwndAdvSearch); dat->hwndAdvSearch=NULL; @@ -590,107 +590,107 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP DestroyWindow(dat->hwndTinySearch); dat->hwndTinySearch=NULL; } - SendMessage(hwndDlg,M_SETGROUPVISIBILITIES,0,0); + SendMessage(hwndDlg, M_SETGROUPVISIBILITIES, 0, 0); } break; case IDC_BYPROTOID: - EnableWindow(GetDlgItem(hwndDlg,IDC_ADD),TRUE); - HideAdvancedSearchDlg(hwndDlg,dat); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE); + HideAdvancedSearchDlg(hwndDlg, dat); break; case IDC_BYEMAIL: case IDC_BYNAME: - EnableWindow(GetDlgItem(hwndDlg,IDC_ADD), ListView_GetSelectedCount(hwndList) > 0); - HideAdvancedSearchDlg(hwndDlg,dat); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), ListView_GetSelectedCount(hwndList) > 0); + HideAdvancedSearchDlg(hwndDlg, dat); break; case IDC_PROTOID: if (HIWORD(wParam) == EN_CHANGE) { - HideAdvancedSearchDlg(hwndDlg,dat); - CheckSearchTypeRadioButton(hwndDlg,IDC_BYPROTOID); - EnableWindow(GetDlgItem(hwndDlg,IDC_ADD),TRUE); + HideAdvancedSearchDlg(hwndDlg, dat); + CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE); } break; case IDC_EMAIL: if (HIWORD(wParam) == EN_CHANGE) { - HideAdvancedSearchDlg(hwndDlg,dat); - CheckSearchTypeRadioButton(hwndDlg,IDC_BYEMAIL); + HideAdvancedSearchDlg(hwndDlg, dat); + CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL); } break; case IDC_NAMENICK: case IDC_NAMEFIRST: case IDC_NAMELAST: if (HIWORD(wParam) == EN_CHANGE) { - HideAdvancedSearchDlg(hwndDlg,dat); - CheckSearchTypeRadioButton(hwndDlg,IDC_BYNAME); + HideAdvancedSearchDlg(hwndDlg, dat); + CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME); } break; case IDC_ADVANCED: - EnableWindow(GetDlgItem(hwndDlg,IDC_ADD), ListView_GetSelectedCount(hwndList) > 0); - if (IsDlgButtonChecked(hwndDlg,IDC_ADVANCED)) - ShowAdvancedSearchDlg(hwndDlg,dat); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), ListView_GetSelectedCount(hwndList) > 0); + if (IsDlgButtonChecked(hwndDlg, IDC_ADVANCED)) + ShowAdvancedSearchDlg(hwndDlg, dat); else - HideAdvancedSearchDlg(hwndDlg,dat); - CheckSearchTypeRadioButton(hwndDlg,IDC_BYADVANCED); + HideAdvancedSearchDlg(hwndDlg, dat); + CheckSearchTypeRadioButton(hwndDlg, IDC_BYADVANCED); break; case IDCANCEL: DestroyWindow(hwndDlg); break; case IDOK: { - HideAdvancedSearchDlg(hwndDlg,dat); + HideAdvancedSearchDlg(hwndDlg, dat); if (dat->searchCount) { //cancel search - SetDlgItemText(hwndDlg,IDOK,TranslateT("&Search")); + SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search")); if (dat->hResultHook) {UnhookEvent(dat->hResultHook); dat->hResultHook=NULL;} if (dat->search) {mir_free(dat->search); dat->search=NULL;} dat->searchCount=0; - StopThrobber(hwndDlg,dat); - SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat); + StopThrobber(hwndDlg, dat); + SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); break; } - char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0); + char *szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); if (dat->search) {mir_free(dat->search); dat->search=NULL;} dat->searchCount=0; - dat->hResultHook=HookEventMessage(ME_PROTO_ACK,hwndDlg,HM_SEARCHACK); - if (IsDlgButtonChecked(hwndDlg,IDC_BYCUSTOM)) + dat->hResultHook=HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_SEARCHACK); + if (IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) { - BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYADVANCED,PF1_EXTSEARCHUI,dat->hwndTinySearch); + BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndTinySearch); } - else if (IsDlgButtonChecked(hwndDlg,IDC_BYPROTOID)) { + else if (IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)) { TCHAR str[256]; - GetDlgItemText(hwndDlg,IDC_PROTOID,str,SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_PROTOID, str, SIZEOF(str)); rtrim(str); if (str[0] == 0) - MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); + MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK); else - BeginSearch(hwndDlg,dat,szProto,PS_BASICSEARCHT,PF1_BASICSEARCH,str); + BeginSearch(hwndDlg, dat, szProto, PS_BASICSEARCHT, PF1_BASICSEARCH, str); } - else if (IsDlgButtonChecked(hwndDlg,IDC_BYEMAIL)) { + else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) { TCHAR str[256]; - GetDlgItemText(hwndDlg,IDC_EMAIL,str,SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_EMAIL, str, SIZEOF(str)); rtrim(str); if (str[0] == 0) - MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); + MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK); else - BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYEMAILT,PF1_SEARCHBYEMAIL,str); + BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYEMAILT, PF1_SEARCHBYEMAIL, str); } - else if (IsDlgButtonChecked(hwndDlg,IDC_BYNAME)) { - TCHAR nick[256],first[256],last[256]; + else if (IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) { + TCHAR nick[256], first[256], last[256]; PROTOSEARCHBYNAME psbn; - GetDlgItemText(hwndDlg,IDC_NAMENICK,nick,SIZEOF(nick)); - GetDlgItemText(hwndDlg,IDC_NAMEFIRST,first,SIZEOF(first)); - GetDlgItemText(hwndDlg,IDC_NAMELAST,last,SIZEOF(last)); + GetDlgItemText(hwndDlg, IDC_NAMENICK, nick, SIZEOF(nick)); + GetDlgItemText(hwndDlg, IDC_NAMEFIRST, first, SIZEOF(first)); + GetDlgItemText(hwndDlg, IDC_NAMELAST, last, SIZEOF(last)); psbn.pszFirstName = first; psbn.pszLastName = last; psbn.pszNick = nick; if (nick[0] == 0 && first[0] == 0 && last[0] == 0) - MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); + MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK); else - BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYNAMET,PF1_SEARCHBYNAME,&psbn); + BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAMET, PF1_SEARCHBYNAME, &psbn); } - else if (IsDlgButtonChecked(hwndDlg,IDC_BYADVANCED)) { + else if (IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) { if (dat->hwndAdvSearch == NULL) - MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK); + MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK); else - BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYADVANCED,PF1_EXTSEARCHUI,dat->hwndAdvSearch); + BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndAdvSearch); } if (dat->searchCount == 0) { @@ -701,10 +701,10 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->notSearchedYet=0; FreeSearchResults(hwndList); - CreateResultsColumns(hwndList,dat,szProto); - SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat); + CreateResultsColumns(hwndList, dat, szProto); + SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); SetStatusBarResultInfo(hwndDlg); - StartThrobber(hwndDlg,dat); + StartThrobber(hwndDlg, dat); SetDlgItemText(hwndDlg, IDOK, TranslateT("Cancel")); break; } @@ -734,7 +734,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP psr.id = str; acs.psr = &psr; - acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, + acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); } @@ -744,8 +744,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP } case IDC_MOREOPTIONS: { RECT rc; - GetWindowRect(GetDlgItem(hwndDlg,IDC_MOREOPTIONS),&rc); - ShowMoreOptionsMenu(hwndDlg,rc.left,rc.bottom); + GetWindowRect(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc); + ShowMoreOptionsMenu(hwndDlg, rc.left, rc.bottom); break; } } @@ -761,13 +761,13 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP pt.x=(short)LOWORD(lParam); pt.y=(short)HIWORD(lParam); lvhti.pt=pt; - ScreenToClient(hwndDlg,&pt); - switch(GetDlgCtrlID(ChildWindowFromPoint(hwndDlg,pt))) { + ScreenToClient(hwndDlg, &pt); + switch(GetDlgCtrlID(ChildWindowFromPoint(hwndDlg, pt))) { case IDC_RESULTS: if (dat->notSearchedYet) return TRUE; - ScreenToClient(hwndList,&lvhti.pt); - if (ListView_HitTest(hwndList,&lvhti) == -1) break; - ShowMoreOptionsMenu(hwndDlg,(short)LOWORD(lParam),(short)HIWORD(lParam)); + ScreenToClient(hwndList, &lvhti.pt); + if (ListView_HitTest(hwndList, &lvhti) == -1) break; + ShowMoreOptionsMenu(hwndDlg, (short)LOWORD(lParam), (short)HIWORD(lParam)); return TRUE; } break; @@ -778,21 +778,21 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP 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 (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)); + memmove(dat->search+i, dat->search+i+1, sizeof(struct ProtoSearchInfo)*(dat->searchCount-i)); if (dat->searchCount == 0) { mir_free(dat->search); dat->search=NULL; UnhookEvent(dat->hResultHook); dat->hResultHook=NULL; SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search")); - StopThrobber(hwndDlg,dat); + StopThrobber(hwndDlg, dat); } ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg); - SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat); + SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); } else if (ack->result == ACKRESULT_SEARCHRESULT && ack->lParam) { @@ -810,7 +810,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP FreeSearchResults(hwndList); ListView_DeleteAllItems(hwndList); //not sure if previous delete list items too //secondly remove all columns - while (ListView_DeleteColumn(hwndList,1)); //will delete fist column till it possible + while (ListView_DeleteColumn(hwndList, 1)); //will delete fist column till it possible //now will add columns and captions; lvc.mask=LVCF_TEXT; for (iColumn=0; iColumnnFieldCount; iColumn++) @@ -827,7 +827,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP char *szComboProto; COMBOBOXEXITEM cbei = {0}; - lsr = (struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult,psr)+psr->cbSize); + lsr = (struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult, psr)+psr->cbSize); lsr->szProto = ack->szModule; memcpy(&lsr->psr, psr, psr->cbSize); @@ -857,11 +857,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP { szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); if (szComboProto == NULL) continue; - if (!lstrcmpA(szComboProto,ack->szModule)) + if (!lstrcmpA(szComboProto, ack->szModule)) { cbei.mask = CBEIF_IMAGE; cbei.iItem = i; - SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_GETITEM,0,(LPARAM)&cbei); + SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_GETITEM, 0, (LPARAM)&cbei); lvi.iImage = cbei.iImage; } } @@ -878,13 +878,13 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP } else if (ack->result == ACKRESULT_DATA) { LVITEM lvi={0}; - int i,col; + int i, col; PROTOSEARCHRESULT *psr=(PROTOSEARCHRESULT*)ack->lParam; struct ListSearchResult *lsr; char *szComboProto; COMBOBOXEXITEM cbei={0}; dat->bFlexSearchResult=FALSE; - lsr=(struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult,psr)+psr->cbSize); + lsr=(struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult, psr)+psr->cbSize); lsr->szProto=ack->szModule; CopyMemory(&lsr->psr, psr, psr->cbSize); @@ -897,14 +897,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP lvi.mask = LVIF_PARAM|LVIF_IMAGE; lvi.lParam=(LPARAM)lsr; - for (i = SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCOUNT,0,0); i--; ) + for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--; ) { - szComboProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,i,0); + szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); if (szComboProto == NULL) continue; - if (!lstrcmpA(szComboProto,ack->szModule)) { + if (!lstrcmpA(szComboProto, ack->szModule)) { cbei.mask=CBEIF_IMAGE; cbei.iItem=i; - SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_GETITEM,0,(LPARAM)&cbei); + SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_GETITEM, 0, (LPARAM)&cbei); lvi.iImage=cbei.iImage; break; } @@ -926,10 +926,10 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY: { TCHAR *szProto; - int len = SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETLBTEXTLEN,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0); + int len = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); szProto = ( TCHAR* )alloca( sizeof(TCHAR)*( len+1 )); *szProto='\0'; - SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETLBTEXT,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),(LPARAM)szProto); + SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), (LPARAM)szProto); DBWriteContactSettingTString(NULL, "FindAdd", "LastSearched", szProto?szProto:_T("")); } SaveColumnSizes(hwndList); @@ -949,7 +949,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP DeleteObject(dat->hBmpSortUp); mir_free(dat); Window_FreeIcon_IcoLib(hwndDlg); - Utils_SaveWindowPosition(hwndDlg,NULL,"FindAdd",""); + Utils_SaveWindowPosition(hwndDlg, NULL, "FindAdd", ""); break; } @@ -959,7 +959,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP static INT_PTR FindAddCommand(WPARAM, LPARAM) { if (IsWindow(hwndFindAdd)) { - ShowWindow(hwndFindAdd,SW_SHOWNORMAL); + ShowWindow(hwndFindAdd, SW_SHOWNORMAL); SetForegroundWindow(hwndFindAdd); SetFocus(hwndFindAdd); } @@ -995,10 +995,10 @@ int FindAddPreShutdown(WPARAM, LPARAM) int LoadFindAddModule(void) { - CreateServiceFunction(MS_FINDADD_FINDADD,FindAddCommand); + CreateServiceFunction(MS_FINDADD_FINDADD, FindAddCommand); HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); HookEvent(ME_PROTO_ACCLISTCHANGED, OnSystemModulesLoaded); - HookEvent(ME_SYSTEM_PRESHUTDOWN,FindAddPreShutdown); + HookEvent(ME_SYSTEM_PRESHUTDOWN, FindAddPreShutdown); CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof(mi); @@ -1007,7 +1007,7 @@ int LoadFindAddModule(void) mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_FINDUSER ); mi.pszName = LPGEN("&Find/Add Contacts..."); mi.pszService = MS_FINDADD_FINDADD; - hMainMenuItem = ( HANDLE )CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi); + hMainMenuItem = Menu_AddMainMenuItem(&mi); return 0; } diff --git a/src/modules/findadd/findadd.h b/src/modules/findadd/findadd.h index 8e5fcb29e1..edd0c46bb9 100644 --- a/src/modules/findadd/findadd.h +++ b/src/modules/findadd/findadd.h @@ -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. @@ -35,12 +35,12 @@ struct FindAddDlgData { int bSortAscending; int iLastColumnSortIndex; HIMAGELIST himlComboIcons; - int showProtoId,showEmail,showName,showAdvanced,showTiny; + int showProtoId, showEmail, showName, showAdvanced, showTiny; int minDlgHeight; int notSearchedYet; struct ProtoSearchInfo *search; int searchCount; - HBITMAP hBmpSortUp,hBmpSortDown; + HBITMAP hBmpSortUp, hBmpSortDown; int throbbing; int pivot; HWND hwndAdvSearch; @@ -50,10 +50,10 @@ struct FindAddDlgData { int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); void FreeSearchResults(HWND hwndResults); -int BeginSearch(HWND hwndDlg,struct FindAddDlgData *dat,const char *szProto,const char *szSearchService,DWORD requiredCapability,void *pvSearchParams); -void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat); +int BeginSearch(HWND hwndDlg, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams); +void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat); void SetStatusBarResultInfo(HWND hwndDlg); -void CreateResultsColumns(HWND hwndResults,struct FindAddDlgData *dat,char *szProto); -void EnableResultButtons(HWND hwndDlg,int enable); -void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y); +void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto); +void EnableResultButtons(HWND hwndDlg, int enable); +void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y); void SaveColumnSizes(HWND hwndResults); diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index cc3622609f..827fe920b0 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -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. @@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "findadd.h" enum { - COLUMNID_PROTO, - COLUMNID_HANDLE, - COLUMNID_NICK, - COLUMNID_FIRST, - COLUMNID_LAST, - COLUMNID_EMAIL, + COLUMNID_PROTO, + COLUMNID_HANDLE, + COLUMNID_NICK, + COLUMNID_FIRST, + COLUMNID_LAST, + COLUMNID_EMAIL, NUM_COLUMNID }; @@ -41,24 +41,24 @@ void SaveColumnSizes(HWND hwndResults) int i; struct FindAddDlgData *dat; - dat=(struct FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults),GWLP_USERDATA); + dat=(struct FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults), GWLP_USERDATA); columnCount=Header_GetItemCount(ListView_GetHeader(hwndResults)); if (columnCount != NUM_COLUMNID) return; - ListView_GetColumnOrderArray(hwndResults,columnCount,columnOrder); + ListView_GetColumnOrderArray(hwndResults, columnCount, columnOrder); for (i=0; i < NUM_COLUMNID; i++) { mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i); - DBWriteContactSettingByte(NULL,"FindAdd",szSetting,(BYTE)columnOrder[i]); + DBWriteContactSettingByte(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]); if (i>=columnCount) continue; mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i); - DBWriteContactSettingWord(NULL,"FindAdd",szSetting,(WORD)ListView_GetColumnWidth(hwndResults,i)); + DBWriteContactSettingWord(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i)); } - DBWriteContactSettingByte(NULL,"FindAdd","SortColumn",(BYTE)dat->iLastColumnSortIndex); - DBWriteContactSettingByte(NULL,"FindAdd","SortAscending",(BYTE)dat->bSortAscending); + DBWriteContactSettingByte(NULL, "FindAdd", "SortColumn", (BYTE)dat->iLastColumnSortIndex); + DBWriteContactSettingByte(NULL, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending); } static const TCHAR *szColumnNames[] = { NULL, NULL, _T("Nick"), _T("First Name"), _T("Last Name"), _T("E-mail") }; -static int defaultColumnSizes[]={0,90,100,100,100,2000}; -void LoadColumnSizes(HWND hwndResults,const char *szProto) +static int defaultColumnSizes[]={0, 90, 100, 100, 100, 2000}; +void LoadColumnSizes(HWND hwndResults, const char *szProto) { HDITEM hdi; int columnOrder[NUM_COLUMNID]; @@ -88,9 +88,9 @@ void LoadColumnSizes(HWND hwndResults,const char *szProto) { #if defined( _UNICODE ) bNeedsFree = TRUE; - lvc.pszText = mir_a2t((char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0)); + lvc.pszText = mir_a2t((char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0)); #else - lvc.pszText = (char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0); + lvc.pszText = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); #endif } else @@ -128,7 +128,7 @@ static LPARAM ListView_GetItemLParam(HWND hwndList, int idx) LVITEM lv; lv.iItem = idx; lv.mask = LVIF_PARAM; - ListView_GetItem(hwndList,&lv); + ListView_GetItem(hwndList, &lv); return lv.lParam; } @@ -168,8 +168,8 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa { TCHAR szText1[100]; TCHAR szText2[100]; - ListView_GetItemText(hList,(int)lParam1,sortCol,szText1,SIZEOF(szText1)); - ListView_GetItemText(hList,(int)lParam2,sortCol,szText2,SIZEOF(szText2)); + ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, SIZEOF(szText1)); + ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, SIZEOF(szText2)); return _tcsicmp(szText1, szText2)*sortMultiplier; } return 0; @@ -181,7 +181,7 @@ void FreeSearchResults(HWND hwndResults) struct ListSearchResult *lsr; for (lvi.iItem=ListView_GetItemCount(hwndResults)-1;lvi.iItem>=0;lvi.iItem--) { lvi.mask=LVIF_PARAM; - ListView_GetItem(hwndResults,&lvi); + ListView_GetItem(hwndResults, &lvi); lsr=(struct ListSearchResult*)lvi.lParam; if (lsr == NULL) continue; mir_free(lsr->psr.id); @@ -192,7 +192,7 @@ void FreeSearchResults(HWND hwndResults) mir_free(lsr); } ListView_DeleteAllItems(hwndResults); - EnableResultButtons(GetParent(hwndResults),0); + EnableResultButtons(GetParent(hwndResults), 0); } // on its own thread @@ -201,16 +201,16 @@ static void BeginSearchFailed(void * arg) TCHAR buf[128]; if ( arg != NULL ) { const TCHAR* protoName = (TCHAR*)arg; - mir_sntprintf(buf,SIZEOF(buf), - TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"), - protoName,protoName); + mir_sntprintf(buf, SIZEOF(buf), + TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"), + protoName, protoName); mir_free((char*)arg); } - else lstrcpyn(buf,TranslateT("Could not search on any of the protocols, are you online?"),SIZEOF(buf)); - MessageBox(0,buf,TranslateT("Problem with search"),MB_OK | MB_ICONERROR); + else lstrcpyn(buf, TranslateT("Could not search on any of the protocols, are you online?"), SIZEOF(buf)); + MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR); } -int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *szSearchService,DWORD requiredCapability,void *pvSearchParams) +int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams) { int i; if ( szProto == NULL ) { @@ -220,9 +220,9 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * for ( i=0; i < accounts.getCount();i++) { PROTOACCOUNT* pa = accounts[i]; if (!Proto_IsAccountEnabled(pa)) continue; - DWORD caps=(DWORD)CallProtoService(pa->szModuleName,PS_GETCAPS,PFLAGNUM_1,0); + DWORD caps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(caps&requiredCapability)) continue; - dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName,szSearchService,0,(LPARAM)pvSearchParams); + dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[dat->searchCount].szProto = pa->szModuleName; if ( dat->search[dat->searchCount].hProcess == NULL ) failures++; else dat->searchCount++; @@ -230,7 +230,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * if (failures) { //infuriatingly vague error message. fixme. if (dat->searchCount == 0) { - forkthread(BeginSearchFailed,0,NULL); + forkthread(BeginSearchFailed, 0, NULL); mir_free(dat->search); dat->search=NULL; return 1; @@ -239,7 +239,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * else { dat->search=(struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo)); dat->searchCount=1; - dat->search[0].hProcess=(HANDLE)CallProtoService(szProto,szSearchService,0,(LPARAM)pvSearchParams); + dat->search[0].hProcess=(HANDLE)CallProtoService(szProto, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[0].szProto=szProto; if (dat->search[0].hProcess == NULL) { //infuriatingly vague error message. fixme. @@ -255,7 +255,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char * } // !!!!!!!! this code is dangerous like a hell -void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat) +void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat) { TCHAR str[256]; @@ -268,7 +268,7 @@ void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat) if ( !pa ) continue; - lstrcat(str, i ? _T(",") : _T( " " )); + lstrcat(str, i ? _T(", ") : _T( " " )); lstrcat(str, pa->tszAccountName ); } } else lstrcpy(str, TranslateT("Idle")); @@ -282,19 +282,19 @@ struct ProtoResultsSummary { }; void SetStatusBarResultInfo(HWND hwndDlg) { - HWND hwndStatus=GetDlgItem(hwndDlg,IDC_STATUSBAR); - HWND hwndResults=GetDlgItem(hwndDlg,IDC_RESULTS); + HWND hwndStatus=GetDlgItem(hwndDlg, IDC_STATUSBAR); + HWND hwndResults=GetDlgItem(hwndDlg, IDC_RESULTS); LV_ITEM lvi; struct ListSearchResult *lsr; struct ProtoResultsSummary *subtotal=NULL; int subtotalCount=0; - int i,total; + int i, total; TCHAR str[256]; total=ListView_GetItemCount(hwndResults); for (lvi.iItem=total-1;lvi.iItem>=0;lvi.iItem--) { lvi.mask=LVIF_PARAM; - ListView_GetItem(hwndResults,&lvi); + ListView_GetItem(hwndResults, &lvi); lsr=(struct ListSearchResult*)lvi.lParam; if (lsr == NULL) continue; for (i=0;iszProto; subtotal[subtotalCount++].count=1; } @@ -320,7 +320,7 @@ void SetStatusBarResultInfo(HWND hwndDlg) else mir_sntprintf( str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName ); } else { - mir_sntprintf( str, SIZEOF(str), TranslateT("%d users found ("),total); + mir_sntprintf( str, SIZEOF(str), TranslateT("%d users found ("), total); for ( i=0; i < subtotalCount; i++ ) { if ( i ) { if (( pa = Proto_GetAccount( subtotal[i].szProto )) == NULL ) @@ -338,35 +338,35 @@ void SetStatusBarResultInfo(HWND hwndDlg) SendMessage(hwndStatus, SB_SETTEXT, 2, (LPARAM)str ); } -void CreateResultsColumns(HWND hwndResults,struct FindAddDlgData *dat,char *szProto) +void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto) { SaveColumnSizes(hwndResults); - while (ListView_DeleteColumn(hwndResults,0)); - ListView_SetImageList(hwndResults,dat->himlComboIcons,LVSIL_SMALL); - LoadColumnSizes(hwndResults,szProto); + while (ListView_DeleteColumn(hwndResults, 0)); + ListView_SetImageList(hwndResults, dat->himlComboIcons, LVSIL_SMALL); + LoadColumnSizes(hwndResults, szProto); } -void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y) +void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) { struct FindAddDlgData *dat; - HMENU hPopupMenu,hMenu; + HMENU hPopupMenu, hMenu; int commandId; struct ListSearchResult *lsr; - dat=(struct FindAddDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + 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); + lvi.iItem=ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_RESULTS), -1, LVNI_ALL|LVNI_SELECTED); + ListView_GetItem(GetDlgItem(hwndDlg, IDC_RESULTS), &lvi); lsr=(struct ListSearchResult*)lvi.lParam; } - hMenu=LoadMenu(hMirandaInst,MAKEINTRESOURCE(IDR_CONTEXT)); - hPopupMenu=GetSubMenu(hMenu,4); - CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hPopupMenu,0); - commandId=TrackPopupMenu(hPopupMenu,TPM_RIGHTBUTTON|TPM_RETURNCMD,x,y,0,hwndDlg,NULL); + hMenu=LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_CONTEXT)); + hPopupMenu=GetSubMenu(hMenu, 4); + CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM)hPopupMenu, 0); + commandId=TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON|TPM_RETURNCMD, x, y, 0, hwndDlg, NULL); switch(commandId) { case IDC_ADD: { ADDCONTACTSTRUCT acs; @@ -375,19 +375,19 @@ void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y) acs.handleType=HANDLE_SEARCHRESULT; acs.szProto=lsr->szProto; acs.psr=&lsr->psr; - CallService(MS_ADDCONTACT_SHOW,(WPARAM)hwndDlg,(LPARAM)&acs); + CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); break; } case IDC_DETAILS: { HANDLE hContact; - hContact=(HANDLE)CallProtoService(lsr->szProto,PS_ADDTOLIST,PALF_TEMPORARY,(LPARAM)&lsr->psr); - CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)hContact,0); + hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break; } case IDC_SENDMESSAGE: { HANDLE hContact; - hContact=(HANDLE)CallProtoService(lsr->szProto,PS_ADDTOLIST,PALF_TEMPORARY,(LPARAM)&lsr->psr); - CallService(MS_MSG_SENDMESSAGE,(WPARAM)hContact,(LPARAM)(const char*)NULL); + hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); + CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)(const char*)NULL); break; } } diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 961c598c3b..12291fb933 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.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. @@ -486,47 +486,47 @@ static INT_PTR CALLBACK ChooseEffectDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wPa int i; TCHAR * ModernEffectNames[]= { - _T(""), - _T("Shadow at left"), - _T("Shadow at right"), - _T("Outline"), - _T("Outline smooth"), - _T("Smooth bump"), - _T("Contour thin"), - _T("Contour heavy"), + _T(""), + _T("Shadow at left"), + _T("Shadow at right"), + _T("Outline"), + _T("Outline smooth"), + _T("Smooth bump"), + _T("Contour thin"), + _T("Contour heavy"), }; for ( i=0; ieffectIndex ) { - SendDlgItemMessage(hwndDlg,IDC_EFFECT_COMBO,CB_SETCURSEL, i, 0 ); + if (SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0) == pEffect->effectIndex ) { + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, i, 0 ); break; } } } - SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR1,CPM_SETCOLOUR,0,pEffect->baseColour&0x00FFFFFF); - SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR2,CPM_SETCOLOUR,0,pEffect->secondaryColour&0x00FFFFFF); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_SETCOLOUR, 0, pEffect->baseColour&0x00FFFFFF); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_SETCOLOUR, 0, pEffect->secondaryColour&0x00FFFFFF); - SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR_SPIN1,UDM_SETRANGE,0,MAKELONG(255,0)); - SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR_SPIN2,UDM_SETRANGE,0,MAKELONG(255,0)); - SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR_SPIN1,UDM_SETPOS,0,MAKELONG((BYTE)~((BYTE)((pEffect->baseColour&0xFF000000)>>24)),0)); - SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR_SPIN2,UDM_SETPOS,0,MAKELONG((BYTE)~((BYTE)((pEffect->secondaryColour&0xFF000000)>>24)),0)); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_SETRANGE, 0, MAKELONG(255, 0)); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_SETRANGE, 0, MAKELONG(255, 0)); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_SETPOS, 0, MAKELONG((BYTE)~((BYTE)((pEffect->baseColour&0xFF000000)>>24)), 0)); + SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_SETPOS, 0, MAKELONG((BYTE)~((BYTE)((pEffect->secondaryColour&0xFF000000)>>24)), 0)); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { - int i = SendDlgItemMessage(hwndDlg,IDC_EFFECT_COMBO,CB_GETCURSEL, 0, 0 ); - pEffect->effectIndex=(BYTE)SendDlgItemMessage(hwndDlg,IDC_EFFECT_COMBO,CB_GETITEMDATA,i,0); - pEffect->baseColour=SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR1,CPM_GETCOLOUR,0,0)|((~(BYTE)SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR_SPIN1,UDM_GETPOS,0,0))<<24); - pEffect->secondaryColour=SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR2,CPM_GETCOLOUR,0,0)|((~(BYTE)SendDlgItemMessage(hwndDlg,IDC_EFFECT_COLOUR_SPIN2,UDM_GETPOS,0,0))<<24);; + int i = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCURSEL, 0, 0 ); + pEffect->effectIndex=(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0); + pEffect->baseColour=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR1, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN1, UDM_GETPOS, 0, 0))<<24); + pEffect->secondaryColour=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR2, CPM_GETCOLOUR, 0, 0)|((~(BYTE)SendDlgItemMessage(hwndDlg, IDC_EFFECT_COLOUR_SPIN2, UDM_GETPOS, 0, 0))<<24);; } EndDialog( hwndDlg, IDOK ); return TRUE; @@ -879,10 +879,10 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, hbrBack = CreateBrushIndirect(&lb); } - SetRect(&rc, - dis->rcItem.left+FSUI_COLORBOXLEFT, - dis->rcItem.top+FSUI_FONTFRAMEVERT, - dis->rcItem.left+FSUI_COLORBOXLEFT+FSUI_COLORBOXWIDTH, + SetRect(&rc, + dis->rcItem.left+FSUI_COLORBOXLEFT, + dis->rcItem.top+FSUI_FONTFRAMEVERT, + dis->rcItem.left+FSUI_COLORBOXLEFT+FSUI_COLORBOXWIDTH, dis->rcItem.bottom-FSUI_FONTFRAMEVERT); FillRect(dis->hDC, &rc, hbrBack); @@ -910,10 +910,10 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, { RECT rc; HBRUSH hbrTmp; - SetRect(&rc, - dis->rcItem.left+FSUI_COLORBOXLEFT, - dis->rcItem.top+FSUI_FONTFRAMEVERT, - dis->rcItem.left+FSUI_COLORBOXLEFT+FSUI_COLORBOXWIDTH, + SetRect(&rc, + dis->rcItem.left+FSUI_COLORBOXLEFT, + dis->rcItem.top+FSUI_FONTFRAMEVERT, + dis->rcItem.left+FSUI_COLORBOXLEFT+FSUI_COLORBOXWIDTH, dis->rcItem.bottom-FSUI_FONTFRAMEVERT); hbrTmp = CreateSolidBrush(clText); @@ -1311,7 +1311,7 @@ int OptInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS; odp.nIDBottomSimpleControl = 0; odp.pfnDlgProc = DlgProcLogOptions; - CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp ); + CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp ); return 0; } @@ -1479,7 +1479,7 @@ int FontsModernOptInit(WPARAM wParam, LPARAM lParam) { static int iBoldControls[] = { - IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, + IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, MODERNOPT_CTRL_LAST }; diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp index f8e977f9b3..7b19e962f4 100644 --- a/src/modules/fonts/FontService.cpp +++ b/src/modules/fonts/FontService.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. diff --git a/src/modules/fonts/FontService.h b/src/modules/fonts/FontService.h index 4f665ae6d3..5d9a3f10a2 100644 --- a/src/modules/fonts/FontService.h +++ b/src/modules/fonts/FontService.h @@ -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. @@ -46,7 +46,7 @@ struct TFontID char prefix[32]; // this is prepended to the settings used to store this font's data in the db DWORD flags; // bitwise OR of the FIDF_* flags above TFontSettings deffontsettings; // defaults, valid if flags & FIDF_DEFAULTVALID - int order; // controls the order in the font group in which the fonts are listed in the UI (if order fields are equal, + int order; // controls the order in the font group in which the fonts are listed in the UI (if order fields are equal, // they will be ordered alphabetically by name) TCHAR backgroundGroup[64]; TCHAR backgroundName[64]; diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index 09e465c59a..0a00198d66 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.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. @@ -115,7 +115,7 @@ static void GetDefaultFontSetting(LOGFONT* lf, COLORREF* colour) lf->lfHeight = 10; HDC hdc = GetDC(0); - lf->lfHeight = -MulDiv(lf->lfHeight,GetDeviceCaps(hdc, LOGPIXELSY), 72); + lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); ReleaseDC(0, hdc); } @@ -174,7 +174,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR if (lf->lfHeight > 0) { HDC hdc = GetDC(0); if (flags & FIDF_SAVEPOINTSIZE) { - lf->lfHeight = -MulDiv(lf->lfHeight,GetDeviceCaps(hdc, LOGPIXELSY), 72); + lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); } else { // assume SAVEACTUALHEIGHT TEXTMETRIC tm; HFONT hFont = CreateFontIndirect(lf); @@ -236,8 +236,8 @@ void UpdateFontSettings(TFontID* font_id, TFontSettings* fontsettings) static COLORREF sttMixColor(COLORREF cl1, COLORREF cl2, int q) { return RGB( - (GetRValue(cl1) * q + GetRValue(cl2) * (255 - q)) / 255, - (GetGValue(cl1) * q + GetGValue(cl2) * (255 - q)) / 255, + (GetRValue(cl1) * q + GetRValue(cl2) * (255 - q)) / 255, + (GetGValue(cl1) * q + GetGValue(cl2) * (255 - q)) / 255, (GetBValue(cl1) * q + GetBValue(cl2) * (255 - q)) / 255 ); } @@ -255,10 +255,10 @@ COLORREF GetColorFromDefault(COLORREF cl) case MIRCOLOR_BTNHALF: return sttMixColor(GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_BTNTEXT), 128); case MIRCOLOR_WNDHALF: return sttMixColor(GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOWTEXT), 128); case MIRCOLOR_SELHALF: return sttMixColor(GetSysColor(COLOR_HIGHLIGHT), GetSysColor(COLOR_HIGHLIGHTTEXT), 128); - case MIRCOLOR_INBACK: return sttMixColor(GetSysColor(COLOR_WINDOW), RGB(0,0,255), 245); + case MIRCOLOR_INBACK: return sttMixColor(GetSysColor(COLOR_WINDOW), RGB(0, 0, 255), 245); case MIRCOLOR_INTEXT: return GetSysColor(COLOR_WINDOWTEXT); case MIRCOLOR_INHALF: return sttMixColor(GetColorFromDefault(MIRCOLOR_INBACK), GetColorFromDefault(MIRCOLOR_INTEXT), 128); - case MIRCOLOR_OUTBACK: return sttMixColor(GetSysColor(COLOR_WINDOW), RGB(0,255,0), 245); + case MIRCOLOR_OUTBACK: return sttMixColor(GetSysColor(COLOR_WINDOW), RGB(0, 255, 0), 245); case MIRCOLOR_OUTTEXT: return GetSysColor(COLOR_WINDOWTEXT); case MIRCOLOR_OUTHALF: return sttMixColor(GetColorFromDefault(MIRCOLOR_OUTBACK), GetColorFromDefault(MIRCOLOR_OUTTEXT), 128); } diff --git a/src/modules/help/about.cpp b/src/modules/help/about.cpp index b3594c4dc0..d1dc8bac5c 100644 --- a/src/modules/help/about.cpp +++ b/src/modules/help/about.cpp @@ -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. @@ -40,25 +40,25 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar UINT blockSize; PVOID pVerInfo; - GetModuleFileName(NULL,filename,SIZEOF(filename)); - verInfoSize=GetFileVersionInfoSize(filename,&unused); + GetModuleFileName(NULL, filename, SIZEOF(filename)); + verInfoSize=GetFileVersionInfoSize(filename, &unused); pVerInfo=mir_alloc(verInfoSize); - GetFileVersionInfo(filename,0,verInfoSize,pVerInfo); - VerQueryValue(pVerInfo,_T("\\StringFileInfo\\000004b0\\LegalCopyright"),(LPVOID*)&productCopyright,&blockSize); - SetDlgItemText(hwndDlg,IDC_DEVS,productCopyright); + GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo); + VerQueryValue(pVerInfo, _T("\\StringFileInfo\\000004b0\\LegalCopyright"), (LPVOID*)&productCopyright, &blockSize); + SetDlgItemText(hwndDlg, IDC_DEVS, productCopyright); mir_free(pVerInfo); } { char productVersion[56], *p; int isAnsi = 0; TCHAR str[64]; - CallService(MS_SYSTEM_GETVERSIONTEXT,SIZEOF(productVersion),(LPARAM)productVersion); + CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(productVersion), (LPARAM)productVersion); // Hide Unicode from version text as it is assumed at this point p = strstr(productVersion, " Unicode"); if (p) *p = '\0'; else isAnsi = 1; - mir_sntprintf(str,SIZEOF(str),_T(STR_VERSION_FORMAT), TranslateT("v"), productVersion, isAnsi?" ANSI":""); + mir_sntprintf(str, SIZEOF(str), _T(STR_VERSION_FORMAT), TranslateT("v"), productVersion, isAnsi?" ANSI":""); { TCHAR oldTitle[256], newTitle[256]; GetDlgItemText( hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF( oldTitle )); @@ -66,14 +66,14 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetDlgItemText( hwndDlg, IDC_HEADERBAR, newTitle ); } - mir_sntprintf(str,SIZEOF(str),TranslateT("Built %s %s"),_T(__DATE__),_T(__TIME__)); - SetDlgItemText(hwndDlg,IDC_BUILDTIME,str); + mir_sntprintf(str, SIZEOF(str), TranslateT("Built %s %s"), _T(__DATE__), _T(__TIME__)); + SetDlgItemText(hwndDlg, IDC_BUILDTIME, str); } ShowWindow(GetDlgItem(hwndDlg, IDC_CREDITSFILE), SW_HIDE); { - HRSRC hResInfo = FindResource(hMirandaInst,MAKEINTRESOURCE(IDR_CREDITS),_T("TEXT")); - DWORD ResSize = SizeofResource(hMirandaInst,hResInfo); - HGLOBAL hRes = LoadResource(hMirandaInst,hResInfo); + HRSRC hResInfo = FindResource(hMirandaInst, MAKEINTRESOURCE(IDR_CREDITS), _T("TEXT")); + DWORD ResSize = SizeofResource(hMirandaInst, hResInfo); + HGLOBAL hRes = LoadResource(hMirandaInst, hResInfo); char* pszMsg = (char*)LockResource(hRes); if (pszMsg) { @@ -127,7 +127,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case IDC_BUILDTIME: case IDC_CREDITSFILE: case IDC_DEVS: - SetTextColor((HDC)wParam,GetSysColor(COLOR_WINDOWTEXT)); + SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); break; default: return FALSE; @@ -138,8 +138,8 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_DESTROY: Window_FreeIcon_IcoLib( hwndDlg ); { - HFONT hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_VERSION,WM_GETFONT,0,0); - SendDlgItemMessage(hwndDlg,IDC_VERSION,WM_SETFONT,SendDlgItemMessage(hwndDlg,IDOK,WM_GETFONT,0,0),0); + HFONT hFont=(HFONT)SendDlgItemMessage(hwndDlg, IDC_VERSION, WM_GETFONT, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_VERSION, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0), 0); DeleteObject(hFont); } break; diff --git a/src/modules/help/help.cpp b/src/modules/help/help.cpp index 32c6a8528d..d6035957b7 100644 --- a/src/modules/help/help.cpp +++ b/src/modules/help/help.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. @@ -27,26 +27,26 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar HWND hAboutDlg=NULL; static HANDLE hBugEvent = NULL; -static INT_PTR AboutCommand(WPARAM wParam,LPARAM) +static INT_PTR AboutCommand(WPARAM wParam, LPARAM) { if (IsWindow(hAboutDlg)) { SetForegroundWindow(hAboutDlg); SetFocus(hAboutDlg); return 0; } - hAboutDlg=CreateDialog(hMirandaInst,MAKEINTRESOURCE(IDD_ABOUT),(HWND)wParam,DlgProcAbout); + hAboutDlg=CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)wParam, DlgProcAbout); return 0; } static INT_PTR IndexCommand(WPARAM, LPARAM) { - CallService(MS_UTILS_OPENURL,1,(LPARAM)Translate("http://wiki.miranda-im.org/")); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)Translate("http://wiki.miranda-im.org/")); return 0; } static INT_PTR WebsiteCommand(WPARAM, LPARAM) { - CallService(MS_UTILS_OPENURL,1,(LPARAM)"http://www.miranda-im.org"); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.miranda-im.org"); return 0; } @@ -54,7 +54,7 @@ static int BugCommandEvent(WPARAM wParam, LPARAM lParam) { char *szUrl = (char*)lParam; if (szUrl) { - CallService(MS_UTILS_OPENURL,1,(LPARAM)szUrl); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)szUrl); } return 0; } @@ -75,12 +75,12 @@ int ShutdownHelpModule(WPARAM, LPARAM) int LoadHelpModule(void) { - HookEvent(ME_SYSTEM_PRESHUTDOWN,ShutdownHelpModule); + HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownHelpModule); - CreateServiceFunction("Help/AboutCommand",AboutCommand); - CreateServiceFunction("Help/IndexCommand",IndexCommand); - CreateServiceFunction("Help/WebsiteCommand",WebsiteCommand); - CreateServiceFunction("Help/BugCommand",BugCommand); + CreateServiceFunction("Help/AboutCommand", AboutCommand); + CreateServiceFunction("Help/IndexCommand", IndexCommand); + CreateServiceFunction("Help/WebsiteCommand", WebsiteCommand); + CreateServiceFunction("Help/BugCommand", BugCommand); hBugEvent = CreateHookableEvent(ME_HELP_BUGREPORT); SetHookDefaultForHookableEvent(hBugEvent, BugCommandEvent); @@ -94,24 +94,24 @@ int LoadHelpModule(void) mi.position = 2000090000; mi.pszName = LPGEN("&About..."); mi.pszService = "Help/AboutCommand"; - CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + Menu_AddMainMenuItem(&mi); mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_HELP); mi.position = -500050000; mi.pszName = LPGEN("&Support"); mi.pszService = "Help/IndexCommand"; - CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + Menu_AddMainMenuItem(&mi); mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_MIRANDAWEB); mi.position = 2000050000; mi.pszName = LPGEN("&Miranda IM Homepage"); mi.pszService = "Help/WebsiteCommand"; - CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + Menu_AddMainMenuItem(&mi); mi.icolibItem = GetSkinIconHandle(SKINICON_EVENT_URL); mi.position = 2000040000; mi.pszName = LPGEN("&Report Bug"); mi.pszService = "Help/BugCommand"; - CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + Menu_AddMainMenuItem(&mi); return 0; } diff --git a/src/modules/history/history.cpp b/src/modules/history/history.cpp index 6e502790b9..ee3f039624 100644 --- a/src/modules/history/history.cpp +++ b/src/modules/history/history.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,19 +33,19 @@ static HANDLE hWindowList=0; static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find( hWindowList,( HANDLE )wParam ); + HWND hwnd = WindowList_Find( hWindowList, ( HANDLE )wParam ); if ( hwnd ) { SetForegroundWindow(hwnd); SetFocus(hwnd); return 0; } - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_HISTORY),NULL,DlgProcHistory,wParam); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, DlgProcHistory, wParam); return 0; } static int HistoryContactDelete(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(hWindowList,(HANDLE)wParam); + HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam); if ( hwnd != NULL ) DestroyWindow(hwnd); return 0; @@ -54,7 +54,7 @@ static int HistoryContactDelete(WPARAM wParam, LPARAM) int PreShutdownHistoryModule(WPARAM, LPARAM) { if (hWindowList) - WindowList_BroadcastAsync(hWindowList,WM_DESTROY,0,0); + WindowList_BroadcastAsync(hWindowList, WM_DESTROY, 0, 0); return 0; } @@ -67,12 +67,12 @@ int LoadHistoryModule(void) mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_HISTORY ); mi.pszName = LPGEN("View &History"); mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY; - CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi); + Menu_AddContactMenuItem(&mi); - CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY,UserHistoryCommand); - hWindowList=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0); - HookEvent(ME_DB_CONTACT_DELETED,HistoryContactDelete); - HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdownHistoryModule); + CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, UserHistoryCommand); + hWindowList=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + HookEvent(ME_DB_CONTACT_DELETED, HistoryContactDelete); + HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdownHistoryModule); return 0; } @@ -195,42 +195,42 @@ static void FillHistoryThread(void* param) TCHAR str[200], eventText[256], strdatetime[64]; HANDLE hDbEvent; DBEVENTINFO dbei; - int newBlobSize,oldBlobSize,i; + int newBlobSize, oldBlobSize, i; HWND hwndList; THistoryThread *hInfo = ( THistoryThread* )param; - SendDlgItemMessage(hInfo->hwnd,IDC_LIST,LB_RESETCONTENT,0,0); - i=CallService(MS_DB_EVENT_GETCOUNT,(WPARAM)hInfo->hContact,0); - SendDlgItemMessage(hInfo->hwnd,IDC_LIST,LB_INITSTORAGE,i,i*40); + SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_RESETCONTENT, 0, 0); + i=CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)hInfo->hContact, 0); + SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_INITSTORAGE, i, i*40); - ZeroMemory(&dbei,sizeof(dbei)); + ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize=sizeof(dbei); oldBlobSize=0; - hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDLAST,(WPARAM)hInfo->hContact,0); - hwndList = GetDlgItem(hInfo->hwnd,IDC_LIST); + hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hInfo->hContact, 0); + hwndList = GetDlgItem(hInfo->hwnd, IDC_LIST); while ( hDbEvent != NULL ) { if ( !IsWindow( hInfo->hwnd )) break; - newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0); + newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); if (newBlobSize>oldBlobSize) { - dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob,newBlobSize); + dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob, newBlobSize); oldBlobSize=newBlobSize; } dbei.cbBlob = oldBlobSize; CallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei ); - GetObjectSummary(&dbei,str,SIZEOF(str)); + GetObjectSummary(&dbei, str, SIZEOF(str)); if (str[0]) { tmi.printTimeStamp(NULL, dbei.timestamp, _T("d t"), strdatetime, SIZEOF(strdatetime), 0); mir_sntprintf( eventText, SIZEOF(eventText), _T("%s: %s"), strdatetime, str ); i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText ); SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent); } - hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDPREV,(WPARAM)hDbEvent,0); + hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0); } mir_free(dbei.pBlob); - SendDlgItemMessage(hInfo->hwnd,IDC_LIST,LB_SETCURSEL,0,0); - SendMessage(hInfo->hwnd,WM_COMMAND,MAKEWPARAM(IDC_LIST,LBN_SELCHANGE),0); + SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_SETCURSEL, 0, 0); + SendMessage(hInfo->hwnd, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0); EnableWindow(GetDlgItem(hInfo->hwnd, IDC_LIST), TRUE); mir_free(hInfo); } @@ -255,22 +255,22 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP { HANDLE hContact; - hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + hContact=(HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); hContact = (HANDLE)lParam; - WindowList_Add(hWindowList,hwndDlg,hContact); - Utils_RestoreWindowPosition(hwndDlg,hContact,"History",""); + WindowList_Add(hWindowList, hwndDlg, hContact); + Utils_RestoreWindowPosition(hwndDlg, hContact, "History", ""); { TCHAR* contactName, str[200]; contactName = cli.pfnGetContactDisplayName( hContact, 0 ); - mir_sntprintf(str,SIZEOF(str),TranslateT("History for %s"),contactName); - SetWindowText(hwndDlg,str); + mir_sntprintf(str, SIZEOF(str), TranslateT("History for %s"), contactName); + SetWindowText(hwndDlg, str); } Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY); - SendMessage(hwndDlg,DM_HREBUILD,0,0); + SendMessage(hwndDlg, DM_HREBUILD, 0, 0); return TRUE; case DM_HREBUILD: @@ -285,8 +285,8 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY: Window_FreeIcon_IcoLib(hwndDlg); - Utils_SaveWindowPosition(hwndDlg,hContact,"History",""); - WindowList_Remove(hWindowList,hwndDlg); + Utils_SaveWindowPosition(hwndDlg, hContact, "History", ""); + WindowList_Remove(hWindowList, hwndDlg); return TRUE; case WM_GETMINMAXINFO: @@ -302,7 +302,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP urd.lpTemplate=MAKEINTRESOURCEA(IDD_HISTORY); urd.lParam=(LPARAM)NULL; urd.pfnResizer=HistoryDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); + CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); return TRUE; } case WM_COMMAND: @@ -319,37 +319,37 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DELETEHISTORY: { HANDLE hDbevent; - int index = SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETCURSEL,0,0); + int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0); if ( index == LB_ERR ) break; - if ( MessageBox(hwndDlg,TranslateT("Are you sure you want to delete this history item?"),TranslateT("Delete History"),MB_YESNO|MB_ICONQUESTION) == IDYES) { - hDbevent = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,index,0); - CallService(MS_DB_EVENT_DELETE,(WPARAM)hContact,(LPARAM)hDbevent); - SendMessage(hwndDlg,DM_HREBUILD,0,0); + if ( MessageBox(hwndDlg, TranslateT("Are you sure you want to delete this history item?"), TranslateT("Delete History"), MB_YESNO|MB_ICONQUESTION) == IDYES) { + hDbevent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0); + CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)hDbevent); + SendMessage(hwndDlg, DM_HREBUILD, 0, 0); } return TRUE; } case IDC_LIST: if ( HIWORD(wParam) == LBN_SELCHANGE ) { - TCHAR str[8192],*contactName; + TCHAR str[8192], *contactName; HANDLE hDbEvent; DBEVENTINFO dbei; int sel; - sel=SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETCURSEL,0,0); - if (sel == LB_ERR) { EnableWindow(GetDlgItem(hwndDlg,IDC_DELETEHISTORY),FALSE); break; } - EnableWindow(GetDlgItem(hwndDlg,IDC_DELETEHISTORY),TRUE); + sel=SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0); + if (sel == LB_ERR) { EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), FALSE); break; } + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), TRUE); contactName = cli.pfnGetContactDisplayName( hContact, 0 ); - hDbEvent=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,sel,0); - ZeroMemory(&dbei,sizeof(dbei)); + hDbEvent=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, sel, 0); + ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize=sizeof(dbei); - dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0); + dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); if ((int)dbei.cbBlob != -1) { dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob); - if (CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei) == 0) + if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) == 0) { - GetObjectDescription(&dbei,str,SIZEOF(str)); + GetObjectDescription(&dbei, str, SIZEOF(str)); if ( str[0] ) SetDlgItemText(hwndDlg, IDC_EDIT, str); } @@ -362,39 +362,39 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP case DM_FINDNEXT: { TCHAR str[1024]; - HANDLE hDbEvent,hDbEventStart; + HANDLE hDbEvent, hDbEventStart; DBEVENTINFO dbei; - int newBlobSize,oldBlobSize; + int newBlobSize, oldBlobSize; - int index = SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETCURSEL,0,0); + int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0); if ( index == LB_ERR ) break; - hDbEventStart=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,index,0); - ZeroMemory(&dbei,sizeof(dbei)); + hDbEventStart=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0); + ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize=sizeof(dbei); dbei.pBlob=NULL; oldBlobSize=0; for (;;) { - hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,++index,0); + hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, ++index, 0); if (hDbEvent == ( HANDLE )LB_ERR) { index = -1; continue; } if (hDbEvent == hDbEventStart) break; - newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0); + newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); if (newBlobSize>oldBlobSize) { - dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob,newBlobSize); + dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob, newBlobSize); oldBlobSize=newBlobSize; } dbei.cbBlob=oldBlobSize; - CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei); - GetObjectDescription(&dbei,str,SIZEOF(str)); + CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei); + GetObjectDescription(&dbei, str, SIZEOF(str)); if (str[0]) { - CharUpperBuff(str,lstrlen(str)); - if ( _tcsstr(str,(const TCHAR*)lParam) != NULL) { - SendDlgItemMessage(hwndDlg,IDC_LIST,LB_SETCURSEL,index,0); - SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_LIST,LBN_SELCHANGE),0); + CharUpperBuff(str, lstrlen(str)); + if ( _tcsstr(str, (const TCHAR*)lParam) != NULL) { + SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0); + SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0); break; } } } @@ -420,8 +420,8 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam TCHAR str[128]; HWND hwndParent = ( HWND )GetWindowLongPtr(hwndDlg, GWLP_USERDATA); GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, SIZEOF(str)); - CharUpperBuff(str,lstrlen(str)); - SendMessage(hwndParent,DM_FINDNEXT,0,(LPARAM)str); + CharUpperBuff(str, lstrlen(str)); + SendMessage(hwndParent, DM_FINDNEXT, 0, (LPARAM)str); return TRUE; } case IDCANCEL: diff --git a/src/modules/icolib/IcoLib.h b/src/modules/icolib/IcoLib.h index 72e3aa4122..29bd85905b 100644 --- a/src/modules/icolib/IcoLib.h +++ b/src/modules/icolib/IcoLib.h @@ -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. diff --git a/src/modules/icolib/extracticon.cpp b/src/modules/icolib/extracticon.cpp index fae0a073fd..06025ad843 100644 --- a/src/modules/icolib/extracticon.cpp +++ b/src/modules/icolib/extracticon.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. @@ -253,7 +253,7 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC return 0; // failed to read file signature - if ( !ReadFile(hFile,&magic, sizeof(magic), &read, NULL ) || (read != sizeof(magic))) { + if ( !ReadFile(hFile, &magic, sizeof(magic), &read, NULL ) || (read != sizeof(magic))) { CloseHandle(hFile); return 0; } diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 5000607aaa..10e1ef58dc 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.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,7 +29,7 @@ static BOOL bModuleInitialized = FALSE; static HANDLE hIcons2ChangedEvent, hIconsChangedEvent; static HICON hIconBlank = NULL; -HANDLE hIcoLib_AddNewIcon, hIcoLib_RemoveIcon, hIcoLib_GetIcon, hIcoLib_GetIcon2, +HANDLE hIcoLib_AddNewIcon, hIcoLib_RemoveIcon, hIcoLib_GetIcon, hIcoLib_GetIcon2, hIcoLib_GetIconHandle, hIcoLib_IsManaged, hIcoLib_AddRef, hIcoLib_ReleaseIcon; static int iconEventActive = 0; @@ -363,7 +363,7 @@ IconSourceItem* GetIconSourceItemFromPath( const TCHAR* path, int cxIcon, int cy return NULL; lstrcpyn( file, path, SIZEOF( file )); - comma = _tcsrchr( file, ',' ); + comma = _tcsrchr( file, ', ' ); if ( !comma ) n = 0; else { @@ -429,7 +429,7 @@ static HICON ExtractIconFromPath( const TCHAR *path, int cxIcon, int cyIcon ) return (HICON)NULL; lstrcpyn( file, path, SIZEOF( file )); - comma = _tcsrchr( file, ',' ); + comma = _tcsrchr( file, ', ' ); if ( !comma ) n = 0; else { @@ -955,7 +955,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) HICON hIcon; int indx; - mir_sntprintf( path, SIZEOF(path), _T("%s,"), filename ); + mir_sntprintf( path, SIZEOF(path), _T("%s, "), filename ); suffIndx = lstrlen( path ); EnterCriticalSection( &csIconList ); @@ -1067,28 +1067,28 @@ static int OpenPopupMenu(HWND hwndDlg) static TCHAR* OpenFileDlg( HWND hParent, const TCHAR* szFile, BOOL bAll ) { OPENFILENAME ofn = {0}; - TCHAR filter[512],*pfilter,file[MAX_PATH*2]; + TCHAR filter[512], *pfilter, file[MAX_PATH*2]; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hParent; - lstrcpy(filter,TranslateT("Icon Sets")); + lstrcpy(filter, TranslateT("Icon Sets")); if (bAll) - lstrcat(filter,_T(" (*.dll;*.icl;*.exe;*.ico)")); + lstrcat(filter, _T(" (*.dll;*.icl;*.exe;*.ico)")); else - lstrcat(filter,_T(" (*.dll)")); + lstrcat(filter, _T(" (*.dll)")); pfilter=filter+lstrlen(filter)+1; if (bAll) - lstrcpy(pfilter,_T("*.DLL;*.ICL;*.EXE;*.ICO")); + lstrcpy(pfilter, _T("*.DLL;*.ICL;*.EXE;*.ICO")); else - lstrcpy(pfilter,_T("*.DLL")); + lstrcpy(pfilter, _T("*.DLL")); pfilter += lstrlen(pfilter) + 1; lstrcpy(pfilter, TranslateT("All Files")); - lstrcat(pfilter,_T(" (*)")); + lstrcat(pfilter, _T(" (*)")); pfilter += lstrlen(pfilter) + 1; - lstrcpy(pfilter,_T("*")); + lstrcpy(pfilter, _T("*")); pfilter += lstrlen(pfilter) + 1; *pfilter='\0'; @@ -1199,9 +1199,9 @@ static int IconDlg_Resize(HWND, LPARAM, UTILRESIZECONTROL *urc) INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - static HWND hwndParent,hwndDragOver; + static HWND hwndParent, hwndDragOver; static int dragging; - static int dragItem,dropHiLite; + static int dragItem, dropHiLite; static HWND hPreview = NULL; switch (msg) { @@ -1210,37 +1210,37 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hwndParent = (HWND)lParam; hPreview = GetDlgItem(hwndDlg, IDC_PREVIEW); dragging = dragItem = 0; - ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,0,100), LVSIL_NORMAL); + ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 0, 100), LVSIL_NORMAL); ListView_SetIconSpacing(hPreview, 56, 67); { RECT rcThis, rcParent; int cxScreen = GetSystemMetrics(SM_CXSCREEN); - GetWindowRect(hwndDlg,&rcThis); - GetWindowRect(hwndParent,&rcParent); - OffsetRect(&rcThis,rcParent.right-rcThis.left,0); - OffsetRect(&rcThis,0,rcParent.top-rcThis.top); - GetWindowRect(GetParent(hwndParent),&rcParent); + GetWindowRect(hwndDlg, &rcThis); + GetWindowRect(hwndParent, &rcParent); + OffsetRect(&rcThis, rcParent.right-rcThis.left, 0); + OffsetRect(&rcThis, 0, rcParent.top-rcThis.top); + GetWindowRect(GetParent(hwndParent), &rcParent); if (rcThis.right > cxScreen) { - OffsetRect(&rcParent,cxScreen-rcThis.right,0); - OffsetRect(&rcThis,cxScreen-rcThis.right,0); - MoveWindow(GetParent(hwndParent),rcParent.left,rcParent.top,rcParent.right-rcParent.left,rcParent.bottom-rcParent.top,TRUE); + OffsetRect(&rcParent, cxScreen-rcThis.right, 0); + OffsetRect(&rcThis, cxScreen-rcThis.right, 0); + MoveWindow(GetParent(hwndParent), rcParent.left, rcParent.top, rcParent.right-rcParent.left, rcParent.bottom-rcParent.top, TRUE); } - MoveWindow(hwndDlg,rcThis.left,rcThis.top,rcThis.right-rcThis.left,rcThis.bottom-rcThis.top,FALSE); + MoveWindow(hwndDlg, rcThis.left, rcThis.top, rcThis.right-rcThis.left, rcThis.bottom-rcThis.top, FALSE); GetClientRect(hwndDlg, &rcThis); SendMessage(hwndDlg, WM_SIZE, 0, MAKELPARAM(rcThis.right-rcThis.left, rcThis.bottom-rcThis.top)); } - if (shAutoComplete) shAutoComplete(GetDlgItem(hwndDlg,IDC_ICONSET), 1); - SetDlgItemText(hwndDlg,IDC_ICONSET,_T("icons.dll")); + if (shAutoComplete) shAutoComplete(GetDlgItem(hwndDlg, IDC_ICONSET), 1); + SetDlgItemText(hwndDlg, IDC_ICONSET, _T("icons.dll")); return TRUE; case DM_REBUILDICONSPREVIEW: { LVITEM lvi; - TCHAR filename[MAX_PATH],caption[64]; + TCHAR filename[MAX_PATH], caption[64]; HIMAGELIST hIml; - int count,i; + int count, i; HICON hIcon; MySetCursor(IDC_WAIT); @@ -1249,14 +1249,14 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ImageList_RemoveAll(hIml); GetDlgItemText(hwndDlg, IDC_ICONSET, filename, SIZEOF(filename)); { - RECT rcPreview,rcGroup; + RECT rcPreview, rcGroup; GetWindowRect(hPreview, &rcPreview); - GetWindowRect(GetDlgItem(hwndDlg,IDC_IMPORTMULTI),&rcGroup); - //SetWindowPos(hPreview,0,0,0,rcPreview.right-rcPreview.left,rcGroup.bottom-rcPreview.top,SWP_NOZORDER|SWP_NOMOVE); + GetWindowRect(GetDlgItem(hwndDlg, IDC_IMPORTMULTI), &rcGroup); + //SetWindowPos(hPreview, 0, 0, 0, rcPreview.right-rcPreview.left, rcGroup.bottom-rcPreview.top, SWP_NOZORDER|SWP_NOMOVE); } - if (_taccess(filename,0) != 0) { + if (_taccess(filename, 0) != 0) { MySetCursor(IDC_ARROW); break; } @@ -1264,12 +1264,12 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM; lvi.iSubItem = 0; lvi.iItem = 0; - count = (int)_ExtractIconEx( filename, -1, 16,16, NULL, LR_DEFAULTCOLOR ); + count = (int)_ExtractIconEx( filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR ); for (i = 0; i < count; lvi.iItem++, i++) { mir_sntprintf(caption, SIZEOF(caption), _T("%d"), i+1); lvi.pszText = caption; //hIcon = ExtractIcon(hMirandaInst, filename, i); - _ExtractIconEx( filename, i, 16,16, &hIcon, LR_DEFAULTCOLOR ); + _ExtractIconEx( filename, i, 16, 16, &hIcon, LR_DEFAULTCOLOR ); lvi.iImage = ImageList_AddIcon(hIml, hIcon); DestroyIcon(hIcon); lvi.lParam = i; @@ -1286,9 +1286,9 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR str[MAX_PATH]; TCHAR *file; - GetDlgItemText(hwndDlg,IDC_ICONSET,str,SIZEOF(str)); + GetDlgItemText(hwndDlg, IDC_ICONSET, str, SIZEOF(str)); if (!(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE))) break; - SetDlgItemText(hwndDlg,IDC_ICONSET,file); + SetDlgItemText(hwndDlg, IDC_ICONSET, file); SAFE_FREE(( void** )&file ); } break; @@ -1358,7 +1358,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ImageList_EndDrag(); dragging = 0; if (dropHiLite != -1) { - TCHAR path[MAX_PATH],fullPath[MAX_PATH],filename[MAX_PATH]; + TCHAR path[MAX_PATH], fullPath[MAX_PATH], filename[MAX_PATH]; LVITEM lvi; GetDlgItemText(hwndDlg, IDC_ICONSET, fullPath, SIZEOF(fullPath)); @@ -1366,7 +1366,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lvi.mask=LVIF_PARAM; lvi.iItem = dragItem; lvi.iSubItem = 0; ListView_GetItem(hPreview, &lvi); - mir_sntprintf(path, MAX_PATH, _T("%s,%d"), filename, (int)lvi.lParam); + mir_sntprintf(path, MAX_PATH, _T("%s, %d"), filename, (int)lvi.lParam); SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path); ListView_SetItemState(GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED); } } @@ -1399,7 +1399,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_CLOSE: DestroyWindow(hwndDlg); - EnableWindow(GetDlgItem(hwndParent,IDC_IMPORT),TRUE); + EnableWindow(GetDlgItem(hwndParent, IDC_IMPORT), TRUE); break; case WM_SIZE: @@ -1499,7 +1499,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // ListView_SetUnicodeFormat(hPreview, TRUE); ListView_SetExtendedListViewStyleEx(hPreview, LVS_EX_INFOTIP, LVS_EX_INFOTIP); - ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,0,30), LVSIL_NORMAL); + ListView_SetImageList(hPreview, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 0, 30), LVSIL_NORMAL); ListView_SetIconSpacing(hPreview, 56, 67); SendMessage(hwndDlg, DM_REBUILD_CTREE, 0, 0); @@ -1790,7 +1790,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( item->temp_file ) _tcsncpy( pInfoTip->pszText, item->temp_file, pInfoTip->cchTextMax ); else if ( item->default_file ) - mir_sntprintf( pInfoTip->pszText, pInfoTip->cchTextMax, _T("%s,%d"), item->default_file, item->default_indx ); + mir_sntprintf( pInfoTip->pszText, pInfoTip->cchTextMax, _T("%s, %d"), item->default_file, item->default_indx ); } } if ( bNeedRebuild ) { @@ -1857,7 +1857,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM static UINT iconsExpertOnlyControls[]={IDC_IMPORT}; -static int SkinOptionsInit( WPARAM wParam,LPARAM ) +static int SkinOptionsInit( WPARAM wParam, LPARAM ) { OPTIONSDIALOGPAGE odp = {0}; @@ -1916,7 +1916,7 @@ int LoadIcoLibModule(void) { bModuleInitialized = TRUE; - hIconBlank = LoadIconEx(NULL, MAKEINTRESOURCE(IDI_BLANK),0); + hIconBlank = LoadIconEx(NULL, MAKEINTRESOURCE(IDI_BLANK), 0); InitializeCriticalSection(&csIconList); hIcoLib_AddNewIcon = CreateServiceFunction(MS_SKIN2_ADDICON, sttIcoLib_AddNewIcon); diff --git a/src/modules/idle/idle.cpp b/src/modules/idle/idle.cpp index 8ac510b29a..96c71161da 100644 --- a/src/modules/idle/idle.cpp +++ b/src/modules/idle/idle.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2005 Miranda ICQ/IM project, +Copyright 2000-2005 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. @@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define IdleObject_SetIdle(obj) (obj->state|=0x1) #define IdleObject_ClearIdle(obj) (obj->state&=~0x1) -// either use meth 0,1 or figure out which one +// either use meth 0, 1 or figure out which one #define IdleObject_UseMethod0(obj) (obj->state&=~0x2) #define IdleObject_UseMethod1(obj) (obj->state|=0x2) #define IdleObject_GetMethod(obj) (obj->state&0x2) @@ -84,23 +84,23 @@ typedef enum _WTS_CONNECTSTATE_CLASS { typedef enum _WTS_INFO_CLASS { - WTSInitialProgram, - WTSApplicationName, - WTSWorkingDirectory, - WTSOEMId, - WTSSessionId, - WTSUserName, - WTSWinStationName, - WTSDomainName, - WTSConnectState, - WTSClientBuildNumber, - WTSClientName, - WTSClientDirectory, - WTSClientProductId, - WTSClientHardwareId, - WTSClientAddress, - WTSClientDisplay, - WTSClientProtocolType, + WTSInitialProgram, + WTSApplicationName, + WTSWorkingDirectory, + WTSOEMId, + WTSSessionId, + WTSUserName, + WTSWinStationName, + WTSDomainName, + WTSConnectState, + WTSClientBuildNumber, + WTSClientName, + WTSClientDirectory, + WTSClientProductId, + WTSClientHardwareId, + WTSClientAddress, + WTSClientDisplay, + WTSClientProtocolType, } WTS_INFO_CLASS; #endif @@ -208,7 +208,7 @@ static int IdleObject_IsUserIdle(IdleObject * obj) if ( MyGetLastInputInfo != NULL ) { LASTINPUTINFO ii; - ZeroMemory(&ii,sizeof(ii)); + ZeroMemory(&ii, sizeof(ii)); ii.cbSize=sizeof(ii); if ( MyGetLastInputInfo(&ii) ) return GetTickCount() - ii.dwTime > (obj->minutes * 60 * 1000); @@ -349,23 +349,23 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_INITDIALOG: { int j; - int method = DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLEMETHOD, 0); + int method = DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEMETHOD, 0); TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_IDLESHORT, DBGetContactSettingByte(NULL,IDLEMOD,IDL_USERIDLECHECK,0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IDLESHORT, DBGetContactSettingByte(NULL, IDLEMOD, IDL_USERIDLECHECK, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_IDLEONWINDOWS, method == 0 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_IDLEONMIRANDA, method ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SCREENSAVER, DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLEONSAVER,0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FULLSCREEN, DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLEONFULLSCR,0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LOCKED, DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLEONLOCK,0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IDLEPRIVATE, DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLEPRIVATE,0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IDLESTATUSLOCK, DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLESTATUSLOCK,0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SCREENSAVER, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONSAVER, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FULLSCREEN, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONFULLSCR, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_LOCKED, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONLOCK, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IDLEPRIVATE, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEPRIVATE, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IDLESTATUSLOCK, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLESTATUSLOCK, 0) ? BST_CHECKED : BST_UNCHECKED); if ( !bIsWTSApiPresent ) EnableWindow( GetDlgItem( hwndDlg, IDC_IDLETERMINAL ), FALSE ); else - CheckDlgButton(hwndDlg, IDC_IDLETERMINAL, DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLEONTSDC,0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IDLETERMINAL, DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLEONTSDC, 0) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_IDLE1STTIME), 0); SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETRANGE32, 1, 60); - SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETPOS, 0, MAKELONG((short) DBGetContactSettingByte(NULL,IDLEMOD,IDL_IDLETIME1ST, 10), 0)); + SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETPOS, 0, MAKELONG((short) DBGetContactSettingByte(NULL, IDLEMOD, IDL_IDLETIME1ST, 10), 0)); SendDlgItemMessage(hwndDlg, IDC_IDLE1STTIME, EM_LIMITTEXT, (WPARAM)2, 0); CheckDlgButton(hwndDlg, IDC_AASHORTIDLE, DBGetContactSettingByte(NULL, IDLEMOD, IDL_AAENABLE, 0) ? BST_CHECKED:BST_UNCHECKED); @@ -476,7 +476,7 @@ static int IdleModernOptInit(WPARAM wParam, LPARAM) { static const int iBoldControls[] = { - IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, + IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, MODERNOPT_CTRL_LAST }; diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 17c62f00cd..2c3ca8ba78 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -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. @@ -24,84 +24,84 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define IGNOREEVENT_MAX 7 -static const DWORD ignoreIdToPf1[IGNOREEVENT_MAX]={PF1_IMRECV,PF1_URLRECV,PF1_FILERECV,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; -static const DWORD ignoreIdToPf4[IGNOREEVENT_MAX]={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,PF4_SUPPORTTYPING}; +static const DWORD ignoreIdToPf1[IGNOREEVENT_MAX]={PF1_IMRECV, PF1_URLRECV, PF1_FILERECV, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; +static const DWORD ignoreIdToPf4[IGNOREEVENT_MAX]={0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, PF4_SUPPORTTYPING}; static DWORD GetMask(HANDLE hContact) { - DWORD mask=DBGetContactSettingDword(hContact,"Ignore","Mask1",(DWORD)(-1)); + DWORD mask=DBGetContactSettingDword(hContact, "Ignore", "Mask1", (DWORD)(-1)); if (mask == (DWORD)(-1)) { if (hContact == NULL) mask=0; else { - if (DBGetContactSettingByte(hContact,"CList","Hidden",0) || DBGetContactSettingByte(hContact,"CList","NotOnList",0)) - mask=DBGetContactSettingDword(NULL,"Ignore","Mask1",0); + if (DBGetContactSettingByte(hContact, "CList", "Hidden", 0) || DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) + mask=DBGetContactSettingDword(NULL, "Ignore", "Mask1", 0); else - mask=DBGetContactSettingDword(NULL,"Ignore","Default1",0); + mask=DBGetContactSettingDword(NULL, "Ignore", "Default1", 0); } } return mask; } -static void SetListGroupIcons(HWND hwndList,HANDLE hFirstItem,HANDLE hParentItem,int *groupChildCount) +static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount) { int typeOfFirst; - int iconOn[IGNOREEVENT_MAX]={1,1,1,1,1,1,1}; - int childCount[IGNOREEVENT_MAX]={0,0,0,0,0,0,0},i; + int iconOn[IGNOREEVENT_MAX]={1, 1, 1, 1, 1, 1, 1}; + int childCount[IGNOREEVENT_MAX]={0, 0, 0, 0, 0, 0, 0}, i; int iImage; - HANDLE hItem,hChildItem; + HANDLE hItem, hChildItem; - typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0); + typeOfFirst=SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0); //check groups if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem); while (hItem) { - hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); - if (hChildItem) SetListGroupIcons(hwndList,hChildItem,hItem,childCount); + hChildItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount); for (i=0; i < SIZEOF(iconOn); i++) - if (iconOn[i] && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i) == 0) iconOn[i]=0; - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem); + if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0) iconOn[i]=0; + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem); } //check contacts if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem); while (hItem) { for ( i=0; i < SIZEOF(iconOn); i++ ) { - iImage=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i); + iImage=SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i); if (iconOn[i] && iImage == 0) iconOn[i]=0; if (iImage != 0xFF) childCount[i]++; } - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem); + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem); } //set icons for ( i=0; i < SIZEOF(iconOn); i++ ) { - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hParentItem,MAKELPARAM(i,childCount[i]?(iconOn[i]?i+3:0):0xFF)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+3:0):0xFF)); if (groupChildCount) groupChildCount[i]+=childCount[i]; } - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hParentItem,MAKELPARAM(IGNOREEVENT_MAX,1)); - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hParentItem,MAKELPARAM(IGNOREEVENT_MAX+1,2)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(IGNOREEVENT_MAX, 1)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(IGNOREEVENT_MAX+1, 2)); } -static void SetAllChildIcons(HWND hwndList,HANDLE hFirstItem,int iColumn,int iImage) +static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage) { - int typeOfFirst,iOldIcon; - HANDLE hItem,hChildItem; + int typeOfFirst, iOldIcon; + HANDLE hItem, hChildItem; - typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0); + typeOfFirst=SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0); //check groups if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem); while (hItem) { - hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); - if (hChildItem) SetAllChildIcons(hwndList,hChildItem,iColumn,iImage); - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem); + hChildItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hChildItem) SetAllChildIcons(hwndList, hChildItem, iColumn, iImage); + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem); } //check contacts if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem); while (hItem) { - iOldIcon=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); - if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem); + iOldIcon=SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn); + if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage)); + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem); } } @@ -109,37 +109,37 @@ static void ResetListOptions(HWND hwndList) { int i; - SendMessage(hwndList,CLM_SETBKBITMAP,0,(LPARAM)(HBITMAP)NULL); - SendMessage(hwndList,CLM_SETBKCOLOR,GetSysColor(COLOR_WINDOW),0); - SendMessage(hwndList,CLM_SETGREYOUTFLAGS,0,0); - SendMessage(hwndList,CLM_SETLEFTMARGIN,4,0); - SendMessage(hwndList,CLM_SETINDENT,10,0); - SendMessage(hwndList,CLM_SETHIDEEMPTYGROUPS,1,0); + SendMessage(hwndList, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP)NULL); + SendMessage(hwndList, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0); + SendMessage(hwndList, CLM_SETGREYOUTFLAGS, 0, 0); + SendMessage(hwndList, CLM_SETLEFTMARGIN, 4, 0); + SendMessage(hwndList, CLM_SETINDENT, 10, 0); + SendMessage(hwndList, CLM_SETHIDEEMPTYGROUPS, 1, 0); for (i=0;i<=FONTID_MAX;i++) - SendMessage(hwndList,CLM_SETTEXTCOLOR,i,GetSysColor(COLOR_WINDOWTEXT)); + SendMessage(hwndList, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT)); } -static void SetIconsForColumn(HWND hwndList,HANDLE hItem,HANDLE hItemAll,int iColumn,int iImage) +static void SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int iColumn, int iImage) { int itemType; - itemType=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hItem,0); + itemType=SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hItem, 0); if (itemType == CLCIT_CONTACT) { - int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); + int oldiImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn); if (oldiImage != 0xFF&&oldiImage != iImage) - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage)); } else if (itemType == CLCIT_INFO) { - if (hItem == hItemAll) SetAllChildIcons(hwndList,hItem,iColumn,iImage); - else SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); //hItemUnknown + if (hItem == hItemAll) SetAllChildIcons(hwndList, hItem, iColumn, iImage); + else SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage)); //hItemUnknown } else if (itemType == CLCIT_GROUP) { - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); - if (hItem) SetAllChildIcons(hwndList,hItem,iColumn,iImage); + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItem) SetAllChildIcons(hwndList, hItem, iColumn, iImage); } } -static void InitialiseItem(HWND hwndList,HANDLE hContact,HANDLE hItem,DWORD proto1Caps,DWORD proto4Caps) +static void InitialiseItem(HWND hwndList, HANDLE hContact, HANDLE hItem, DWORD proto1Caps, DWORD proto4Caps) { DWORD mask; int i; @@ -147,51 +147,51 @@ static void InitialiseItem(HWND hwndList,HANDLE hContact,HANDLE hItem,DWORD prot mask=GetMask(hContact); for (i=0;iidFrom) { @@ -258,13 +258,13 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM { case CLN_NEWCONTACT: case CLN_LISTREBUILT: - SetAllContactIcons(GetDlgItem(hwndDlg,IDC_LIST)); + SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST)); //fall through case CLN_CONTACTMOVED: - SetListGroupIcons(GetDlgItem(hwndDlg,IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL); + SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL); break; case CLN_OPTIONSCHANGED: - ResetListOptions(GetDlgItem(hwndDlg,IDC_LIST)); + ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST)); break; case CLN_CHECKCHANGED: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -276,24 +276,24 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM int iImage; if (nm->iColumn == -1) break; - hItem=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y)); + hItem=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y)); if (hItem == NULL) break; if (!(hitFlags&CLCHT_ONITEMEXTRA)) break; if (nm->iColumn == IGNOREEVENT_MAX) { //ignore all for (iImage=0;iImageiColumn == IGNOREEVENT_MAX+1) { //ignore none for (iImage=0;iImageiColumn,0)); + iImage=SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0)); if (iImage == 0) iImage=nm->iColumn+3; else if (iImage != 0xFF) iImage=0; - SetIconsForColumn(GetDlgItem(hwndDlg,IDC_LIST),hItem,hItemAll,nm->iColumn,iImage); + SetIconsForColumn(GetDlgItem(hwndDlg, IDC_LIST), hItem, hItemAll, nm->iColumn, iImage); } - SetListGroupIcons(GetDlgItem(hwndDlg,IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL); + SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } @@ -303,24 +303,24 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - { HANDLE hContact,hItem; + { HANDLE hContact, hItem; - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); do { - hItem=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_FINDCONTACT,(WPARAM)hContact,0); - if (hItem) SaveItemMask(GetDlgItem(hwndDlg,IDC_LIST),hContact,hItem,"Mask1"); - if (SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETCHECKMARK,(WPARAM)hItem,0)) - DBDeleteContactSetting(hContact,"CList","Hidden"); + hItem=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); + if (hItem) SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), hContact, hItem, "Mask1"); + if (SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) + DBDeleteContactSetting(hContact, "CList", "Hidden"); else - DBWriteContactSettingByte(hContact,"CList","Hidden",1); - } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); - SaveItemMask(GetDlgItem(hwndDlg,IDC_LIST),NULL,hItemAll,"Default1"); - SaveItemMask(GetDlgItem(hwndDlg,IDC_LIST),NULL,hItemUnknown,"Mask1"); + DBWriteContactSettingByte(hContact, "CList", "Hidden", 1); + } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)); + SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemAll, "Default1"); + SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemUnknown, "Mask1"); return TRUE; } case PSN_EXPERTCHANGED: - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_LIST),GWL_STYLE,((PSHNOTIFY*)lParam)->lParam?GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_LIST),GWL_STYLE)|CLS_CHECKBOXES|CLS_GROUPCHECKBOXES|CLS_SHOWHIDDEN:GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_LIST),GWL_STYLE)&~(CLS_CHECKBOXES|CLS_GROUPCHECKBOXES|CLS_SHOWHIDDEN)); - SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_AUTOREBUILD,0,0); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE, ((PSHNOTIFY*)lParam)->lParam?GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE)|CLS_CHECKBOXES|CLS_GROUPCHECKBOXES|CLS_SHOWHIDDEN:GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE)&~(CLS_CHECKBOXES|CLS_GROUPCHECKBOXES|CLS_SHOWHIDDEN)); + SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_AUTOREBUILD, 0, 0); break; } break; @@ -331,7 +331,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM HIMAGELIST hIml; for ( i=0; i < SIZEOF(hIcons); i++ ) DestroyIcon(hIcons[i]); - hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGELIST,0,0); + hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0); ImageList_Destroy(hIml); break; } @@ -357,61 +357,61 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM) return 0; } -static INT_PTR IsIgnored(WPARAM wParam,LPARAM lParam) +static INT_PTR IsIgnored(WPARAM wParam, LPARAM lParam) { DWORD mask=GetMask((HANDLE)wParam); if (lParam<1 || lParam>IGNOREEVENT_MAX) return 1; return (mask>>(lParam-1))&1; } -static INT_PTR Ignore(WPARAM wParam,LPARAM lParam) +static INT_PTR Ignore(WPARAM wParam, LPARAM lParam) { DWORD mask=GetMask((HANDLE)wParam); if ((lParam<1 || lParam>IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL) return 1; if (lParam == IGNOREEVENT_ALL) mask=(1<IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL) return 1; if (lParam == IGNOREEVENT_ALL) mask=0; else mask&=~(1<<(lParam-1)); - DBWriteContactSettingDword((HANDLE)wParam,"Ignore","Mask1",mask); + DBWriteContactSettingDword((HANDLE)wParam, "Ignore", "Mask1", mask); return 0; } static int IgnoreContactAdded(WPARAM wParam, LPARAM) { - CallService(MS_PROTO_ADDTOCONTACT,wParam,(LPARAM)"Ignore"); + CallService(MS_PROTO_ADDTOCONTACT, wParam, (LPARAM)"Ignore"); return 0; } -static INT_PTR IgnoreRecvMessage(WPARAM wParam,LPARAM lParam) +static INT_PTR IgnoreRecvMessage(WPARAM wParam, LPARAM lParam) { - if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact,IGNOREEVENT_MESSAGE)) return 1; - return CallService(MS_PROTO_CHAINRECV,wParam,lParam); + if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_MESSAGE)) return 1; + return CallService(MS_PROTO_CHAINRECV, wParam, lParam); } -static INT_PTR IgnoreRecvUrl(WPARAM wParam,LPARAM lParam) +static INT_PTR IgnoreRecvUrl(WPARAM wParam, LPARAM lParam) { - if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact,IGNOREEVENT_URL)) return 1; - return CallService(MS_PROTO_CHAINRECV,wParam,lParam); + if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_URL)) return 1; + return CallService(MS_PROTO_CHAINRECV, wParam, lParam); } -static INT_PTR IgnoreRecvFile(WPARAM wParam,LPARAM lParam) +static INT_PTR IgnoreRecvFile(WPARAM wParam, LPARAM lParam) { - if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact,IGNOREEVENT_FILE)) return 1; - return CallService(MS_PROTO_CHAINRECV,wParam,lParam); + if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_FILE)) return 1; + return CallService(MS_PROTO_CHAINRECV, wParam, lParam); } -static INT_PTR IgnoreRecvAuth(WPARAM wParam,LPARAM lParam) +static INT_PTR IgnoreRecvAuth(WPARAM wParam, LPARAM lParam) { - if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact,IGNOREEVENT_AUTHORIZATION)) return 1; - return CallService(MS_PROTO_CHAINRECV,wParam,lParam); + if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_AUTHORIZATION)) return 1; + return CallService(MS_PROTO_CHAINRECV, wParam, lParam); } static int IgnoreAddedNotify(WPARAM, LPARAM lParam) @@ -421,7 +421,7 @@ static int IgnoreAddedNotify(WPARAM, LPARAM lParam) HANDLE hContact; hContact=*((PHANDLE)(dbei->pBlob+sizeof(DWORD))); - if (CallService(MS_DB_CONTACT_IS,(WPARAM)hContact,0) && IsIgnored((WPARAM)hContact,IGNOREEVENT_YOUWEREADDED)) + if (CallService(MS_DB_CONTACT_IS, (WPARAM)hContact, 0) && IsIgnored((WPARAM)hContact, IGNOREEVENT_YOUWEREADDED)) return 1; } return 0; @@ -431,7 +431,7 @@ static int IgnoreModernOptInit(WPARAM wParam, LPARAM) { static int iBoldControls[] = { - IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, + IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, MODERNOPT_CTRL_LAST }; @@ -456,26 +456,26 @@ int LoadIgnoreModule(void) pd.cbSize=sizeof(pd); pd.szName="Ignore"; pd.type=PROTOTYPE_IGNORE; - CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); - HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while ( hContact != NULL ) { - if (!CallService(MS_PROTO_ISPROTOONCONTACT,(WPARAM)hContact,(LPARAM)"Ignore")) - CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)"Ignore"); - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); + if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)"Ignore")) + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)"Ignore"); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); } - CreateServiceFunction("Ignore"PSR_MESSAGE,IgnoreRecvMessage); - CreateServiceFunction("Ignore"PSR_URL,IgnoreRecvUrl); - CreateServiceFunction("Ignore"PSR_FILE,IgnoreRecvFile); - CreateServiceFunction("Ignore"PSR_AUTH,IgnoreRecvAuth); - CreateServiceFunction(MS_IGNORE_ISIGNORED,IsIgnored); - CreateServiceFunction(MS_IGNORE_IGNORE,Ignore); - CreateServiceFunction(MS_IGNORE_UNIGNORE,Unignore); + CreateServiceFunction("Ignore"PSR_MESSAGE, IgnoreRecvMessage); + CreateServiceFunction("Ignore"PSR_URL, IgnoreRecvUrl); + CreateServiceFunction("Ignore"PSR_FILE, IgnoreRecvFile); + CreateServiceFunction("Ignore"PSR_AUTH, IgnoreRecvAuth); + CreateServiceFunction(MS_IGNORE_ISIGNORED, IsIgnored); + CreateServiceFunction(MS_IGNORE_IGNORE, Ignore); + CreateServiceFunction(MS_IGNORE_UNIGNORE, Unignore); - HookEvent(ME_DB_CONTACT_ADDED,IgnoreContactAdded); - HookEvent(ME_DB_EVENT_FILTER_ADD,IgnoreAddedNotify); + HookEvent(ME_DB_CONTACT_ADDED, IgnoreContactAdded); + HookEvent(ME_DB_EVENT_FILTER_ADD, IgnoreAddedNotify); HookEvent(ME_MODERNOPT_INITIALIZE, IgnoreModernOptInit); - HookEvent(ME_OPT_INITIALISE,IgnoreOptInitialise); + HookEvent(ME_OPT_INITIALISE, IgnoreOptInitialise); return 0; } diff --git a/src/modules/langpack/langpack.cpp b/src/modules/langpack/langpack.cpp index 5013361393..71b0dddaf9 100644 --- a/src/modules/langpack/langpack.cpp +++ b/src/modules/langpack/langpack.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. @@ -153,7 +153,7 @@ unsigned int __fastcall hashstrW(const char * key) return hash(buf, len); } -static int SortLangPackHashesProc(LangPackEntry *arg1,LangPackEntry *arg2) +static int SortLangPackHashesProc(LangPackEntry *arg1, LangPackEntry *arg2) { if (arg1->englishHash < arg2->englishHash) return -1; if (arg1->englishHash > arg2->englishHash) return 1; @@ -333,7 +333,7 @@ static int LoadLangPack(const TCHAR *szLangPack) if ( p ) p[1] = 0; - FILE *fp = _tfopen(szLangPack,_T("rt")); + FILE *fp = _tfopen(szLangPack, _T("rt")); if ( fp == NULL ) return 1; @@ -367,17 +367,17 @@ static int LoadLangPack(const TCHAR *szLangPack) if ( line[0] == '[' || line[0] == '#' ) break; - char* pszColon = strchr( line,':' ); + char* pszColon = strchr( line, ':' ); if ( pszColon == NULL ) { fclose( fp ); return 3; } *pszColon++ = 0; - if (!lstrcmpA(line,"Language")) {mir_snprintf(langPack.language,sizeof(langPack.language),"%s",pszColon); lrtrim(langPack.language);} - else if (!lstrcmpA(line,"Last-Modified-Using")) {mir_snprintf(langPack.lastModifiedUsing,sizeof(langPack.lastModifiedUsing),"%s",pszColon); lrtrim(langPack.lastModifiedUsing);} - else if (!lstrcmpA(line,"Authors")) {mir_snprintf(langPack.authors,sizeof(langPack.authors),"%s",pszColon); lrtrim(langPack.authors);} - else if (!lstrcmpA(line,"Author-email")) {mir_snprintf(langPack.authorEmail,sizeof(langPack.authorEmail),"%s",pszColon); lrtrim(langPack.authorEmail);} + if (!lstrcmpA(line, "Language")) {mir_snprintf(langPack.language, sizeof(langPack.language), "%s", pszColon); lrtrim(langPack.language);} + else if (!lstrcmpA(line, "Last-Modified-Using")) {mir_snprintf(langPack.lastModifiedUsing, sizeof(langPack.lastModifiedUsing), "%s", pszColon); lrtrim(langPack.lastModifiedUsing);} + else if (!lstrcmpA(line, "Authors")) {mir_snprintf(langPack.authors, sizeof(langPack.authors), "%s", pszColon); lrtrim(langPack.authors);} + else if (!lstrcmpA(line, "Author-email")) {mir_snprintf(langPack.authorEmail, sizeof(langPack.authorEmail), "%s", pszColon); lrtrim(langPack.authorEmail);} else if (!lstrcmpA(line, "Locale")) { char szBuf[20], *stopped; @@ -399,13 +399,13 @@ static int LoadLangPack(const TCHAR *szLangPack) LoadLangPackFile( fp, line, fileCp ); fclose(fp); - qsort(langPack.entry,langPack.entryCount,sizeof(LangPackEntry),(int(*)(const void*,const void*))SortLangPackHashesProc); + qsort(langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc); return 0; } ///////////////////////////////////////////////////////////////////////////////////////// -static int SortLangPackHashesProc2(LangPackEntry *arg1,LangPackEntry *arg2) +static int SortLangPackHashesProc2(LangPackEntry *arg1, LangPackEntry *arg2) { if (arg1->englishHash < arg2->englishHash) return -1; if (arg1->englishHash > arg2->englishHash) return 1; @@ -417,9 +417,9 @@ char *LangPackTranslateString(LangPackMuuid* pUuid, const char *szEnglish, const if ( langPack.entryCount == 0 || szEnglish == NULL ) return (char*)szEnglish; - LangPackEntry key,*entry; + LangPackEntry key, *entry; key.englishHash = W ? hashstrW(szEnglish) : hashstr(szEnglish); - entry = (LangPackEntry*)bsearch(&key, langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*,const void*))SortLangPackHashesProc2 ); + entry = (LangPackEntry*)bsearch(&key, langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc2 ); if ( entry == NULL ) return (char*)szEnglish; @@ -511,7 +511,7 @@ void LangPackDropUnusedItems( void ) if ( bSortNeeded ) { langPack.entryCount = ( int )( d - langPack.entry ); - qsort(langPack.entry,langPack.entryCount,sizeof(LangPackEntry),(int(*)(const void*,const void*))SortLangPackHashesProc); + qsort(langPack.entry, langPack.entryCount, sizeof(LangPackEntry), (int(*)(const void*, const void*))SortLangPackHashesProc); } } @@ -525,7 +525,7 @@ int LoadLangPackModule(void) bModuleInitialized = TRUE; - ZeroMemory(&langPack,sizeof(langPack)); + ZeroMemory(&langPack, sizeof(langPack)); LoadLangPackServices(); pathToAbsoluteT(_T("langpack_*.txt"), szSearch, NULL); hFind = FindFirstFile( szSearch, &fd ); diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index 69d416330b..0de43ecb6a 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -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,7 +33,7 @@ int LangPackMarkPluginLoaded( PLUGININFOEX* pInfo ); ///////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR TranslateString(WPARAM wParam,LPARAM lParam) +static INT_PTR TranslateString(WPARAM wParam, LPARAM lParam) { return (INT_PTR)LangPackTranslateString( LangPackLookupUuid(wParam), (const char *)lParam, (wParam & LANG_UNICODE) ? 1 : 0); } @@ -80,11 +80,11 @@ static void TranslateWindow( LangPackMuuid* pUuid, HWND hwnd ) SetWindowText(hwnd, result ); } } -static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd,LPARAM lParam) +static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam) { LANGPACKTRANSLATEDIALOG *lptd = (LANGPACKTRANSLATEDIALOG*)lParam; TCHAR szClass[32]; - int i,id = GetDlgCtrlID( hwnd ); + int i, id = GetDlgCtrlID( hwnd ); if ( lptd->ignoreControls != NULL ) for ( i=0; lptd->ignoreControls[i]; i++ ) @@ -94,10 +94,10 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd,LPARAM lParam) LangPackMuuid* uuid = LangPackLookupUuid( lptd->flags ); GetClassName( hwnd, szClass, SIZEOF(szClass)); - if (!lstrcmpi(szClass,_T("static")) || !lstrcmpi(szClass,_T("hyperlink")) || !lstrcmpi(szClass,_T("button")) || !lstrcmpi(szClass,_T("MButtonClass")) || !lstrcmpi(szClass,_T("MHeaderbarCtrl"))) + if (!lstrcmpi(szClass, _T("static")) || !lstrcmpi(szClass, _T("hyperlink")) || !lstrcmpi(szClass, _T("button")) || !lstrcmpi(szClass, _T("MButtonClass")) || !lstrcmpi(szClass, _T("MHeaderbarCtrl"))) TranslateWindow( uuid, hwnd ); - else if ( !lstrcmpi( szClass,_T("edit"))) { - if ( lptd->flags & LPTDF_NOIGNOREEDIT || GetWindowLongPtr(hwnd,GWL_STYLE) & ES_READONLY ) + else if ( !lstrcmpi( szClass, _T("edit"))) { + if ( lptd->flags & LPTDF_NOIGNOREEDIT || GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY ) TranslateWindow( uuid, hwnd ); } return TRUE; @@ -126,7 +126,7 @@ static INT_PTR LPRegister(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR GetDefaultCodePage(WPARAM,LPARAM) +static INT_PTR GetDefaultCodePage(WPARAM, LPARAM) { return LangPackGetDefaultCodePage(); } @@ -166,14 +166,14 @@ INT_PTR ReloadLangpack(WPARAM wParam, LPARAM lParam); int LoadLangPackServices(void) { - CreateServiceFunction(MS_LANGPACK_TRANSLATESTRING,TranslateString); - CreateServiceFunction(MS_LANGPACK_TRANSLATEMENU,TranslateMenu); - CreateServiceFunction(MS_LANGPACK_TRANSLATEDIALOG,TranslateDialog); - CreateServiceFunction(MS_LANGPACK_GETCODEPAGE,GetDefaultCodePage); - CreateServiceFunction(MS_LANGPACK_GETLOCALE,GetDefaultLocale); - CreateServiceFunction(MS_LANGPACK_PCHARTOTCHAR,PcharToTchar); - CreateServiceFunction(MS_LANGPACK_REGISTER,LPRegister); - CreateServiceFunction(MS_LANGPACK_RELOAD,ReloadLangpack); + CreateServiceFunction(MS_LANGPACK_TRANSLATESTRING, TranslateString); + CreateServiceFunction(MS_LANGPACK_TRANSLATEMENU, TranslateMenu); + CreateServiceFunction(MS_LANGPACK_TRANSLATEDIALOG, TranslateDialog); + CreateServiceFunction(MS_LANGPACK_GETCODEPAGE, GetDefaultCodePage); + CreateServiceFunction(MS_LANGPACK_GETLOCALE, GetDefaultLocale); + CreateServiceFunction(MS_LANGPACK_PCHARTOTCHAR, PcharToTchar); + CreateServiceFunction(MS_LANGPACK_REGISTER, LPRegister); + CreateServiceFunction(MS_LANGPACK_RELOAD, ReloadLangpack); return 0; } diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index 80e005ad7a..cb46c6d14d 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2012 Miranda ICQ/IM project, +Copyright 2000-2012 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. @@ -55,7 +55,7 @@ void NetlibInitializeNestedCS(struct NetlibNestedCriticalSection *nlncs) { nlncs->dwOwningThreadId= 0; nlncs->lockCount=0; - nlncs->hMutex=CreateMutex(NULL,FALSE,NULL); + nlncs->hMutex=CreateMutex(NULL, FALSE, NULL); } void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs) @@ -63,12 +63,12 @@ void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs) CloseHandle(nlncs->hMutex); } -int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which) +int NetlibEnterNestedCS(struct NetlibConnection *nlc, int which) { struct NetlibNestedCriticalSection *nlncs; DWORD dwCurrentThreadId=GetCurrentThreadId(); - WaitForSingleObject(hConnectionHeaderMutex,INFINITE); + WaitForSingleObject(hConnectionHeaderMutex, INFINITE); if (nlc == NULL || nlc->handleType != NLH_CONNECTION) { ReleaseMutex(hConnectionHeaderMutex); SetLastError(ERROR_INVALID_PARAMETER); @@ -83,7 +83,7 @@ int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which) InterlockedIncrement(&nlc->dontCloseNow); ResetEvent(nlc->hOkToCloseEvent); ReleaseMutex(hConnectionHeaderMutex); - WaitForSingleObject(nlncs->hMutex,INFINITE); + WaitForSingleObject(nlncs->hMutex, INFINITE); nlncs->dwOwningThreadId=dwCurrentThreadId; nlncs->lockCount=1; if (InterlockedDecrement(&nlc->dontCloseNow) == 0) @@ -99,22 +99,22 @@ void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs) } } -static INT_PTR GetNetlibUserSettingInt(const char *szUserModule,const char *szSetting,int defValue) +static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szSetting, int defValue) { DBVARIANT dbv; - if (DBGetContactSetting(NULL,szUserModule,szSetting,&dbv) - && DBGetContactSetting(NULL,"Netlib",szSetting,&dbv)) + if (DBGetContactSetting(NULL, szUserModule, szSetting, &dbv) + && DBGetContactSetting(NULL, "Netlib", szSetting, &dbv)) return defValue; if (dbv.type == DBVT_BYTE) return dbv.bVal; if (dbv.type == DBVT_WORD) return dbv.wVal; return dbv.dVal; } -static char *GetNetlibUserSettingString(const char *szUserModule,const char *szSetting,int decode) +static char *GetNetlibUserSettingString(const char *szUserModule, const char *szSetting, int decode) { DBVARIANT dbv; - if (DBGetContactSettingString(NULL,szUserModule,szSetting,&dbv) - && DBGetContactSettingString(NULL,"Netlib",szSetting,&dbv)) { + if (DBGetContactSettingString(NULL, szUserModule, szSetting, &dbv) + && DBGetContactSettingString(NULL, "Netlib", szSetting, &dbv)) { return NULL; } else { @@ -127,7 +127,7 @@ static char *GetNetlibUserSettingString(const char *szUserModule,const char *szS } } -static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam) +static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam) { NETLIBUSER *nlu=(NETLIBUSER*)lParam; struct NetlibUser *thisUser; @@ -170,28 +170,28 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam) thisUser->user.szHttpGatewayHello=NULL; thisUser->settings.cbSize=sizeof(NETLIBUSERSETTINGS); - thisUser->settings.useProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLUseProxy",0); - thisUser->settings.proxyType=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLProxyType",PROXYTYPE_SOCKS5); + thisUser->settings.useProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLUseProxy", 0); + thisUser->settings.proxyType=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyType", PROXYTYPE_SOCKS5); if (thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType == PROXYTYPE_HTTPS) thisUser->settings.proxyType=PROXYTYPE_HTTP; if (!(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) { thisUser->settings.useProxy=0; thisUser->settings.proxyType=PROXYTYPE_SOCKS5; } - thisUser->settings.szProxyServer=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLProxyServer",0); - thisUser->settings.wProxyPort=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLProxyPort",1080); - thisUser->settings.useProxyAuth=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLUseProxyAuth",0); - thisUser->settings.szProxyAuthUser=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLProxyAuthUser",0); - thisUser->settings.szProxyAuthPassword=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLProxyAuthPassword",1); - thisUser->settings.dnsThroughProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLDnsThroughProxy",1); - thisUser->settings.specifyIncomingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLSpecifyIncomingPorts",0); - thisUser->settings.szIncomingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLIncomingPorts",0); - thisUser->settings.specifyOutgoingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLSpecifyOutgoingPorts",0); - thisUser->settings.szOutgoingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLOutgoingPorts",0); - thisUser->settings.enableUPnP=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLEnableUPnP",1); //default to on - thisUser->settings.validateSSL=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLValidateSSL",0); - - thisUser->toLog=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLlog",1); + thisUser->settings.szProxyServer=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyServer", 0); + thisUser->settings.wProxyPort=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyPort", 1080); + thisUser->settings.useProxyAuth=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLUseProxyAuth", 0); + thisUser->settings.szProxyAuthUser=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthUser", 0); + thisUser->settings.szProxyAuthPassword=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthPassword", 1); + thisUser->settings.dnsThroughProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLDnsThroughProxy", 1); + thisUser->settings.specifyIncomingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLSpecifyIncomingPorts", 0); + thisUser->settings.szIncomingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLIncomingPorts", 0); + thisUser->settings.specifyOutgoingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLSpecifyOutgoingPorts", 0); + thisUser->settings.szOutgoingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLOutgoingPorts", 0); + thisUser->settings.enableUPnP=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLEnableUPnP", 1); //default to on + thisUser->settings.validateSSL=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLValidateSSL", 0); + + thisUser->toLog=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLlog", 1); EnterCriticalSection(&csNetlibUser); netlibUser.insert(thisUser); @@ -199,7 +199,7 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam) return (INT_PTR)thisUser; } -static INT_PTR NetlibGetUserSettings(WPARAM wParam,LPARAM lParam) +static INT_PTR NetlibGetUserSettings(WPARAM wParam, LPARAM lParam) { NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam; struct NetlibUser *nlu=(struct NetlibUser*)wParam; @@ -212,7 +212,7 @@ static INT_PTR NetlibGetUserSettings(WPARAM wParam,LPARAM lParam) return 1; } -static INT_PTR NetlibSetUserSettings(WPARAM wParam,LPARAM lParam) +static INT_PTR NetlibSetUserSettings(WPARAM wParam, LPARAM lParam) { NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam; struct NetlibUser *nlu=(struct NetlibUser*)wParam; @@ -221,7 +221,7 @@ static INT_PTR NetlibSetUserSettings(WPARAM wParam,LPARAM lParam) SetLastError(ERROR_INVALID_PARAMETER); return 0; } - NetlibSaveUserSettingsStruct(nlu->user.szSettingsModule,nlus); + NetlibSaveUserSettingsStruct(nlu->user.szSettingsModule, nlus); return 1; } @@ -267,7 +267,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM) HANDLE waitHandles[4]; DWORD waitResult; - WaitForSingleObject(hConnectionHeaderMutex,INFINITE); + WaitForSingleObject(hConnectionHeaderMutex, INFINITE); if (nlc->usingHttpGateway) { HttpGatewayRemovePacket(nlc, -1); @@ -286,7 +286,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM) waitHandles[1]=nlc->hOkToCloseEvent; waitHandles[2]=nlc->ncsRecv.hMutex; waitHandles[3]=nlc->ncsSend.hMutex; - waitResult=WaitForMultipleObjects( SIZEOF(waitHandles),waitHandles,TRUE,INFINITE); + waitResult=WaitForMultipleObjects( SIZEOF(waitHandles), waitHandles, TRUE, INFINITE); if (waitResult= WAIT_OBJECT_0 + SIZEOF(waitHandles)) { ReleaseMutex(hConnectionHeaderMutex); SetLastError(ERROR_INVALID_PARAMETER); //already been closed @@ -304,7 +304,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM) CloseHandle(nlc->hOkToCloseEvent); DeleteCriticalSection(&nlc->csHttpSequenceNums); ReleaseMutex(hConnectionHeaderMutex); - NetlibLogf(nlc->nlu,"(%p:%u) Connection closed",nlc,nlc->s); + NetlibLogf(nlc->nlu, "(%p:%u) Connection closed", nlc, nlc->s); break; } case NLH_BOUNDPORT: @@ -332,7 +332,7 @@ static INT_PTR NetlibGetSocket(WPARAM wParam, LPARAM) } else { - WaitForSingleObject(hConnectionHeaderMutex,INFINITE); + WaitForSingleObject(hConnectionHeaderMutex, INFINITE); switch (GetNetlibHandleType(wParam)) { case NLH_CONNECTION: @@ -384,7 +384,7 @@ INT_PTR NetlibShutdown(WPARAM wParam, LPARAM) { if (wParam) { - WaitForSingleObject(hConnectionHeaderMutex,INFINITE); + WaitForSingleObject(hConnectionHeaderMutex, INFINITE); switch(GetNetlibHandleType(wParam)) { case NLH_CONNECTION: { @@ -409,29 +409,29 @@ INT_PTR NetlibShutdown(WPARAM wParam, LPARAM) } static const char szHexDigits[]="0123456789ABCDEF"; -INT_PTR NetlibHttpUrlEncode(WPARAM,LPARAM lParam) +INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam) { - unsigned char *szOutput,*szInput=(unsigned char*)lParam; - unsigned char *pszIn,*pszOut; + unsigned char *szOutput, *szInput=(unsigned char*)lParam; + unsigned char *pszIn, *pszOut; int outputLen; if (szInput == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return (INT_PTR)(char*)NULL; } - for (outputLen=0,pszIn=szInput;*pszIn;pszIn++) { + for (outputLen=0, pszIn=szInput;*pszIn;pszIn++) { if ( (48 <= *pszIn && *pszIn <= 57) ||//0-9 (65 <= *pszIn && *pszIn <= 90) ||//ABC...XYZ (97 <= *pszIn && *pszIn <= 122) ||//abc...xyz *pszIn == '-' || *pszIn == '_' || *pszIn == '.' || *pszIn == ' ') outputLen++; else outputLen+=3; } - szOutput=(unsigned char*)HeapAlloc(GetProcessHeap(),0,outputLen+1); + szOutput=(unsigned char*)HeapAlloc(GetProcessHeap(), 0, outputLen+1); if (szOutput == NULL) { SetLastError(ERROR_OUTOFMEMORY); return (INT_PTR)(unsigned char*)NULL; } - for (pszOut=szOutput,pszIn=szInput;*pszIn;pszIn++) { + for (pszOut=szOutput, pszIn=szInput;*pszIn;pszIn++) { if ( (48 <= *pszIn && *pszIn <= 57) || (65 <= *pszIn && *pszIn <= 90) || (97 <= *pszIn && *pszIn <= 122) || @@ -464,7 +464,7 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam) return 0; } nlb64->cchEncoded=Netlib_GetBase64EncodedBufferSize(nlb64->cbDecoded); - for (iIn=0,pbIn=nlb64->pbDecoded,pszOut=nlb64->pszEncoded;iIncbDecoded;iIn+=3,pbIn+=3,pszOut+=4) { + for (iIn=0, pbIn=nlb64->pbDecoded, pszOut=nlb64->pszEncoded;iIncbDecoded;iIn+=3, pbIn+=3, pszOut+=4) { pszOut[0]=base64chars[pbIn[0]>>2]; if (nlb64->cbDecoded-iIn == 1) { pszOut[1]=base64chars[(pbIn[0]&3)<<4]; @@ -503,7 +503,7 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam) NETLIBBASE64 *nlb64=(NETLIBBASE64*)lParam; char *pszIn; PBYTE pbOut; - BYTE b1,b2,b3,b4; + BYTE b1, b2, b3, b4; int iIn; if (nlb64 == NULL || nlb64->pszEncoded == NULL || nlb64->pbDecoded == NULL) { @@ -519,7 +519,7 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam) return 0; } nlb64->cbDecoded=Netlib_GetBase64DecodedBufferSize(nlb64->cchEncoded); - for (iIn=0,pszIn=nlb64->pszEncoded,pbOut=nlb64->pbDecoded;iIncchEncoded;iIn+=4,pszIn+=4,pbOut+=3) { + for (iIn=0, pszIn=nlb64->pszEncoded, pbOut=nlb64->pbDecoded;iIncchEncoded;iIn+=4, pszIn+=4, pbOut+=3) { b1=Base64CharToInt(pszIn[0]); b2=Base64CharToInt(pszIn[1]); b3=Base64CharToInt(pszIn[2]); @@ -571,12 +571,12 @@ int LoadNetlibModule(void) bModuleInitialized = TRUE; - WSAStartup(MAKEWORD(2,2), &wsadata); + WSAStartup(MAKEWORD(2, 2), &wsadata); - HookEvent(ME_OPT_INITIALISE,NetlibOptInitialise); + HookEvent(ME_OPT_INITIALISE, NetlibOptInitialise); InitializeCriticalSection(&csNetlibUser); - hConnectionHeaderMutex=CreateMutex(NULL,FALSE,NULL); + hConnectionHeaderMutex=CreateMutex(NULL, FALSE, NULL); NetlibLogInit(); connectionTimeout = 0; @@ -629,38 +629,38 @@ int LoadNetlibModule(void) } } - hConnectionOpenMutex = connectionTimeout ? CreateMutex(NULL,FALSE,NULL) : NULL; + hConnectionOpenMutex = connectionTimeout ? CreateMutex(NULL, FALSE, NULL) : NULL; g_LastConnectionTick = GetTickCount(); - CreateServiceFunction(MS_NETLIB_REGISTERUSER,NetlibRegisterUser); - CreateServiceFunction(MS_NETLIB_GETUSERSETTINGS,NetlibGetUserSettings); - CreateServiceFunction(MS_NETLIB_SETUSERSETTINGS,NetlibSetUserSettings); - CreateServiceFunction(MS_NETLIB_CLOSEHANDLE,NetlibCloseHandle); - CreateServiceFunction(MS_NETLIB_BINDPORT,NetlibBindPort); - CreateServiceFunction(MS_NETLIB_OPENCONNECTION,NetlibOpenConnection); - CreateServiceFunction(MS_NETLIB_SETHTTPPROXYINFO,NetlibHttpGatewaySetInfo); - CreateServiceFunction(MS_NETLIB_SETSTICKYHEADERS,NetlibHttpSetSticky); - CreateServiceFunction(MS_NETLIB_GETSOCKET,NetlibGetSocket); - CreateServiceFunction(MS_NETLIB_URLENCODE,NetlibHttpUrlEncode); - CreateServiceFunction(MS_NETLIB_BASE64ENCODE,NetlibBase64Encode); - CreateServiceFunction(MS_NETLIB_BASE64DECODE,NetlibBase64Decode); - CreateServiceFunction(MS_NETLIB_SENDHTTPREQUEST,NetlibHttpSendRequest); - CreateServiceFunction(MS_NETLIB_RECVHTTPHEADERS,NetlibHttpRecvHeaders); - CreateServiceFunction(MS_NETLIB_FREEHTTPREQUESTSTRUCT,NetlibHttpFreeRequestStruct); - CreateServiceFunction(MS_NETLIB_HTTPTRANSACTION,NetlibHttpTransaction); - CreateServiceFunction(MS_NETLIB_SEND,NetlibSend); - CreateServiceFunction(MS_NETLIB_RECV,NetlibRecv); - CreateServiceFunction(MS_NETLIB_SELECT,NetlibSelect); - CreateServiceFunction(MS_NETLIB_SELECTEX,NetlibSelectEx); - CreateServiceFunction(MS_NETLIB_SHUTDOWN,NetlibShutdown); - CreateServiceFunction(MS_NETLIB_CREATEPACKETRECVER,NetlibPacketRecverCreate); - CreateServiceFunction(MS_NETLIB_GETMOREPACKETS,NetlibPacketRecverGetMore); - CreateServiceFunction(MS_NETLIB_SETPOLLINGTIMEOUT,NetlibHttpSetPollingTimeout); - CreateServiceFunction(MS_NETLIB_STARTSSL,NetlibStartSsl); - CreateServiceFunction(MS_NETLIB_STARINGTOADDRESS,NetlibStringToAddressSrv); - CreateServiceFunction(MS_NETLIB_ADDRESSTOSTRING,NetlibAddressToStringSrv); - CreateServiceFunction(MS_NETLIB_GETCONNECTIONINFO,NetlibGetConnectionInfoSrv); - CreateServiceFunction(MS_NETLIB_GETMYIP,NetlibGetMyIp); + CreateServiceFunction(MS_NETLIB_REGISTERUSER, NetlibRegisterUser); + CreateServiceFunction(MS_NETLIB_GETUSERSETTINGS, NetlibGetUserSettings); + CreateServiceFunction(MS_NETLIB_SETUSERSETTINGS, NetlibSetUserSettings); + CreateServiceFunction(MS_NETLIB_CLOSEHANDLE, NetlibCloseHandle); + CreateServiceFunction(MS_NETLIB_BINDPORT, NetlibBindPort); + CreateServiceFunction(MS_NETLIB_OPENCONNECTION, NetlibOpenConnection); + CreateServiceFunction(MS_NETLIB_SETHTTPPROXYINFO, NetlibHttpGatewaySetInfo); + CreateServiceFunction(MS_NETLIB_SETSTICKYHEADERS, NetlibHttpSetSticky); + CreateServiceFunction(MS_NETLIB_GETSOCKET, NetlibGetSocket); + CreateServiceFunction(MS_NETLIB_URLENCODE, NetlibHttpUrlEncode); + CreateServiceFunction(MS_NETLIB_BASE64ENCODE, NetlibBase64Encode); + CreateServiceFunction(MS_NETLIB_BASE64DECODE, NetlibBase64Decode); + CreateServiceFunction(MS_NETLIB_SENDHTTPREQUEST, NetlibHttpSendRequest); + CreateServiceFunction(MS_NETLIB_RECVHTTPHEADERS, NetlibHttpRecvHeaders); + CreateServiceFunction(MS_NETLIB_FREEHTTPREQUESTSTRUCT, NetlibHttpFreeRequestStruct); + CreateServiceFunction(MS_NETLIB_HTTPTRANSACTION, NetlibHttpTransaction); + CreateServiceFunction(MS_NETLIB_SEND, NetlibSend); + CreateServiceFunction(MS_NETLIB_RECV, NetlibRecv); + CreateServiceFunction(MS_NETLIB_SELECT, NetlibSelect); + CreateServiceFunction(MS_NETLIB_SELECTEX, NetlibSelectEx); + CreateServiceFunction(MS_NETLIB_SHUTDOWN, NetlibShutdown); + CreateServiceFunction(MS_NETLIB_CREATEPACKETRECVER, NetlibPacketRecverCreate); + CreateServiceFunction(MS_NETLIB_GETMOREPACKETS, NetlibPacketRecverGetMore); + CreateServiceFunction(MS_NETLIB_SETPOLLINGTIMEOUT, NetlibHttpSetPollingTimeout); + CreateServiceFunction(MS_NETLIB_STARTSSL, NetlibStartSsl); + CreateServiceFunction(MS_NETLIB_STARINGTOADDRESS, NetlibStringToAddressSrv); + CreateServiceFunction(MS_NETLIB_ADDRESSTOSTRING, NetlibAddressToStringSrv); + CreateServiceFunction(MS_NETLIB_GETCONNECTIONINFO, NetlibGetConnectionInfoSrv); + CreateServiceFunction(MS_NETLIB_GETMYIP, NetlibGetMyIp); hRecvEvent = CreateHookableEvent(ME_NETLIB_FASTRECV); hSendEvent = CreateHookableEvent(ME_NETLIB_FASTSEND); diff --git a/src/modules/netlib/netlib.h b/src/modules/netlib/netlib.h index 8939e7fafc..88a1db2284 100644 --- a/src/modules/netlib/netlib.h +++ b/src/modules/netlib/netlib.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2012 Miranda ICQ/IM project, +Copyright 2000-2012 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. @@ -74,7 +74,7 @@ struct NetlibConnection CRITICAL_SECTION csHttpSequenceNums; HANDLE hOkToCloseEvent; LONG dontCloseNow; - struct NetlibNestedCriticalSection ncsSend,ncsRecv; + struct NetlibNestedCriticalSection ncsSend, ncsRecv; HSSL hSsl; struct NetlibHTTPProxyPacketQueue * pHttpProxyPacketQueue; char *szNewUrl; @@ -107,16 +107,16 @@ struct NetlibPacketRecver { //netlib.c void NetlibFreeUserSettingsStruct(NETLIBUSERSETTINGS *settings); void NetlibDoClose(NetlibConnection *nlc, bool noShutdown = false); -INT_PTR NetlibCloseHandle(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM lParam); void NetlibInitializeNestedCS(struct NetlibNestedCriticalSection *nlncs); void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs); #define NLNCS_SEND 0 #define NLNCS_RECV 1 -int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which); +int NetlibEnterNestedCS(struct NetlibConnection *nlc, int which); void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs); -INT_PTR NetlibBase64Encode(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibBase64Decode(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibHttpUrlEncode(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibBase64Encode(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibBase64Decode(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibHttpUrlEncode(WPARAM wParam, LPARAM lParam); extern CRITICAL_SECTION csNetlibUser; extern LIST netlibUser; @@ -129,62 +129,62 @@ bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps); //netlibbind.c int NetlibFreeBoundPort(struct NetlibBoundPort *nlbp); -INT_PTR NetlibBindPort(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam); bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn); //netlibhttp.c -INT_PTR NetlibHttpSendRequest(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibHttpFreeRequestStruct(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibHttpTransaction(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibHttpFreeRequestStruct(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam); void NetlibHttpSetLastErrorUsingHttpResult(int result); NETLIBHTTPREQUEST* NetlibHttpRecv(NetlibConnection* nlc, DWORD hflags, DWORD dflags, bool isConnect = false); void NetlibConnFromUrl(const char* szUrl, bool secur, NETLIBOPENCONNECTION &nloc); //netlibhttpproxy.c -int NetlibInitHttpConnection(struct NetlibConnection *nlc,struct NetlibUser *nlu,NETLIBOPENCONNECTION *nloc); -int NetlibHttpGatewayRecv(struct NetlibConnection *nlc,char *buf,int len,int flags); -int NetlibHttpGatewayPost(struct NetlibConnection *nlc,const char *buf,int len,int flags); +int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc); +int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int flags); +int NetlibHttpGatewayPost(struct NetlibConnection *nlc, const char *buf, int len, int flags); void HttpGatewayRemovePacket(NetlibConnection *nlc, int pck); -INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibHttpSetPollingTimeout(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibHttpSetPollingTimeout(WPARAM wParam, LPARAM lParam); INT_PTR NetlibHttpSetSticky(WPARAM wParam, LPARAM lParam); //netliblog.c void NetlibLogShowOptions(void); -void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int flags); +void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags); void NetlibLogf(NetlibUser* nlu, const char *fmt, ...); void NetlibLogInit(void); void NetlibLogShutdown(void); //netlibopenconn.c -DWORD DnsLookup(struct NetlibUser *nlu,const char *szHost); -int WaitUntilReadable(SOCKET s,DWORD dwTimeout, bool check = false); -int WaitUntilWritable(SOCKET s,DWORD dwTimeout); +DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost); +int WaitUntilReadable(SOCKET s, DWORD dwTimeout, bool check = false); +int WaitUntilWritable(SOCKET s, DWORD dwTimeout); bool NetlibDoConnect(NetlibConnection *nlc); bool NetlibReconnect(NetlibConnection *nlc); -INT_PTR NetlibOpenConnection(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam); INT_PTR NetlibStartSsl(WPARAM wParam, LPARAM lParam); //netlibopts.c -int NetlibOptInitialise(WPARAM wParam,LPARAM lParam); -void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTINGS *settings); +int NetlibOptInitialise(WPARAM wParam, LPARAM lParam); +void NetlibSaveUserSettingsStruct(const char *szSettingsModule, NETLIBUSERSETTINGS *settings); //netlibpktrecver.c -INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibPacketRecverCreate(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam); //netlibsock.c #define NL_SELECT_READ 0x0001 #define NL_SELECT_WRITE 0x0002 #define NL_SELECT_ALL (NL_SELECT_READ+NL_SELECT_WRITE) -INT_PTR NetlibSend(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibRecv(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibSelect(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibSelectEx(WPARAM wParam,LPARAM lParam); -INT_PTR NetlibShutdown(WPARAM wParam,LPARAM lParam); +INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibSelect(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibSelectEx(WPARAM wParam, LPARAM lParam); +INT_PTR NetlibShutdown(WPARAM wParam, LPARAM lParam); bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr); char* NetlibAddressToString(SOCKADDR_INET_M* addr); @@ -192,7 +192,7 @@ void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo); NETLIBIPLIST* GetMyIp(unsigned flags); //netlibupnp.c -bool NetlibUPnPAddPortMapping(WORD intport, char *proto, +bool NetlibUPnPAddPortMapping(WORD intport, char *proto, WORD *extport, DWORD *extip, bool search); void NetlibUPnPDeletePortMapping(WORD extport, char* proto); void NetlibUPnPCleanup(void*); @@ -211,11 +211,11 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge bool http, unsigned& complete); -static __inline INT_PTR NLSend(struct NetlibConnection *nlc,const char *buf,int len,int flags) { - NETLIBBUFFER nlb={(char*)buf,len,flags}; - return NetlibSend((WPARAM)nlc,(LPARAM)&nlb); +static __inline INT_PTR NLSend(struct NetlibConnection *nlc, const char *buf, int len, int flags) { + NETLIBBUFFER nlb={(char*)buf, len, flags}; + return NetlibSend((WPARAM)nlc, (LPARAM)&nlb); } -static __inline INT_PTR NLRecv(struct NetlibConnection *nlc,char *buf,int len,int flags) { - NETLIBBUFFER nlb={buf,len,flags}; - return NetlibRecv((WPARAM)nlc,(LPARAM)&nlb); +static __inline INT_PTR NLRecv(struct NetlibConnection *nlc, char *buf, int len, int flags) { + NETLIBBUFFER nlb={buf, len, flags}; + return NetlibRecv((WPARAM)nlc, (LPARAM)&nlb); } diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp index 21f841ff3c..a3164216cd 100644 --- a/src/modules/netlib/netlibautoproxy.cpp +++ b/src/modules/netlib/netlibautoproxy.cpp @@ -1,7 +1,7 @@ /* Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2010-2011 Miranda ICQ/IM project, +Copyright 2010-2011 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -10,7 +10,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. @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////// // ResolveHostName (a helper function) ///////////////////////////////////////////////////////////////////// -DWORD __stdcall ResolveHostName(LPSTR lpszHostName, +DWORD __stdcall ResolveHostName(LPSTR lpszHostName, LPSTR lpszIPAddress, LPDWORD lpdwIPAddressSize) { if (*lpdwIPAddressSize < 17 || lpszIPAddress == NULL) @@ -99,13 +99,13 @@ BOOL __stdcall IsInNet(LPSTR lpszIPAddress, LPSTR lpszDest, LPSTR lpszMask) static const AutoProxyHelperVtbl OurVtbl = { - IsResolvable, - GetIPAddress, - ResolveHostName, - IsInNet, - NULL, - NULL, - NULL, + IsResolvable, + GetIPAddress, + ResolveHostName, + IsInNet, + NULL, + NULL, + NULL, NULL }; diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp index 5e8d76d464..7e5724994d 100644 --- a/src/modules/netlib/netlibbind.cpp +++ b/src/modules/netlib/netlibbind.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2012 Miranda ICQ/IM project, +Copyright 2000-2012 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. @@ -55,7 +55,7 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn) for (psz=szPorts;*psz;) { - while (*psz == ' ' || *psz == ',') psz++; + while (*psz == ' ' || *psz == ', ') psz++; portMin = strtol(psz, &pszEnd, 0); if (pszEnd == psz) break; while (*pszEnd == ' ') pszEnd++; @@ -122,7 +122,7 @@ int NetlibFreeBoundPort(struct NetlibBoundPort *nlbp) { closesocket(nlbp->s); closesocket(nlbp->s6); - WaitForSingleObject(nlbp->hThread,INFINITE); + WaitForSingleObject(nlbp->hThread, INFINITE); CloseHandle(nlbp->hThread); NetlibLogf(nlbp->nlu, "(%u) Port %u closed for incoming connections", nlbp->s, nlbp->wPort); mir_free(nlbp); @@ -213,7 +213,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) nlbp->pExtra = (nlb->cbSize != NETLIBBIND_SIZEOF_V1) ? nlb->pExtra : NULL; if (nlbp->s == INVALID_SOCKET && nlbp->s6 == INVALID_SOCKET) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"socket",WSAGetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "socket", WSAGetLastError()); mir_free(nlbp); return 0; } @@ -238,7 +238,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) be asking for whatever was in nlb->wPort*/ if (nlb->wPort != 0) { - NetlibLogf(nlu,"%s %d: trying to bind port %d, this 'feature' can be abused, please be sure you want to allow it.",__FILE__,__LINE__,nlb->wPort); + NetlibLogf(nlu, "%s %d: trying to bind port %d, this 'feature' can be abused, please be sure you want to allow it.", __FILE__, __LINE__, nlb->wPort); sin.sin_port = htons(nlb->wPort); sin6.sin6_port = htons(nlb->wPort); } @@ -256,7 +256,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) } if (!foundPort) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"bind",WSAGetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "bind", WSAGetLastError()); closesocket(nlbp->s); closesocket(nlbp->s6); mir_free(nlbp); @@ -265,7 +265,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) if (nlbp->s != INVALID_SOCKET && listen(nlbp->s, 5)) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"listen",WSAGetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "listen", WSAGetLastError()); closesocket(nlbp->s); closesocket(nlbp->s6); mir_free(nlbp); @@ -274,7 +274,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) if (nlbp->s6 != INVALID_SOCKET && listen(nlbp->s6, 5)) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"listen",WSAGetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "listen", WSAGetLastError()); closesocket(nlbp->s); closesocket(nlbp->s6); mir_free(nlbp); @@ -293,7 +293,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) nlb->wPort = ntohs(sin.Ipv6.sin6_port); else { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"getsockname",WSAGetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "getsockname", WSAGetLastError()); closesocket(nlbp->s); closesocket(nlbp->s6); mir_free(nlbp); diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index fb027366bc..6c6c58a481 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.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. @@ -398,14 +398,14 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime, return 1; } -static int SendHttpRequestAndData(struct NetlibConnection *nlc,struct ResizableCharBuffer *httpRequest,NETLIBHTTPREQUEST *nlhr,int sendContentLengthHeader) +static int SendHttpRequestAndData(struct NetlibConnection *nlc, struct ResizableCharBuffer *httpRequest, NETLIBHTTPREQUEST *nlhr, int sendContentLengthHeader) { bool sendData = (nlhr->requestType == REQUEST_POST || nlhr->requestType == REQUEST_PUT); if (sendContentLengthHeader && sendData) - AppendToCharBuffer(httpRequest,"Content-Length: %d\r\n\r\n", nlhr->dataLength); + AppendToCharBuffer(httpRequest, "Content-Length: %d\r\n\r\n", nlhr->dataLength); else - AppendToCharBuffer(httpRequest,"\r\n"); + AppendToCharBuffer(httpRequest, "\r\n"); DWORD hflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) | (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND | NLHRF_NODUMPHEADERS) ? @@ -420,7 +420,7 @@ static int SendHttpRequestAndData(struct NetlibConnection *nlc,struct ResizableC MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) | (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0); - int sendResult = NLSend(nlc,nlhr->pData,nlhr->dataLength, sflags); + int sendResult = NLSend(nlc, nlhr->pData, nlhr->dataLength, sflags); bytesSent = sendResult != SOCKET_ERROR ? bytesSent + sendResult : SOCKET_ERROR; } @@ -611,7 +611,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) DWORD dwTimeOutTime = hdrTimeout < 0 ? -1 : GetTickCount() + hdrTimeout; if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &resultCode, NULL, NULL)) { - NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)",__FILE__,__LINE__,"HttpPeekFirstResponseLine",GetLastError(), count); + NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", GetLastError(), count); DWORD err = GetLastError(); if (err == ERROR_TIMEOUT || err == ERROR_BAD_FORMAT || err == ERROR_BUFFER_OVERFLOW || lastFirstLineFail || nlc->termRequested || nlhr->requestType == REQUEST_CONNECT) @@ -839,7 +839,7 @@ INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam) return 1; } -INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam) +INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) { struct NetlibConnection *nlc = (struct NetlibConnection*)wParam; NETLIBHTTPREQUEST *nlhr; @@ -850,7 +850,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam) int headersCount = 0, bufferSize = 8192; bool headersCompleted = false; - if (!NetlibEnterNestedCS(nlc,NLNCS_RECV)) + if (!NetlibEnterNestedCS(nlc, NLNCS_RECV)) return 0; dwRequestTimeoutTime = GetTickCount() + HTTPRECVDATATIMEOUT; @@ -859,7 +859,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam) nlhr->nlc = nlc; // Needed to id connection in the protocol HTTP gateway wrapper functions nlhr->requestType = REQUEST_RESPONSE; - if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK, + if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) { NetlibLeaveNestedCS(&nlc->ncsRecv); @@ -992,13 +992,13 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) } if (!doneUserAgentHeader) { - char *pspace,szMirandaVer[64]; + char *pspace, szMirandaVer[64]; nlhrSend.headers[nlhrSend.headersCount].szName = "User-Agent"; nlhrSend.headers[nlhrSend.headersCount].szValue = szUserAgent; ++nlhrSend.headersCount; - CallService(MS_SYSTEM_GETVERSIONTEXT,SIZEOF(szMirandaVer),(LPARAM)szMirandaVer); - pspace=strchr(szMirandaVer,' '); + CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(szMirandaVer), (LPARAM)szMirandaVer); + pspace=strchr(szMirandaVer, ' '); if (pspace) { *pspace++ = '\0'; @@ -1220,14 +1220,14 @@ next: for (;;) { recvResult = RecvWithTimeoutTime(nlc, GetTickCount() + HTTPRECVDATATIMEOUT, - nlhrReply->pData + nlhrReply->dataLength, + nlhrReply->pData + nlhrReply->dataLength, dataBufferAlloced - nlhrReply->dataLength - 1, dflags | (cenctype ? MSG_NODUMP : 0)); if (recvResult == 0) break; if (recvResult == SOCKET_ERROR) { - NetlibHttpFreeRequestStruct(0,(LPARAM)nlhrReply); + NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply); return NULL; } nlhrReply->dataLength += recvResult; diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp index a760aee43d..6b48894d34 100644 --- a/src/modules/netlib/netlibhttpproxy.cpp +++ b/src/modules/netlib/netlibhttpproxy.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2012 Miranda ICQ/IM project, +Copyright 2000-2012 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. @@ -25,10 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef enum { - reqHelloGet, - reqOldGet, - reqOldPost, - reqNewPost, + reqHelloGet, + reqOldGet, + reqOldPost, + reqNewPost, } RequestType; @@ -151,7 +151,7 @@ static bool NetlibHttpGatewaySend(struct NetlibConnection *nlc, RequestType reqT // nlhrSend.headers[3].szName = "Accept-Encoding"; // nlhrSend.headers[3].szValue = "deflate, gzip"; - return NetlibHttpSendRequest((WPARAM)nlc,(LPARAM)&nlhrSend) != SOCKET_ERROR; + return NetlibHttpSendRequest((WPARAM)nlc, (LPARAM)&nlhrSend) != SOCKET_ERROR; } static bool NetlibHttpGatewayStdPost(NetlibConnection *nlc, int& numPackets) @@ -476,7 +476,7 @@ int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nl return 1; } -INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam,LPARAM lParam) +INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam) { NETLIBHTTPPROXYINFO *nlhpi=(NETLIBHTTPPROXYINFO*)lParam; struct NetlibConnection *nlc=(struct NetlibConnection*)wParam; diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 92496eaa5c..586d160baf 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.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. @@ -42,8 +42,8 @@ struct { TCHAR* szUserFile; int timeFormat; int showUser; - int dumpSent,dumpRecv,dumpProxy,dumpSsl; - int textDumps,autoDetectText; + int dumpSent, dumpRecv, dumpProxy, dumpSsl; + int textDumps, autoDetectText; CRITICAL_SECTION cs; int save; } logOptions = {0}; @@ -53,44 +53,44 @@ typedef struct { const char* pszMsg; } LOGMSG; -static __int64 mirandaStartTime,perfCounterFreq; +static __int64 mirandaStartTime, perfCounterFreq; static int bIsActive = TRUE; static HANDLE hLogEvent = NULL; static const TCHAR* szTimeFormats[] = { - _T( "No times" ), - _T( "Standard hh:mm:ss times" ), - _T( "Times in milliseconds" ), + _T( "No times" ), + _T( "Standard hh:mm:ss times" ), + _T( "Times in milliseconds" ), _T( "Times in microseconds" ) }; -static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: logOptions.hwndOpts=hwndDlg; TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg,IDC_DUMPRECV,logOptions.dumpRecv?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_DUMPSENT,logOptions.dumpSent?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_DUMPPROXY,logOptions.dumpProxy?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_DUMPSSL,logOptions.dumpSsl?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TEXTDUMPS,logOptions.textDumps?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_AUTODETECTTEXT,logOptions.autoDetectText?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DUMPRECV, logOptions.dumpRecv?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DUMPSENT, logOptions.dumpSent?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DUMPPROXY, logOptions.dumpProxy?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DUMPSSL, logOptions.dumpSsl?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TEXTDUMPS, logOptions.textDumps?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTODETECTTEXT, logOptions.autoDetectText?BST_CHECKED:BST_UNCHECKED); { int i; for ( i=0; i < SIZEOF(szTimeFormats); i++ ) - SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_ADDSTRING,0,(LPARAM)TranslateTS( szTimeFormats[i] )); + SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_ADDSTRING, 0, (LPARAM)TranslateTS( szTimeFormats[i] )); } - SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_SETCURSEL,logOptions.timeFormat,0); - CheckDlgButton(hwndDlg,IDC_SHOWNAMES,logOptions.showUser?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TOOUTPUTDEBUGSTRING,logOptions.toOutputDebugString?BST_CHECKED:BST_UNCHECKED); - CheckDlgButton(hwndDlg,IDC_TOFILE,logOptions.toFile?BST_CHECKED:BST_UNCHECKED); - SetDlgItemText(hwndDlg,IDC_FILENAME,logOptions.szUserFile); - SetDlgItemText(hwndDlg,IDC_PATH,logOptions.szFile); - CheckDlgButton(hwndDlg,IDC_SHOWTHISDLGATSTART,DBGetContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart",0)?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_SETCURSEL, logOptions.timeFormat, 0); + CheckDlgButton(hwndDlg, IDC_SHOWNAMES, logOptions.showUser?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TOOUTPUTDEBUGSTRING, logOptions.toOutputDebugString?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TOFILE, logOptions.toFile?BST_CHECKED:BST_UNCHECKED); + SetDlgItemText(hwndDlg, IDC_FILENAME, logOptions.szUserFile); + SetDlgItemText(hwndDlg, IDC_PATH, logOptions.szFile); + CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, DBGetContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart", 0)?BST_CHECKED:BST_UNCHECKED); { DBVARIANT dbv; - if (!DBGetContactSettingString(NULL, "Netlib", "RunAtStart",&dbv)) { - SetDlgItemTextA(hwndDlg,IDC_RUNATSTART,dbv.pszVal); + if (!DBGetContactSettingString(NULL, "Netlib", "RunAtStart", &dbv)) { + SetDlgItemTextA(hwndDlg, IDC_RUNATSTART, dbv.pszVal); DBFreeVariant(&dbv); } } @@ -98,7 +98,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara { TVINSERTSTRUCT tvis = {0}; int i; - HWND hwndFilter = GetDlgItem(hwndDlg,IDC_FILTER); + HWND hwndFilter = GetDlgItem(hwndDlg, IDC_FILTER); SetWindowLongPtr(hwndFilter, GWL_STYLE, GetWindowLongPtr(hwndFilter, GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES)); @@ -139,7 +139,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara case IDC_FILENAME: if (HIWORD(wParam) != EN_CHANGE) break; if ((HWND)lParam == GetFocus()) - CheckDlgButton(hwndDlg,IDC_TOFILE,BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_TOFILE, BST_CHECKED); { TCHAR path[MAX_PATH]; @@ -155,9 +155,9 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara case IDC_RUNATSTARTBROWSE: { TCHAR str[MAX_PATH+2]; OPENFILENAME ofn={0}; - TCHAR filter[512],*pfilter; + TCHAR filter[512], *pfilter; - GetWindowText(GetWindow((HWND)lParam,GW_HWNDPREV),str,SIZEOF(str)); + GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, SIZEOF(str)); ofn.lStructSize=OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner=hwndDlg; ofn.Flags=OFN_HIDEREADONLY | OFN_DONTADDTORECENT; @@ -167,10 +167,10 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara ofn.Flags|=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST; ofn.lpstrTitle=TranslateT("Select program to be run"); } - _tcscpy(filter,TranslateT("All Files")); - _tcscat(filter,_T(" (*)")); + _tcscpy(filter, TranslateT("All Files")); + _tcscat(filter, _T(" (*)")); pfilter=filter+lstrlen(filter)+1; - _tcscpy(pfilter,_T("*")); + _tcscpy(pfilter, _T("*")); pfilter=pfilter+lstrlen(pfilter)+1; *pfilter='\0'; ofn.lpstrFilter=filter; @@ -182,21 +182,21 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara } else { if (!GetOpenFileName(&ofn)) return 1; } - if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str,' ') != NULL) { - MoveMemory(str+1,str,SIZEOF(str)-2); + if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) { + MoveMemory(str+1, str, SIZEOF(str)-2); str[0]='"'; - lstrcat(str,_T("\"")); + lstrcat(str, _T("\"")); } - SetWindowText(GetWindow((HWND)lParam,GW_HWNDPREV),str); + SetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str); break; } case IDC_RUNNOW: { TCHAR str[MAX_PATH+1]; STARTUPINFO si={0}; PROCESS_INFORMATION pi; - GetDlgItemText(hwndDlg,IDC_RUNATSTART,str,MAX_PATH); + GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH); si.cb=sizeof(si); - if (str[0]) CreateProcess(NULL,str,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); + if (str[0]) CreateProcess(NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); } break; case IDC_SAVE: @@ -207,29 +207,29 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara TCHAR str[MAX_PATH]; GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH); - DBWriteContactSettingTString(NULL, "Netlib", "RunAtStart",str); - DBWriteContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWTHISDLGATSTART)); + DBWriteContactSettingTString(NULL, "Netlib", "RunAtStart", str); + DBWriteContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART)); EnterCriticalSection(&logOptions.cs); mir_free(logOptions.szUserFile); - GetWindowText(GetDlgItem(hwndDlg,IDC_FILENAME), str, MAX_PATH ); + GetWindowText(GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH ); logOptions.szUserFile = mir_tstrdup(str); mir_free(logOptions.szFile); - GetWindowText(GetDlgItem(hwndDlg,IDC_PATH), str, MAX_PATH ); + GetWindowText(GetDlgItem(hwndDlg, IDC_PATH), str, MAX_PATH ); logOptions.szFile = mir_tstrdup(str); - logOptions.dumpRecv=IsDlgButtonChecked(hwndDlg,IDC_DUMPRECV); - logOptions.dumpSent=IsDlgButtonChecked(hwndDlg,IDC_DUMPSENT); - logOptions.dumpProxy=IsDlgButtonChecked(hwndDlg,IDC_DUMPPROXY); - logOptions.dumpSsl=IsDlgButtonChecked(hwndDlg,IDC_DUMPSSL); - logOptions.textDumps=IsDlgButtonChecked(hwndDlg,IDC_TEXTDUMPS); - logOptions.autoDetectText=IsDlgButtonChecked(hwndDlg,IDC_AUTODETECTTEXT); - logOptions.timeFormat=SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_GETCURSEL,0,0); - logOptions.showUser=IsDlgButtonChecked(hwndDlg,IDC_SHOWNAMES); - logOptions.toOutputDebugString=IsDlgButtonChecked(hwndDlg,IDC_TOOUTPUTDEBUGSTRING); - logOptions.toFile=IsDlgButtonChecked(hwndDlg,IDC_TOFILE); + logOptions.dumpRecv=IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV); + logOptions.dumpSent=IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT); + logOptions.dumpProxy=IsDlgButtonChecked(hwndDlg, IDC_DUMPPROXY); + logOptions.dumpSsl=IsDlgButtonChecked(hwndDlg, IDC_DUMPSSL); + logOptions.textDumps=IsDlgButtonChecked(hwndDlg, IDC_TEXTDUMPS); + logOptions.autoDetectText=IsDlgButtonChecked(hwndDlg, IDC_AUTODETECTTEXT); + logOptions.timeFormat=SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_GETCURSEL, 0, 0); + logOptions.showUser=IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES); + logOptions.toOutputDebugString=IsDlgButtonChecked(hwndDlg, IDC_TOOUTPUTDEBUGSTRING); + logOptions.toFile=IsDlgButtonChecked(hwndDlg, IDC_TOFILE); LeaveCriticalSection(&logOptions.cs); } @@ -243,36 +243,36 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara while (tvi.hItem) { - TreeView_GetItem(hwndFilter,&tvi); + TreeView_GetItem(hwndFilter, &tvi); checked = ((tvi.state&TVIS_STATEIMAGEMASK)>>12 == 2); if (tvi.lParam == -1) { logOptions.toLog = checked; if ( logOptions.save ) - DBWriteContactSettingDword(NULL, "Netlib", "NLlog",checked); + DBWriteContactSettingDword(NULL, "Netlib", "NLlog", checked); } else if (tvi.lParam < netlibUser.getCount()) { netlibUser[tvi.lParam]->toLog = checked; if ( logOptions.save ) - DBWriteContactSettingDword(NULL,netlibUser[tvi.lParam]->user.szSettingsModule,"NLlog",checked); + DBWriteContactSettingDword(NULL, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked); } - tvi.hItem=TreeView_GetNextSibling(hwndFilter,tvi.hItem); + tvi.hItem=TreeView_GetNextSibling(hwndFilter, tvi.hItem); } } if ( logOptions.save ) { - DBWriteContactSettingByte(NULL, "Netlib", "DumpRecv",(BYTE)logOptions.dumpRecv); - DBWriteContactSettingByte(NULL, "Netlib", "DumpSent",(BYTE)logOptions.dumpSent); - DBWriteContactSettingByte(NULL, "Netlib", "DumpProxy",(BYTE)logOptions.dumpProxy); - DBWriteContactSettingByte(NULL, "Netlib", "DumpSsl",(BYTE)logOptions.dumpSsl); - DBWriteContactSettingByte(NULL, "Netlib", "TextDumps",(BYTE)logOptions.textDumps); - DBWriteContactSettingByte(NULL, "Netlib", "AutoDetectText",(BYTE)logOptions.autoDetectText); - DBWriteContactSettingByte(NULL, "Netlib", "TimeFormat",(BYTE)logOptions.timeFormat); - DBWriteContactSettingByte(NULL, "Netlib", "ShowUser",(BYTE)logOptions.showUser); - DBWriteContactSettingByte(NULL, "Netlib", "ToOutputDebugString",(BYTE)logOptions.toOutputDebugString); - DBWriteContactSettingByte(NULL, "Netlib", "ToFile",(BYTE)logOptions.toFile); + DBWriteContactSettingByte(NULL, "Netlib", "DumpRecv", (BYTE)logOptions.dumpRecv); + DBWriteContactSettingByte(NULL, "Netlib", "DumpSent", (BYTE)logOptions.dumpSent); + DBWriteContactSettingByte(NULL, "Netlib", "DumpProxy", (BYTE)logOptions.dumpProxy); + DBWriteContactSettingByte(NULL, "Netlib", "DumpSsl", (BYTE)logOptions.dumpSsl); + DBWriteContactSettingByte(NULL, "Netlib", "TextDumps", (BYTE)logOptions.textDumps); + DBWriteContactSettingByte(NULL, "Netlib", "AutoDetectText", (BYTE)logOptions.autoDetectText); + DBWriteContactSettingByte(NULL, "Netlib", "TimeFormat", (BYTE)logOptions.timeFormat); + DBWriteContactSettingByte(NULL, "Netlib", "ShowUser", (BYTE)logOptions.showUser); + DBWriteContactSettingByte(NULL, "Netlib", "ToOutputDebugString", (BYTE)logOptions.toOutputDebugString); + DBWriteContactSettingByte(NULL, "Netlib", "ToFile", (BYTE)logOptions.toFile); DBWriteContactSettingTString(NULL, "Netlib", "File", logOptions.szFile ? logOptions.szUserFile: _T("")); logOptions.save = 0; } @@ -299,7 +299,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara void NetlibLogShowOptions(void) { if (logOptions.hwndOpts == NULL) - logOptions.hwndOpts=CreateDialog(hMirandaInst,MAKEINTRESOURCE(IDD_NETLIBLOGOPTS),NULL,LogOptionsDlgProc); + logOptions.hwndOpts=CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), NULL, LogOptionsDlgProc); SetForegroundWindow(logOptions.hwndOpts); } @@ -354,7 +354,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) case TIMEFORMAT_MICROSECONDS: QueryPerformanceCounter(&liTimeNow); liTimeNow.QuadPart -= mirandaStartTime; - mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%06I64u", liTimeNow.QuadPart / perfCounterFreq, + mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%06I64u", liTimeNow.QuadPart / perfCounterFreq, 1000000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq); break; @@ -364,7 +364,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) } if (logOptions.timeFormat || logOptions.showUser) mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%s%s] ", szTime, - (logOptions.showUser && logOptions.timeFormat) ? " " : "", + (logOptions.showUser && logOptions.timeFormat) ? " " : "", logOptions.showUser ? nlu->user.szSettingsModule : ""); else szHead[0]=0; @@ -391,7 +391,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) if (fp) { size_t len = strlen(pszMsg); - fprintf(fp,"%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n"); + fprintf(fp, "%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n"); fclose(fp); } LeaveCriticalSection(&logOptions.cs); @@ -429,7 +429,7 @@ void NetlibLogf(NetlibUser* nlu, const char *fmt, ...) va_list va; char szText[1024]; - va_start(va,fmt); + va_start(va, fmt); mir_vsnprintf(szText, sizeof(szText), fmt, va); va_end(va); @@ -437,7 +437,7 @@ void NetlibLogf(NetlibUser* nlu, const char *fmt, ...) } -void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int flags) +void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags) { int isText=1; char szTitleLine[128]; @@ -526,8 +526,8 @@ void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int if (colsInLine == 16) { PBYTE p = buf + line; pszBuf += wsprintfA( - pszBuf, "%08X: %02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X ", - line, p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15] ); + pszBuf, "%08X: %02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X ", + line, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] ); } else { pszBuf += wsprintfA(pszBuf, "%08X: ", line); @@ -555,7 +555,7 @@ void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int *pszBuf = '\0'; } - NetlibLog((WPARAM)nlu,(LPARAM)szBuf); + NetlibLog((WPARAM)nlu, (LPARAM)szBuf); if (!useStack) mir_free(szBuf); } diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 0be23f2da1..5cc1e7635e 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -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. @@ -32,7 +32,7 @@ static int iUPnPCleanup = 0; #define RECV_DEFAULT_TIMEOUT 60000 //returns in network byte order -DWORD DnsLookup(struct NetlibUser *nlu,const char *szHost) +DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost) { HOSTENT* host; DWORD ip = inet_addr(szHost); @@ -45,7 +45,7 @@ DWORD DnsLookup(struct NetlibUser *nlu,const char *szHost) if ( host ) return *(u_long*)host->h_addr_list[0]; - NetlibLogf(nlu,"%s %d: %s() for host %s failed (%u)",__FILE__,__LINE__,"gethostbyname", szHost, WSAGetLastError()); + NetlibLogf(nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "gethostbyname", szHost, WSAGetLastError()); } __except(EXCEPTION_EXECUTE_HANDLER) {} @@ -70,7 +70,7 @@ int WaitUntilReadable(SOCKET s, DWORD dwTimeout, bool check) return result; } -int WaitUntilWritable(SOCKET s,DWORD dwTimeout) +int WaitUntilWritable(SOCKET s, DWORD dwTimeout) { fd_set writefd; TIMEVAL tv; @@ -138,14 +138,14 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE if (NLSend(nlc, pInit, (int)len, MSG_DUMPPROXY) == SOCKET_ERROR) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError()); return 0; } char reply[8]; if (!RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } @@ -157,35 +157,35 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE case 93: SetLastError(ERROR_INVALID_ACCESS); break; default: SetLastError(ERROR_INVALID_DATA); break; } - NetlibLogf(nlu,"%s %d: Proxy connection failed (%x %u)",__FILE__,__LINE__, (BYTE)reply[1], GetLastError()); + NetlibLogf(nlu, "%s %d: Proxy connection failed (%x %u)", __FILE__, __LINE__, (BYTE)reply[1], GetLastError()); return 0; } -static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct NetlibUser *nlu,NETLIBOPENCONNECTION *nloc) +static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc) { //rfc1928 BYTE buf[258]; buf[0]=5; //yep, socks5 buf[1]=1; //one auth method buf[2]=nlu->settings.useProxyAuth?2:0; - if (NLSend(nlc,(char*)buf,3,MSG_DUMPPROXY) == SOCKET_ERROR) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError()); + if (NLSend(nlc, (char*)buf, 3, MSG_DUMPPROXY) == SOCKET_ERROR) { + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError()); return 0; } //confirmation of auth method - if (!RecvUntilTimeout(nlc,(char*)buf,2,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError()); + if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } if ((buf[1] != 0 && buf[1] != 2)) { SetLastError(ERROR_INVALID_ID_AUTHORITY); - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLRecv", GetLastError()); return 0; } if (buf[1] == 2) { //rfc1929 - int nUserLen,nPassLen; + int nUserLen, nPassLen; PBYTE pAuthBuf; nUserLen=lstrlenA(nlu->settings.szProxyAuthUser); @@ -193,23 +193,23 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib pAuthBuf=(PBYTE)mir_alloc(3+nUserLen+nPassLen); pAuthBuf[0]=1; //auth version pAuthBuf[1]=nUserLen; - memcpy(pAuthBuf+2,nlu->settings.szProxyAuthUser,nUserLen); + memcpy(pAuthBuf+2, nlu->settings.szProxyAuthUser, nUserLen); pAuthBuf[2+nUserLen]=nPassLen; - memcpy(pAuthBuf+3+nUserLen,nlu->settings.szProxyAuthPassword,nPassLen); - if (NLSend(nlc,(char*)pAuthBuf,3+nUserLen+nPassLen,MSG_DUMPPROXY) == SOCKET_ERROR) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError()); + memcpy(pAuthBuf+3+nUserLen, nlu->settings.szProxyAuthPassword, nPassLen); + if (NLSend(nlc, (char*)pAuthBuf, 3+nUserLen+nPassLen, MSG_DUMPPROXY) == SOCKET_ERROR) { + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError()); mir_free(pAuthBuf); return 0; } mir_free(pAuthBuf); - if (!RecvUntilTimeout(nlc,(char*)buf,2,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError()); + if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } if (buf[1]) { SetLastError(ERROR_ACCESS_DENIED); - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError()); + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } } @@ -228,7 +228,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib } else { - hostIP = DnsLookup(nlu,nloc->szHost); + hostIP = DnsLookup(nlu, nloc->szHost); if (hostIP == 0) return 0; nHostLen = 4; @@ -240,23 +240,23 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib if (hostIP == INADDR_NONE) { //DNS lookup through proxy pInit[3]=3; pInit[4]=nHostLen-1; - memcpy(pInit+5,nloc->szHost,nHostLen-1); + memcpy(pInit+5, nloc->szHost, nHostLen-1); } else { pInit[3]=1; *(PDWORD)(pInit+4)=hostIP; } *(PWORD)(pInit+4+nHostLen)=htons(nloc->wPort); - if (NLSend(nlc,(char*)pInit,6+nHostLen,MSG_DUMPPROXY) == SOCKET_ERROR) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError()); + if (NLSend(nlc, (char*)pInit, 6+nHostLen, MSG_DUMPPROXY) == SOCKET_ERROR) { + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError()); mir_free(pInit); return 0; } mir_free(pInit); } - if (!RecvUntilTimeout(nlc,(char*)buf,5,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError()); + if (!RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } @@ -279,7 +279,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib default: SetLastError(ERROR_INVALID_DATA); break; } } - NetlibLogf(nlu,"%s %d: Proxy conection failed. %s.",__FILE__,__LINE__, err); + NetlibLogf(nlu, "%s %d: Proxy conection failed. %s.", __FILE__, __LINE__, err); return 0; } { @@ -295,11 +295,11 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib nRecvSize = 17; break; default: - NetlibLogf(nlu,"%s %d: %s() unknown address type (%u)",__FILE__,__LINE__,"NetlibInitSocks5Connection",(int)buf[3]); + NetlibLogf(nlu, "%s %d: %s() unknown address type (%u)", __FILE__, __LINE__, "NetlibInitSocks5Connection", (int)buf[3]); return 0; } - if (!RecvUntilTimeout(nlc,(char*)buf,nRecvSize,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) { - NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError()); + if (!RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) { + NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError()); return 0; } } @@ -348,7 +348,7 @@ static bool NetlibInitHttpsConnection(struct NetlibConnection *nlc, struct Netli } NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode); - NetlibLogf(nlu,"%s %d: %s request failed (%u %s)",__FILE__,__LINE__,nlu->settings.proxyType == PROXYTYPE_HTTP?"HTTP":"HTTPS",nlhrReply->resultCode,nlhrReply->szResultDescr); + NetlibLogf(nlu, "%s %d: %s request failed (%u %s)", __FILE__, __LINE__, nlu->settings.proxyType == PROXYTYPE_HTTP?"HTTP":"HTTPS", nlhrReply->resultCode, nlhrReply->szResultDescr); NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply); return 0; } @@ -407,9 +407,9 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) if (!nlc->szProxyServer) return false; if (nloc) - NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort); + NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort); else - NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort); + NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort); sin.sin_port = htons(nlc->wProxyPort); he = gethostbyname(nlc->szProxyServer); @@ -417,7 +417,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) else { if (!nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false; - NetlibLogf(nlc->nlu,"(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort); + NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort); sin.sin_port = htons(nloc->wPort); he = gethostbyname(nloc->szHost); @@ -428,7 +428,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) sin.sin_addr.s_addr = *(u_long*)*har; char* szIp = NetlibAddressToString((SOCKADDR_INET_M*)&sin); - NetlibLogf(nlc->nlu,"(%p) Connecting to ip %s ....", nlc, szIp); + NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, szIp); mir_free(szIp); retry: @@ -441,7 +441,7 @@ retry: if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0]) { if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum)) - NetlibLogf(nlc->nlu,"Netlib connect: Not enough ports for outgoing connections specified"); + NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified"); } // try a connect @@ -576,27 +576,27 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) if (!nlc->szProxyServer) return false; if (nloc) - NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort); + NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort); else - NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort); + NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort); _itoa(nlc->wProxyPort, szPort, 10); if (MyGetaddrinfo(nlc->szProxyServer, szPort, &hints, &air)) { - NetlibLogf(nlc->nlu,"%s %d: %s() for host %s failed (%u)",__FILE__,__LINE__,"getaddrinfo", nlc->szProxyServer, WSAGetLastError()); + NetlibLogf(nlc->nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "getaddrinfo", nlc->szProxyServer, WSAGetLastError()); return false; } } else { if (!nloc || !nloc->szHost) return false; - NetlibLogf(nlc->nlu,"(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort); + NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort); _itoa(nlc->nloc.wPort, szPort, 10); if (MyGetaddrinfo(nlc->nloc.szHost, szPort, &hints, &air)) { - NetlibLogf(nlc->nlu,"%s %d: %s() for host %s failed (%u)",__FILE__,__LINE__,"getaddrinfo", nlc->nloc.szHost, WSAGetLastError()); + NetlibLogf(nlc->nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "getaddrinfo", nlc->nloc.szHost, WSAGetLastError()); return false; } } @@ -604,7 +604,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) for (ai = air; ai && !Miranda_Terminated(); ai = ai->ai_next) { char* szIp = NetlibAddressToString((SOCKADDR_INET_M*)ai->ai_addr); - NetlibLogf(nlc->nlu,"(%p) Connecting to ip %s ....", nlc, szIp); + NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, szIp); mir_free(szIp); retry: nlc->s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); @@ -618,7 +618,7 @@ retry: SOCKET s = ai->ai_family == AF_INET ? nlc->s : INVALID_SOCKET; SOCKET s6 = ai->ai_family == AF_INET6 ? nlc->s : INVALID_SOCKET; if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum)) - NetlibLogf(nlc->nlu,"Netlib connect: Not enough ports for outgoing connections specified"); + NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified"); } // try a connect @@ -721,7 +721,7 @@ static int NetlibHttpFallbackToDirect(struct NetlibConnection *nlc, struct Netli { NetlibDoClose(nlc, true); - NetlibLogf(nlu,"Fallback to direct connection"); + NetlibLogf(nlu, "Fallback to direct connection"); nlc->proxyAuthNeeded = false; nlc->proxyType = 0; @@ -854,7 +854,7 @@ retry: nlc->usingDirectHttpGateway = true; } - NetlibLogf(nlu,"(%d) Connected to %s:%d", nlc->s, nloc->szHost, nloc->wPort); + NetlibLogf(nlu, "(%d) Connected to %s:%d", nlc->s, nloc->szHost, nloc->wPort); if (NLOCF_SSL & nloc->flags) { @@ -904,13 +904,13 @@ bool NetlibReconnect(NetlibConnection *nlc) return true; } -INT_PTR NetlibOpenConnection(WPARAM wParam,LPARAM lParam) +INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam) { NETLIBOPENCONNECTION *nloc = (NETLIBOPENCONNECTION*)lParam; struct NetlibUser *nlu = (struct NetlibUser*)wParam; struct NetlibConnection *nlc; - NetlibLogf(nlu,"Connection request to %s:%d (Flags %x)....", nloc->szHost, nloc->wPort, nloc->flags); + NetlibLogf(nlu, "Connection request to %s:%d (Flags %x)....", nloc->szHost, nloc->wPort, nloc->flags); if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) || nloc == NULL || (nloc->cbSize != NETLIBOPENCONNECTION_V1_SIZE && nloc->cbSize != sizeof(NETLIBOPENCONNECTION)) || @@ -929,7 +929,7 @@ INT_PTR NetlibOpenConnection(WPARAM wParam,LPARAM lParam) nlc->dnsThroughProxy = nlu->settings.dnsThroughProxy != 0; InitializeCriticalSection(&nlc->csHttpSequenceNums); - nlc->hOkToCloseEvent = CreateEvent(NULL,TRUE,TRUE,NULL); + nlc->hOkToCloseEvent = CreateEvent(NULL, TRUE, TRUE, NULL); nlc->dontCloseNow = 0; NetlibInitializeNestedCS(&nlc->ncsSend); NetlibInitializeNestedCS(&nlc->ncsRecv); @@ -966,7 +966,7 @@ INT_PTR NetlibStartSsl(WPARAM wParam, LPARAM lParam) nlc->hSsl = si.connect(nlc->s, szHost, nlc->nlu->settings.validateSSL); if (nlc->hSsl == NULL) - NetlibLogf(nlc->nlu,"(%d %s) Failure to negotiate SSL connection", nlc->s, szHost); + NetlibLogf(nlc->nlu, "(%d %s) Failure to negotiate SSL connection", nlc->s, szHost); else NetlibLogf(nlc->nlu, "(%d %s) SSL negotiation successful", nlc->s, szHost); diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 48d4f4c291..7649ab4ab1 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.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. @@ -34,64 +34,64 @@ static LIST tempSettings(5); static const UINT outgoingConnectionsControls[] = { - IDC_STATIC12, - IDC_USEPROXY, - IDC_STATIC21,IDC_PROXYTYPE, - IDC_STATIC22,IDC_PROXYHOST,IDC_STATIC23,IDC_PROXYPORT,IDC_STOFTENPORT, - IDC_PROXYAUTH, - IDC_STATIC31,IDC_PROXYUSER,IDC_STATIC32,IDC_PROXYPASS, - IDC_PROXYDNS, - IDC_SPECIFYPORTSO, - IDC_PORTSRANGEO, - IDC_STATIC54, + IDC_STATIC12, + IDC_USEPROXY, + IDC_STATIC21, IDC_PROXYTYPE, + IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT, + IDC_PROXYAUTH, + IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS, + IDC_PROXYDNS, + IDC_SPECIFYPORTSO, + IDC_PORTSRANGEO, + IDC_STATIC54, IDC_VALIDATESSL}; static const UINT useProxyControls[]={ - IDC_STATIC21,IDC_PROXYTYPE, - IDC_STATIC22,IDC_PROXYHOST,IDC_STATIC23,IDC_PROXYPORT,IDC_STOFTENPORT, - IDC_PROXYAUTH, - IDC_STATIC31,IDC_PROXYUSER,IDC_STATIC32,IDC_PROXYPASS, + IDC_STATIC21, IDC_PROXYTYPE, + IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT, + IDC_PROXYAUTH, + IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS, IDC_PROXYDNS}; static const UINT specifyOPortsControls[]={ - IDC_PORTSRANGEO, + IDC_PORTSRANGEO, IDC_STATIC54 }; static const UINT incomingConnectionsControls[]={ - IDC_STATIC43, - IDC_SPECIFYPORTS, - IDC_PORTSRANGE, - IDC_STATIC52, + IDC_STATIC43, + IDC_SPECIFYPORTS, + IDC_PORTSRANGE, + IDC_STATIC52, IDC_ENABLEUPNP}; static const UINT specifyPortsControls[]={ - IDC_PORTSRANGE, + IDC_PORTSRANGE, IDC_STATIC52}; -static const TCHAR* szProxyTypes[]={_T(""),_T("SOCKS4"),_T("SOCKS5"),_T("HTTP"),_T("HTTPS"),_T("Internet Explorer")}; -static const WORD oftenProxyPorts[]={1080,1080,1080,8080,8080,8080}; +static const TCHAR* szProxyTypes[]={_T(""), _T("SOCKS4"), _T("SOCKS5"), _T("HTTP"), _T("HTTPS"), _T("Internet Explorer")}; +static const WORD oftenProxyPorts[]={1080, 1080, 1080, 8080, 8080, 8080}; #define M_REFRESHALL (WM_USER+100) #define M_REFRESHENABLING (WM_USER+101) -static void ShowMultipleControls(HWND hwndDlg,const UINT *controls,int cControls,int state) +static void ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state) { int i; - for (i=0;iszIncomingPorts) dest->szIncomingPorts=mir_strdup(dest->szIncomingPorts); @@ -101,26 +101,26 @@ static void CopySettingsStruct(NETLIBUSERSETTINGS *dest,NETLIBUSERSETTINGS *sour if (dest->szProxyServer) dest->szProxyServer=mir_strdup(dest->szProxyServer); } -static void CombineSettingsStrings(char **dest,char **source) +static void CombineSettingsStrings(char **dest, char **source) { - if (*dest != NULL && (*source == NULL || lstrcmpiA(*dest,*source))) {mir_free(*dest); *dest=NULL;} + if (*dest != NULL && (*source == NULL || lstrcmpiA(*dest, *source))) {mir_free(*dest); *dest=NULL;} } -static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NETLIBUSERSETTINGS *source,DWORD sourceFlags) +static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest, DWORD *destFlags, NETLIBUSERSETTINGS *source, DWORD sourceFlags) { if (sourceFlags&NUF_OUTGOING) { if (*destFlags&NUF_OUTGOING) { if (dest->validateSSL != source->validateSSL) dest->validateSSL=2; if (dest->useProxy != source->useProxy) dest->useProxy=2; if (dest->proxyType != source->proxyType) dest->proxyType=0; - CombineSettingsStrings(&dest->szProxyServer,&source->szProxyServer); + CombineSettingsStrings(&dest->szProxyServer, &source->szProxyServer); if (dest->wProxyPort != source->wProxyPort) dest->wProxyPort=0; if (dest->useProxyAuth != source->useProxyAuth) dest->useProxyAuth=2; - CombineSettingsStrings(&dest->szProxyAuthUser,&source->szProxyAuthUser); - CombineSettingsStrings(&dest->szProxyAuthPassword,&source->szProxyAuthPassword); + CombineSettingsStrings(&dest->szProxyAuthUser, &source->szProxyAuthUser); + CombineSettingsStrings(&dest->szProxyAuthPassword, &source->szProxyAuthPassword); if (dest->dnsThroughProxy != source->dnsThroughProxy) dest->dnsThroughProxy=2; if (dest->specifyOutgoingPorts != source->specifyOutgoingPorts) dest->specifyOutgoingPorts=2; - CombineSettingsStrings(&dest->szOutgoingPorts,&source->szOutgoingPorts); + CombineSettingsStrings(&dest->szOutgoingPorts, &source->szOutgoingPorts); } else { dest->validateSSL=source->validateSSL; @@ -144,7 +144,7 @@ static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NET if (*destFlags&NUF_INCOMING) { if (dest->enableUPnP != source->enableUPnP) dest->enableUPnP=2; if (dest->specifyIncomingPorts != source->specifyIncomingPorts) dest->specifyIncomingPorts=2; - CombineSettingsStrings(&dest->szIncomingPorts,&source->szIncomingPorts); + CombineSettingsStrings(&dest->szIncomingPorts, &source->szIncomingPorts); } else { dest->enableUPnP=source->enableUPnP; @@ -158,12 +158,12 @@ static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NET else *destFlags|=sourceFlags; } -static void ChangeSettingIntByCheckbox(HWND hwndDlg,UINT ctrlId,int iUser,int memberOffset) +static void ChangeSettingIntByCheckbox(HWND hwndDlg, UINT ctrlId, int iUser, int memberOffset) { - int newValue,i; + int newValue, i; - newValue=IsDlgButtonChecked(hwndDlg,ctrlId) != BST_CHECKED; - CheckDlgButton(hwndDlg,ctrlId,newValue?BST_CHECKED:BST_UNCHECKED); + newValue=IsDlgButtonChecked(hwndDlg, ctrlId) != BST_CHECKED; + CheckDlgButton(hwndDlg, ctrlId, newValue?BST_CHECKED:BST_UNCHECKED); if (iUser == -1) { for (i=0; isettings) + memberOffset) = newValue; } else *(int*)(((PBYTE)&tempSettings[iUser]->settings) + memberOffset)=newValue; - SendMessage(hwndDlg,M_REFRESHENABLING,0,0); + SendMessage(hwndDlg, M_REFRESHENABLING, 0, 0); } -static void ChangeSettingStringByEdit(HWND hwndDlg,UINT ctrlId,int iUser,int memberOffset) +static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int memberOffset) { - int i,newValueLen; - char *szNewValue,**ppszNew; + int i, newValueLen; + char *szNewValue, **ppszNew; - newValueLen=GetWindowTextLength(GetDlgItem(hwndDlg,ctrlId)); + newValueLen=GetWindowTextLength(GetDlgItem(hwndDlg, ctrlId)); szNewValue=(char*)mir_alloc(newValueLen+1); - GetDlgItemTextA(hwndDlg,ctrlId,szNewValue,newValueLen+1); + GetDlgItemTextA(hwndDlg, ctrlId, szNewValue, newValueLen+1); if (iUser == -1) { for (i=0; ivalidateSSL); - DBWriteContactSettingByte(NULL,szSettingsModule,"NLUseProxy",(BYTE)settings->useProxy); - DBWriteContactSettingByte(NULL,szSettingsModule,"NLProxyType",(BYTE)settings->proxyType); - DBWriteContactSettingString(NULL,szSettingsModule,"NLProxyServer",settings->szProxyServer?settings->szProxyServer:""); - DBWriteContactSettingWord(NULL,szSettingsModule,"NLProxyPort",(WORD)settings->wProxyPort); - DBWriteContactSettingByte(NULL,szSettingsModule,"NLUseProxyAuth",(BYTE)settings->useProxyAuth); - DBWriteContactSettingString(NULL,szSettingsModule,"NLProxyAuthUser",settings->szProxyAuthUser?settings->szProxyAuthUser:""); - lstrcpynA(szEncodedPassword,settings->szProxyAuthPassword?settings->szProxyAuthPassword:"",SIZEOF(szEncodedPassword)); - CallService(MS_DB_CRYPT_ENCODESTRING,SIZEOF(szEncodedPassword),(LPARAM)szEncodedPassword); - DBWriteContactSettingString(NULL,szSettingsModule,"NLProxyAuthPassword",szEncodedPassword); - DBWriteContactSettingByte(NULL,szSettingsModule,"NLDnsThroughProxy",(BYTE)settings->dnsThroughProxy); - DBWriteContactSettingByte(NULL,szSettingsModule,"NLSpecifyOutgoingPorts",(BYTE)settings->specifyOutgoingPorts); - DBWriteContactSettingString(NULL,szSettingsModule,"NLOutgoingPorts",settings->szOutgoingPorts?settings->szOutgoingPorts:""); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLValidateSSL", (BYTE)settings->validateSSL); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLUseProxy", (BYTE)settings->useProxy); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLProxyType", (BYTE)settings->proxyType); + DBWriteContactSettingString(NULL, szSettingsModule, "NLProxyServer", settings->szProxyServer?settings->szProxyServer:""); + DBWriteContactSettingWord(NULL, szSettingsModule, "NLProxyPort", (WORD)settings->wProxyPort); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLUseProxyAuth", (BYTE)settings->useProxyAuth); + DBWriteContactSettingString(NULL, szSettingsModule, "NLProxyAuthUser", settings->szProxyAuthUser?settings->szProxyAuthUser:""); + lstrcpynA(szEncodedPassword, settings->szProxyAuthPassword?settings->szProxyAuthPassword:"", SIZEOF(szEncodedPassword)); + CallService(MS_DB_CRYPT_ENCODESTRING, SIZEOF(szEncodedPassword), (LPARAM)szEncodedPassword); + DBWriteContactSettingString(NULL, szSettingsModule, "NLProxyAuthPassword", szEncodedPassword); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLDnsThroughProxy", (BYTE)settings->dnsThroughProxy); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLSpecifyOutgoingPorts", (BYTE)settings->specifyOutgoingPorts); + DBWriteContactSettingString(NULL, szSettingsModule, "NLOutgoingPorts", settings->szOutgoingPorts?settings->szOutgoingPorts:""); } if (flags&NUF_INCOMING) { - DBWriteContactSettingByte(NULL,szSettingsModule,"NLEnableUPnP",(BYTE)settings->enableUPnP); - DBWriteContactSettingByte(NULL,szSettingsModule,"NLSpecifyIncomingPorts",(BYTE)settings->specifyIncomingPorts); - DBWriteContactSettingString(NULL,szSettingsModule,"NLIncomingPorts",settings->szIncomingPorts?settings->szIncomingPorts:""); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLEnableUPnP", (BYTE)settings->enableUPnP); + DBWriteContactSettingByte(NULL, szSettingsModule, "NLSpecifyIncomingPorts", (BYTE)settings->specifyIncomingPorts); + DBWriteContactSettingString(NULL, szSettingsModule, "NLIncomingPorts", settings->szIncomingPorts?settings->szIncomingPorts:""); } } -void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTINGS *settings) +void NetlibSaveUserSettingsStruct(const char *szSettingsModule, NETLIBUSERSETTINGS *settings) { int i; NETLIBUSERSETTINGS combinedSettings={0}; @@ -259,7 +259,7 @@ void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTING if (combinedSettings.dnsThroughProxy == 2) combinedSettings.dnsThroughProxy=1; if (combinedSettings.enableUPnP == 2) combinedSettings.enableUPnP=1; if (combinedSettings.specifyIncomingPorts == 2) combinedSettings.specifyIncomingPorts=0; - WriteSettingsStructToDb("Netlib",&combinedSettings,flags); + WriteSettingsStructToDb("Netlib", &combinedSettings, flags); NetlibFreeUserSettingsStruct(&combinedSettings); LeaveCriticalSection(&csNetlibUser); } @@ -269,12 +269,12 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) { case WM_INITDIALOG: - { int iUser,iItem; + { int iUser, iItem; TranslateDialogDefault(hwndDlg); - iItem=SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_ADDSTRING,0,(LPARAM)TranslateT("")); - SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_SETITEMDATA,iItem,(LPARAM)-1); - SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_SETCURSEL,iItem,0); + iItem=SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_ADDSTRING, 0, (LPARAM)TranslateT("")); + SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_SETITEMDATA, iItem, (LPARAM)-1); + SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_SETCURSEL, iItem, 0); EnterCriticalSection(&csNetlibUser); for (iUser = 0; iUser < netlibUser.getCount(); ++iUser) @@ -288,15 +288,15 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (netlibUser[iUser]->user.flags & NUF_NOOPTIONS) continue; iItem = SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_ADDSTRING, 0, (LPARAM)netlibUser[iUser]->user.ptszDescriptiveName); - SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS,CB_SETITEMDATA, iItem, iUser); + SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_SETITEMDATA, iItem, iUser); } LeaveCriticalSection(&csNetlibUser); - SendMessage(hwndDlg,M_REFRESHALL,0,0); + SendMessage(hwndDlg, M_REFRESHALL, 0, 0); return TRUE; } case M_REFRESHALL: - { int iUser=SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETCURSEL,0,0),0); + { int iUser=SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETCURSEL, 0, 0), 0); NETLIBUSERSETTINGS settings = {0}; DWORD flags; @@ -316,46 +316,46 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, CopySettingsStruct(&settings, &tempSettings[iUser]->settings); flags = tempSettings[iUser]->flags; } - ShowMultipleControls(hwndDlg,outgoingConnectionsControls,SIZEOF(outgoingConnectionsControls),flags&NUF_OUTGOING?SW_SHOW:SW_HIDE); - CheckDlgButton(hwndDlg,IDC_USEPROXY,settings.useProxy); - SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_RESETCONTENT,0,0); - if (settings.proxyType == 0) AddProxyTypeItem(hwndDlg,0,settings.proxyType); + ShowMultipleControls(hwndDlg, outgoingConnectionsControls, SIZEOF(outgoingConnectionsControls), flags&NUF_OUTGOING?SW_SHOW:SW_HIDE); + CheckDlgButton(hwndDlg, IDC_USEPROXY, settings.useProxy); + SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_RESETCONTENT, 0, 0); + if (settings.proxyType == 0) AddProxyTypeItem(hwndDlg, 0, settings.proxyType); AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS4, settings.proxyType); AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS5, settings.proxyType); - if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg,PROXYTYPE_HTTP,settings.proxyType); - if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg,PROXYTYPE_HTTPS,settings.proxyType); + if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTP, settings.proxyType); + if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType); if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY) || !(flags & NUF_NOHTTPSOPTION)) - AddProxyTypeItem(hwndDlg,PROXYTYPE_IE,settings.proxyType); - SetDlgItemTextA(hwndDlg,IDC_PROXYHOST,settings.szProxyServer?settings.szProxyServer:""); - if (settings.wProxyPort) SetDlgItemInt(hwndDlg,IDC_PROXYPORT,settings.wProxyPort,FALSE); - else SetDlgItemTextA(hwndDlg,IDC_PROXYPORT,""); - CheckDlgButton(hwndDlg,IDC_PROXYAUTH,settings.useProxyAuth); - SetDlgItemTextA(hwndDlg,IDC_PROXYUSER,settings.szProxyAuthUser?settings.szProxyAuthUser:""); - SetDlgItemTextA(hwndDlg,IDC_PROXYPASS,settings.szProxyAuthPassword?settings.szProxyAuthPassword:""); - CheckDlgButton(hwndDlg,IDC_PROXYDNS,settings.dnsThroughProxy); - CheckDlgButton(hwndDlg,IDC_VALIDATESSL,settings.validateSSL); + AddProxyTypeItem(hwndDlg, PROXYTYPE_IE, settings.proxyType); + SetDlgItemTextA(hwndDlg, IDC_PROXYHOST, settings.szProxyServer?settings.szProxyServer:""); + if (settings.wProxyPort) SetDlgItemInt(hwndDlg, IDC_PROXYPORT, settings.wProxyPort, FALSE); + else SetDlgItemTextA(hwndDlg, IDC_PROXYPORT, ""); + CheckDlgButton(hwndDlg, IDC_PROXYAUTH, settings.useProxyAuth); + SetDlgItemTextA(hwndDlg, IDC_PROXYUSER, settings.szProxyAuthUser?settings.szProxyAuthUser:""); + SetDlgItemTextA(hwndDlg, IDC_PROXYPASS, settings.szProxyAuthPassword?settings.szProxyAuthPassword:""); + CheckDlgButton(hwndDlg, IDC_PROXYDNS, settings.dnsThroughProxy); + CheckDlgButton(hwndDlg, IDC_VALIDATESSL, settings.validateSSL); - ShowMultipleControls(hwndDlg,incomingConnectionsControls,SIZEOF(incomingConnectionsControls),flags&NUF_INCOMING?SW_SHOW:SW_HIDE); - CheckDlgButton(hwndDlg,IDC_SPECIFYPORTS,settings.specifyIncomingPorts); - SetDlgItemTextA(hwndDlg,IDC_PORTSRANGE,settings.szIncomingPorts?settings.szIncomingPorts:""); + ShowMultipleControls(hwndDlg, incomingConnectionsControls, SIZEOF(incomingConnectionsControls), flags&NUF_INCOMING?SW_SHOW:SW_HIDE); + CheckDlgButton(hwndDlg, IDC_SPECIFYPORTS, settings.specifyIncomingPorts); + SetDlgItemTextA(hwndDlg, IDC_PORTSRANGE, settings.szIncomingPorts?settings.szIncomingPorts:""); - CheckDlgButton(hwndDlg,IDC_SPECIFYPORTSO,settings.specifyOutgoingPorts); - SetDlgItemTextA(hwndDlg,IDC_PORTSRANGEO,settings.szOutgoingPorts?settings.szOutgoingPorts:""); + CheckDlgButton(hwndDlg, IDC_SPECIFYPORTSO, settings.specifyOutgoingPorts); + SetDlgItemTextA(hwndDlg, IDC_PORTSRANGEO, settings.szOutgoingPorts?settings.szOutgoingPorts:""); - CheckDlgButton(hwndDlg,IDC_ENABLEUPNP,settings.enableUPnP); + CheckDlgButton(hwndDlg, IDC_ENABLEUPNP, settings.enableUPnP); NetlibFreeUserSettingsStruct(&settings); - SendMessage(hwndDlg,M_REFRESHENABLING,0,0); + SendMessage(hwndDlg, M_REFRESHENABLING, 0, 0); break; } case M_REFRESHENABLING: { int selectedProxyType; TCHAR str[80]; - selectedProxyType=SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETCURSEL,0,0),0); - mir_sntprintf(str, SIZEOF(str), TranslateT("(often %d)"),oftenProxyPorts[selectedProxyType]); - SetDlgItemText(hwndDlg,IDC_STOFTENPORT,str); - if (IsDlgButtonChecked(hwndDlg,IDC_USEPROXY) != BST_UNCHECKED) + selectedProxyType=SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0); + mir_sntprintf(str, SIZEOF(str), TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]); + SetDlgItemText(hwndDlg, IDC_STOFTENPORT, str); + if (IsDlgButtonChecked(hwndDlg, IDC_USEPROXY) != BST_UNCHECKED) { int enableAuth = 0, enableUser = 0, enablePass = 0, enableServer = 1; EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), TRUE); @@ -386,29 +386,29 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { if (selectedProxyType == PROXYTYPE_IE) enableServer=0; enableAuth=1; - if (IsDlgButtonChecked(hwndDlg,IDC_PROXYAUTH) != BST_UNCHECKED) + if (IsDlgButtonChecked(hwndDlg, IDC_PROXYAUTH) != BST_UNCHECKED) enableUser = enablePass = 1; } } - EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYAUTH), enableAuth); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC31), enableUser); - EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYUSER), enableUser); - EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC32), enablePass); - EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYPASS), enablePass); - EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYHOST), enableServer); - EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYPORT), enableServer); + EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYAUTH), enableAuth); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC31), enableUser); + EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYUSER), enableUser); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC32), enablePass); + EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYPASS), enablePass); + EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYHOST), enableServer); + EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYPORT), enableServer); } - else EnableMultipleControls(hwndDlg,useProxyControls,SIZEOF(useProxyControls),FALSE); - EnableMultipleControls(hwndDlg,specifyPortsControls,SIZEOF(specifyPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTS) != BST_UNCHECKED); - EnableMultipleControls(hwndDlg,specifyOPortsControls,SIZEOF(specifyOPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTSO) != BST_UNCHECKED); + else EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), FALSE); + EnableMultipleControls(hwndDlg, specifyPortsControls, SIZEOF(specifyPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTS) != BST_UNCHECKED); + EnableMultipleControls(hwndDlg, specifyOPortsControls, SIZEOF(specifyOPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTSO) != BST_UNCHECKED); break; } case WM_COMMAND: - { int iUser=SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETCURSEL,0,0),0); + { int iUser=SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETCURSEL, 0, 0), 0); switch(LOWORD(wParam)) { case IDC_NETLIBUSERS: - if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(hwndDlg,M_REFRESHALL,0,0); + if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(hwndDlg, M_REFRESHALL, 0, 0); return 0; case IDC_LOGOPTIONS: @@ -417,8 +417,8 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_PROXYTYPE: if (HIWORD(wParam) != CBN_SELCHANGE) return 0; - { int newValue,i; - newValue = SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETCURSEL,0,0),0); + { int newValue, i; + newValue = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0); if (iUser == -1) { if (newValue == 0) return 0; @@ -436,39 +436,39 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, else { tempSettings[iUser]->settings.proxyType = newValue; - SendMessage(hwndDlg,M_REFRESHENABLING,0,0); + SendMessage(hwndDlg, M_REFRESHENABLING, 0, 0); } } break; case IDC_USEPROXY: - ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,useProxy)); + ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, useProxy)); break; case IDC_PROXYAUTH: - ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,useProxyAuth)); + ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, useProxyAuth)); break; case IDC_PROXYDNS: - ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,dnsThroughProxy)); + ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, dnsThroughProxy)); break; case IDC_SPECIFYPORTS: - ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,specifyIncomingPorts)); + ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, specifyIncomingPorts)); break; case IDC_SPECIFYPORTSO: - ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,specifyOutgoingPorts)); + ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, specifyOutgoingPorts)); break; case IDC_ENABLEUPNP: - ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,enableUPnP)); + ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, enableUPnP)); break; case IDC_VALIDATESSL: - ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,validateSSL)); + ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, validateSSL)); break; case IDC_PROXYHOST: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; - ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyServer)); + ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szProxyServer)); break; case IDC_PROXYPORT: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; - { int newValue,i; - newValue=GetDlgItemInt(hwndDlg,LOWORD(wParam),NULL,FALSE); + { int newValue, i; + newValue=GetDlgItemInt(hwndDlg, LOWORD(wParam), NULL, FALSE); if (iUser == -1) { for (i = 0; i < tempSettings.getCount(); ++i) @@ -480,23 +480,23 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, break; case IDC_PROXYUSER: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; - ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthUser)); + ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szProxyAuthUser)); break; case IDC_PROXYPASS: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; - ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthPassword)); + ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szProxyAuthPassword)); break; case IDC_PORTSRANGE: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; - ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szIncomingPorts)); + ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szIncomingPorts)); break; case IDC_PORTSRANGEO: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; - ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szOutgoingPorts)); + ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szOutgoingPorts)); break; } - ShowWindow(GetDlgItem(hwndDlg,IDC_RECONNECTREQD),SW_SHOW); - SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); + ShowWindow(GetDlgItem(hwndDlg, IDC_RECONNECTREQD), SW_SHOW); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } case WM_NOTIFY: @@ -531,7 +531,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } static UINT expertOnlyControls[]={IDC_LOGOPTIONS}; -int NetlibOptInitialise(WPARAM wParam,LPARAM) +int NetlibOptInitialise(WPARAM wParam, LPARAM) { int optionsCount = 0; EnterCriticalSection(&csNetlibUser); diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp index 401e545792..56f9b8ffae 100644 --- a/src/modules/netlib/netlibpktrecver.cpp +++ b/src/modules/netlib/netlibpktrecver.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" #include "netlib.h" -INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam) +INT_PTR NetlibPacketRecverCreate(WPARAM wParam, LPARAM lParam) { struct NetlibConnection *nlc=(struct NetlibConnection*)wParam; struct NetlibPacketRecver *nlpr; @@ -47,7 +47,7 @@ INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam) return (INT_PTR)nlpr; } -INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam) +INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam) { struct NetlibPacketRecver *nlpr=(struct NetlibPacketRecver*)wParam; NETLIBPACKETRECVER *nlprParam=(NETLIBPACKETRECVER*)lParam; @@ -65,20 +65,20 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam) if (nlprParam->bytesUsed == 0) { if (nlpr->packetRecver.bytesAvailable == nlpr->packetRecver.bufferSize) { nlpr->packetRecver.bytesAvailable=0; - NetlibLogf(nlpr->nlc->nlu,"Packet recver: packet overflowed buffer, ditching"); + NetlibLogf(nlpr->nlc->nlu, "Packet recver: packet overflowed buffer, ditching"); } } else { - MoveMemory(nlpr->packetRecver.buffer,nlpr->packetRecver.buffer+nlprParam->bytesUsed,nlpr->packetRecver.bytesAvailable-nlprParam->bytesUsed); + MoveMemory(nlpr->packetRecver.buffer, nlpr->packetRecver.buffer+nlprParam->bytesUsed, nlpr->packetRecver.bytesAvailable-nlprParam->bytesUsed); nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed; } if (nlprParam->dwTimeout != INFINITE) { - if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s,nlprParam->dwTimeout) <= 0) { + if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) { *nlprParam=nlpr->packetRecver; return SOCKET_ERROR; } } - recvResult=NLRecv(nlpr->nlc, (char*)nlpr->packetRecver.buffer+nlpr->packetRecver.bytesAvailable,nlpr->packetRecver.bufferSize-nlpr->packetRecver.bytesAvailable,0); + recvResult=NLRecv(nlpr->nlc, (char*)nlpr->packetRecver.buffer+nlpr->packetRecver.bytesAvailable, nlpr->packetRecver.bufferSize-nlpr->packetRecver.bytesAvailable, 0); if (recvResult>0) nlpr->packetRecver.bytesAvailable+=recvResult; *nlprParam=nlpr->packetRecver; return recvResult; diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index a8da8af514..c97ee97c30 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -1,7 +1,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. @@ -10,7 +10,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. @@ -67,7 +67,7 @@ static HANDLE hSecMutex; static void ReportSecError(SECURITY_STATUS scRet, int line) { char szMsgBuf[256]; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, SIZEOF(szMsgBuf), NULL); char *p = strchr(szMsgBuf, 13); if (p) *p = 0; @@ -197,8 +197,8 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls SecBuffer inBuffers[2] = { - { sizeof(inDataBuffer), SECBUFFER_DATA, inDataBuffer }, - { chlsz, SECBUFFER_STREAM, szChallenge }, + { sizeof(inDataBuffer), SECBUFFER_DATA, inDataBuffer }, + { chlsz, SECBUFFER_STREAM, szChallenge }, }; SecBufferDesc inBuffersDesc = { SECBUFFER_VERSION, 2, inBuffers }; @@ -229,8 +229,8 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls SecBuffer outBuffers[3] = { - { sizes.cbSecurityTrailer, SECBUFFER_TOKEN, tokenBuffer }, - { sizeof(outDataBuffer), SECBUFFER_DATA, outDataBuffer }, + { sizes.cbSecurityTrailer, SECBUFFER_TOKEN, tokenBuffer }, + { sizeof(outDataBuffer), SECBUFFER_DATA, outDataBuffer }, { sizes.cbBlockSize, SECBUFFER_PADDING, paddingBuffer } }; SecBufferDesc outBuffersDesc = { SECBUFFER_VERSION, 3, outBuffers }; @@ -259,7 +259,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls nlb64.pbDecoded = response; nlb64.cchEncoded = Netlib_GetBase64EncodedBufferSize(nlb64.cbDecoded); nlb64.pszEncoded = (char*)alloca(nlb64.cchEncoded); - if (!NetlibBase64Encode(0,(LPARAM)&nlb64)) return NULL; + if (!NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL; return mir_strdup(nlb64.pszEncoded); } @@ -268,8 +268,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, bool http, unsigned& complete) { SECURITY_STATUS sc; - SecBufferDesc outputBufferDescriptor,inputBufferDescriptor; - SecBuffer outputSecurityToken,inputSecurityToken; + SecBufferDesc outputBufferDescriptor, inputBufferDescriptor; + SecBuffer outputSecurityToken, inputSecurityToken; TimeStamp tokenExpiration; ULONG contextAttributes; NETLIBBASE64 nlb64 = { 0 }; @@ -422,10 +422,10 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, outputSecurityToken.cbBuffer = hNtlm->cbMaxToken; outputSecurityToken.pvBuffer = alloca(outputSecurityToken.cbBuffer); - sc = g_pSSPI->InitializeSecurityContext(&hNtlm->hClientCredential, - hasChallenge ? &hNtlm->hClientContext : NULL, - hNtlm->szPrincipal, isGSSAPI ? ISC_REQ_MUTUAL_AUTH | ISC_REQ_STREAM : 0, 0, SECURITY_NATIVE_DREP, - hasChallenge ? &inputBufferDescriptor : NULL, 0, &hNtlm->hClientContext, + sc = g_pSSPI->InitializeSecurityContext(&hNtlm->hClientCredential, + hasChallenge ? &hNtlm->hClientContext : NULL, + hNtlm->szPrincipal, isGSSAPI ? ISC_REQ_MUTUAL_AUTH | ISC_REQ_STREAM : 0, 0, SECURITY_NATIVE_DREP, + hasChallenge ? &inputBufferDescriptor : NULL, 0, &hNtlm->hClientContext, &outputBufferDescriptor, &contextAttributes, &tokenExpiration); complete = (sc != SEC_I_COMPLETE_AND_CONTINUE && sc != SEC_I_CONTINUE_NEEDED); @@ -454,7 +454,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, size_t authLen = strlen(szLogin) + strlen(szPassw) + 5; char *szAuth = (char*)alloca(authLen); - nlb64.cbDecoded = mir_snprintf(szAuth, authLen,"%s:%s", szLogin, szPassw); + nlb64.cbDecoded = mir_snprintf(szAuth, authLen, "%s:%s", szLogin, szPassw); nlb64.pbDecoded=(PBYTE)szAuth; complete = true; @@ -464,7 +464,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, nlb64.cchEncoded = Netlib_GetBase64EncodedBufferSize(nlb64.cbDecoded); nlb64.pszEncoded = (char*)alloca(nlb64.cchEncoded); - if (!NetlibBase64Encode(0,(LPARAM)&nlb64)) return NULL; + if (!NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL; char* result; if (http) diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index 251d95e0fd..c2f5094aac 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2012 Miranda ICQ/IM project, +Copyright 2000-2012 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. @@ -117,14 +117,14 @@ static int ConnectionListToSocketList(HANDLE *hConns, fd_set *fd, int& pending) SetLastError(ERROR_INVALID_DATA); return 0; } - FD_SET(nlcCheck->s,fd); + FD_SET(nlcCheck->s, fd); if (si.pending(nlcCheck->hSsl)) pending++; } return 1; } -INT_PTR NetlibSelect(WPARAM,LPARAM lParam) +INT_PTR NetlibSelect(WPARAM, LPARAM lParam) { NETLIBSELECT *nls = (NETLIBSELECT*)lParam; if (nls == NULL || nls->cbSize != sizeof(NETLIBSELECT)) @@ -197,19 +197,19 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) if (conn->usingHttpGateway && conn->nlhpi.szHttpGetUrl == NULL && conn->dataBuffer == NULL) nls->hReadStatus[j] = (conn->pHttpProxyPacketQueue != NULL); else - nls->hReadStatus[j] = FD_ISSET(conn->s,&readfd); + nls->hReadStatus[j] = FD_ISSET(conn->s, &readfd); } for (j = 0; j < FD_SETSIZE; j++) { conn = (NetlibConnection*)nls->hWriteConns[j]; if (conn == NULL || conn == INVALID_HANDLE_VALUE) break; - nls->hWriteStatus[j] = FD_ISSET(conn->s,&writefd); + nls->hWriteStatus[j] = FD_ISSET(conn->s, &writefd); } for (j = 0; j < FD_SETSIZE; j++) { conn = (NetlibConnection*)nls->hExceptConns[j]; if (conn == NULL || conn == INVALID_HANDLE_VALUE) break; - nls->hExceptStatus[j] = FD_ISSET(conn->s,&exceptfd); + nls->hExceptStatus[j] = FD_ISSET(conn->s, &exceptfd); } ReleaseMutex(hConnectionHeaderMutex); return rc; diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp index d533bc1236..76c663d5ba 100644 --- a/src/modules/netlib/netlibssl.cpp +++ b/src/modules/netlib/netlibssl.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. @@ -54,8 +54,8 @@ static pfnCertVerifyCertificateChainPolicy fnCertVerifyCertificateChainPolicy; typedef enum { - sockOpen, - sockClosed, + sockOpen, + sockClosed, sockError } SocketState; @@ -96,7 +96,7 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool showPopup = fal break; default: - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, SIZEOF(szMsgBuf), NULL); } @@ -133,7 +133,7 @@ static bool AcquireCredentials(void) &SchannelCred, // Package specific data NULL, // Pointer to GetKey() func NULL, // Value to pass to GetKey() - &hCreds, // (out) Cred Handle + &hCreds, // (out) Cred Handle &tsExpiry); // (out) Lifetime (optional) ReportSslError(scRet, __LINE__); @@ -207,8 +207,8 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF static LPSTR rgszUsages[] = { - szOID_PKIX_KP_SERVER_AUTH, - szOID_SERVER_GATED_CRYPTO, + szOID_PKIX_KP_SERVER_AUTH, + szOID_SERVER_GATED_CRYPTO, szOID_SGC_NETSCAPE }; @@ -222,7 +222,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF PWSTR pwszServerName = mir_a2u(pszServerName); - scRet = g_pSSPI->QueryContextAttributesA(&ssl->hContext, + scRet = g_pSSPI->QueryContextAttributesA(&ssl->hContext, SECPKG_ATTR_REMOTE_CERT_CONTEXT, &pServerCert); if (scRet != SEC_E_OK) goto cleanup; @@ -255,7 +255,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF PolicyStatus.cbSize = sizeof(PolicyStatus); - if (!fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext, + if (!fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext, &PolicyPara, &PolicyStatus)) { scRet = GetLastError(); @@ -386,17 +386,17 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead) OutBuffer.ulVersion = SECBUFFER_VERSION; scRet = g_pSSPI->InitializeSecurityContextA( - &hCreds, - &ssl->hContext, - NULL, - dwSSPIFlags, - 0, - SECURITY_NATIVE_DREP, - &InBuffer, - 0, - NULL, - &OutBuffer, - &dwSSPIOutFlags, + &hCreds, + &ssl->hContext, + NULL, + dwSSPIFlags, + 0, + SECURITY_NATIVE_DREP, + &InBuffer, + 0, + NULL, + &OutBuffer, + &dwSSPIOutFlags, &tsExpiry); // If success (or if the error was one of the special extended ones), @@ -431,8 +431,8 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead) // Store remaining data for further use if (InBuffers[1].BufferType == SECBUFFER_EXTRA) { - memmove(ssl->pbIoBuffer, - ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer), + memmove(ssl->pbIoBuffer, + ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer), InBuffers[1].cbBuffer); ssl->cbIoBuffer = InBuffers[1].cbBuffer; } @@ -460,8 +460,8 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead) // Copy any leftover data from the buffer, and go around again. if (InBuffers[1].BufferType == SECBUFFER_EXTRA) { - memmove(ssl->pbIoBuffer, - ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer), + memmove(ssl->pbIoBuffer, + ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer), InBuffers[1].cbBuffer); ssl->cbIoBuffer = InBuffers[1].cbBuffer; @@ -518,17 +518,17 @@ static bool ClientConnect(SslHandle *ssl, const char *host) OutBuffer.ulVersion = SECBUFFER_VERSION; scRet = g_pSSPI->InitializeSecurityContextA( - &hCreds, - NULL, - (SEC_CHAR*)host, - dwSSPIFlags, - 0, - SECURITY_NATIVE_DREP, - NULL, - 0, - &ssl->hContext, - &OutBuffer, - &dwSSPIOutFlags, + &hCreds, + NULL, + (SEC_CHAR*)host, + dwSSPIFlags, + 0, + SECURITY_NATIVE_DREP, + NULL, + 0, + &ssl->hContext, + &OutBuffer, + &dwSSPIOutFlags, &tsExpiry); if (scRet != SEC_I_CONTINUE_NEEDED) @@ -631,17 +631,17 @@ void NetlibSslShutdown(SslHandle *ssl) OutBuffer.ulVersion = SECBUFFER_VERSION; scRet = g_pSSPI->InitializeSecurityContextA( - &hCreds, - &ssl->hContext, - NULL, - dwSSPIFlags, - 0, - SECURITY_NATIVE_DREP, - NULL, - 0, - &ssl->hContext, - &OutBuffer, - &dwSSPIOutFlags, + &hCreds, + &ssl->hContext, + NULL, + dwSSPIFlags, + 0, + SECURITY_NATIVE_DREP, + NULL, + 0, + &ssl->hContext, + &OutBuffer, + &dwSSPIOutFlags, &tsExpiry); if (FAILED(scRet)) return; @@ -953,10 +953,10 @@ static INT_PTR GetSslApi(WPARAM, LPARAM lParam) if (si->cbSize != sizeof(SSL_API)) return FALSE; - si->connect = (HSSL (__cdecl *)(SOCKET,const char *,int))NetlibSslConnect; + si->connect = (HSSL (__cdecl *)(SOCKET, const char *, int))NetlibSslConnect; si->pending = (BOOL (__cdecl *)(HSSL))NetlibSslPending; - si->read = (int (__cdecl *)(HSSL,char *,int,int))NetlibSslRead; - si->write = (int (__cdecl *)(HSSL,const char *,int))NetlibSslWrite; + si->read = (int (__cdecl *)(HSSL, char *, int, int))NetlibSslRead; + si->write = (int (__cdecl *)(HSSL, const char *, int))NetlibSslWrite; si->shutdown = (void (__cdecl *)(HSSL))NetlibSslShutdown; si->sfree = (void (__cdecl *)(HSSL))NetlibSslFree; diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 655bb781eb..12e0345c27 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2012 Miranda ICQ/IM project, +Copyright 2000-2012 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. @@ -115,12 +115,12 @@ static char szCtlUrl[256], szDev[256]; typedef enum { - DeviceGetReq, - ControlAction, + DeviceGetReq, + ControlAction, ControlQuery } ReqType; -static bool txtParseParam(char* szData, char* presearch, +static bool txtParseParam(char* szData, char* presearch, char* start, char* finish, char* param, size_t size) { char *cp, *cp1; @@ -156,14 +156,14 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath) char *ppath, *phost, *pport; int sz; - phost = strstr(szUrl,"://"); + phost = strstr(szUrl, "://"); if (phost == NULL) phost = szUrl; else phost += 3; - ppath = strchr(phost,'/'); + ppath = strchr(phost, '/'); if (ppath == NULL) ppath = phost + strlen(phost); - pport = strchr(phost,':'); + pport = strchr(phost, ':'); if (pport == NULL) pport = ppath; if (szHost != NULL) @@ -272,11 +272,11 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction char szData1[1024]; szReq = mir_strdup(szResult); - sz = mir_snprintf (szData1, sizeof(szData1), + sz = mir_snprintf (szData1, sizeof(szData1), soap_action, szActionName, szDev, szReq, szActionName); - sz = mir_snprintf (szData, 4096, - szPostHdr, szPath, szHost, sPort, + sz = mir_snprintf (szData, 4096, + szPostHdr, szPath, szHost, sPort, sz, szDev, szActionName, szData1); } break; @@ -285,11 +285,11 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction { char szData1[1024]; - sz = mir_snprintf (szData1, sizeof(szData1), + sz = mir_snprintf (szData1, sizeof(szData1), soap_query, szActionName); - sz = mir_snprintf (szData, 4096, - szPostHdr, szPath, szHost, sPort, + sz = mir_snprintf (szData, 4096, + szPostHdr, szPath, szHost, sPort, sz, "urn:schemas-upnp-org:control-1-0", "QueryStateVariable", szData1); } break; @@ -742,7 +742,7 @@ bool NetlibUPnPAddPortMapping(WORD intport, char *proto, WORD *extport, DWORD *e do { ++*extport; - mir_snprintf(szData, 4096, add_port_mapping, + mir_snprintf(szData, 4096, add_port_mapping, *extport, proto, intport, inet_ntoa(locIP.sin_addr)); res = httpTransact(szCtlUrl, szData, 4096, "AddPortMapping", ControlAction); txtParseParam(szData, NULL, "", "", szExtIP, sizeof(szExtIP)); @@ -795,7 +795,7 @@ void NetlibUPnPDeletePortMapping(WORD extport, char* proto) void NetlibUPnPCleanup(void*) { - if (DBGetContactSettingByte(NULL,"Netlib","NLEnableUPnP",1) == 0) + if (DBGetContactSettingByte(NULL, "Netlib", "NLEnableUPnP", 1) == 0) // upnp is disabled globally, no need for a cleanup return; diff --git a/src/modules/options/descbutton.cpp b/src/modules/options/descbutton.cpp index 2b5a270271..08538fc41c 100644 --- a/src/modules/options/descbutton.cpp +++ b/src/modules/options/descbutton.cpp @@ -3,7 +3,7 @@ Miranda IM: the free IM client for Microsoft* Windows* Copyright 2007 Artem Shpynov -Copyright 2000-2007 Miranda ICQ/IM project, +Copyright 2000-2007 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -13,7 +13,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. @@ -130,8 +130,8 @@ static void MDescButton_DrawGradient(HDC hdc, int x, int y, int width, int heigh RECT rc; SetRect(&rc, x, 0, x+width, 0); for (int i=y+height; --i >= y; ) { COLORREF color = RGB( - ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height, - ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height, + ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height, + ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height, ((height-i-1)*rgb0->rgbBlue + i*rgb1->rgbBlue) / height); rc.top = rc.bottom = i; ++rc.bottom; @@ -150,13 +150,13 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat, UINT msg RECT temprc; HFONT hfntSave; - HDC hdc=BeginPaint(hwndDlg,&ps); + HDC hdc=BeginPaint(hwndDlg, &ps); HDC tempDC=CreateCompatibleDC(hdc); SIZE titleSize = {0}; - hBmp=CreateCompatibleBitmap(hdc,dat->width, dat->height); - hOldBmp=(HBITMAP)SelectObject(tempDC,hBmp); + hBmp=CreateCompatibleBitmap(hdc, dat->width, dat->height); + hOldBmp=(HBITMAP)SelectObject(tempDC, hBmp); temprc.left=0; temprc.right=dat->width; @@ -212,11 +212,11 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat, UINT msg SelectObject(tempDC, hfntSave); //Copy to output - BitBlt(hdc,dat->rc.left,dat->rc.top,dat->width,dat->height,tempDC,0,0,SRCCOPY); - SelectObject(tempDC,hOldBmp); + BitBlt(hdc, dat->rc.left, dat->rc.top, dat->width, dat->height, tempDC, 0, 0, SRCCOPY); + SelectObject(tempDC, hOldBmp); DeleteObject(hBmp); DeleteDC(tempDC); - EndPaint(hwndDlg,&ps); + EndPaint(hwndDlg, &ps); return TRUE; } @@ -240,7 +240,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara break; case WM_SIZE: - GetClientRect(hwndDlg,&dat->rc); + GetClientRect(hwndDlg, &dat->rc); dat->width=dat->rc.right-dat->rc.left; dat->height=dat->rc.bottom-dat->rc.top; return TRUE; diff --git a/src/modules/options/filter.cpp b/src/modules/options/filter.cpp index 0088220266..3e003d720e 100644 --- a/src/modules/options/filter.cpp +++ b/src/modules/options/filter.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. @@ -50,7 +50,7 @@ INT_PTR CALLBACK DlgProcOptSearch(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_ENABLE_KEYWORDFILTERING: - SendMessage(GetParent(hWnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); break; } break; @@ -151,7 +151,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) AddFilterString(key, title); TCHAR szClass[64]; - GetClassName(hWndDlg,szClass, SIZEOF(szClass)); + GetClassName(hWndDlg, szClass, SIZEOF(szClass)); if (lstrcmpi(szClass, _T("SysTreeView32")) == 0) { HTREEITEM hItem = TreeView_GetRoot(hWndDlg); @@ -194,7 +194,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key) AddFilterString(key, title); } } } } } } } -static BOOL CALLBACK GetDialogStringsCallback(HWND hWnd,LPARAM lParam) +static BOOL CALLBACK GetDialogStringsCallback(HWND hWnd, LPARAM lParam) { AddDialogString(hWnd, lParam); diff --git a/src/modules/options/filter.h b/src/modules/options/filter.h index 3db823fcdf..fc15074502 100644 --- a/src/modules/options/filter.h +++ b/src/modules/options/filter.h @@ -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. diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp index 4a6f11cba5..f47047ad19 100644 --- a/src/modules/options/headerbar.cpp +++ b/src/modules/options/headerbar.cpp @@ -3,7 +3,7 @@ Miranda IM: the free IM client for Microsoft* Windows* Copyright 2007 Artem Shpynov -Copyright 2000-2007 Miranda ICQ/IM project, +Copyright 2000-2007 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -13,7 +13,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. @@ -129,8 +129,8 @@ static void MHeaderbar_DrawGradient(HDC hdc, int x, int y, int width, int height for (i=y+height; --i >= y; ) { COLORREF color = RGB( - ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height, - ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height, + ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height, + ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height, ((height-i-1)*rgb0->rgbBlue + i*rgb1->rgbBlue) / height); rc.top = rc.bottom = i; ++rc.bottom; @@ -155,7 +155,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg, TCHAR *szSubTitle = _tcschr(szTitle, _T('\n')); if (szSubTitle) *szSubTitle++ = 0; - HDC hdc=BeginPaint(hwndDlg,&ps); + HDC hdc=BeginPaint(hwndDlg, &ps); HDC tempDC=CreateCompatibleDC(hdc); BITMAPINFO bmi; @@ -167,7 +167,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg, bmi.bmiHeader.biCompression = BI_RGB; hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0); - hOldBmp=(HBITMAP)SelectObject(tempDC,hBmp); + hOldBmp=(HBITMAP)SelectObject(tempDC, hBmp); if (IsAeroMode()) { RECT temprc; @@ -177,7 +177,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg, temprc.bottom=mit->width; FillRect(tempDC, &temprc, (HBRUSH)GetStockObject(BLACK_BRUSH)); - MARGINS margins = {0,0,mit->height,0}; + MARGINS margins = {0, 0, mit->height, 0}; dwmExtendFrameIntoClientArea(GetParent(hwndDlg), &margins); WTA_OPTIONS opts; @@ -275,19 +275,19 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg, CombineRgn(hRgn, hRgn, hRgnTmp, RGN_DIFF); DeleteObject(hRgnTmp); } - SelectClipRgn(hdc,hRgn); + SelectClipRgn(hdc, hRgn); DeleteObject(hRgn); } - BitBlt(hdc,mit->rc.left,mit->rc.top,mit->width,mit->height,tempDC,0,0,SRCCOPY); + BitBlt(hdc, mit->rc.left, mit->rc.top, mit->width, mit->height, tempDC, 0, 0, SRCCOPY); - SelectClipRgn(hdc,NULL); + SelectClipRgn(hdc, NULL); - SelectObject(tempDC,hOldBmp); + SelectObject(tempDC, hOldBmp); DeleteObject(hBmp); DeleteDC(tempDC); - EndPaint(hwndDlg,&ps); + EndPaint(hwndDlg, &ps); return TRUE; } @@ -332,7 +332,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam break; case WM_SIZE: - GetClientRect(hwndDlg,&itc->rc); + GetClientRect(hwndDlg, &itc->rc); itc->width=itc->rc.right-itc->rc.left; itc->height=itc->rc.bottom-itc->rc.top; return TRUE; diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index b31ba45bba..8499f3d470 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -3,7 +3,7 @@ Miranda IM: the free IM client for Microsoft* Windows* Copyright 2007 Artem Shpynov -Copyright 2000-2007 Miranda ICQ/IM project, +Copyright 2000-2007 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -13,7 +13,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. @@ -171,8 +171,8 @@ static void MIcoTab_DrawGradient(HDC hdc, int x, int y, int width, int height, R RECT rc; SetRect(&rc, x, 0, x+width, 0); for ( int i=y+height; --i >= y; ) { COLORREF color = RGB( - ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height, - ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height, + ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height, + ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height, ((height-i-1)*rgb0->rgbBlue + i*rgb1->rgbBlue) / height); rc.top = rc.bottom = i; ++rc.bottom; @@ -244,7 +244,7 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, textRect.right=itemX+dat->itemWidth; textRect.top=textTop; textRect.bottom=iconTop+dat->itemHeight; - DrawIcon(hdc,itemX+dat->itemWidth/2-16, iconTop, tab->hIcon); + DrawIcon(hdc, itemX+dat->itemWidth/2-16, iconTop, tab->hIcon); if (IsVSMode()) { DTTOPTS dto = {0}; @@ -257,7 +257,7 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, mir_free(tcsNameW); closeThemeData(hTheme); } - else DrawText(hdc,tab->tcsName,-1,&textRect, DT_VCENTER|DT_CENTER|DT_END_ELLIPSIS); + else DrawText(hdc, tab->tcsName, -1, &textRect, DT_VCENTER|DT_CENTER|DT_END_ELLIPSIS); if (hFntSave) DeleteObject(SelectObject(hdc, hFntSave)); @@ -270,7 +270,7 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM RECT temprc; int i; - HDC hdc=BeginPaint(hwndDlg,&ps); + HDC hdc=BeginPaint(hwndDlg, &ps); HDC tempDC=CreateCompatibleDC(hdc); HFONT hFont = 0; @@ -284,7 +284,7 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM bmi.bmiHeader.biCompression = BI_RGB; hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0); - hOldBmp=(HBITMAP)SelectObject(tempDC,hBmp); + hOldBmp=(HBITMAP)SelectObject(tempDC, hBmp); if (IsAeroMode()) { temprc.left=0; @@ -295,7 +295,7 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM } else { if (mit->hBkgBmp) - StretchBlt(tempDC,0,0,mit->width,mit->height,mit->hBkgDC,0,0,mit->BkgSize.cx,mit->BkgSize.cy,SRCCOPY); + StretchBlt(tempDC, 0, 0, mit->width, mit->height, mit->hBkgDC, 0, 0, mit->BkgSize.cx, mit->BkgSize.cy, SRCCOPY); else { if (IsVSMode()) MIcoTab_FillRect(tempDC, 0, 0, mit->width, mit->height, GetSysColor(COLOR_WINDOW)); @@ -308,8 +308,8 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM //Draw Items hFont = mit->hFont; - SelectObject(tempDC,hFont); - SetBkMode(tempDC,TRANSPARENT); + SelectObject(tempDC, hFont); + SetBkMode(tempDC, TRANSPARENT); for (i=0; ipList.getCount(); i++) { MIcoTab *tab = (MIcoTab *)mit->pList[i]; @@ -317,12 +317,12 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM } //Copy to output - BitBlt(hdc,mit->rc.left,mit->rc.top,mit->width,mit->height,tempDC,0,0,SRCCOPY); - SelectObject(tempDC,hOldBmp); + BitBlt(hdc, mit->rc.left, mit->rc.top, mit->width, mit->height, tempDC, 0, 0, SRCCOPY); + SelectObject(tempDC, hOldBmp); DeleteObject(hBmp); DeleteDC(tempDC); - EndPaint(hwndDlg,&ps); + EndPaint(hwndDlg, &ps); return TRUE; } @@ -342,7 +342,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (IsAeroMode()) { RECT rc; GetWindowRect(hwndDlg, &rc); - MARGINS margins = {0,0,rc.bottom-rc.top,0}; + MARGINS margins = {0, 0, rc.bottom-rc.top, 0}; dwmExtendFrameIntoClientArea(GetParent(hwndDlg), &margins); } @@ -353,7 +353,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case WM_SIZE: - GetClientRect(hwndDlg,&itc->rc); + GetClientRect(hwndDlg, &itc->rc); itc->width=itc->rc.right-itc->rc.left; itc->height=itc->rc.bottom-itc->rc.top; @@ -397,8 +397,8 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L itc->nSelectedIdx = itc->nHotIdx; SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName); RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE); - SendMessage(GetParent(hwndDlg), WM_COMMAND, - MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED), + SendMessage(GetParent(hwndDlg), WM_COMMAND, + MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED), itc->nSelectedIdx); } return 0; @@ -454,8 +454,8 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L itc->nSelectedIdx = newIdx; SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName); RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE); - SendMessage(GetParent(hwndDlg), WM_COMMAND, - MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGEDKBD), + SendMessage(GetParent(hwndDlg), WM_COMMAND, + MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGEDKBD), itc->nSelectedIdx); } return 0; @@ -518,8 +518,8 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L itc->nSelectedIdx = wParam; SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName); RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE); - SendMessage(GetParent(hwndDlg), WM_COMMAND, - MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED), + SendMessage(GetParent(hwndDlg), WM_COMMAND, + MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED), itc->nSelectedIdx); } return TRUE; @@ -537,7 +537,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SelectObject(itc->hBkgDC, itc->hBkgOldBmp); DeleteDC(itc->hBkgDC); } - li_ListDestruct(itc->pList,MITListDestructor); + li_ListDestruct(itc->pList, MITListDestructor); delete itc; return TRUE; } diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 0b6c2d583d..c417b4b6e4 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -1483,7 +1483,7 @@ static int OptModulesLoaded(WPARAM, LPARAM) mi.position = 1900000000; mi.pszName = LPGEN("&Options..."); mi.pszService = "Options/OptionsCommand"; - CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi ); + Menu_AddMainMenuItem(&mi); return 0; } diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index f8067579ba..5dc90a2750 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -854,7 +854,7 @@ static int UnloadPluginDynamically(PluginListItemData* dat) return TRUE; } -static LRESULT CALLBACK PluginListWndProc(HWND hwnd,UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_LBUTTONDOWN) { LVHITTESTINFO hi; diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index e865450967..f2706ddb08 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.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. diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index f5ebd92fb1..0960aa34f0 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.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. @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include //Protocol chain is list of integers "0".."n", with network protocol named "p" -INT_PTR Proto_CallContactService(WPARAM wParam,LPARAM lParam) +INT_PTR Proto_CallContactService(WPARAM wParam, LPARAM lParam) //note that this is ChainSend() too, due to a quirk of function definitions { CCSDATA *ccs=(CCSDATA*)lParam; @@ -68,7 +68,7 @@ INT_PTR Proto_CallContactService(WPARAM wParam,LPARAM lParam) return ret; } -static INT_PTR CallRecvChain(WPARAM wParam,LPARAM lParam) +static INT_PTR CallRecvChain(WPARAM wParam, LPARAM lParam) { CCSDATA *ccs=(CCSDATA*)lParam; int i; @@ -121,10 +121,10 @@ static INT_PTR CallRecvChain(WPARAM wParam,LPARAM lParam) return ret; } -static INT_PTR Proto_ChainRecv(WPARAM wParam,LPARAM lParam) +static INT_PTR Proto_ChainRecv(WPARAM wParam, LPARAM lParam) { /* this will switch threads just like before */ - return CallServiceSync(MS_PROTO_CHAINRECV "ThreadSafe",wParam,lParam); + return CallServiceSync(MS_PROTO_CHAINRECV "ThreadSafe", wParam, lParam); } PROTOACCOUNT* __fastcall Proto_GetAccount(HANDLE hContact) @@ -157,7 +157,7 @@ static INT_PTR Proto_GetContactBaseAccount(WPARAM wParam, LPARAM) return (INT_PTR)(pa ? pa->szModuleName : NULL); } -static INT_PTR Proto_IsProtoOnContact(WPARAM wParam,LPARAM lParam) +static INT_PTR Proto_IsProtoOnContact(WPARAM wParam, LPARAM lParam) { int i; char str[10]; @@ -165,17 +165,17 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam,LPARAM lParam) if (!lParam) return 0; - if (!DBGetContactSettingString((HANDLE)wParam,"Protocol","p",&dbv)) { - if (!_stricmp((char*)lParam,dbv.pszVal)) { + if (!DBGetContactSettingString((HANDLE)wParam, "Protocol", "p", &dbv)) { + if (!_stricmp((char*)lParam, dbv.pszVal)) { mir_free(dbv.pszVal); return -1; } mir_free(dbv.pszVal); } for (i=0;;i++) { - _itoa(i,str,10); - if (DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) break; - if (!strcmp((char*)lParam,dbv.pszVal)) { + _itoa(i, str, 10); + if (DBGetContactSettingString((HANDLE)wParam, "_Filter", str, &dbv)) break; + if (!strcmp((char*)lParam, dbv.pszVal)) { mir_free(dbv.pszVal); return i+1; } @@ -184,33 +184,33 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam,LPARAM lParam) return 0; } -static INT_PTR Proto_AddToContact(WPARAM wParam,LPARAM lParam) +static INT_PTR Proto_AddToContact(WPARAM wParam, LPARAM lParam) { - PROTOCOLDESCRIPTOR *pd,*pdCompare; + PROTOCOLDESCRIPTOR *pd, *pdCompare; pd = Proto_IsProtocolLoaded(( char* )lParam ); if ( pd == NULL ) { PROTOACCOUNT* pa = Proto_GetAccount(( char* )lParam ); if ( pa ) { - DBWriteContactSettingString((HANDLE)wParam,"Protocol","p",(char*)lParam); + DBWriteContactSettingString((HANDLE)wParam, "Protocol", "p", (char*)lParam); return 0; } return 1; } if ( pd->type == PROTOTYPE_PROTOCOL ) { - DBWriteContactSettingString((HANDLE)wParam,"Protocol","p",(char*)lParam); + DBWriteContactSettingString((HANDLE)wParam, "Protocol", "p", (char*)lParam); return 0; } - if (Proto_IsProtoOnContact(wParam,lParam)) return 1; + if (Proto_IsProtoOnContact(wParam, lParam)) return 1; { /* v:0.3.3 + PROTO FILTERS ARE NOW KEPT IN THEIR OWN DB MODULE! */ int i; - char str[10],*lastProto; + char str[10], *lastProto; DBVARIANT dbv; for (i=0;;i++) { - _itoa(i,str,10); - if (DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) break; + _itoa(i, str, 10); + if (DBGetContactSettingString((HANDLE)wParam, "_Filter", str, &dbv)) break; pdCompare = Proto_IsProtocolLoaded(( char* )dbv.pszVal ); mir_free(dbv.pszVal); if (pdCompare == NULL) continue; @@ -219,13 +219,13 @@ static INT_PTR Proto_AddToContact(WPARAM wParam,LPARAM lParam) //put the new module at position i lastProto=mir_strdup((char*)lParam); for (;;i++) { - _itoa(i,str,10); - if (DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) { - DBWriteContactSettingString((HANDLE)wParam,"_Filter",str,lastProto); + _itoa(i, str, 10); + if (DBGetContactSettingString((HANDLE)wParam, "_Filter", str, &dbv)) { + DBWriteContactSettingString((HANDLE)wParam, "_Filter", str, lastProto); mir_free(lastProto); break; } - DBWriteContactSettingString((HANDLE)wParam,"_Filter",str,lastProto); + DBWriteContactSettingString((HANDLE)wParam, "_Filter", str, lastProto); mir_free(lastProto); lastProto=dbv.pszVal; } @@ -233,26 +233,26 @@ static INT_PTR Proto_AddToContact(WPARAM wParam,LPARAM lParam) return 0; } -static INT_PTR Proto_RemoveFromContact(WPARAM wParam,LPARAM lParam) +static INT_PTR Proto_RemoveFromContact(WPARAM wParam, LPARAM lParam) { int i; DBVARIANT dbv; char str[10]; - i = Proto_IsProtoOnContact(wParam,lParam); + i = Proto_IsProtoOnContact(wParam, lParam); if (!i) return 1; if (i == -1) - DBDeleteContactSetting((HANDLE)wParam,"Protocol","p"); + DBDeleteContactSetting((HANDLE)wParam, "Protocol", "p"); else { for (i--;;i++) { //we have to decrease i, as Proto_IsOnContact returns +1 more number than read from database - _itoa(i+1,str,10); - if (0 != DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) { - _itoa(i,str,10); - DBDeleteContactSetting((HANDLE)wParam,"_Filter",str); + _itoa(i+1, str, 10); + if (0 != DBGetContactSettingString((HANDLE)wParam, "_Filter", str, &dbv)) { + _itoa(i, str, 10); + DBDeleteContactSetting((HANDLE)wParam, "_Filter", str); break; } - _itoa(i,str,10); - DBWriteContactSettingString((HANDLE)wParam,"_Filter",str,dbv.pszVal); + _itoa(i, str, 10); + DBWriteContactSettingString((HANDLE)wParam, "_Filter", str, dbv.pszVal); mir_free(dbv.pszVal); } } @@ -261,14 +261,14 @@ static INT_PTR Proto_RemoveFromContact(WPARAM wParam,LPARAM lParam) int LoadProtoChains(void) { - CreateServiceFunction(MS_PROTO_CALLCONTACTSERVICE,Proto_CallContactService); - CreateServiceFunction(MS_PROTO_CHAINSEND,Proto_CallContactService); - CreateServiceFunction(MS_PROTO_CHAINRECV,Proto_ChainRecv); - CreateServiceFunction(MS_PROTO_CHAINRECV "ThreadSafe",CallRecvChain); - CreateServiceFunction(MS_PROTO_GETCONTACTBASEPROTO,Proto_GetContactBaseProto); - CreateServiceFunction(MS_PROTO_GETCONTACTBASEACCOUNT,Proto_GetContactBaseAccount); - CreateServiceFunction(MS_PROTO_ISPROTOONCONTACT,Proto_IsProtoOnContact); - CreateServiceFunction(MS_PROTO_ADDTOCONTACT,Proto_AddToContact); - CreateServiceFunction(MS_PROTO_REMOVEFROMCONTACT,Proto_RemoveFromContact); + CreateServiceFunction(MS_PROTO_CALLCONTACTSERVICE, Proto_CallContactService); + CreateServiceFunction(MS_PROTO_CHAINSEND, Proto_CallContactService); + CreateServiceFunction(MS_PROTO_CHAINRECV, Proto_ChainRecv); + CreateServiceFunction(MS_PROTO_CHAINRECV "ThreadSafe", CallRecvChain); + CreateServiceFunction(MS_PROTO_GETCONTACTBASEPROTO, Proto_GetContactBaseProto); + CreateServiceFunction(MS_PROTO_GETCONTACTBASEACCOUNT, Proto_GetContactBaseAccount); + CreateServiceFunction(MS_PROTO_ISPROTOONCONTACT, Proto_IsProtoOnContact); + CreateServiceFunction(MS_PROTO_ADDTOCONTACT, Proto_AddToContact); + CreateServiceFunction(MS_PROTO_REMOVEFROMCONTACT, Proto_RemoveFromContact); return 0; } diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index ed1e7c14f2..1da7f0b4dd 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.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. @@ -26,7 +26,7 @@ int LoadProtoChains(void); int LoadProtoOptions( void ); HANDLE hAccListChanged; -static HANDLE hAckEvent,hTypeEvent; +static HANDLE hAckEvent, hTypeEvent; static BOOL bModuleInitialized = FALSE; typedef struct @@ -86,7 +86,7 @@ INT_PTR srvProto_IsLoaded(WPARAM, LPARAM lParam) return (INT_PTR)Proto_GetAccount(( char* )lParam ); } -INT_PTR Proto_EnumProtocols(WPARAM wParam,LPARAM lParam) +INT_PTR Proto_EnumProtocols(WPARAM wParam, LPARAM lParam) { *( int* )wParam = protos.getCount(); *( PROTOCOLDESCRIPTOR*** )lParam = protos.getArray(); @@ -144,7 +144,7 @@ static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // Basic core services -static INT_PTR Proto_RecvFile(WPARAM,LPARAM lParam) +static INT_PTR Proto_RecvFile(WPARAM, LPARAM lParam) { CCSDATA* ccs = ( CCSDATA* )lParam; PROTORECVEVENT* pre = ( PROTORECVEVENT* )ccs->lParam; @@ -195,7 +195,7 @@ static void sttRecvCreateBlob( DBEVENTINFO& dbei, int fileCount, char** pszFiles strcpy(( char* )p, ( szDescr == NULL ) ? "" : szDescr ); } -static INT_PTR Proto_RecvFileT(WPARAM,LPARAM lParam) +static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) { CCSDATA* ccs = ( CCSDATA* )lParam; PROTORECVFILET* pre = ( PROTORECVFILET* )ccs->lParam; @@ -230,7 +230,7 @@ static INT_PTR Proto_RecvFileT(WPARAM,LPARAM lParam) return 0; } -static INT_PTR Proto_RecvMessage(WPARAM,LPARAM lParam) +static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) { CCSDATA *ccs = ( CCSDATA* )lParam; PROTORECVEVENT *pre = ( PROTORECVEVENT* )ccs->lParam; @@ -262,10 +262,10 @@ static int Proto_ValidTypingContact(HANDLE hContact, char *szProto) if ( !hContact || !szProto ) return 0; - return ( CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_4,0) & PF4_SUPPORTTYPING ) ? 1 : 0; + return ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING ) ? 1 : 0; } -static INT_PTR Proto_SelfIsTyping(WPARAM wParam,LPARAM lParam) +static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) { if ( lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON ) { char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 ); @@ -279,7 +279,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam,LPARAM lParam) return 0; } -static INT_PTR Proto_ContactIsTyping(WPARAM wParam,LPARAM lParam) +static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) { int type = (int)lParam; char *szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 ); diff --git a/src/modules/protocols/protoint.cpp b/src/modules/protocols/protoint.cpp index 0acabb84a2..ccad4701d6 100644 --- a/src/modules/protocols/protoint.cpp +++ b/src/modules/protocols/protoint.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. @@ -30,7 +30,7 @@ INT_PTR __fastcall MyCallProtoService( const char *szModule, const char *szServi { char str[MAXMODULELABELLENGTH]; mir_snprintf( str, sizeof(str), "%s%s", szModule, szService ); - return CallService(str,wParam,lParam); + return CallService(str, wParam, lParam); } struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE @@ -180,7 +180,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE } int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ) - { CCSDATA ccs = { hContact, PSS_CONTACTS, MAKEWPARAM(flags,nContacts), (LPARAM)hContactsList }; + { CCSDATA ccs = { hContact, PSS_CONTACTS, MAKEWPARAM(flags, nContacts), (LPARAM)hContactsList }; return ( int )MyCallProtoService( m_szModuleName, PSS_CONTACTS, 0, (LPARAM)&ccs ); } diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 4fcb5b7e18..ccf68482ee 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.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. @@ -69,7 +69,7 @@ typedef struct } AccFormDlgParam; -static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg,UINT message, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch( message ) { case WM_INITDIALOG: @@ -277,7 +277,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam); } -static LRESULT CALLBACK AccListWndProc(HWND hwnd,UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct TAccListData *dat = (struct TAccListData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); if ( !dat ) @@ -461,7 +461,7 @@ static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat) SetWindowText(GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT(welcomeMsg)); } -INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg,UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { struct TAccMgrData *dat = (struct TAccMgrData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); @@ -783,8 +783,8 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg,UINT message, WPARAM wParam, LPARAM else { DWORD dwStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0); if (dwStatus >= ID_STATUS_ONLINE) { - if (IDCANCEL == ::MessageBox(hwndDlg, - TranslateT("Account is online. Disable account?"), + if (IDCANCEL == ::MessageBox(hwndDlg, + TranslateT("Account is online. Disable account?"), TranslateT("Accounts"), MB_OKCANCEL)) { pa->bIsEnabled = 1; //stay enabled } @@ -852,7 +852,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg,UINT message, WPARAM wParam, LPARAM TCHAR buf[ 200 ]; mir_sntprintf( buf, SIZEOF(buf), TranslateT( "Account %s is being deleted" ), pa->tszAccountName ); if (pa->bOldProto) { - MessageBox( NULL, TranslateT( "You need to disable plugin to delete this account" ), buf, + MessageBox( NULL, TranslateT( "You need to disable plugin to delete this account" ), buf, MB_ICONERROR | MB_OK ); break; } @@ -1041,7 +1041,7 @@ int OptProtosLoaded(WPARAM, LPARAM) mi.position = 1900000000; mi.pszName = LPGEN("&Accounts..."); mi.pszService = MS_PROTO_SHOWACCMGR; - CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi ); + Menu_AddMainMenuItem(&mi); return 0; } diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index 1d3c0cdd6b..018411d7a1 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.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. @@ -215,7 +215,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) item->DefHotkey = desc->DefHotKey & ~HKF_MIRANDA_LOCAL; item->Hotkey = DBGetContactSettingWord(NULL, DBMODULENAME, item->pszName, item->DefHotkey); item->type = item->pszService ? - ( THotkeyType )DBGetContactSettingByte(NULL, DBMODULENAME "Types", item->pszName, + ( THotkeyType )DBGetContactSettingByte(NULL, DBMODULENAME "Types", item->pszName, (desc->DefHotKey & HKF_MIRANDA_LOCAL) ? HKT_LOCAL : HKT_GLOBAL) : HKT_MANUAL; item->lParam = desc->lParam; @@ -403,11 +403,11 @@ static TCHAR *sttHokeyVkToName(WORD vkKey) void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key) { - mir_sntprintf(buf, size, _T("%s%s%s%s%s"), - (shift & HOTKEYF_CONTROL) ? _T("Ctrl + ") : _T(""), - (shift & HOTKEYF_ALT) ? _T("Alt + ") : _T(""), - (shift & HOTKEYF_SHIFT) ? _T("Shift + ") : _T(""), - (shift & HOTKEYF_EXT) ? _T("Win + ") : _T(""), + mir_sntprintf(buf, size, _T("%s%s%s%s%s"), + (shift & HOTKEYF_CONTROL) ? _T("Ctrl + ") : _T(""), + (shift & HOTKEYF_ALT) ? _T("Alt + ") : _T(""), + (shift & HOTKEYF_SHIFT) ? _T("Shift + ") : _T(""), + (shift & HOTKEYF_EXT) ? _T("Win + ") : _T(""), sttHokeyVkToName(key)); } @@ -853,7 +853,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, szSetting = mir_t2a(lvi.pszText); - ListView_SetCheckState(hwndHotkey, lvi.iItem, + ListView_SetCheckState(hwndHotkey, lvi.iItem, DBGetContactSettingByte(NULL, DBMODULENAME "UI", szSetting, TRUE)); mir_free(szSetting); @@ -891,7 +891,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, szSetting = mir_t2a(lvi.pszText); - DBWriteContactSettingByte(NULL, DBMODULENAME "UI", szSetting, + DBWriteContactSettingByte(NULL, DBMODULENAME "UI", szSetting, (BYTE) ListView_GetCheckState(hwndHotkey, lvi.iItem)); mir_free(szSetting); @@ -1060,10 +1060,10 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (item->type != HKT_MANUAL) { AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); AppendMenu(hMenu, MF_STRING| - ((item->OptType == HKT_GLOBAL) ? MF_CHECKED : 0), + ((item->OptType == HKT_GLOBAL) ? MF_CHECKED : 0), (UINT_PTR)MI_SYSTEM, TranslateT("System scope")); AppendMenu(hMenu, MF_STRING| - ((item->OptType == HKT_LOCAL) ? MF_CHECKED : 0), + ((item->OptType == HKT_LOCAL) ? MF_CHECKED : 0), (UINT_PTR)MI_LOCAL, TranslateT("Miranda scope")); } AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index b8febacf3a..8dd3d47a68 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.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. @@ -34,66 +34,66 @@ struct StandardIconDescription static const struct StandardIconDescription mainIcons[] = { - { SKINICON_OTHER_MIRANDA, LPGEN("Miranda IM"), -IDI_MIRANDA }, - { SKINICON_EVENT_MESSAGE, LPGEN("Message"), -IDI_RECVMSG }, - { SKINICON_EVENT_URL, LPGEN("URL"), -IDI_URL }, - { SKINICON_EVENT_FILE, LPGEN("File"), -IDI_FILE }, - { SKINICON_OTHER_USERONLINE, LPGEN("User Online"), -IDI_USERONLINE }, - { SKINICON_OTHER_GROUPOPEN, LPGEN("Group (Open)"), -IDI_GROUPOPEN }, - { SKINICON_OTHER_GROUPSHUT, LPGEN("Group (Closed)"), -IDI_GROUPSHUT }, - { SKINICON_OTHER_CONNECTING, LPGEN("Connecting"), -IDI_LOAD }, - { SKINICON_OTHER_ADDCONTACT, LPGEN("Add Contact"), -IDI_ADDCONTACT }, - { SKINICON_OTHER_USERDETAILS, LPGEN("User Details"), -IDI_USERDETAILS }, - { SKINICON_OTHER_HISTORY, LPGEN("History"), -IDI_HISTORY }, - { SKINICON_OTHER_DOWNARROW, LPGEN("Down Arrow"), -IDI_DOWNARROW }, - { SKINICON_OTHER_FINDUSER, LPGEN("Find User"), -IDI_FINDUSER }, - { SKINICON_OTHER_OPTIONS, LPGEN("Options"), -IDI_OPTIONS }, - { SKINICON_OTHER_SENDEMAIL, LPGEN("Send E-mail"), -IDI_SENDEMAIL }, - { SKINICON_OTHER_DELETE, LPGEN("Delete"), -IDI_DELETE }, - { SKINICON_OTHER_RENAME, LPGEN("Rename"), -IDI_RENAME }, - { SKINICON_OTHER_SMS, LPGEN("SMS"), -IDI_SMS }, - { SKINICON_OTHER_SEARCHALL, LPGEN("Search All"), -IDI_SEARCHALL }, - { SKINICON_OTHER_TICK, LPGEN("Tick"), -IDI_TICK }, - { SKINICON_OTHER_NOTICK, LPGEN("No Tick"), -IDI_NOTICK }, - { SKINICON_OTHER_HELP, LPGEN("Help"), -IDI_HELP }, - { SKINICON_OTHER_MIRANDAWEB, LPGEN("Miranda Website"), -IDI_MIRANDAWEBSITE }, - { SKINICON_OTHER_TYPING, LPGEN("Typing"), -IDI_TYPING }, - { SKINICON_OTHER_SMALLDOT, LPGEN("Small Dot"), -IDI_SMALLDOT }, - { SKINICON_OTHER_FILLEDBLOB, LPGEN("Filled Blob"), -IDI_FILLEDBLOB }, - { SKINICON_OTHER_EMPTYBLOB, LPGEN("Empty Blob"), -IDI_EMPTYBLOB }, - { SKINICON_OTHER_UNICODE, LPGEN("Unicode plugin"), -IDI_UNICODE }, - { SKINICON_OTHER_ANSI, LPGEN("ANSI plugin"), -IDI_ANSI }, - { SKINICON_OTHER_LOADED, LPGEN("Running plugin"), -IDI_LOADED }, - { SKINICON_OTHER_NOTLOADED, LPGEN("Unloaded plugin"), -IDI_NOTLOADED }, - { SKINICON_OTHER_UNDO, LPGEN("Undo"), -IDI_UNDO }, - { SKINICON_OTHER_WINDOW, LPGEN("Window"), -IDI_WINDOW }, - { SKINICON_OTHER_WINDOWS, LPGEN("System"), -IDI_WINDOWS }, - { SKINICON_OTHER_ACCMGR, LPGEN("Accounts"), -IDI_ACCMGR }, - { SKINICON_OTHER_SHOWHIDE, LPGEN("ShowHide"), -IDI_SHOWHIDE }, - { SKINICON_OTHER_EXIT, LPGEN("Exit"), -IDI_EXIT }, - { SKINICON_OTHER_MAINMENU, LPGEN("Main Menu"), -IDI_MIRANDA }, - { SKINICON_OTHER_STATUS, LPGEN("Status"), -IDI_ONLINE }, - { SKINICON_CHAT_JOIN, LPGEN("Join chat"), -IDI_JOINCHAT }, - { SKINICON_CHAT_LEAVE, LPGEN("Leave chat"), -IDI_LEAVECHAT }, - { SKINICON_OTHER_GROUP, LPGEN("Move to Group"), -IDI_MOVETOGROUP }, - { SKINICON_OTHER_ON, LPGEN("On"), -IDI_ON }, - { SKINICON_OTHER_OFF, LPGEN("Off"), -IDI_OFF }, - { SKINICON_OTHER_STATUS_LOCKED, LPGEN("Locked status"), -IDI_STATUS_LOCKED, 0, "Status Icons" }, + { SKINICON_OTHER_MIRANDA, LPGEN("Miranda IM"), -IDI_MIRANDA }, + { SKINICON_EVENT_MESSAGE, LPGEN("Message"), -IDI_RECVMSG }, + { SKINICON_EVENT_URL, LPGEN("URL"), -IDI_URL }, + { SKINICON_EVENT_FILE, LPGEN("File"), -IDI_FILE }, + { SKINICON_OTHER_USERONLINE, LPGEN("User Online"), -IDI_USERONLINE }, + { SKINICON_OTHER_GROUPOPEN, LPGEN("Group (Open)"), -IDI_GROUPOPEN }, + { SKINICON_OTHER_GROUPSHUT, LPGEN("Group (Closed)"), -IDI_GROUPSHUT }, + { SKINICON_OTHER_CONNECTING, LPGEN("Connecting"), -IDI_LOAD }, + { SKINICON_OTHER_ADDCONTACT, LPGEN("Add Contact"), -IDI_ADDCONTACT }, + { SKINICON_OTHER_USERDETAILS, LPGEN("User Details"), -IDI_USERDETAILS }, + { SKINICON_OTHER_HISTORY, LPGEN("History"), -IDI_HISTORY }, + { SKINICON_OTHER_DOWNARROW, LPGEN("Down Arrow"), -IDI_DOWNARROW }, + { SKINICON_OTHER_FINDUSER, LPGEN("Find User"), -IDI_FINDUSER }, + { SKINICON_OTHER_OPTIONS, LPGEN("Options"), -IDI_OPTIONS }, + { SKINICON_OTHER_SENDEMAIL, LPGEN("Send E-mail"), -IDI_SENDEMAIL }, + { SKINICON_OTHER_DELETE, LPGEN("Delete"), -IDI_DELETE }, + { SKINICON_OTHER_RENAME, LPGEN("Rename"), -IDI_RENAME }, + { SKINICON_OTHER_SMS, LPGEN("SMS"), -IDI_SMS }, + { SKINICON_OTHER_SEARCHALL, LPGEN("Search All"), -IDI_SEARCHALL }, + { SKINICON_OTHER_TICK, LPGEN("Tick"), -IDI_TICK }, + { SKINICON_OTHER_NOTICK, LPGEN("No Tick"), -IDI_NOTICK }, + { SKINICON_OTHER_HELP, LPGEN("Help"), -IDI_HELP }, + { SKINICON_OTHER_MIRANDAWEB, LPGEN("Miranda Website"), -IDI_MIRANDAWEBSITE }, + { SKINICON_OTHER_TYPING, LPGEN("Typing"), -IDI_TYPING }, + { SKINICON_OTHER_SMALLDOT, LPGEN("Small Dot"), -IDI_SMALLDOT }, + { SKINICON_OTHER_FILLEDBLOB, LPGEN("Filled Blob"), -IDI_FILLEDBLOB }, + { SKINICON_OTHER_EMPTYBLOB, LPGEN("Empty Blob"), -IDI_EMPTYBLOB }, + { SKINICON_OTHER_UNICODE, LPGEN("Unicode plugin"), -IDI_UNICODE }, + { SKINICON_OTHER_ANSI, LPGEN("ANSI plugin"), -IDI_ANSI }, + { SKINICON_OTHER_LOADED, LPGEN("Running plugin"), -IDI_LOADED }, + { SKINICON_OTHER_NOTLOADED, LPGEN("Unloaded plugin"), -IDI_NOTLOADED }, + { SKINICON_OTHER_UNDO, LPGEN("Undo"), -IDI_UNDO }, + { SKINICON_OTHER_WINDOW, LPGEN("Window"), -IDI_WINDOW }, + { SKINICON_OTHER_WINDOWS, LPGEN("System"), -IDI_WINDOWS }, + { SKINICON_OTHER_ACCMGR, LPGEN("Accounts"), -IDI_ACCMGR }, + { SKINICON_OTHER_SHOWHIDE, LPGEN("ShowHide"), -IDI_SHOWHIDE }, + { SKINICON_OTHER_EXIT, LPGEN("Exit"), -IDI_EXIT }, + { SKINICON_OTHER_MAINMENU, LPGEN("Main Menu"), -IDI_MIRANDA }, + { SKINICON_OTHER_STATUS, LPGEN("Status"), -IDI_ONLINE }, + { SKINICON_CHAT_JOIN, LPGEN("Join chat"), -IDI_JOINCHAT }, + { SKINICON_CHAT_LEAVE, LPGEN("Leave chat"), -IDI_LEAVECHAT }, + { SKINICON_OTHER_GROUP, LPGEN("Move to Group"), -IDI_MOVETOGROUP }, + { SKINICON_OTHER_ON, LPGEN("On"), -IDI_ON }, + { SKINICON_OTHER_OFF, LPGEN("Off"), -IDI_OFF }, + { SKINICON_OTHER_STATUS_LOCKED, LPGEN("Locked status"), -IDI_STATUS_LOCKED, 0, "Status Icons" }, }; HANDLE hMainIcons[SIZEOF(mainIcons)]; static const struct StandardIconDescription statusIcons[] = { - { ID_STATUS_OFFLINE, LPGEN("Offline"), -IDI_OFFLINE, 0xFFFFFFFF }, - { ID_STATUS_ONLINE, LPGEN("Online"), -IDI_ONLINE, PF2_ONLINE }, - { ID_STATUS_AWAY, LPGEN("Away"), -IDI_AWAY, PF2_SHORTAWAY }, - { ID_STATUS_NA, LPGEN("NA"), -IDI_NA, PF2_LONGAWAY }, - { ID_STATUS_OCCUPIED, LPGEN("Occupied"), -IDI_OCCUPIED, PF2_LIGHTDND }, - { ID_STATUS_DND, LPGEN("DND"), -IDI_DND, PF2_HEAVYDND }, - { ID_STATUS_FREECHAT, LPGEN("Free for chat"), -IDI_FREE4CHAT, PF2_FREECHAT }, - { ID_STATUS_INVISIBLE, LPGEN("Invisible"), -IDI_INVISIBLE, PF2_INVISIBLE }, - { ID_STATUS_ONTHEPHONE, LPGEN("On the phone"), -IDI_ONTHEPHONE, PF2_ONTHEPHONE }, + { ID_STATUS_OFFLINE, LPGEN("Offline"), -IDI_OFFLINE, 0xFFFFFFFF }, + { ID_STATUS_ONLINE, LPGEN("Online"), -IDI_ONLINE, PF2_ONLINE }, + { ID_STATUS_AWAY, LPGEN("Away"), -IDI_AWAY, PF2_SHORTAWAY }, + { ID_STATUS_NA, LPGEN("NA"), -IDI_NA, PF2_LONGAWAY }, + { ID_STATUS_OCCUPIED, LPGEN("Occupied"), -IDI_OCCUPIED, PF2_LIGHTDND }, + { ID_STATUS_DND, LPGEN("DND"), -IDI_DND, PF2_HEAVYDND }, + { ID_STATUS_FREECHAT, LPGEN("Free for chat"), -IDI_FREE4CHAT, PF2_FREECHAT }, + { ID_STATUS_INVISIBLE, LPGEN("Invisible"), -IDI_INVISIBLE, PF2_INVISIBLE }, + { ID_STATUS_ONTHEPHONE, LPGEN("On the phone"), -IDI_ONTHEPHONE, PF2_ONTHEPHONE }, { ID_STATUS_OUTTOLUNCH, LPGEN("Out to lunch"), -IDI_OUTTOLUNCH, PF2_OUTTOLUNCH } }; @@ -114,7 +114,7 @@ const char* protoIconsFmt = LPGEN("%s Icons"); static HICON LoadSmallIconShared(HINSTANCE hInstance, LPCTSTR lpIconName) { int cx = GetSystemMetrics(SM_CXSMICON); - return ( HICON )LoadImage( hInstance, lpIconName, IMAGE_ICON,cx, cx, LR_DEFAULTCOLOR | LR_SHARED ); + return ( HICON )LoadImage( hInstance, lpIconName, IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED ); } // load small icon (not shared) it IS NEED to be destroyed @@ -131,11 +131,11 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) // load small icon from hInstance HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) { - HICON hResIcon = bShared ? LoadSmallIcon(hInstance,lpIconName) : LoadSmallIconShared(hInstance,lpIconName); + HICON hResIcon = bShared ? LoadSmallIcon(hInstance, lpIconName) : LoadSmallIconShared(hInstance, lpIconName); if ( !hResIcon ) { //Icon not found in hInstance lets try to load it from core HINSTANCE hCoreInstance=hMirandaInst; if ( hCoreInstance != hInstance ) - hResIcon = bShared ? LoadSmallIcon(hCoreInstance,lpIconName) : LoadSmallIconShared(hCoreInstance,lpIconName); + hResIcon = bShared ? LoadSmallIcon(hCoreInstance, lpIconName) : LoadSmallIconShared(hCoreInstance, lpIconName); } return hResIcon; } @@ -152,7 +152,7 @@ int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId) { HICON hIcon = LoadSkinIcon( iconId ); int res = ImageList_AddIcon(hIml, hIcon); - IconLib_ReleaseIcon(hIcon,0); + IconLib_ReleaseIcon(hIcon, 0); return res; } @@ -160,7 +160,7 @@ int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char* szProto, i { HICON hIcon = LoadSkinProtoIcon( szProto, iconId ); int res = ImageList_AddIcon(hIml, hIcon); - IconLib_ReleaseIcon(hIcon,0); + IconLib_ReleaseIcon(hIcon, 0); return res; } @@ -174,8 +174,8 @@ int ImageList_ReplaceIcon_NotShared(HIMAGELIST hIml, int iIndex, HINSTANCE hInst int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon) { - int res = ImageList_ReplaceIcon(hIml,nIndex, hIcon); - IconLib_ReleaseIcon(hIcon,0); + int res = ImageList_ReplaceIcon(hIml, nIndex, hIcon); + IconLib_ReleaseIcon(hIcon, 0); return res; } @@ -208,7 +208,7 @@ void Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char* too void Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId) { HICON hIcon = ( HICON )SendDlgItemMessage(hwndDlg, itemId, BM_SETIMAGE, IMAGE_ICON, 0 ); - IconLib_ReleaseIcon(hIcon,0); + IconLib_ReleaseIcon(hIcon, 0); } // @@ -220,7 +220,7 @@ HICON LoadSkinProtoIcon( const char* szProto, int status, bool big ) int i, statusIndx = -1; char iconName[MAX_PATH]; HICON hIcon; - DWORD caps2 = ( szProto == NULL ) ? ( DWORD )-1 : CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_2,0); + DWORD caps2 = ( szProto == NULL ) ? ( DWORD )-1 : CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0); if ( status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES ) { mir_snprintf( iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 7 ); diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index b629958a0d..d9fb7fbb8e 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.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. @@ -53,7 +53,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam) DBVARIANT dbv; DWORD dwFlags = ( ssd->cbSize == sizeof(SKINSOUNDDESCEX)) ? ssd->dwFlags : 0; - soundList=(struct SoundItem*)mir_realloc(soundList,sizeof(struct SoundItem)*(soundCount+1)); + soundList=(struct SoundItem*)mir_realloc(soundList, sizeof(struct SoundItem)*(soundCount+1)); SoundItem* item = &soundList[soundCount++]; item->name = mir_strdup( ssd->pszName ); item->tempFile = NULL; @@ -93,7 +93,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam) static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam) { char * pszFile = (char *) lParam; - if ( pszFile && (DBGetContactSettingByte(NULL,"Skin","UseSound",0) || (int)wParam == 1)) + if ( pszFile && (DBGetContactSettingByte(NULL, "Skin", "UseSound", 0) || (int)wParam == 1)) PlaySoundA(pszFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT); return 0; @@ -156,7 +156,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); hwndTree = GetDlgItem(hwndDlg, IDC_SOUNDTREE); - SetWindowLongPtr(hwndTree,GWL_STYLE,GetWindowLongPtr(hwndTree,GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); + SetWindowLongPtr(hwndTree, GWL_STYLE, GetWindowLongPtr(hwndTree, GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); SendMessage(hwndDlg, DM_HIDEPANE, 0, 0); SendMessage(hwndDlg, DM_REBUILD_STREE, 0, 0); TreeView_SetItemState(hwndTree, 0, TVIS_SELECTED, TVIS_SELECTED); @@ -188,7 +188,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TreeView_SetItem( hwndTree, &tvis.item ); } tvis.item.stateMask = TVIS_STATEIMAGEMASK; - tvis.item.state = INDEXTOSTATEIMAGEMASK(!DBGetContactSettingByte(NULL,"SkinSoundsOff",soundList[i].name,0)?2:1); + tvis.item.state = INDEXTOSTATEIMAGEMASK(!DBGetContactSettingByte(NULL, "SkinSoundsOff", soundList[i].name, 0)?2:1); tvis.item.lParam = i; tvis.item.pszText = soundList[i].description; TreeView_InsertItem( hwndTree, &tvis ); @@ -201,7 +201,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( tvi.lParam == -1 ) TreeView_SetItemState(hwndTree, tvi.hItem, INDEXTOSTATEIMAGEMASK(0), TVIS_STATEIMAGEMASK); - tvi.hItem=TreeView_GetNextSibling(hwndTree,tvi.hItem); + tvi.hItem=TreeView_GetNextSibling(hwndTree, tvi.hItem); } } ShowWindow(hwndTree, SW_SHOW); @@ -245,8 +245,8 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TVITEM tvi; HTREEITEM hti; - ZeroMemory(&tvi,sizeof(tvi)); - ZeroMemory(&hti,sizeof(hti)); + ZeroMemory(&tvi, sizeof(tvi)); + ZeroMemory(&hti, sizeof(hti)); hti=TreeView_GetSelection(hwndTree); if (hti == NULL) break; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM|TVIF_TEXT; @@ -257,7 +257,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NotifyEventHooks(hPlayEvent, 1, (LPARAM)soundList[tvi.lParam].tempFile); else { DBVARIANT dbv; - if (!DBGetContactSettingString(NULL,"SkinSounds",soundList[tvi.lParam].name,&dbv)) { + if (!DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) { char szPathFull[MAX_PATH]; pathToAbsolute(dbv.pszVal, szPathFull, NULL); @@ -272,8 +272,8 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TVITEM tvi; HTREEITEM hti; - ZeroMemory(&tvi,sizeof(tvi)); - ZeroMemory(&hti,sizeof(hti)); + ZeroMemory(&tvi, sizeof(tvi)); + ZeroMemory(&hti, sizeof(hti)); hti=TreeView_GetSelection(hwndTree); if (hti == NULL) break; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM|TVIF_TEXT; @@ -316,7 +316,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemTextA(hwndDlg, IDC_LOCATION, strFull); } if (LOWORD(wParam) == IDC_GETMORE) { - CallService(MS_UTILS_OPENURL,1,(LPARAM)"http://addons.miranda-im.org/index.php?action=display&id=5"); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://addons.miranda-im.org/index.php?action=display&id=5"); break; } if (LOWORD(wParam) == IDC_LOCATION) { @@ -334,9 +334,9 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM DBWriteContactSettingByte(NULL, "Skin", "UseSound", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS)); for ( i=0; i < soundCount; i++ ) if ( soundList[i].tempFile ) - DBWriteContactSettingString(NULL,"SkinSounds",soundList[i].name,soundList[i].tempFile); + DBWriteContactSettingString(NULL, "SkinSounds", soundList[i].name, soundList[i].tempFile); { - TVITEM tvi,tvic; + TVITEM tvi, tvic; tvi.hItem = TreeView_GetRoot(hwndTree); while ( tvi.hItem != NULL ) { tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE; @@ -350,13 +350,13 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM DBCONTACTGETSETTING cgs; cgs.szModule = "SkinSoundsOff"; cgs.szSetting = soundList[tvic.lParam].name; - CallService(MS_DB_CONTACT_DELETESETTING,(WPARAM)(HANDLE)NULL,(LPARAM)&cgs); + CallService(MS_DB_CONTACT_DELETESETTING, (WPARAM)(HANDLE)NULL, (LPARAM)&cgs); } - else DBWriteContactSettingByte(NULL,"SkinSoundsOff",soundList[tvic.lParam].name,1); - tvic.hItem=TreeView_GetNextSibling(hwndTree,tvic.hItem); + else DBWriteContactSettingByte(NULL, "SkinSoundsOff", soundList[tvic.lParam].name, 1); + tvic.hItem=TreeView_GetNextSibling(hwndTree, tvic.hItem); } } - tvi.hItem=TreeView_GetNextSibling(hwndTree,tvi.hItem); + tvi.hItem=TreeView_GetNextSibling(hwndTree, tvi.hItem); } } return TRUE; } @@ -379,7 +379,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_NAMEVAL, buf); if (soundList[tvi.lParam].tempFile) SetDlgItemTextA(hwndDlg, IDC_LOCATION, soundList[tvi.lParam].tempFile); - else if (!DBGetContactSettingString(NULL,"SkinSounds",soundList[tvi.lParam].name,&dbv)) { + else if (!DBGetContactSettingString(NULL, "SkinSounds", soundList[tvi.lParam].name, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_LOCATION, dbv.pszVal); DBFreeVariant(&dbv); } @@ -401,8 +401,8 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(GetMessagePos()); hti.pt.y=(short)HIWORD(GetMessagePos()); - ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt); - if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti)) + ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt); + if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) if (hti.flags&TVHT_ONITEM) if (hti.flags&TVHT_ONITEMSTATEICON) if (TreeView_GetParent(hwndTree, hti.hItem) != NULL) @@ -435,7 +435,7 @@ static int SkinOptionsInit(WPARAM wParam, LPARAM) static int SkinSystemModulesLoaded(WPARAM, LPARAM) { - HookEvent(ME_OPT_INITIALISE,SkinOptionsInit); + HookEvent(ME_OPT_INITIALISE, SkinOptionsInit); return 0; } @@ -445,9 +445,9 @@ int LoadSkinSounds(void) soundList=NULL; soundCount=0; - CreateServiceFunction(MS_SKIN_ADDNEWSOUND,ServiceSkinAddNewSound); - CreateServiceFunction(MS_SKIN_PLAYSOUND,ServiceSkinPlaySound); - HookEvent(ME_SYSTEM_MODULESLOADED,SkinSystemModulesLoaded); + CreateServiceFunction(MS_SKIN_ADDNEWSOUND, ServiceSkinAddNewSound); + CreateServiceFunction(MS_SKIN_PLAYSOUND, ServiceSkinPlaySound); + HookEvent(ME_SYSTEM_MODULESLOADED, SkinSystemModulesLoaded); hPlayEvent=CreateHookableEvent(ME_SKIN_PLAYINGSOUND); SetHookDefaultForHookableEvent(hPlayEvent, SkinPlaySoundDefault); return 0; diff --git a/src/modules/srauth/auth.cpp b/src/modules/srauth/auth.cpp index 4b0c02cca6..44fca593c4 100644 --- a/src/modules/srauth/auth.cpp +++ b/src/modules/srauth/auth.cpp @@ -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. @@ -30,14 +30,14 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar INT_PTR ShowReqWindow(WPARAM, LPARAM lParam) { - CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_AUTHREQ), NULL, DlgProcAuthReq, + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_AUTHREQ), NULL, DlgProcAuthReq, (LPARAM)((CLISTEVENT *)lParam)->hDbEvent); return 0; } INT_PTR ShowAddedWindow(WPARAM, LPARAM lParam) { - CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDED), NULL, DlgProcAdded, + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDED), NULL, DlgProcAdded, (LPARAM)((CLISTEVENT *)lParam)->hDbEvent); return 0; } @@ -50,7 +50,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); - CallService(MS_DB_EVENT_GET,(WPARAM)lParam,(LPARAM)&dbei); + CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&dbei); if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED)) return 0; diff --git a/src/modules/srauth/authdialogs.cpp b/src/modules/srauth/authdialogs.cpp index 367c8790ac..8d3e90a836 100644 --- a/src/modules/srauth/authdialogs.cpp +++ b/src/modules/srauth/authdialogs.cpp @@ -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. @@ -41,7 +41,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar //blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); - dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0); + dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); dbei.pBlob = (PBYTE)alloca(dbei.cbBlob); CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei); @@ -115,7 +115,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar HANDLE hContact = (HANDLE)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA); if ((hContact == INVALID_HANDLE_VALUE) || !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) - ShowWindow(GetDlgItem(hwndDlg,IDC_ADD),FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); break; } case IDC_DETAILS: @@ -141,8 +141,8 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar break; case WM_DESTROY: - Button_FreeIcon_IcoLib(hwndDlg,IDC_ADD); - Button_FreeIcon_IcoLib(hwndDlg,IDC_DETAILS); + Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD); + Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS); DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); break; @@ -164,13 +164,13 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { DBEVENTINFO dbei = {0}; DWORD uin; - char *nick,*first,*last,*email,*reason; + char *nick, *first, *last, *email, *reason; HANDLE hContact; hDbEvent = (HANDLE)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - //blob is: uin(DWORD),hcontact(HANDLE),nick(ASCIIZ),first(ASCIIZ),last(ASCIIZ),email(ASCIIZ),reason(ASCIIZ) + //blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) dbei.cbSize = sizeof(dbei); dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); dbei.pBlob = (PBYTE)alloca(dbei.cbBlob); @@ -234,7 +234,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); SendDlgItemMessage(hwndDlg, IDC_DENYREASON, EM_LIMITTEXT, 255, 0); - if (CallProtoService(dbei.szModule, PS_GETCAPS,PFLAGNUM_4, 0) & PF4_NOAUTHDENYREASON) + if (CallProtoService(dbei.szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_NOAUTHDENYREASON) { EnableWindow(GetDlgItem(hwndDlg, IDC_DENYREASON), FALSE); SetDlgItemText(hwndDlg, IDC_DENYREASON, TranslateT("Feature is not supported by protocol")); @@ -267,7 +267,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei); - CallProtoService(dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent,0); + CallProtoService(dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent, 0); if (IsDlgButtonChecked(hwndDlg, IDC_ADDCHECK)) { @@ -302,8 +302,8 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case WM_DESTROY: - Button_FreeIcon_IcoLib(hwndDlg,IDC_ADD); - Button_FreeIcon_IcoLib(hwndDlg,IDC_DETAILS); + Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD); + Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS); DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); break; diff --git a/src/modules/srawaymsg/awaymsg.cpp b/src/modules/srawaymsg/awaymsg.cpp index 2657ab5564..f1c8bbc46e 100644 --- a/src/modules/srawaymsg/awaymsg.cpp +++ b/src/modules/srawaymsg/awaymsg.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. @@ -99,8 +99,8 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP #endif SetDlgItemTextA(hwndDlg, IDC_MSG, (const char*)ack->lParam); - ShowWindow(GetDlgItem(hwndDlg,IDC_RETRIEVING), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_MSG), SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg, IDC_RETRIEVING), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_MSG), SW_SHOW); SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close")); break; } @@ -121,8 +121,8 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP case WM_DESTROY: if (dat->hAwayMsgEvent) UnhookEvent(dat->hAwayMsgEvent); - Utils_SaveWindowPosition(hwndDlg,dat->hContact,"SRAway","AwayMsgDlg"); - WindowList_Remove(hWindowList,hwndDlg); + Utils_SaveWindowPosition(hwndDlg, dat->hContact, "SRAway", "AwayMsgDlg"); + WindowList_Remove(hWindowList, hwndDlg); Window_FreeIcon_IcoLib(hwndDlg); mir_free(dat); break; @@ -133,11 +133,11 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) { HWND hwnd; - if (hwnd=WindowList_Find(hWindowList,(HANDLE)wParam)) { + if (hwnd=WindowList_Find(hWindowList, (HANDLE)wParam)) { SetForegroundWindow(hwnd); SetFocus(hwnd); } - else CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_READAWAYMSG),NULL,ReadAwayMsgDlgProc,wParam); + else CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam); return 0; } @@ -147,15 +147,15 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) TCHAR str[128]; char *szProto; - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - ZeroMemory(&clmi,sizeof(clmi)); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); + ZeroMemory(&clmi, sizeof(clmi)); clmi.cbSize = sizeof(clmi); clmi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR; if ( szProto != NULL ) { int chatRoom = szProto ? DBGetContactSettingByte((HANDLE)wParam, szProto, "ChatRoom", 0) : 0; if ( !chatRoom ) { - int status = DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE); + int status = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); mir_sntprintf( str, SIZEOF(str), TranslateT("Re&ad %s Message"), cli.pfnGetStatusModeDescription( status, 0 )); clmi.ptszName = str; if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0 ) & PF1_MODEMSGRECV ) { @@ -165,13 +165,13 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) } } } } CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hAwayMsgMenuItem, ( LPARAM )&clmi ); - IconLib_ReleaseIcon(clmi.hIcon,0); + IconLib_ReleaseIcon(clmi.hIcon, 0); return 0; } static int AwayMsgPreShutdown(WPARAM, LPARAM) { - if (hWindowList) WindowList_BroadcastAsync(hWindowList,WM_CLOSE,0,0); + if (hWindowList) WindowList_BroadcastAsync(hWindowList, WM_CLOSE, 0, 0); return 0; } @@ -179,16 +179,16 @@ int LoadAwayMsgModule(void) { CLISTMENUITEM mi = { 0 }; - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0); - CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG,GetMessageCommand); + hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); mi.cbSize = sizeof(mi); mi.position = -2000005000; mi.flags = CMIF_NOTOFFLINE; mi.pszName = LPGEN("Re&ad Status Message"); mi.pszService = MS_AWAYMSG_SHOWAWAYMSG; - hAwayMsgMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi); - HookEvent(ME_CLIST_PREBUILDCONTACTMENU,AwayMsgPreBuildMenu); - HookEvent(ME_SYSTEM_PRESHUTDOWN,AwayMsgPreShutdown); + hAwayMsgMenuItem = Menu_AddContactMenuItem(&mi); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu); + HookEvent(ME_SYSTEM_PRESHUTDOWN, AwayMsgPreShutdown); return LoadAwayMessageSending(); } diff --git a/src/modules/srawaymsg/sendmsg.cpp b/src/modules/srawaymsg/sendmsg.cpp index 0e5b4c5ff2..015fdce3f8 100644 --- a/src/modules/srawaymsg/sendmsg.cpp +++ b/src/modules/srawaymsg/sendmsg.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. @@ -79,7 +79,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) if (DBGetContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Ignore"), 0)) return NULL; - if (DBGetContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(statusMode, "UsePrev"),0)) + if (DBGetContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(statusMode, "UsePrev"), 0)) { if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Msg"), &dbv)) dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode)); @@ -87,7 +87,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) else { int i; TCHAR substituteStr[128]; - if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(statusMode,"Default"), &dbv)) + if (DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Default"), &dbv)) dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusMode)); for (i=0; dbv.ptszVal[i]; i++) @@ -126,7 +126,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) static WNDPROC OldMessageEditProc; -static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { @@ -182,7 +182,7 @@ void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg) } } else - CallProtoService(szProto, PS_SETAWAYMSGT, statusMode,(LPARAM)msg); + CallProtoService(szProto, PS_SETAWAYMSGT, statusMode, (LPARAM)msg); } struct SetAwayMsgData @@ -217,7 +217,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa dat->szProto = newdat->szProto; mir_free(newdat); SendDlgItemMessage(hwndDlg, IDC_MSG, EM_LIMITTEXT, 1024, 0); - OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MSG), GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc); + OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc); { TCHAR str[256], format[128]; GetWindowText(hwndDlg, format, SIZEOF(format)); @@ -233,7 +233,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa dat->countdown = 6; SendMessage(hwndDlg, WM_TIMER, 0, 0); Window_SetProtoIcon_IcoLib(hwndDlg, dat->szProto, dat->statusMode); - Utils_RestoreWindowPosition(hwndDlg,NULL,"SRAway","AwayMsgDlg"); + Utils_RestoreWindowPosition(hwndDlg, NULL, "SRAway", "AwayMsgDlg"); SetTimer(hwndDlg, 1, 1000, 0); dat->hPreshutdown = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, DM_SRAWAY_SHUTDOWN); } @@ -294,11 +294,11 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa break; case WM_DESTROY: - Utils_SaveWindowPosition(hwndDlg,NULL,"SRAway","AwayMsgDlg"); + Utils_SaveWindowPosition(hwndDlg, NULL, "SRAway", "AwayMsgDlg"); KillTimer(hwndDlg, 1); UnhookEvent(dat->hPreshutdown); Window_FreeIcon_IcoLib(hwndDlg); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MSG), GWLP_WNDPROC, (LONG_PTR)OldMessageEditProc); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)OldMessageEditProc); mir_free(dat); hwndStatusMsg = NULL; break; @@ -323,7 +323,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) else { // If its a single protocol check the PFLAGNUM_3 for the single protocol - if (!(CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_1, 0) & PF1_MODEMSGSEND) || + if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) || !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode))) return 0; } @@ -346,7 +346,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) newdat->statusMode = statusMode; if (hwndStatusMsg) DestroyWindow(hwndStatusMsg); - hwndStatusMsg = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_SETAWAYMSG), + hwndStatusMsg = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)newdat); } return 0; @@ -354,8 +354,8 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) static const int statusModes[] = { - ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, - ID_STATUS_FREECHAT,ID_STATUS_INVISIBLE,ID_STATUS_OUTTOLUNCH,ID_STATUS_ONTHEPHONE, ID_STATUS_IDLE + ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, + ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE, ID_STATUS_OUTTOLUNCH, ID_STATUS_ONTHEPHONE, ID_STATUS_IDLE }; struct AwayMsgInfo @@ -377,7 +377,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam HWND hLst = GetDlgItem(hwndDlg, IDC_LST_STATUS); - dat=(struct AwayMsgDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + dat=(struct AwayMsgDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: @@ -480,7 +480,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_USEPREVIOUS, i < 0 ? 0 : dat->info[i].usePrevious); CheckDlgButton(hwndDlg, IDC_USESPECIFIC, i < 0 ? 0 : !dat->info[i].usePrevious); - SetDlgItemText(hwndDlg,IDC_MSG, i < 0 ? _T("") : dat->info[i].msg); + SetDlgItemText(hwndDlg, IDC_MSG, i < 0 ? _T("") : dat->info[i].msg); EnableWindow(GetDlgItem(hwndDlg, IDC_NODIALOG), i < 0 ? 0 : !dat->info[i].ignore); EnableWindow(GetDlgItem(hwndDlg, IDC_USEPREVIOUS), i < 0 ? 0 : !dat->info[i].ignore); @@ -493,7 +493,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam case IDC_DONTREPLY: case IDC_USEPREVIOUS: case IDC_USESPECIFIC: - SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_STATUS,CBN_SELCHANGE),0); + SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0); break; case IDC_MSG: @@ -511,7 +511,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam { case PSN_APPLY: { int i, status; - SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS,CBN_SELCHANGE), 0); + SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0); i = hLst ? (SendDlgItemMessage(hwndDlg, IDC_LST_STATUS, LB_GETCOUNT, 0, 0) - 1) : (SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCOUNT, 0, 0) - 1); @@ -520,10 +520,10 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam status = hLst ? SendDlgItemMessage(hwndDlg, IDC_LST_STATUS, LB_GETITEMDATA, i, 0): SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETITEMDATA, i, 0); - DBWriteContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(status,"Ignore"), (BYTE)dat->info[i].ignore); - DBWriteContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(status,"NoDlg"), (BYTE)dat->info[i].noDialog); - DBWriteContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(status,"UsePrev"),(BYTE)dat->info[i].usePrevious); - DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(status,"Default"), dat->info[i].msg); + DBWriteContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(status, "Ignore"), (BYTE)dat->info[i].ignore); + DBWriteContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(status, "NoDlg"), (BYTE)dat->info[i].noDialog); + DBWriteContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(status, "UsePrev"), (BYTE)dat->info[i].usePrevious); + DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(status, "Default"), dat->info[i].msg); } return TRUE; } @@ -564,7 +564,7 @@ static int AwayMsgSendModernOptInit(WPARAM wParam, LPARAM) static const int iBoldControls[] = { - IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, + IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, MODERNOPT_CTRL_LAST }; @@ -624,7 +624,7 @@ static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam) int LoadAwayMessageSending(void) { - HookEvent(ME_SYSTEM_MODULESLOADED,AwayMsgSendModulesLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, AwayMsgSendModulesLoaded); HookEvent(ME_PROTO_ACCLISTCHANGED, AwayMsgSendAccountsChanged); #ifdef UNICODE diff --git a/src/modules/sremail/email.cpp b/src/modules/sremail/email.cpp index 38a1e0eb11..db8893b570 100644 --- a/src/modules/sremail/email.cpp +++ b/src/modules/sremail/email.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. @@ -26,29 +26,29 @@ static HANDLE hEMailMenuItem; void SendEmailThread(void *szUrl) { - ShellExecuteA(NULL,"open",( char* )szUrl,"","",SW_SHOW); + ShellExecuteA(NULL, "open", ( char* )szUrl, "", "", SW_SHOW); mir_free(szUrl); return; } -static INT_PTR SendEMailCommand(WPARAM wParam,LPARAM lParam) +static INT_PTR SendEMailCommand(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; char *szUrl; char *szProto; - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam,szProto,"e-mail",&dbv)) { - if (DBGetContactSettingString((HANDLE)wParam,"UserInfo","Mye-mail0",&dbv)) { - MessageBox((HWND)lParam,TranslateT("User has not registered an e-mail address"),TranslateT("Send e-mail"),MB_OK); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); + if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam, szProto, "e-mail", &dbv)) { + if (DBGetContactSettingString((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) { + MessageBox((HWND)lParam, TranslateT("User has not registered an e-mail address"), TranslateT("Send e-mail"), MB_OK); return 1; } } szUrl=(char*)mir_alloc(lstrlenA(dbv.pszVal)+8); - lstrcpyA(szUrl,"mailto:"); - lstrcatA(szUrl,dbv.pszVal); + lstrcpyA(szUrl, "mailto:"); + lstrcatA(szUrl, dbv.pszVal); mir_free(dbv.pszVal); - forkthread(SendEmailThread,0,szUrl); + forkthread(SendEmailThread, 0, szUrl); return 0; } @@ -58,12 +58,12 @@ static int EMailPreBuildMenu(WPARAM wParam, LPARAM) DBVARIANT dbv = { 0 }; char *szProto; - ZeroMemory(&mi,sizeof(mi)); + ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS; szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); - if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam, szProto, "e-mail",& dbv)) + if (szProto == NULL || DBGetContactSettingString((HANDLE)wParam, szProto, "e-mail", & dbv)) if (DBGetContactSettingString((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) mi.flags = CMIM_FLAGS | CMIF_HIDDEN; @@ -81,7 +81,7 @@ int LoadSendRecvEMailModule(void) mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_SENDEMAIL ); mi.pszName = LPGEN("&E-mail"); mi.pszService = MS_EMAIL_SENDEMAIL; - hEMailMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi); + hEMailMenuItem = Menu_AddContactMenuItem(&mi); CreateServiceFunction(MS_EMAIL_SENDEMAIL, SendEMailCommand); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, EMailPreBuildMenu); diff --git a/src/modules/srfile/file.cpp b/src/modules/srfile/file.cpp index 6073dd7a8a..3a39014162 100644 --- a/src/modules/srfile/file.cpp +++ b/src/modules/srfile/file.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,11 +33,11 @@ static INT_PTR SendFileCommand(WPARAM wParam, LPARAM) struct FileSendData fsd; fsd.hContact=(HANDLE)wParam; fsd.ppFiles=NULL; - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILESEND),NULL,DlgProcSendFile,(LPARAM)&fsd); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); return 0; } -static INT_PTR SendSpecificFiles(WPARAM wParam,LPARAM lParam) +static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) { FileSendData fsd; fsd.hContact=(HANDLE)wParam; @@ -54,7 +54,7 @@ static INT_PTR SendSpecificFiles(WPARAM wParam,LPARAM lParam) #else fsd.ppFiles=(const char**)lParam; #endif - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILESEND),NULL,DlgProcSendFile,(LPARAM)&fsd); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); #if defined( _UNICODE ) for ( int j=0; j < count; j++ ) mir_free(( void* )fsd.ppFiles[j] ); @@ -62,28 +62,28 @@ static INT_PTR SendSpecificFiles(WPARAM wParam,LPARAM lParam) return 0; } -static INT_PTR SendSpecificFilesT(WPARAM wParam,LPARAM lParam) +static INT_PTR SendSpecificFilesT(WPARAM wParam, LPARAM lParam) { FileSendData fsd; fsd.hContact=(HANDLE)wParam; fsd.ppFiles=(const TCHAR**)lParam; - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILESEND),NULL,DlgProcSendFile,(LPARAM)&fsd); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); return 0; } -static INT_PTR GetReceivedFilesFolder(WPARAM wParam,LPARAM lParam) +static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) { TCHAR buf[MAX_PATH]; - GetContactReceivedFilesDir((HANDLE)wParam,buf,MAX_PATH,TRUE); + GetContactReceivedFilesDir((HANDLE)wParam, buf, MAX_PATH, TRUE); char* dir = mir_t2a(buf); - lstrcpynA((char*)lParam,dir,MAX_PATH); + lstrcpynA((char*)lParam, dir, MAX_PATH); mir_free(dir); return 0; } static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam) { - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILERECV),NULL,DlgProcRecvFile,lParam); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, lParam); return 0; } @@ -94,23 +94,23 @@ void PushFileEvent( HANDLE hContact, HANDLE hdbe, LPARAM lParam ) cle.hContact = hContact; cle.hDbEvent = hdbe; cle.lParam = lParam; - if ( DBGetContactSettingByte(NULL,"SRFile","AutoAccept",0) && !DBGetContactSettingByte(hContact,"CList","NotOnList",0)) { - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILERECV),NULL,DlgProcRecvFile,(LPARAM)&cle); + if ( DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) { + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle); } else { SkinPlaySound("RecvFile"); TCHAR szTooltip[256]; - mir_sntprintf(szTooltip,SIZEOF(szTooltip),TranslateT("File from %s"), cli.pfnGetContactDisplayName( hContact, 0 )); + mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("File from %s"), cli.pfnGetContactDisplayName( hContact, 0 )); cle.ptszTooltip = szTooltip; cle.flags |= CLEF_TCHAR; cle.hIcon = LoadSkinIcon( SKINICON_EVENT_FILE ); cle.pszService = "SRFile/RecvFile"; - CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); } } -static int FileEventAdded(WPARAM wParam,LPARAM lParam) +static int FileEventAdded(WPARAM wParam, LPARAM lParam) { DWORD dwSignature; @@ -126,15 +126,15 @@ static int FileEventAdded(WPARAM wParam,LPARAM lParam) return 0; } -int SRFile_GetRegValue(HKEY hKeyBase,const TCHAR *szSubKey,const TCHAR *szValue,TCHAR *szOutput,int cbOutput) +int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValue, TCHAR *szOutput, int cbOutput) { HKEY hKey; DWORD cbOut=cbOutput; - if ( RegOpenKeyEx( hKeyBase,szSubKey,0,KEY_QUERY_VALUE,&hKey ) != ERROR_SUCCESS) + if ( RegOpenKeyEx( hKeyBase, szSubKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS) return 0; - if ( RegQueryValueEx( hKey,szValue,NULL,NULL,(PBYTE)szOutput, &cbOut ) != ERROR_SUCCESS ) { + if ( RegQueryValueEx( hKey, szValue, NULL, NULL, (PBYTE)szOutput, &cbOut ) != ERROR_SUCCESS ) { RegCloseKey(hKey); return 0; } @@ -143,7 +143,7 @@ int SRFile_GetRegValue(HKEY hKeyBase,const TCHAR *szSubKey,const TCHAR *szValue, return 1; } -void GetSensiblyFormattedSize(__int64 size,TCHAR *szOut,int cchOut,int unitsOverride,int appendUnits,int *unitsUsed) +void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed) { if (!unitsOverride) { if (size<1000) unitsOverride=UNITS_BYTES; @@ -154,11 +154,11 @@ void GetSensiblyFormattedSize(__int64 size,TCHAR *szOut,int cchOut,int unitsOver } if (unitsUsed) *unitsUsed=unitsOverride; switch(unitsOverride) { - case UNITS_BYTES: mir_sntprintf(szOut,cchOut,_T("%u%s%s"),(int)size,appendUnits?_T(" "):_T(""),appendUnits?TranslateT("bytes"):_T("")); break; - case UNITS_KBPOINT1: mir_sntprintf(szOut,cchOut,_T("%.1lf%s"),size/1024.0,appendUnits?_T(" KB"):_T("")); break; - case UNITS_KBPOINT0: mir_sntprintf(szOut,cchOut,_T("%u%s"),(int)(size/1024),appendUnits?_T(" KB"):_T("")); break; - case UNITS_GBPOINT3: mir_sntprintf(szOut,cchOut,_T("%.3f%s"),(size >> 20)/1024.0,appendUnits?_T(" GB"):_T("")); break; - default: mir_sntprintf(szOut,cchOut,_T("%.2lf%s"),size/1048576.0,appendUnits?_T(" MB"):_T("")); break; + case UNITS_BYTES: mir_sntprintf(szOut, cchOut, _T("%u%s%s"), (int)size, appendUnits?_T(" "):_T(""), appendUnits?TranslateT("bytes"):_T("")); break; + case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, _T("%.1lf%s"), size/1024.0, appendUnits?_T(" KB"):_T("")); break; + case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, _T("%u%s"), (int)(size/1024), appendUnits?_T(" KB"):_T("")); break; + case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, _T("%.3f%s"), (size >> 20)/1024.0, appendUnits?_T(" GB"):_T("")); break; + default: mir_sntprintf(szOut, cchOut, _T("%.2lf%s"), size/1048576.0, appendUnits?_T(" MB"):_T("")); break; } } @@ -263,20 +263,20 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS static void RemoveUnreadFileEvents(void) { DBEVENTINFO dbei={0}; - HANDLE hDbEvent,hContact; + HANDLE hDbEvent, hContact; dbei.cbSize=sizeof(dbei); - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact) { - hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0); + hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0); while (hDbEvent) { dbei.cbBlob=0; - CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei); + CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei); if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE) - CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)hDbEvent); - hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0); + CallService(MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDbEvent); + hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0); } - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); } } @@ -288,8 +288,8 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); if (szProto != NULL) { - if ( CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_1, 0 ) & PF1_FILESEND) { - if ( CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_4, 0 ) & PF4_OFFLINEFILES ) + if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0 ) & PF1_FILESEND) { + if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0 ) & PF4_OFFLINEFILES ) mi.flags = CMIM_FLAGS; else if ( DBGetContactSettingWord(( HANDLE )wParam, szProto, "Status", ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE ) mi.flags = CMIM_FLAGS; @@ -308,7 +308,7 @@ static int SRFileModulesLoaded(WPARAM, LPARAM) mi.pszName = LPGEN("&File"); mi.pszService = MS_FILE_SENDFILE; mi.flags = CMIF_ICONFROMICOLIB; - hSRFileMenuItem = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi); + hSRFileMenuItem = Menu_AddContactMenuItem(&mi); RemoveUnreadFileEvents(); return 0; @@ -324,7 +324,7 @@ INT_PTR openContRecDir(WPARAM wparam, LPARAM) { TCHAR szContRecDir[MAX_PATH]; HANDLE hContact = (HANDLE)wparam; - GetContactReceivedFilesDir(hContact, szContRecDir, SIZEOF(szContRecDir),TRUE); + GetContactReceivedFilesDir(hContact, szContRecDir, SIZEOF(szContRecDir), TRUE); ShellExecute(0, _T("open"), szContRecDir, 0, 0, SW_SHOW); return 0; } @@ -348,21 +348,21 @@ int LoadSendRecvFileModule(void) mi.position = 1900000000; mi.pszName = LPGEN("File &Transfers..."); mi.pszService = "FtMgr/Show"; //MS_PROTO_SHOWFTMGR; - CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi ); + Menu_AddMainMenuItem(&mi); - HookEvent(ME_SYSTEM_MODULESLOADED,SRFileModulesLoaded); - HookEvent(ME_DB_EVENT_ADDED,FileEventAdded); - HookEvent(ME_OPT_INITIALISE,FileOptInitialise); + HookEvent(ME_SYSTEM_MODULESLOADED, SRFileModulesLoaded); + HookEvent(ME_DB_EVENT_ADDED, FileEventAdded); + HookEvent(ME_OPT_INITIALISE, FileOptInitialise); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRFilePreBuildMenu); - CreateServiceFunction(MS_FILE_SENDFILE,SendFileCommand); - CreateServiceFunction(MS_FILE_SENDSPECIFICFILES,SendSpecificFiles); - CreateServiceFunction(MS_FILE_SENDSPECIFICFILEST,SendSpecificFilesT); - CreateServiceFunction(MS_FILE_GETRECEIVEDFILESFOLDER,GetReceivedFilesFolder); - CreateServiceFunction("SRFile/RecvFile",RecvFileCommand); + CreateServiceFunction(MS_FILE_SENDFILE, SendFileCommand); + CreateServiceFunction(MS_FILE_SENDSPECIFICFILES, SendSpecificFiles); + CreateServiceFunction(MS_FILE_SENDSPECIFICFILEST, SendSpecificFilesT); + CreateServiceFunction(MS_FILE_GETRECEIVEDFILESFOLDER, GetReceivedFilesFolder); + CreateServiceFunction("SRFile/RecvFile", RecvFileCommand); - CreateServiceFunction("SRFile/OpenContRecDir",openContRecDir); - CreateServiceFunction("SRFile/OpenRecDir",openRecDir); + CreateServiceFunction("SRFile/OpenContRecDir", openContRecDir); + CreateServiceFunction("SRFile/OpenRecDir", openRecDir); SkinAddNewSoundEx("RecvFile", "File", "Incoming"); SkinAddNewSoundEx("FileDone", "File", "Complete"); diff --git a/src/modules/srfile/file.h b/src/modules/srfile/file.h index 8ee9048eb9..f4e9a63336 100644 --- a/src/modules/srfile/file.h +++ b/src/modules/srfile/file.h @@ -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. @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define VIRUSSCAN_DURINGDL 2 #define FILERESUME_ASK 0 -//1,2,3,4: resume, overwrite, rename, skip: from proto library +//1, 2, 3, 4: resume, overwrite, rename, skip: from proto library #define FILERESUMEF_ALL 0x80 #define FILERESUME_RESUMEALL (FILERESUME_RESUME|FILERESUMEF_ALL) #define FILERESUME_OVERWRITEALL (FILERESUME_OVERWRITE|FILERESUMEF_ALL) @@ -72,21 +72,21 @@ struct FileDlgData { #define UNITS_MBPOINT2 4 // 1024*1024<=size: "%.2f MB" #define UNITS_GBPOINT3 5 // 1024*1024*1024<=size: "%.3f GB" -void GetSensiblyFormattedSize(__int64 size,TCHAR *szOut,int cchOut,int unitsOverride,int appendUnits,int *unitsUsed); +void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed); void FreeFilesMatrix(TCHAR ***files); //loving that triple indirection void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts); -void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest,PROTOFILETRANSFERSTATUS *src); -void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest,PROTOFILETRANSFERSTATUS *src); -int SRFile_GetRegValue(HKEY hKeyBase,const TCHAR *szSubKey,const TCHAR *szValue,TCHAR *szOutput,int cbOutput); +void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src); +void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src); +int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValue, TCHAR *szOutput, int cbOutput); //filesenddlg.c INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //filerecv.c INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); void RemoveInvalidFilenameChars(TCHAR *tszString); void RemoveInvalidPathChars(TCHAR *tszString); -void GetContactReceivedFilesDir(HANDLE hContact,TCHAR *szDir,int cchDir,BOOL substVars); -void GetReceivedFilesDir(TCHAR *szDir,int cchDir); -int BrowseForFolder(HWND hwnd,TCHAR *szPath); +void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL substVars); +void GetReceivedFilesDir(TCHAR *szDir, int cchDir); +int BrowseForFolder(HWND hwnd, TCHAR *szPath); //fileexistsdlg.c struct TDlgProcFileExistsParam { @@ -97,7 +97,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM //filexferdlg.c INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //fileopts.c -int FileOptInitialise(WPARAM wParam,LPARAM lParam); +int FileOptInitialise(WPARAM wParam, LPARAM lParam); //ftmanager.c #define WM_FT_ADD (WM_USER+701) #define WM_FT_RESIZE (WM_USER+702) diff --git a/src/modules/srfile/fileexistsdlg.cpp b/src/modules/srfile/fileexistsdlg.cpp index 23bc8b0877..a6b5dfd3c2 100644 --- a/src/modules/srfile/fileexistsdlg.cpp +++ b/src/modules/srfile/fileexistsdlg.cpp @@ -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. @@ -31,16 +31,16 @@ static void SetControlToUnixTime(HWND hwndDlg, UINT idCtrl, time_t unixTime) LARGE_INTEGER liFiletime; FILETIME filetime; SYSTEMTIME st; - char szTime[64],szDate[64],szOutput[128]; + char szTime[64], szDate[64], szOutput[128]; liFiletime.QuadPart=(BIGI(11644473600)+(__int64)unixTime)*10000000; filetime.dwHighDateTime=liFiletime.HighPart; filetime.dwLowDateTime=liFiletime.LowPart; - FileTimeToSystemTime(&filetime,&st); - GetTimeFormatA(LOCALE_USER_DEFAULT,0,&st,NULL,szTime,SIZEOF(szTime)); - GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&st,NULL,szDate,SIZEOF(szDate)); - mir_snprintf(szOutput, SIZEOF(szOutput), "%s %s",szDate,szTime); - SetDlgItemTextA(hwndDlg,idCtrl,szOutput); + FileTimeToSystemTime(&filetime, &st); + GetTimeFormatA(LOCALE_USER_DEFAULT, 0, &st, NULL, szTime, SIZEOF(szTime)); + GetDateFormatA(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szDate, SIZEOF(szDate)); + mir_snprintf(szOutput, SIZEOF(szOutput), "%s %s", szDate, szTime); + SetDlgItemTextA(hwndDlg, idCtrl, szOutput); } #define C_CONTEXTMENU 0 @@ -49,7 +49,7 @@ static void SetControlToUnixTime(HWND hwndDlg, UINT idCtrl, time_t unixTime) #ifndef CMF_EXTENDEDVERBS #define CMF_EXTENDEDVERBS 0x00000100 #endif -static void DoAnnoyingShellCommand(HWND hwnd,const TCHAR *szFilename,int cmd,POINT *ptCursor) +static void DoAnnoyingShellCommand(HWND hwnd, const TCHAR *szFilename, int cmd, POINT *ptCursor) { IShellFolder *pDesktopFolder; if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) { @@ -58,26 +58,26 @@ static void DoAnnoyingShellCommand(HWND hwnd,const TCHAR *szFilename,int cmd,POI WCHAR* wszFilename = ( LPWSTR )szFilename; #else WCHAR wszFilename[MAX_PATH]; - MultiByteToWideChar(CP_ACP,0,szFilename,-1,wszFilename,SIZEOF(wszFilename)); + MultiByteToWideChar(CP_ACP, 0, szFilename, -1, wszFilename, SIZEOF(wszFilename)); #endif - if (pDesktopFolder->ParseDisplayName(NULL,NULL,wszFilename,NULL,&pCurrentIdl,NULL) == NOERROR) { + if (pDesktopFolder->ParseDisplayName(NULL, NULL, wszFilename, NULL, &pCurrentIdl, NULL) == NOERROR) { if (pCurrentIdl->mkid.cb) { - ITEMIDLIST *pidl,*pidlNext,*pidlFilename; + ITEMIDLIST *pidl, *pidlNext, *pidlFilename; IShellFolder *pFileFolder; for (pidl=pCurrentIdl;;) { pidlNext=(ITEMIDLIST*)((PBYTE)pidl+pidl->mkid.cb); if (pidlNext->mkid.cb == 0) { pidlFilename = (ITEMIDLIST*)CoTaskMemAlloc(pidl->mkid.cb+sizeof(pidl->mkid.cb)); - CopyMemory(pidlFilename,pidl,pidl->mkid.cb+sizeof(pidl->mkid.cb)); + CopyMemory(pidlFilename, pidl, pidl->mkid.cb+sizeof(pidl->mkid.cb)); pidl->mkid.cb=0; break; } pidl=pidlNext; } - if (pDesktopFolder->BindToObject(pCurrentIdl,NULL,IID_IShellFolder,(void**)&pFileFolder) == NOERROR) { + if (pDesktopFolder->BindToObject(pCurrentIdl, NULL, IID_IShellFolder, (void**)&pFileFolder) == NOERROR) { IContextMenu *pContextMenu; - if (pFileFolder->GetUIObjectOf(NULL,1,(LPCITEMIDLIST*)&pidlFilename,IID_IContextMenu,NULL,(void**)&pContextMenu) == NOERROR) { + if (pFileFolder->GetUIObjectOf(NULL, 1, (LPCITEMIDLIST*)&pidlFilename, IID_IContextMenu, NULL, (void**)&pContextMenu) == NOERROR) { switch(cmd) { case C_PROPERTIES: { CMINVOKECOMMANDINFO ici={0}; @@ -91,9 +91,9 @@ static void DoAnnoyingShellCommand(HWND hwnd,const TCHAR *szFilename,int cmd,POI case C_CONTEXTMENU: { HMENU hMenu; hMenu=CreatePopupMenu(); - if (SUCCEEDED(pContextMenu->QueryContextMenu(hMenu,0,1000,65535,(GetKeyState(VK_SHIFT)&0x8000?CMF_EXTENDEDVERBS:0)|CMF_NORMAL))) { + if (SUCCEEDED(pContextMenu->QueryContextMenu(hMenu, 0, 1000, 65535, (GetKeyState(VK_SHIFT)&0x8000?CMF_EXTENDEDVERBS:0)|CMF_NORMAL))) { int cmd; - cmd=TrackPopupMenu(hMenu,TPM_RETURNCMD,ptCursor->x,ptCursor->y,0,hwnd,NULL); + cmd=TrackPopupMenu(hMenu, TPM_RETURNCMD, ptCursor->x, ptCursor->y, 0, hwnd, NULL); if (cmd) { CMINVOKECOMMANDINFO ici={0}; ici.cbSize=sizeof(ici); @@ -122,11 +122,11 @@ static void DoAnnoyingShellCommand(HWND hwnd,const TCHAR *szFilename,int cmd,POI static WNDPROC pfnIconWindowProc; static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - PROTOFILETRANSFERSTATUS* pft = (PROTOFILETRANSFERSTATUS*)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA); + PROTOFILETRANSFERSTATUS* pft = (PROTOFILETRANSFERSTATUS*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); switch(msg) { case WM_LBUTTONDBLCLK: - ShellExecute(hwnd,NULL,pft->tszCurrentFile,NULL,NULL,SW_SHOW); + ShellExecute(hwnd, NULL, pft->tszCurrentFile, NULL, NULL, SW_SHOW); break; case WM_RBUTTONUP: { POINT pt; @@ -136,7 +136,7 @@ static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0; } } - return CallWindowProc(pfnIconWindowProc,hwnd,msg,wParam,lParam); + return CallWindowProc(pfnIconWindowProc, hwnd, msg, wParam, lParam); } struct loadiconsstartinfo { @@ -148,12 +148,12 @@ void __cdecl LoadIconsAndTypesThread(void* param) loadiconsstartinfo *info = ( loadiconsstartinfo* )param; SHFILEINFO fileInfo; - if ( SHGetFileInfo( info->szFilename, 0, &fileInfo, sizeof(fileInfo),SHGFI_TYPENAME|SHGFI_ICON|SHGFI_LARGEICON)) { - TCHAR *pszExtension,*pszFilename; + if ( SHGetFileInfo( info->szFilename, 0, &fileInfo, sizeof(fileInfo), SHGFI_TYPENAME|SHGFI_ICON|SHGFI_LARGEICON)) { + TCHAR *pszExtension, *pszFilename; TCHAR szExtension[64]; TCHAR szIconFile[MAX_PATH]; - pszFilename = _tcsrchr(info->szFilename,'\\'); + pszFilename = _tcsrchr(info->szFilename, '\\'); if ( pszFilename == NULL ) pszFilename = info->szFilename; @@ -166,28 +166,28 @@ void __cdecl LoadIconsAndTypesThread(void* param) } CharUpper(szExtension); if ( fileInfo.szTypeName[0] == '\0' ) - mir_sntprintf( fileInfo.szTypeName, SIZEOF(fileInfo.szTypeName), TranslateT("%s File"),szExtension); - SetDlgItemText(info->hwndDlg,IDC_EXISTINGTYPE,fileInfo.szTypeName); - SetDlgItemText(info->hwndDlg,IDC_NEWTYPE,fileInfo.szTypeName); - SendDlgItemMessage(info->hwndDlg,IDC_EXISTINGICON,STM_SETICON,(WPARAM)fileInfo.hIcon,0); + mir_sntprintf( fileInfo.szTypeName, SIZEOF(fileInfo.szTypeName), TranslateT("%s File"), szExtension); + SetDlgItemText(info->hwndDlg, IDC_EXISTINGTYPE, fileInfo.szTypeName); + SetDlgItemText(info->hwndDlg, IDC_NEWTYPE, fileInfo.szTypeName); + SendDlgItemMessage(info->hwndDlg, IDC_EXISTINGICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0); szIconFile[0]='\0'; if ( !lstrcmp( szExtension, _T("EXE"))) { - SRFile_GetRegValue(HKEY_LOCAL_MACHINE,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"),_T("2"),szIconFile,SIZEOF(szIconFile)); + SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("2"), szIconFile, SIZEOF(szIconFile)); } else { TCHAR szTypeName[MAX_PATH]; - if (SRFile_GetRegValue(HKEY_CLASSES_ROOT,pszExtension,NULL,szTypeName,SIZEOF(szTypeName))) { - lstrcat(szTypeName,_T("\\DefaultIcon")); - if (SRFile_GetRegValue(HKEY_CLASSES_ROOT,szTypeName,NULL,szIconFile,SIZEOF(szIconFile))) { + if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, SIZEOF(szTypeName))) { + lstrcat(szTypeName, _T("\\DefaultIcon")); + if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, SIZEOF(szIconFile))) { if ( _tcsstr( szIconFile, _T("%1"))) - SRFile_GetRegValue(HKEY_LOCAL_MACHINE,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"),_T("0"),szIconFile,SIZEOF(szIconFile)); + SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("0"), szIconFile, SIZEOF(szIconFile)); else szIconFile[0]='\0'; } } } if ( szIconFile[0]) { int iconIndex; HICON hIcon; - TCHAR *pszComma = _tcsrchr(szIconFile,','); + TCHAR *pszComma = _tcsrchr(szIconFile, ', '); if ( pszComma == NULL ) iconIndex=0; else { @@ -197,7 +197,7 @@ void __cdecl LoadIconsAndTypesThread(void* param) if ( hIcon ) fileInfo.hIcon = hIcon; } - SendDlgItemMessage(info->hwndDlg,IDC_NEWICON,STM_SETICON,(WPARAM)fileInfo.hIcon,0); + SendDlgItemMessage(info->hwndDlg, IDC_NEWICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0); } mir_free(info->szFilename); mir_free(info); @@ -207,7 +207,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { PROTOFILETRANSFERSTATUS *fts; - fts=(PROTOFILETRANSFERSTATUS*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + fts=(PROTOFILETRANSFERSTATUS*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch(msg) { case WM_INITDIALOG: { @@ -216,37 +216,37 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HWND hwndFocus; struct TDlgProcFileExistsParam *dat = (struct TDlgProcFileExistsParam *)lParam; - SetPropA(hwndDlg,"Miranda.Preshutdown",HookEventMessage(ME_SYSTEM_PRESHUTDOWN,hwndDlg,M_PRESHUTDOWN)); - SetPropA(hwndDlg,"Miranda.ParentWnd",dat->hwndParent); + SetPropA(hwndDlg, "Miranda.Preshutdown", HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN)); + SetPropA(hwndDlg, "Miranda.ParentWnd", dat->hwndParent); TranslateDialogDefault(hwndDlg); fts=(PROTOFILETRANSFERSTATUS*)mir_alloc(sizeof(PROTOFILETRANSFERSTATUS)); - CopyProtoFileTransferStatus(fts,dat->fts); - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)fts); - SetDlgItemText(hwndDlg,IDC_FILENAME,fts->tszCurrentFile); - SetControlToUnixTime(hwndDlg,IDC_NEWDATE,fts->currentFileTime); - GetSensiblyFormattedSize(fts->currentFileSize,szSize,SIZEOF(szSize),0,1,NULL); - SetDlgItemText(hwndDlg,IDC_NEWSIZE,szSize); + CopyProtoFileTransferStatus(fts, dat->fts); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)fts); + SetDlgItemText(hwndDlg, IDC_FILENAME, fts->tszCurrentFile); + SetControlToUnixTime(hwndDlg, IDC_NEWDATE, fts->currentFileTime); + GetSensiblyFormattedSize(fts->currentFileSize, szSize, SIZEOF(szSize), 0, 1, NULL); + SetDlgItemText(hwndDlg, IDC_NEWSIZE, szSize); - pfnIconWindowProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_EXISTINGICON),GWLP_WNDPROC,(LONG_PTR)IconCtrlSubclassProc); + pfnIconWindowProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EXISTINGICON), GWLP_WNDPROC, (LONG_PTR)IconCtrlSubclassProc); - hwndFocus=GetDlgItem(hwndDlg,IDC_RESUME); - if ( _tstati64(fts->tszCurrentFile,&statbuf) == 0) { - SetControlToUnixTime(hwndDlg,IDC_EXISTINGDATE,statbuf.st_mtime); - GetSensiblyFormattedSize(statbuf.st_size,szSize,SIZEOF(szSize),0,1,NULL); - SetDlgItemText(hwndDlg,IDC_EXISTINGSIZE,szSize); + hwndFocus=GetDlgItem(hwndDlg, IDC_RESUME); + if ( _tstati64(fts->tszCurrentFile, &statbuf) == 0) { + SetControlToUnixTime(hwndDlg, IDC_EXISTINGDATE, statbuf.st_mtime); + GetSensiblyFormattedSize(statbuf.st_size, szSize, SIZEOF(szSize), 0, 1, NULL); + SetDlgItemText(hwndDlg, IDC_EXISTINGSIZE, szSize); if (statbuf.st_size>(int)fts->currentFileSize) { - EnableWindow(GetDlgItem(hwndDlg,IDC_RESUME),FALSE); - hwndFocus=GetDlgItem(hwndDlg,IDC_OVERWRITE); + EnableWindow(GetDlgItem(hwndDlg, IDC_RESUME), FALSE); + hwndFocus=GetDlgItem(hwndDlg, IDC_OVERWRITE); } } loadiconsstartinfo *lisi = ( loadiconsstartinfo* )mir_alloc(sizeof(loadiconsstartinfo)); lisi->hwndDlg=hwndDlg; lisi->szFilename = mir_tstrdup(fts->tszCurrentFile); //can be a little slow, so why not? - forkthread(LoadIconsAndTypesThread,0,lisi); + forkthread(LoadIconsAndTypesThread, 0, lisi); SetFocus(hwndFocus); - SetWindowLongPtr(hwndFocus,GWL_STYLE,GetWindowLongPtr(hwndFocus,GWL_STYLE)|BS_DEFPUSHBUTTON); + SetWindowLongPtr(hwndFocus, GWL_STYLE, GetWindowLongPtr(hwndFocus, GWL_STYLE)|BS_DEFPUSHBUTTON); return FALSE; } case WM_COMMAND: @@ -264,11 +264,11 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR* pszLastBackslash = _tcsrchr( szFile, '\\' ); if ( pszLastBackslash ) *pszLastBackslash = '\0'; - ShellExecute(hwndDlg,NULL,szFile,NULL,NULL,SW_SHOW); + ShellExecute(hwndDlg, NULL, szFile, NULL, NULL, SW_SHOW); return FALSE; } case IDC_PROPERTIES: - DoAnnoyingShellCommand(hwndDlg,fts->tszCurrentFile,C_PROPERTIES,NULL); + DoAnnoyingShellCommand(hwndDlg, fts->tszCurrentFile, C_PROPERTIES, NULL); return FALSE; case IDC_RESUME: pfr.action=FILERESUME_RESUME; @@ -290,7 +290,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_SAVEAS: { OPENFILENAME ofn={0}; - TCHAR filter[512],*pfilter; + TCHAR filter[512], *pfilter; TCHAR str[MAX_PATH]; lstrcpyn( str, fts->tszCurrentFile, SIZEOF(str)); @@ -325,27 +325,27 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } { PROTOFILERESUME *pfrCopy; pfrCopy=(PROTOFILERESUME*)mir_alloc(sizeof(pfr)); - CopyMemory(pfrCopy,&pfr,sizeof(pfr)); - PostMessage((HWND)GetPropA(hwndDlg,"Miranda.ParentWnd"),M_FILEEXISTSDLGREPLY,(WPARAM)mir_tstrdup(fts->tszCurrentFile),(LPARAM)pfrCopy); + CopyMemory(pfrCopy, &pfr, sizeof(pfr)); + PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy); DestroyWindow(hwndDlg); } break; } case WM_CLOSE: - PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDCANCEL,BN_CLICKED),(LPARAM)GetDlgItem(hwndDlg,IDCANCEL)); + PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDCANCEL, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDCANCEL)); break; case M_PRESHUTDOWN: - PostMessage(hwndDlg,WM_CLOSE,0,0); + PostMessage(hwndDlg, WM_CLOSE, 0, 0); break; case WM_DESTROY: - UnhookEvent(GetPropA(hwndDlg,"Miranda.Preshutdown")); // GetProp() will return NULL if it couldnt find anything - RemovePropA(hwndDlg,"Miranda.Preshutdown"); - RemovePropA(hwndDlg,"Miranda.ParentWnd"); - DestroyIcon((HICON)SendDlgItemMessage(hwndDlg,IDC_EXISTINGICON,STM_GETICON,0,0)); - DestroyIcon((HICON)SendDlgItemMessage(hwndDlg,IDC_NEWICON,STM_GETICON,0,0)); + UnhookEvent(GetPropA(hwndDlg, "Miranda.Preshutdown")); // GetProp() will return NULL if it couldnt find anything + RemovePropA(hwndDlg, "Miranda.Preshutdown"); + RemovePropA(hwndDlg, "Miranda.ParentWnd"); + DestroyIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_EXISTINGICON, STM_GETICON, 0, 0)); + DestroyIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_NEWICON, STM_GETICON, 0, 0)); FreeProtoFileTransferStatus(fts); mir_free(fts); break; diff --git a/src/modules/srfile/fileopts.cpp b/src/modules/srfile/fileopts.cpp index ca22961ece..e0189fc56f 100644 --- a/src/modules/srfile/fileopts.cpp +++ b/src/modules/srfile/fileopts.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. @@ -36,16 +36,16 @@ struct virusscannerinfo { }; static const struct virusscannerinfo virusScanners[]={ - {_T("Network Associates/McAfee VirusScan"),_T("SOFTWARE\\McAfee\\VirusScan"),_T("Scan32EXE"),_T("\"%s\" %%f /nosplash /comp /autoscan /autoexit /noboot")}, - {_T("Dr Solomon's VirusScan (Network Associates)"),_T("SOFTWARE\\Network Associates\\TVD\\VirusScan\\AVConsol\\General"),_T("szScannerExe"),_T("\"%s\" %%f /uinone /noboot /comp /prompt /autoexit")}, - {_T("Norton AntiVirus"),_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Navw32.exe"),NULL,_T("\"%s\" %%f /b- /m- /s+ /noresults")}, - {_T("Computer Associates/Inoculate IT"),_T("Software\\Antivirus"),_T("ImageFilename"),_T("\"%s\" %%f /display=progress /exit")}, - {_T("Computer Associates eTrust"),_T("SOFTWARE\\ComputerAssociates\\Anti-Virus\\Resident"),_T("VetPath"),_T("\"%s\" %%f /display=progress /exit")}, - {_T("Kaspersky Anti-Virus"),_T("SOFTWARE\\KasperskyLab\\Components\\101"),_T("EXEName"),_T("\"%s\" /S /Q %%f")}, - {_T("Kaspersky Anti-Virus"),_T("SOFTWARE\\KasperskyLab\\SetupFolders"),_T("KAV8"),_T("\"%savp.exe\" SCAN %%f")}, - {_T("Kaspersky Anti-Virus"),_T("SOFTWARE\\KasperskyLab\\SetupFolders"),_T("KAV9"),_T("\"%savp.exe\" SCAN %%f")}, - {_T("AntiVir PersonalEdition Classic"),_T("SOFTWARE\\Avira\\AntiVir PersonalEdition Classic"),_T("Path"),_T("\"%savscan.exe\" /GUIMODE=2 /PATH=\"%%f\"")}, - {_T("ESET NOD32 Antivirus"),_T("SOFTWARE\\ESET\\ESET Security\\CurrentVersion\\Info"),_T("InstallDir"),_T("\"%secls.exe\" /log-all /aind /no-boots /adware /sfx /unsafe /unwanted /heur /adv-heur /action=clean \"%%f\"")}, + {_T("Network Associates/McAfee VirusScan"), _T("SOFTWARE\\McAfee\\VirusScan"), _T("Scan32EXE"), _T("\"%s\" %%f /nosplash /comp /autoscan /autoexit /noboot")}, + {_T("Dr Solomon's VirusScan (Network Associates)"), _T("SOFTWARE\\Network Associates\\TVD\\VirusScan\\AVConsol\\General"), _T("szScannerExe"), _T("\"%s\" %%f /uinone /noboot /comp /prompt /autoexit")}, + {_T("Norton AntiVirus"), _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Navw32.exe"), NULL, _T("\"%s\" %%f /b- /m- /s+ /noresults")}, + {_T("Computer Associates/Inoculate IT"), _T("Software\\Antivirus"), _T("ImageFilename"), _T("\"%s\" %%f /display=progress /exit")}, + {_T("Computer Associates eTrust"), _T("SOFTWARE\\ComputerAssociates\\Anti-Virus\\Resident"), _T("VetPath"), _T("\"%s\" %%f /display=progress /exit")}, + {_T("Kaspersky Anti-Virus"), _T("SOFTWARE\\KasperskyLab\\Components\\101"), _T("EXEName"), _T("\"%s\" /S /Q %%f")}, + {_T("Kaspersky Anti-Virus"), _T("SOFTWARE\\KasperskyLab\\SetupFolders"), _T("KAV8"), _T("\"%savp.exe\" SCAN %%f")}, + {_T("Kaspersky Anti-Virus"), _T("SOFTWARE\\KasperskyLab\\SetupFolders"), _T("KAV9"), _T("\"%savp.exe\" SCAN %%f")}, + {_T("AntiVir PersonalEdition Classic"), _T("SOFTWARE\\Avira\\AntiVir PersonalEdition Classic"), _T("Path"), _T("\"%savscan.exe\" /GUIMODE=2 /PATH=\"%%f\"")}, + {_T("ESET NOD32 Antivirus"), _T("SOFTWARE\\ESET\\ESET Security\\CurrentVersion\\Info"), _T("InstallDir"), _T("\"%secls.exe\" /log-all /aind /no-boots /adware /sfx /unsafe /unwanted /heur /adv-heur /action=clean \"%%f\"")}, }; #define M_UPDATEENABLING (WM_USER+100) @@ -67,74 +67,74 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR str[MAX_PATH]; - GetContactReceivedFilesDir(NULL,str,SIZEOF(str),FALSE); - SetDlgItemText(hwndDlg,IDC_FILEDIR,str); + GetContactReceivedFilesDir(NULL, str, SIZEOF(str), FALSE); + SetDlgItemText(hwndDlg, IDC_FILEDIR, str); } - CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, DBGetContactSettingByte(NULL,"SRFile","AutoAccept",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOMIN, DBGetContactSettingByte(NULL,"SRFile","AutoMin",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, DBGetContactSettingByte(NULL,"SRFile","AutoClose",0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, DBGetContactSettingByte(NULL,"SRFile","AutoClear",1) ? BST_CHECKED : BST_UNCHECKED); - switch(DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE)) { + CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOMIN, DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, DBGetContactSettingByte(NULL, "SRFile", "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, DBGetContactSettingByte(NULL, "SRFile", "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED); + switch(DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE)) { case VIRUSSCAN_AFTERDL: CheckDlgButton(hwndDlg, IDC_SCANAFTERDL, BST_CHECKED); break; case VIRUSSCAN_DURINGDL: CheckDlgButton(hwndDlg, IDC_SCANDURINGDL, BST_CHECKED); break; default: CheckDlgButton(hwndDlg, IDC_NOSCANNER, BST_CHECKED); break; } - CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, DBGetContactSettingByte(NULL,"SRFile","WarnBeforeOpening",1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, DBGetContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED); { TCHAR szScanExe[MAX_PATH]; - int i,iItem; + int i, iItem; for ( i=0; i < SIZEOF(virusScanners); i++ ) { - if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE,virusScanners[i].szExeRegPath,virusScanners[i].szExeRegValue,szScanExe,SIZEOF(szScanExe))) { - iItem=SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_ADDSTRING,0,(LPARAM)virusScanners[i].szProductName); - SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_SETITEMDATA,iItem,i); + if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, SIZEOF(szScanExe))) { + iItem=SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)virusScanners[i].szProductName); + SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, i); } } - if ( SendDlgItemMessageA(hwndDlg,IDC_SCANCMDLINE,CB_GETCOUNT,0,0) == 0 ) + if ( SendDlgItemMessageA(hwndDlg, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0) == 0 ) { - iItem = SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_ADDSTRING,0,(LPARAM)_T("") ); - SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_SETITEMDATA,iItem, (LPARAM)-1); + iItem = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)_T("") ); + SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, (LPARAM)-1); } } DBVARIANT dbv; - if (DBGetContactSettingTString(NULL,"SRFile","ScanCmdLine",&dbv) == 0) { - SetDlgItemText(hwndDlg,IDC_SCANCMDLINE,dbv.ptszVal); + if (DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv) == 0) { + SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, dbv.ptszVal); DBFreeVariant(&dbv); } else { - if (SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_GETCOUNT,0,0)) { - SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_SETCURSEL,0,0); - PostMessage(hwndDlg,M_SCANCMDLINESELCHANGE,0,0); + if (SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0)) { + SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETCURSEL, 0, 0); + PostMessage(hwndDlg, M_SCANCMDLINESELCHANGE, 0, 0); } } - switch(DBGetContactSettingByte(NULL,"SRFile","IfExists",FILERESUME_ASK)) { + switch(DBGetContactSettingByte(NULL, "SRFile", "IfExists", FILERESUME_ASK)) { case FILERESUME_RESUMEALL: CheckDlgButton(hwndDlg, IDC_RESUME, BST_CHECKED); break; case FILERESUME_OVERWRITEALL: CheckDlgButton(hwndDlg, IDC_OVERWRITE, BST_CHECKED); break; case FILERESUME_RENAMEALL: CheckDlgButton(hwndDlg, IDC_RENAME, BST_CHECKED); break; default: CheckDlgButton(hwndDlg, IDC_ASK, BST_CHECKED); break; } - SendMessage(hwndDlg,M_UPDATEENABLING,0,0); + SendMessage(hwndDlg, M_UPDATEENABLING, 0, 0); return TRUE; } case M_UPDATEENABLING: - { int on=!IsDlgButtonChecked(hwndDlg,IDC_NOSCANNER); - EnableWindow(GetDlgItem(hwndDlg,IDC_ST_CMDLINE),on); - EnableWindow(GetDlgItem(hwndDlg,IDC_SCANCMDLINE),on); - EnableWindow(GetDlgItem(hwndDlg,IDC_SCANCMDLINEBROWSE),on); - EnableWindow(GetDlgItem(hwndDlg,IDC_ST_CMDLINEHELP),on); - EnableWindow(GetDlgItem(hwndDlg,IDC_AUTOMIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOACCEPT)); + { int on=!IsDlgButtonChecked(hwndDlg, IDC_NOSCANNER); + EnableWindow(GetDlgItem(hwndDlg, IDC_ST_CMDLINE), on); + EnableWindow(GetDlgItem(hwndDlg, IDC_SCANCMDLINE), on); + EnableWindow(GetDlgItem(hwndDlg, IDC_SCANCMDLINEBROWSE), on); + EnableWindow(GetDlgItem(hwndDlg, IDC_ST_CMDLINEHELP), on); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOMIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT)); break; } case M_SCANCMDLINESELCHANGE: { TCHAR str[512]; TCHAR szScanExe[MAX_PATH]; - int iScanner=SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_SCANCMDLINE,CB_GETCURSEL,0,0),0); + int iScanner=SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCURSEL, 0, 0), 0); if (iScanner >= SIZEOF(virusScanners) || iScanner<0) break; str[0]='\0'; - if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE,virusScanners[iScanner].szExeRegPath,virusScanners[iScanner].szExeRegValue,szScanExe,SIZEOF(szScanExe))) - mir_sntprintf(str, SIZEOF(str), virusScanners[iScanner].szCommandLine,szScanExe); - SetDlgItemText(hwndDlg,IDC_SCANCMDLINE,str); + if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[iScanner].szExeRegPath, virusScanners[iScanner].szExeRegValue, szScanExe, SIZEOF(szScanExe))) + mir_sntprintf(str, SIZEOF(str), virusScanners[iScanner].szCommandLine, szScanExe); + SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str); break; } case WM_COMMAND: @@ -144,19 +144,19 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case IDC_FILEDIRBROWSE: { TCHAR str[MAX_PATH]; - GetDlgItemText(hwndDlg,IDC_FILEDIR,str,SIZEOF(str)); - if (BrowseForFolder(hwndDlg,str)) - SetDlgItemText(hwndDlg,IDC_FILEDIR,str); + GetDlgItemText(hwndDlg, IDC_FILEDIR, str, SIZEOF(str)); + if (BrowseForFolder(hwndDlg, str)) + SetDlgItemText(hwndDlg, IDC_FILEDIR, str); break; } case IDC_AUTOACCEPT: case IDC_NOSCANNER: case IDC_SCANAFTERDL: case IDC_SCANDURINGDL: - SendMessage(hwndDlg,M_UPDATEENABLING,0,0); + SendMessage(hwndDlg, M_UPDATEENABLING, 0, 0); break; case IDC_SCANCMDLINE: - if (HIWORD(wParam) == CBN_SELCHANGE) PostMessage(hwndDlg,M_SCANCMDLINESELCHANGE,0,0); + if (HIWORD(wParam) == CBN_SELCHANGE) PostMessage(hwndDlg, M_SCANCMDLINESELCHANGE, 0, 0); else if (HIWORD(wParam) != CBN_EDITCHANGE) return 0; break; case IDC_SCANCMDLINEBROWSE: @@ -168,7 +168,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT; - _tcscpy(filter,TranslateT("Executable Files")); + _tcscpy(filter, TranslateT("Executable Files")); _tcscat(filter, _T(" (*.exe)")); pfilter = filter + _tcslen(filter) + 1; _tcscpy(pfilter, _T("*.exe")); @@ -211,16 +211,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR str[512]; GetDlgItemText(hwndDlg, IDC_FILEDIR, str, SIZEOF(str)); RemoveInvalidPathChars(str); - DBWriteContactSettingTString(NULL,"SRFile","RecvFilesDirAdv",str); - DBWriteContactSettingByte(NULL,"SRFile","AutoAccept",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOACCEPT)); - DBWriteContactSettingByte(NULL,"SRFile","AutoMin",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOMIN)); - DBWriteContactSettingByte(NULL,"SRFile","AutoClose",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOCLOSE)); - DBWriteContactSettingByte(NULL,"SRFile","AutoClear",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOCLEAR)); - DBWriteContactSettingByte(NULL,"SRFile","UseScanner",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_SCANAFTERDL)?VIRUSSCAN_AFTERDL:(IsDlgButtonChecked(hwndDlg,IDC_SCANDURINGDL)?VIRUSSCAN_DURINGDL:VIRUSSCAN_DISABLE))); + DBWriteContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", str); + DBWriteContactSettingByte(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT)); + DBWriteContactSettingByte(NULL, "SRFile", "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN)); + DBWriteContactSettingByte(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); + DBWriteContactSettingByte(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR)); + DBWriteContactSettingByte(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL)?VIRUSSCAN_AFTERDL:(IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL)?VIRUSSCAN_DURINGDL:VIRUSSCAN_DISABLE))); GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, SIZEOF(str)); - DBWriteContactSettingTString(NULL,"SRFile","ScanCmdLine",str); - DBWriteContactSettingByte(NULL,"SRFile","WarnBeforeOpening",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_WARNBEFOREOPENING)); - DBWriteContactSettingByte(NULL,"SRFile","IfExists",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_ASK)?FILERESUME_ASK:(IsDlgButtonChecked(hwndDlg,IDC_RESUME)?FILERESUME_RESUMEALL:(IsDlgButtonChecked(hwndDlg,IDC_OVERWRITE)?FILERESUME_OVERWRITEALL:FILERESUME_RENAMEALL)))); + DBWriteContactSettingTString(NULL, "SRFile", "ScanCmdLine", str); + DBWriteContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING)); + DBWriteContactSettingByte(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK)?FILERESUME_ASK:(IsDlgButtonChecked(hwndDlg, IDC_RESUME)?FILERESUME_RESUMEALL:(IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE)?FILERESUME_OVERWRITEALL:FILERESUME_RENAMEALL)))); return TRUE; } } diff --git a/src/modules/srfile/filerecvdlg.cpp b/src/modules/srfile/filerecvdlg.cpp index 4de076e0fe..35ed892544 100644 --- a/src/modules/srfile/filerecvdlg.cpp +++ b/src/modules/srfile/filerecvdlg.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. @@ -27,22 +27,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM) { - SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)|WS_CLIPSIBLINGS); + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE)|WS_CLIPSIBLINGS); return TRUE; } -static void GetLowestExistingDirName(const TCHAR *szTestDir,TCHAR *szExistingDir,int cchExistingDir) +static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDir, int cchExistingDir) { DWORD dwAttributes; TCHAR *pszLastBackslash; - lstrcpyn(szExistingDir,szTestDir,cchExistingDir); + lstrcpyn(szExistingDir, szTestDir, cchExistingDir); while ((dwAttributes=GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) { - pszLastBackslash=_tcsrchr(szExistingDir,'\\'); + pszLastBackslash=_tcsrchr(szExistingDir, '\\'); if (pszLastBackslash == NULL) {*szExistingDir='\0'; break;} *pszLastBackslash='\0'; } - if (szExistingDir[0] == '\0') GetCurrentDirectory(cchExistingDir,szExistingDir); + if (szExistingDir[0] == '\0') GetCurrentDirectory(cchExistingDir, szExistingDir); } static const TCHAR InvalidFilenameChars[] = _T("\\/:*?\"<>|"); @@ -50,7 +50,7 @@ void RemoveInvalidFilenameChars(TCHAR *tszString) { size_t i; if (tszString) { - for (i=_tcscspn(tszString,InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1,InvalidFilenameChars)+1) + for (i=_tcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidFilenameChars)+1) if (tszString[i] >= 0) tszString[i] = _T('_'); } @@ -61,7 +61,7 @@ void RemoveInvalidPathChars(TCHAR *tszString) { size_t i; if (tszString) { - for (i=_tcscspn(tszString,InvalidPathChars); tszString[i]; i+=_tcscspn(tszString+i+1,InvalidPathChars)+1) + for (i=_tcscspn(tszString, InvalidPathChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidPathChars)+1) if (tszString[i] >= 0) tszString[i] = _T('_'); } @@ -75,14 +75,14 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData); break; case BFFM_SELCHANGED: - if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir)) - SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir); + if (SHGetPathFromIDList((LPITEMIDLIST) lp , szDir)) + SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir); break; } return 0; } -int BrowseForFolder(HWND hwnd,TCHAR *szPath) +int BrowseForFolder(HWND hwnd, TCHAR *szPath) { BROWSEINFO bi={0}; LPITEMIDLIST pidlResult; @@ -96,8 +96,8 @@ int BrowseForFolder(HWND hwnd,TCHAR *szPath) pidlResult=SHBrowseForFolder(&bi); if (pidlResult) { - SHGetPathFromIDList(pidlResult,szPath); - lstrcat(szPath,_T("\\")); + SHGetPathFromIDList(pidlResult, szPath); + lstrcat(szPath, _T("\\")); CoTaskMemFree(pidlResult); } return pidlResult != NULL; @@ -105,9 +105,9 @@ int BrowseForFolder(HWND hwnd,TCHAR *szPath) static REPLACEVARSARRAY sttVarsToReplace[] = { - { ( TCHAR* )"///", ( TCHAR* )"//" }, - { ( TCHAR* )"//", ( TCHAR* )"/" }, - { ( TCHAR* )"()", ( TCHAR* )"" }, + { ( TCHAR* )"///", ( TCHAR* )"//" }, + { ( TCHAR* )"//", ( TCHAR* )"/" }, + { ( TCHAR* )"()", ( TCHAR* )"" }, { NULL, NULL } }; @@ -156,7 +156,7 @@ void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL rvaVarsToReplace[1].lptzKey = _T("userid"); rvaVarsToReplace[1].lptzValue = GetContactID(hContact); rvaVarsToReplace[2].lptzKey = _T("proto"); - rvaVarsToReplace[2].lptzValue = mir_a2t((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact,0)); + rvaVarsToReplace[2].lptzValue = mir_a2t((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); rvaVarsToReplace[3].lptzKey = NULL; rvaVarsToReplace[3].lptzValue = NULL; for (int i=0; i < (SIZEOF(rvaVarsToReplace)-1);i++) @@ -208,7 +208,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { struct FileDlgData *dat; - dat=(struct FileDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + dat=(struct FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { TCHAR *contactName; @@ -218,13 +218,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l TranslateDialogDefault(hwndDlg); dat=(struct FileDlgData*)mir_calloc(sizeof(struct FileDlgData)); - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)dat); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->hContact = cle->hContact; dat->hDbEvent = cle->hDbEvent; - dat->hPreshutdownEvent = HookEventMessage(ME_SYSTEM_PRESHUTDOWN,hwndDlg,M_PRESHUTDOWN); + dat->hPreshutdownEvent = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN); dat->dwTicks = GetTickCount(); - EnumChildWindows(hwndDlg,ClipSiblingsChildEnumProc,0); + EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0); Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE); Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add Contact Permanently to List")); @@ -233,43 +233,43 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User Menu")); contactName = cli.pfnGetContactDisplayName( dat->hContact, 0 ); - SetDlgItemText(hwndDlg,IDC_FROM,contactName); - GetContactReceivedFilesDir(dat->hContact,szPath,SIZEOF(szPath),TRUE); - SetDlgItemText(hwndDlg,IDC_FILEDIR,szPath); + SetDlgItemText(hwndDlg, IDC_FROM, contactName); + GetContactReceivedFilesDir(dat->hContact, szPath, SIZEOF(szPath), TRUE); + SetDlgItemText(hwndDlg, IDC_FILEDIR, szPath); { int i; char idstr[32]; DBVARIANT dbv; if (shAutoComplete) - shAutoComplete(GetWindow(GetDlgItem(hwndDlg,IDC_FILEDIR),GW_CHILD),1); + shAutoComplete(GetWindow(GetDlgItem(hwndDlg, IDC_FILEDIR), GW_CHILD), 1); for (i=0;ihContact,(LPARAM)dat->hDbEvent); + CallService(MS_DB_EVENT_MARKREAD, (WPARAM)dat->hContact, (LPARAM)dat->hDbEvent); { DBEVENTINFO dbei={0}; TCHAR datetimestr[64]; char buf[540]; dbei.cbSize=sizeof(dbei); - dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)dat->hDbEvent,0); + dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)dat->hDbEvent, 0); dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob); - CallService(MS_DB_EVENT_GET,(WPARAM)dat->hDbEvent,(LPARAM)&dbei); + CallService(MS_DB_EVENT_GET, (WPARAM)dat->hDbEvent, (LPARAM)&dbei); dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob; - lstrcpynA(buf, (char*)dbei.pBlob+4, min(dbei.cbBlob+1,SIZEOF(buf))); + lstrcpynA(buf, (char*)dbei.pBlob+4, min(dbei.cbBlob+1, SIZEOF(buf))); TCHAR* ptszFileName = DbGetEventStringT( &dbei, buf ); - SetDlgItemText(hwndDlg,IDC_FILENAMES,ptszFileName); + SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName); mir_free(ptszFileName); - lstrcpynA(buf, (char*)dbei.pBlob+4+strlen((char*)dbei.pBlob+4)+1, min((int)(dbei.cbBlob-4-strlen((char*)dbei.pBlob+4)),SIZEOF(buf))); + lstrcpynA(buf, (char*)dbei.pBlob+4+strlen((char*)dbei.pBlob+4)+1, min((int)(dbei.cbBlob-4-strlen((char*)dbei.pBlob+4)), SIZEOF(buf))); TCHAR* ptszDescription = DbGetEventStringT( &dbei, buf ); - SetDlgItemText(hwndDlg,IDC_MSG,ptszDescription); + SetDlgItemText(hwndDlg, IDC_MSG, ptszDescription); mir_free(ptszDescription); mir_free(dbei.pBlob); @@ -282,13 +282,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CONTACTINFO ci; int hasName = 0; char buf[128]; - ZeroMemory(&ci,sizeof(ci)); + ZeroMemory(&ci, sizeof(ci)); ci.cbSize = sizeof(ci); ci.hContact = dat->hContact; ci.szProto = szProto; ci.dwFlag = CNF_UNIQUEID; - if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { switch(ci.type) { case CNFT_ASCIIZ: hasName = 1; @@ -297,7 +297,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case CNFT_DWORD: hasName = 1; - mir_snprintf(buf, SIZEOF(buf),"%u",ci.dVal); + mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal); break; } } if (hasName) @@ -306,97 +306,97 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_NAME, contactName); } } - if (DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) { - RECT rcBtn1,rcBtn2,rcDateCtrl; - GetWindowRect(GetDlgItem(hwndDlg,IDC_ADD),&rcBtn1); - GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU),&rcBtn2); - GetWindowRect(GetDlgItem(hwndDlg,IDC_DATE),&rcDateCtrl); - SetWindowPos(GetDlgItem(hwndDlg,IDC_DATE),0,0,0,rcDateCtrl.right-rcDateCtrl.left-(rcBtn2.left-rcBtn1.left),rcDateCtrl.bottom-rcDateCtrl.top,SWP_NOZORDER|SWP_NOMOVE); + if (DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) { + RECT rcBtn1, rcBtn2, rcDateCtrl; + GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rcBtn1); + GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rcBtn2); + GetWindowRect(GetDlgItem(hwndDlg, IDC_DATE), &rcDateCtrl); + SetWindowPos(GetDlgItem(hwndDlg, IDC_DATE), 0, 0, 0, rcDateCtrl.right-rcDateCtrl.left-(rcBtn2.left-rcBtn1.left), rcDateCtrl.bottom-rcDateCtrl.top, SWP_NOZORDER|SWP_NOMOVE); } - else if (DBGetContactSettingByte(NULL,"SRFile","AutoAccept",0)) { + else if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0)) { //don't check auto-min here to fix BUG#647620 - PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDOK,BN_CLICKED),(LPARAM)GetDlgItem(hwndDlg,IDOK)); + PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK)); } - if (!DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) - ShowWindow(GetDlgItem(hwndDlg, IDC_ADD),SW_HIDE); + if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) + ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); return TRUE; } case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); case WM_DRAWITEM: { LPDRAWITEMSTRUCT dis=(LPDRAWITEMSTRUCT)lParam; if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) { char *szProto; - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); if (szProto) { HICON hIcon; - hIcon=(HICON)CallProtoService(szProto,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0); + hIcon=(HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); if (hIcon) { - DrawIconEx(dis->hDC,dis->rcItem.left,dis->rcItem.top,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); DestroyIcon(hIcon); } } } } - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); case WM_COMMAND: - if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU), (LPARAM)dat->hContact )) + if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact )) break; switch ( LOWORD( wParam )) { case IDC_FILEDIRBROWSE: { - TCHAR szDirName[MAX_PATH],szExistingDirName[MAX_PATH]; + TCHAR szDirName[MAX_PATH], szExistingDirName[MAX_PATH]; - GetDlgItemText(hwndDlg,IDC_FILEDIR,szDirName,SIZEOF(szDirName)); - GetLowestExistingDirName(szDirName,szExistingDirName,SIZEOF(szExistingDirName)); - if (BrowseForFolder(hwndDlg,szExistingDirName)) - SetDlgItemText(hwndDlg,IDC_FILEDIR,szExistingDirName); + GetDlgItemText(hwndDlg, IDC_FILEDIR, szDirName, SIZEOF(szDirName)); + GetLowestExistingDirName(szDirName, szExistingDirName, SIZEOF(szExistingDirName)); + if (BrowseForFolder(hwndDlg, szExistingDirName)) + SetDlgItemText(hwndDlg, IDC_FILEDIR, szExistingDirName); } break; case IDOK: { //most recently used directories - TCHAR szRecvDir[MAX_PATH],szDefaultRecvDir[MAX_PATH]; - GetDlgItemText(hwndDlg,IDC_FILEDIR,szRecvDir,SIZEOF(szRecvDir)); + TCHAR szRecvDir[MAX_PATH], szDefaultRecvDir[MAX_PATH]; + GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, SIZEOF(szRecvDir)); RemoveInvalidPathChars(szRecvDir); - GetContactReceivedFilesDir(NULL,szDefaultRecvDir,SIZEOF(szDefaultRecvDir),TRUE); - if (_tcsnicmp(szRecvDir,szDefaultRecvDir,lstrlen(szDefaultRecvDir))) { + GetContactReceivedFilesDir(NULL, szDefaultRecvDir, SIZEOF(szDefaultRecvDir), TRUE); + if (_tcsnicmp(szRecvDir, szDefaultRecvDir, lstrlen(szDefaultRecvDir))) { char idstr[32]; int i; DBVARIANT dbv; for (i=MAX_MRU_DIRS-2;i>=0;i--) { - mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d",i); - if (DBGetContactSettingTString(NULL,"SRFile",idstr,&dbv)) continue; - mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d",i+1); - DBWriteContactSettingTString(NULL,"SRFile",idstr,dbv.ptszVal); + mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i); + if (DBGetContactSettingTString(NULL, "SRFile", idstr, &dbv)) continue; + mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i+1); + DBWriteContactSettingTString(NULL, "SRFile", idstr, dbv.ptszVal); DBFreeVariant(&dbv); } - DBWriteContactSettingTString(NULL,"SRFile",idstr,szRecvDir); + DBWriteContactSettingTString(NULL, "SRFile", idstr, szRecvDir); } } - EnableWindow(GetDlgItem(hwndDlg,IDC_FILENAMES),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_MSG),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_FILEDIR),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_FILEDIRBROWSE),FALSE); - - GetDlgItemText(hwndDlg,IDC_FILEDIR,dat->szSavePath,SIZEOF(dat->szSavePath)); - GetDlgItemText(hwndDlg,IDC_FILE,dat->szFilenames,SIZEOF(dat->szFilenames)); - GetDlgItemText(hwndDlg,IDC_MSG,dat->szMsg,SIZEOF(dat->szMsg)); + EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAMES), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_MSG), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_FILEDIR), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_FILEDIRBROWSE), FALSE); + + GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, SIZEOF(dat->szSavePath)); + GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames)); + GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg)); dat->hwndTransfer = FtMgr_AddTransfer(dat); SetWindowLongPtr( hwndDlg, GWLP_USERDATA, 0); //check for auto-minimize here to fix BUG#647620 - if (DBGetContactSettingByte(NULL,"SRFile","AutoAccept",0) && DBGetContactSettingByte(NULL,"SRFile","AutoMin",0)) { - ShowWindow(hwndDlg,SW_HIDE); - ShowWindow(hwndDlg,SW_SHOWMINNOACTIVE); + if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0)) { + ShowWindow(hwndDlg, SW_HIDE); + ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE); } DestroyWindow(hwndDlg); break; case IDCANCEL: - if (dat->fs) CallContactService(dat->hContact,PSS_FILEDENYT,(WPARAM)dat->fs,(LPARAM)TranslateT("Cancelled")); + if (dat->fs) CallContactService(dat->hContact, PSS_FILEDENYT, (WPARAM)dat->fs, (LPARAM)TranslateT("Cancelled")); dat->fs=NULL; /* the protocol will free the handle */ DestroyWindow(hwndDlg); break; @@ -407,37 +407,37 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l acs.handle=dat->hContact; acs.handleType=HANDLE_CONTACT; acs.szProto=""; - CallService(MS_ADDCONTACT_SHOW,(WPARAM)hwndDlg,(LPARAM)&acs); - if (!DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) - ShowWindow(GetDlgItem(hwndDlg,IDC_ADD), SW_HIDE); + CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); + if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) + ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); } break; case IDC_USERMENU: { RECT rc; - HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)dat->hContact,0); - GetWindowRect((HWND)lParam,&rc); - TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL); + HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); + GetWindowRect((HWND)lParam, &rc); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); DestroyMenu(hMenu); } break; case IDC_DETAILS: - CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)dat->hContact,0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0); break; case IDC_HISTORY: - CallService(MS_HISTORY_SHOWCONTACTHISTORY,(WPARAM)dat->hContact,0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0); break; } break; case WM_DESTROY: Window_FreeIcon_IcoLib(hwndDlg); - Button_FreeIcon_IcoLib(hwndDlg,IDC_ADD); - Button_FreeIcon_IcoLib(hwndDlg,IDC_DETAILS); - Button_FreeIcon_IcoLib(hwndDlg,IDC_HISTORY); - Button_FreeIcon_IcoLib(hwndDlg,IDC_USERMENU); + Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD); + Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS); + Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY); + Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU); if ( dat ) FreeFileDlgData( dat ); break; diff --git a/src/modules/srfile/filesenddlg.cpp b/src/modules/srfile/filesenddlg.cpp index 8567003f91..228fc18059 100644 --- a/src/modules/srfile/filesenddlg.cpp +++ b/src/modules/srfile/filesenddlg.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. @@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include "file.h" -static void SetFileListAndSizeControls(HWND hwndDlg,struct FileDlgData *dat) +static void SetFileListAndSizeControls(HWND hwndDlg, struct FileDlgData *dat) { - int fileCount=0,dirCount=0,totalSize=0,i; + int fileCount=0, dirCount=0, totalSize=0, i; struct _stat statbuf; TCHAR str[64]; @@ -40,25 +40,25 @@ static void SetFileListAndSizeControls(HWND hwndDlg,struct FileDlgData *dat) totalSize += statbuf.st_size; } } - GetSensiblyFormattedSize(totalSize,str,SIZEOF(str),0,1,NULL); - SetDlgItemText(hwndDlg,IDC_TOTALSIZE,str); + GetSensiblyFormattedSize(totalSize, str, SIZEOF(str), 0, 1, NULL); + SetDlgItemText(hwndDlg, IDC_TOTALSIZE, str); if (i>1) { TCHAR szFormat[32]; if (fileCount && dirCount) { - mir_sntprintf(szFormat,SIZEOF(szFormat),_T("%s, %s"),TranslateTS(fileCount == 1?_T("%d file"):_T("%d files")),TranslateTS(dirCount == 1?_T("%d directory"):_T("%d directories"))); - mir_sntprintf(str,SIZEOF(str),szFormat,fileCount,dirCount); + mir_sntprintf(szFormat, SIZEOF(szFormat), _T("%s, %s"), TranslateTS(fileCount == 1?_T("%d file"):_T("%d files")), TranslateTS(dirCount == 1?_T("%d directory"):_T("%d directories"))); + mir_sntprintf(str, SIZEOF(str), szFormat, fileCount, dirCount); } else if (fileCount) { - lstrcpy(szFormat,TranslateT("%d files")); - mir_sntprintf(str,SIZEOF(str),szFormat,fileCount); + lstrcpy(szFormat, TranslateT("%d files")); + mir_sntprintf(str, SIZEOF(str), szFormat, fileCount); } else { - lstrcpy(szFormat,TranslateT("%d directories")); - mir_sntprintf(str,SIZEOF(str),szFormat,dirCount); + lstrcpy(szFormat, TranslateT("%d directories")); + mir_sntprintf(str, SIZEOF(str), szFormat, dirCount); } - SetDlgItemText(hwndDlg,IDC_FILE,str); + SetDlgItemText(hwndDlg, IDC_FILE, str); } - else SetDlgItemText(hwndDlg,IDC_FILE,dat->files[0]); + else SetDlgItemText(hwndDlg, IDC_FILE, dat->files[0]); EnableWindow(GetDlgItem(hwndDlg, IDOK), fileCount || dirCount); } @@ -168,53 +168,53 @@ void __cdecl ChooseFilesThread(void* param) PostMessage( hwndDlg, M_FILECHOOSEDONE, 0, ( LPARAM )( TCHAR* )NULL ); } } } -static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd,LPARAM) +static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM) { - SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)|WS_CLIPSIBLINGS); + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE)|WS_CLIPSIBLINGS); return TRUE; } static WNDPROC OldSendEditProc; -static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CHAR: if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) { - PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0); + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } break; case WM_SYSCHAR: if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) { - PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0); + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } break; } - return CallWindowProc(OldSendEditProc,hwnd,msg,wParam,lParam); + return CallWindowProc(OldSendEditProc, hwnd, msg, wParam, lParam); } INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { struct FileDlgData *dat; - dat=(struct FileDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + dat=(struct FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { struct FileSendData *fsd=(struct FileSendData*)lParam; dat=(struct FileDlgData*)mir_calloc(sizeof(struct FileDlgData)); - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)dat); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->hContact=fsd->hContact; dat->send=1; - dat->hPreshutdownEvent=HookEventMessage(ME_SYSTEM_PRESHUTDOWN,hwndDlg,M_PRESHUTDOWN); + dat->hPreshutdownEvent=HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, M_PRESHUTDOWN); dat->fs=NULL; dat->dwTicks=GetTickCount(); TranslateDialogDefault(hwndDlg); - EnumChildWindows(hwndDlg,ClipSiblingsChildEnumProc,0); - OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MSG),GWLP_WNDPROC,(LONG_PTR)SendEditSubclassProc); + EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0); + OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc); Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE); Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View User's Details")); @@ -224,31 +224,31 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) { - int totalCount,i; + int totalCount, i; for (totalCount=0;fsd->ppFiles[totalCount];totalCount++); dat->files = ( TCHAR** )mir_alloc( sizeof(TCHAR*)*(totalCount+1)); // Leaks for (i=0;ifiles[i] = mir_tstrdup( fsd->ppFiles[i] ); dat->files[totalCount]=NULL; - SetFileListAndSizeControls(hwndDlg,dat); + SetFileListAndSizeControls(hwndDlg, dat); } { char *szProto; TCHAR* contactName = cli.pfnGetContactDisplayName( dat->hContact, 0 ); - SetDlgItemText(hwndDlg,IDC_TO,contactName); + SetDlgItemText(hwndDlg, IDC_TO, contactName); - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); if (szProto) { CONTACTINFO ci; int hasName = 0; char buf[128]; - ZeroMemory(&ci,sizeof(ci)); + ZeroMemory(&ci, sizeof(ci)); ci.cbSize = sizeof(ci); ci.hContact = dat->hContact; ci.szProto = szProto; ci.dwFlag = CNF_UNIQUEID; - if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { switch(ci.type) { case CNFT_ASCIIZ: hasName = 1; @@ -257,26 +257,26 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case CNFT_DWORD: hasName = 1; - mir_snprintf(buf, SIZEOF(buf),"%u",ci.dVal); + mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal); break; } } if ( hasName ) - SetDlgItemTextA(hwndDlg,IDC_NAME,buf); + SetDlgItemTextA(hwndDlg, IDC_NAME, buf); else - SetDlgItemText(hwndDlg,IDC_NAME,contactName); + SetDlgItemText(hwndDlg, IDC_NAME, contactName); } } if ( fsd->ppFiles == NULL ) { EnableWindow(hwndDlg, FALSE); dat->closeIfFileChooseCancelled=1; - PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_CHOOSE,BN_CLICKED),(LPARAM)GetDlgItem(hwndDlg,IDC_CHOOSE)); + PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CHOOSE, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDC_CHOOSE)); } return TRUE; } case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); case WM_DRAWITEM: { @@ -284,14 +284,14 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) { char *szProto; - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); if (szProto) { - HICON hIcon = (HICON)CallProtoService(szProto,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0); + HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); if (hIcon) { - DrawIconEx(dis->hDC,dis->rcItem.left,dis->rcItem.top,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); DestroyIcon(hIcon); } } } } - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); case M_FILECHOOSEDONE: if ( lParam != 0 ) { @@ -300,27 +300,27 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->closeIfFileChooseCancelled = 0; } else if (dat->closeIfFileChooseCancelled) DestroyWindow(hwndDlg); - EnableWindow(hwndDlg,TRUE); + EnableWindow(hwndDlg, TRUE); break; case WM_COMMAND: - if (CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU),(LPARAM)dat->hContact)) + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact)) break; switch (LOWORD(wParam)) { case IDC_CHOOSE: - EnableWindow(hwndDlg,FALSE); + EnableWindow(hwndDlg, FALSE); //GetOpenFileName() creates its own message queue which prevents any incoming events being processed - forkthread(ChooseFilesThread,0,hwndDlg); + forkthread(ChooseFilesThread, 0, hwndDlg); break; case IDOK: - EnableWindow(GetDlgItem(hwndDlg,IDC_FILENAME),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_MSG),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_CHOOSE),FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_MSG), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSE), FALSE); - GetDlgItemText(hwndDlg,IDC_FILEDIR,dat->szSavePath,SIZEOF(dat->szSavePath)); - GetDlgItemText(hwndDlg,IDC_FILE,dat->szFilenames,SIZEOF(dat->szFilenames)); - GetDlgItemText(hwndDlg,IDC_MSG,dat->szMsg,SIZEOF(dat->szMsg)); + GetDlgItemText(hwndDlg, IDC_FILEDIR, dat->szSavePath, SIZEOF(dat->szSavePath)); + GetDlgItemText(hwndDlg, IDC_FILE, dat->szFilenames, SIZEOF(dat->szFilenames)); + GetDlgItemText(hwndDlg, IDC_MSG, dat->szMsg, SIZEOF(dat->szMsg)); dat->hwndTransfer = FtMgr_AddTransfer(dat); SetWindowLongPtr( hwndDlg, GWLP_USERDATA, 0); DestroyWindow(hwndDlg); @@ -332,31 +332,31 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_USERMENU: { RECT rc; - HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)dat->hContact,0); - GetWindowRect((HWND)lParam,&rc); - TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL); + HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); + GetWindowRect((HWND)lParam, &rc); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); DestroyMenu(hMenu); break; } case IDC_DETAILS: - CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)dat->hContact,0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0); return TRUE; case IDC_HISTORY: - CallService(MS_HISTORY_SHOWCONTACTHISTORY,(WPARAM)dat->hContact,0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0); return TRUE; } break; case WM_DESTROY: Window_FreeIcon_IcoLib(hwndDlg); - Button_FreeIcon_IcoLib(hwndDlg,IDC_DETAILS); - Button_FreeIcon_IcoLib(hwndDlg,IDC_HISTORY); - Button_FreeIcon_IcoLib(hwndDlg,IDC_USERMENU); + Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS); + Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY); + Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU); if ( dat ) FreeFileDlgData( dat ); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MSG),GWLP_WNDPROC,(LONG_PTR)OldSendEditProc); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MSG), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc); return TRUE; } return FALSE; diff --git a/src/modules/srfile/filexferdlg.cpp b/src/modules/srfile/filexferdlg.cpp index 7c7adf8281..ab7090166b 100644 --- a/src/modules/srfile/filexferdlg.cpp +++ b/src/modules/srfile/filexferdlg.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 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. @@ -26,13 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HM_RECVEVENT (WM_USER+10) -static int CheckVirusScanned(HWND hwnd,struct FileDlgData *dat,int i) +static int CheckVirusScanned(HWND hwnd, struct FileDlgData *dat, int i) { if (dat->send) return 1; if (dat->fileVirusScanned == NULL) return 0; if (dat->fileVirusScanned[i]) return 1; - if (DBGetContactSettingByte(NULL,"SRFile","WarnBeforeOpening",1) == 0) return 1; - return IDYES == MessageBox(hwnd,TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"),TranslateT("File Received"),MB_YESNO|MB_DEFBUTTON2); + if (DBGetContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1; + return IDYES == MessageBox(hwnd, TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"), TranslateT("File Received"), MB_YESNO|MB_DEFBUTTON2); } #define M_VIRUSSCANDONE (WM_USER+100) @@ -88,15 +88,15 @@ int PFTS_CompareWithTchar( PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHA #endif } -static void SetOpenFileButtonStyle(HWND hwndButton,int enabled) +static void SetOpenFileButtonStyle(HWND hwndButton, int enabled) { - EnableWindow(hwndButton,enabled); + EnableWindow(hwndButton, enabled); } void FillSendData( FileDlgData* dat, DBEVENTINFO& dbei ) { dbei.cbSize = sizeof(dbei); - dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); dbei.eventType = EVENTTYPE_FILE; dbei.flags = DBEF_SENT; dbei.timestamp = time(NULL); @@ -110,8 +110,8 @@ void FillSendData( FileDlgData* dat, DBEVENTINFO& dbei ) dbei.cbBlob = sizeof(DWORD) + lstrlenA(szFileNames)+lstrlenA(szMsg)+2; dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob); *(PDWORD)dbei.pBlob=0; - lstrcpyA((char*)dbei.pBlob+sizeof(DWORD),szFileNames); - lstrcpyA((char*)dbei.pBlob+sizeof(DWORD)+lstrlenA(szFileNames)+1,szMsg); + lstrcpyA((char*)dbei.pBlob+sizeof(DWORD), szFileNames); + lstrcpyA((char*)dbei.pBlob+sizeof(DWORD)+lstrlenA(szFileNames)+1, szMsg); #if defined( _UNICODE ) mir_free( szFileNames ), mir_free( szMsg ); @@ -125,7 +125,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) DBVARIANT dbv; TCHAR szCmdLine[768]; - if (!DBGetContactSettingTString(NULL,"SRFile", "ScanCmdLine", &dbv)) + if (!DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv)) { if (dbv.ptszVal[0]) { @@ -140,9 +140,9 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace+2); } else lstrcpyn(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine)); - if (CreateProcess(NULL,szCmdLine,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) { - if (WaitForSingleObject(pi.hProcess,3600*1000) == WAIT_OBJECT_0) - PostMessage(info->hwndReply,M_VIRUSSCANDONE,info->returnCode,0); + if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + if (WaitForSingleObject(pi.hProcess, 3600*1000) == WAIT_OBJECT_0) + PostMessage(info->hwndReply, M_VIRUSSCANDONE, info->returnCode, 0); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } @@ -169,8 +169,8 @@ static void SetFilenameControls(HWND hwndDlg, struct FileDlgData *dat, PROTOFILE if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = NULL; if (fn && (fts->totalFiles > 1)) { - mir_sntprintf(msg, SIZEOF(msg), _T("%s: %s (%d %s %d)"), - cli.pfnGetContactDisplayName( fts->hContact, 0 ), + mir_sntprintf(msg, SIZEOF(msg), _T("%s: %s (%d %s %d)"), + cli.pfnGetContactDisplayName( fts->hContact, 0 ), fn, fts->currentFileNumber+1, TranslateT("of"), fts->totalFiles); SHGetFileInfo(fn, FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES|SHGFI_ICON|SHGFI_SMALLICON); @@ -198,13 +198,13 @@ static void SetFilenameControls(HWND hwndDlg, struct FileDlgData *dat, PROTOFILE enum { FTS_TEXT, FTS_PROGRESS, FTS_OPEN }; static void SetFtStatus(HWND hwndDlg, TCHAR *text, int mode) { - SetDlgItemText(hwndDlg,IDC_STATUS,TranslateTS(text)); - SetDlgItemText(hwndDlg,IDC_TRANSFERCOMPLETED,TranslateTS(text)); + SetDlgItemText(hwndDlg, IDC_STATUS, TranslateTS(text)); + SetDlgItemText(hwndDlg, IDC_TRANSFERCOMPLETED, TranslateTS(text)); - ShowWindow(GetDlgItem(hwndDlg,IDC_STATUS), (mode == FTS_TEXT)?SW_SHOW:SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_ALLFILESPROGRESS), (mode == FTS_PROGRESS)?SW_SHOW:SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_TRANSFERCOMPLETED), (mode == FTS_OPEN)?SW_SHOW:SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg,IDC_FILEICON), (mode == FTS_OPEN)?SW_SHOW:SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STATUS), (mode == FTS_TEXT)?SW_SHOW:SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_ALLFILESPROGRESS), (mode == FTS_PROGRESS)?SW_SHOW:SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_TRANSFERCOMPLETED), (mode == FTS_OPEN)?SW_SHOW:SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_FILEICON), (mode == FTS_OPEN)?SW_SHOW:SW_HIDE); } static void HideProgressControls(HWND hwndDlg) @@ -262,12 +262,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TranslateDialogDefault(hwndDlg); dat = (FileDlgData*)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->hNotifyEvent=HookEventMessage(ME_PROTO_ACK,hwndDlg,HM_RECVEVENT); + dat->hNotifyEvent=HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_RECVEVENT); dat->transferStatus.currentFileNumber = -1; if (dat->send) { - dat->fs=(HANDLE)CallContactService(dat->hContact,PSS_FILET,(WPARAM)dat->szMsg,(LPARAM)dat->files); + dat->fs=(HANDLE)CallContactService(dat->hContact, PSS_FILET, (WPARAM)dat->szMsg, (LPARAM)dat->files); SetFtStatus(hwndDlg, LPGENT("Request sent, waiting for acceptance..."), FTS_TEXT); - SetOpenFileButtonStyle(GetDlgItem(hwndDlg,IDC_OPENFILE),1); + SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); dat->waitingForAcceptance=1; // hide "open" button since it may cause potential access violations... ShowWindow(GetDlgItem(hwndDlg, IDC_OPENFILE), SW_HIDE); @@ -275,10 +275,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } else { //recv CreateDirectoryTreeT(dat->szSavePath); - dat->fs=(HANDLE)CallContactService(dat->hContact,PSS_FILEALLOWT,(WPARAM)dat->fs,(LPARAM)dat->szSavePath); + dat->fs=(HANDLE)CallContactService(dat->hContact, PSS_FILEALLOWT, (WPARAM)dat->fs, (LPARAM)dat->szSavePath); dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath); - if (DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) dat->resumeBehaviour=FILERESUME_ASK; - else dat->resumeBehaviour=DBGetContactSettingByte(NULL,"SRFile","IfExists",FILERESUME_ASK); + if (DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour=FILERESUME_ASK; + else dat->resumeBehaviour=DBGetContactSettingByte(NULL, "SRFile", "IfExists", FILERESUME_ASK); SetFtStatus(hwndDlg, LPGENT("Waiting for connection..."), FTS_TEXT); } { @@ -290,11 +290,11 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } { LOGFONT lf; HFONT hFont; - hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_CONTACTNAME,WM_GETFONT,0,0); - GetObject(hFont,sizeof(lf),&lf); + hFont=(HFONT)SendDlgItemMessage(hwndDlg, IDC_CONTACTNAME, WM_GETFONT, 0, 0); + GetObject(hFont, sizeof(lf), &lf); lf.lfWeight=FW_BOLD; hFont=CreateFontIndirect(&lf); - SendDlgItemMessage(hwndDlg,IDC_CONTACTNAME,WM_SETFONT,(WPARAM)hFont,0); + SendDlgItemMessage(hwndDlg, IDC_CONTACTNAME, WM_SETFONT, (WPARAM)hFont, 0); } { SHFILEINFO shfi = {0}; @@ -304,7 +304,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->hIcon = NULL; - SendDlgItemMessage(hwndDlg, IDC_CONTACT, BM_SETIMAGE, IMAGE_ICON, + SendDlgItemMessage(hwndDlg, IDC_CONTACT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedProtoIcon((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0), ID_STATUS_ONLINE)); SendDlgItemMessage(hwndDlg, IDC_CONTACT, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Contact menu"), 0); SendDlgItemMessage(hwndDlg, IDC_CONTACT, BUTTONSETASFLATBTN, 0, 0); @@ -320,10 +320,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemText(hwndDlg, IDC_CONTACTNAME, cli.pfnGetContactDisplayName( dat->hContact, 0 )); - if (!dat->waitingForAcceptance) SetTimer(hwndDlg,1,1000,NULL); + if (!dat->waitingForAcceptance) SetTimer(hwndDlg, 1, 1000, NULL); return TRUE; case WM_TIMER: - MoveMemory(dat->bytesRecvedHistory+1,dat->bytesRecvedHistory,sizeof(dat->bytesRecvedHistory)-sizeof(dat->bytesRecvedHistory[0])); + MoveMemory(dat->bytesRecvedHistory+1, dat->bytesRecvedHistory, sizeof(dat->bytesRecvedHistory)-sizeof(dat->bytesRecvedHistory[0])); dat->bytesRecvedHistory[0]=dat->transferStatus.totalProgress; if ( dat->bytesRecvedHistorySize < SIZEOF(dat->bytesRecvedHistory)) dat->bytesRecvedHistorySize++; @@ -333,32 +333,32 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ULARGE_INTEGER li; FILETIME ft; - GetSensiblyFormattedSize((dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])/dat->bytesRecvedHistorySize,szSpeed,SIZEOF(szSpeed),0,1,NULL); + GetSensiblyFormattedSize((dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])/dat->bytesRecvedHistorySize, szSpeed, SIZEOF(szSpeed), 0, 1, NULL); if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]) - lstrcpy(szTime,_T("??:??:??")); + lstrcpy(szTime, _T("??:??:??")); else { li.QuadPart=BIGI(10000000)*(dat->transferStatus.currentFileSize-dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]); ft.dwHighDateTime=li.HighPart; ft.dwLowDateTime=li.LowPart; - FileTimeToSystemTime(&ft,&st); - GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER,&st,NULL,szTime,SIZEOF(szTime)); + FileTimeToSystemTime(&ft, &st); + GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER, &st, NULL, szTime, SIZEOF(szTime)); } if (dat->bytesRecvedHistory[0] != dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]) { li.QuadPart=BIGI(10000000)*(dat->transferStatus.totalBytes-dat->transferStatus.totalProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]); ft.dwHighDateTime=li.HighPart; ft.dwLowDateTime=li.LowPart; - FileTimeToSystemTime(&ft,&st); - GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER,&st,NULL,szTime,SIZEOF(szTime)); + FileTimeToSystemTime(&ft, &st); + GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER, &st, NULL, szTime, SIZEOF(szTime)); } - mir_sntprintf(szDisplay,SIZEOF(szDisplay),_T("%s/%s (%s %s)"),szSpeed,TranslateT("sec"),szTime,TranslateT("remaining")); - SetDlgItemText(hwndDlg,IDC_ALLSPEED,szDisplay); + mir_sntprintf(szDisplay, SIZEOF(szDisplay), _T("%s/%s (%s %s)"), szSpeed, TranslateT("sec"), szTime, TranslateT("remaining")); + SetDlgItemText(hwndDlg, IDC_ALLSPEED, szDisplay); } break; case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); case WM_DRAWITEM: - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); case WM_FT_CLEANUP: if (!dat->fs) @@ -369,7 +369,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case WM_COMMAND: - if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU), (LPARAM)dat->hContact )) + if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact )) break; switch (LOWORD(wParam)) @@ -382,9 +382,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_CONTACT: { RECT rc; - HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)dat->hContact,0); - GetWindowRect((HWND)lParam,&rc); - TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL); + HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); + GetWindowRect((HWND)lParam, &rc); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); DestroyMenu(hMenu); break; } @@ -432,7 +432,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (files && *files) { int i, limit; - TCHAR *pszFilename,*pszNewFileName; + TCHAR *pszFilename, *pszNewFileName; if (dat->send) limit = dat->transferStatus.totalFiles; @@ -492,12 +492,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case M_FILEEXISTSDLGREPLY: { PROTOFILERESUME *pfr=(PROTOFILERESUME*)lParam; TCHAR *szOriginalFilename=(TCHAR*)wParam; - char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); - EnableWindow(hwndDlg,TRUE); + EnableWindow(hwndDlg, TRUE); switch(pfr->action) { case FILERESUME_CANCEL: - if (dat->fs) CallContactService(dat->hContact,PSS_FILECANCEL,(WPARAM)dat->fs,0); + if (dat->fs) CallContactService(dat->hContact, PSS_FILECANCEL, (WPARAM)dat->fs, 0); dat->fs=NULL; mir_free(szOriginalFilename); if (pfr->szFilename) mir_free((char*)pfr->szFilename); @@ -510,22 +510,22 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case FILERESUME_RENAMEALL: pfr->action=FILERESUME_RENAME; - { TCHAR *pszExtension,*pszFilename; + { TCHAR *pszExtension, *pszFilename; int i; - if ((pszFilename = _tcsrchr(szOriginalFilename,'\\')) == NULL) pszFilename=szOriginalFilename; - if ((pszExtension = _tcsrchr(pszFilename+1,'.')) == NULL) pszExtension=pszFilename+lstrlen(pszFilename); + if ((pszFilename = _tcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename=szOriginalFilename; + if ((pszExtension = _tcsrchr(pszFilename+1, '.')) == NULL) pszExtension=pszFilename+lstrlen(pszFilename); if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename); pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*((pszExtension-szOriginalFilename)+21+lstrlen(pszExtension))); for (i=1;;i++) { - _stprintf((TCHAR*)pfr->szFilename,_T("%.*s (%u)%s"),pszExtension-szOriginalFilename,szOriginalFilename,i,pszExtension); - if (_taccess(pfr->szFilename,0) != 0) + _stprintf((TCHAR*)pfr->szFilename, _T("%.*s (%u)%s"), pszExtension-szOriginalFilename, szOriginalFilename, i, pszExtension); + if (_taccess(pfr->szFilename, 0) != 0) break; } } break; } mir_free(szOriginalFilename); - CallProtoService(szProto,PS_FILERESUMET,(WPARAM)dat->fs,(LPARAM)pfr); + CallProtoService(szProto, PS_FILERESUMET, (WPARAM)dat->fs, (LPARAM)pfr); if (pfr->szFilename) mir_free((char*)pfr->szFilename); mir_free(pfr); break; @@ -537,7 +537,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ack->type != ACKTYPE_FILE) break; if (dat->waitingForAcceptance) { - SetTimer(hwndDlg,1,1000,NULL); + SetTimer(hwndDlg, 1, 1000, NULL); dat->waitingForAcceptance=0; } switch(ack->result) { @@ -549,19 +549,19 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case ACKRESULT_INITIALISING: SetFtStatus(hwndDlg, LPGENT("Initialising..."), FTS_TEXT); break; case ACKRESULT_NEXTFILE: SetFtStatus(hwndDlg, LPGENT("Moving to next file..."), FTS_TEXT); - SetDlgItemTextA(hwndDlg,IDC_FILENAME,""); + SetDlgItemTextA(hwndDlg, IDC_FILENAME, ""); if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles>1 && !dat->send) - SetOpenFileButtonStyle(GetDlgItem(hwndDlg,IDC_OPENFILE),1); - if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) { + SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); + if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) { if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) - PostMessage(hwndDlg,M_VIRUSSCANDONE,dat->transferStatus.currentFileNumber,0); + PostMessage(hwndDlg, M_VIRUSSCANDONE, dat->transferStatus.currentFileNumber, 0); else { virusscanthreadstartinfo *vstsi; vstsi=(struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo)); vstsi->hwndReply = hwndDlg; vstsi->szFile = mir_tstrdup(dat->files[dat->transferStatus.currentFileNumber]); vstsi->returnCode = dat->transferStatus.currentFileNumber; - forkthread((void (*)(void*))RunVirusScannerThread,0,vstsi); + forkthread((void (*)(void*))RunVirusScannerThread, 0, vstsi); } } break; @@ -578,24 +578,24 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetFtStatus(hwndDlg, LPGENT("File already exists"), FTS_TEXT); if (dat->resumeBehaviour == FILERESUME_ASK) { TDlgProcFileExistsParam param = { hwndDlg, fts }; - ShowWindow(hwndDlg,SW_SHOWNORMAL); - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_FILEEXISTS),hwndDlg,DlgProcFileExists,(LPARAM)¶m); - EnableWindow(hwndDlg,FALSE); + ShowWindow(hwndDlg, SW_SHOWNORMAL); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILEEXISTS), hwndDlg, DlgProcFileExists, (LPARAM)¶m); + EnableWindow(hwndDlg, FALSE); } else { PROTOFILERESUME *pfr; pfr=(PROTOFILERESUME*)mir_alloc(sizeof(PROTOFILERESUME)); pfr->action = dat->resumeBehaviour; pfr->szFilename = NULL; - PostMessage(hwndDlg,M_FILEEXISTSDLGREPLY,(WPARAM)mir_tstrdup(fts->tszCurrentFile),(LPARAM)pfr); + PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfr); } - SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,1); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1); return TRUE; } case ACKRESULT_DATA: { PROTOFILETRANSFERSTATUS *fts=(PROTOFILETRANSFERSTATUS*)ack->lParam; - TCHAR str[64], str2[64], szSizeDone[32], szSizeTotal[32];//,*contactName; + TCHAR str[64], str2[64], szSizeDone[32], szSizeTotal[32];//, *contactName; int units; if ( dat->fileVirusScanned == NULL ) @@ -649,10 +649,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { HideProgressControls(hwndDlg); - KillTimer(hwndDlg,1); + KillTimer(hwndDlg, 1); if (!dat->send) - SetOpenFileButtonStyle(GetDlgItem(hwndDlg,IDC_OPENFILE),1); - SetDlgItemText(hwndDlg,IDCANCEL,TranslateT("Close")); + SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); + SetDlgItemText(hwndDlg, IDCANCEL, TranslateT("Close")); if (dat->hNotifyEvent) UnhookEvent(dat->hNotifyEvent); dat->hNotifyEvent=NULL; @@ -676,19 +676,19 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DBEVENTINFO dbei={0}; FillSendData( dat, dbei ); - CallService(MS_DB_EVENT_ADD,(WPARAM)dat->hContact,(LPARAM)&dbei); + CallService(MS_DB_EVENT_ADD, (WPARAM)dat->hContact, (LPARAM)&dbei); if (dbei.pBlob) mir_free(dbei.pBlob); dat->files=NULL; //protocol library frees this } else { - SetFtStatus(hwndDlg, + SetFtStatus(hwndDlg, (dat->transferStatus.totalFiles == 1) ? LPGENT("Transfer completed, open file.") : - LPGENT("Transfer completed, open folder."), + LPGENT("Transfer completed, open folder."), FTS_OPEN); - int useScanner=DBGetContactSettingByte(NULL,"SRFile","UseScanner",VIRUSSCAN_DISABLE); + int useScanner=DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE); if (useScanner != VIRUSSCAN_DISABLE) { struct virusscanthreadstartinfo *vstsi; vstsi=(struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo)); @@ -696,7 +696,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (useScanner == VIRUSSCAN_DURINGDL) { vstsi->returnCode=dat->transferStatus.currentFileNumber; if ( GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY) { - PostMessage(hwndDlg,M_VIRUSSCANDONE,vstsi->returnCode,0); + PostMessage(hwndDlg, M_VIRUSSCANDONE, vstsi->returnCode, 0); mir_free(vstsi); vstsi=NULL; } @@ -707,7 +707,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR vstsi->returnCode = -1; } SetFtStatus(hwndDlg, LPGENT("Scanning for viruses..."), FTS_TEXT); - if (vstsi) forkthread((void (*)(void*))RunVirusScannerThread,0,vstsi); + if (vstsi) forkthread((void (*)(void*))RunVirusScannerThread, 0, vstsi); } else { dat->fs=NULL; /* protocol will free structure */ } @@ -723,7 +723,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } // switch ack->result } break; // case HM_RECVEVENT case M_VIRUSSCANDONE: - { int done=1,i; + { int done=1, i; if ((int)wParam == -1) { for (i=0;itransferStatus.totalFiles;i++) dat->fileVirusScanned[i]=1; } @@ -746,7 +746,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR urd.hInstance=hMirandaInst; urd.lpTemplate=MAKEINTRESOURCEA(IDD_FILETRANSFERINFO); urd.pfnResizer=FileTransferDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); + CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd); RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLTRANSFERRED), NULL, NULL, RDW_INVALIDATE|RDW_NOERASE); RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLSPEED), NULL, NULL, RDW_INVALIDATE|RDW_NOERASE); @@ -757,7 +757,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_DESTROY: KillTimer(hwndDlg, 1); - HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg,IDC_CONTACTNAME,WM_GETFONT,0,0); + HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_CONTACTNAME, WM_GETFONT, 0, 0); DeleteObject(hFont); Button_FreeIcon_IcoLib(hwndDlg, IDC_CONTACT); @@ -773,7 +773,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR void FreeFileDlgData( FileDlgData* dat ) { if (dat->fs) - CallContactService(dat->hContact,PSS_FILECANCEL,(WPARAM)dat->fs,0); + CallContactService(dat->hContact, PSS_FILECANCEL, (WPARAM)dat->fs, 0); dat->fs = NULL; if (dat->hPreshutdownEvent) UnhookEvent(dat->hPreshutdownEvent); diff --git a/src/modules/srfile/ftmanager.cpp b/src/modules/srfile/ftmanager.cpp index 4199c5b255..0b321ee16c 100644 --- a/src/modules/srfile/ftmanager.cpp +++ b/src/modules/srfile/ftmanager.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. @@ -179,7 +179,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if (i == dat->wnds->realCount) PostMessage(GetParent(hwnd), WM_TIMER, 1, NULL); - if (dat->runningCount == 0 && (int)wParam == ACKRESULT_SUCCESS && DBGetContactSettingByte(NULL,"SRFile","AutoClose",0)) + if (dat->runningCount == 0 && (int)wParam == ACKRESULT_SUCCESS && DBGetContactSettingByte(NULL, "SRFile", "AutoClose", 0)) ShowWindow(hwndFtMgr, SW_HIDE); break; } @@ -532,7 +532,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND FtMgr_Show(bool bForceActivate, bool bFromMenu) { - bool bAutoMin = DBGetContactSettingByte(NULL,"SRFile","AutoMin",0) != 0; /* lqbe */ + bool bAutoMin = DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */ bool bJustCreated = (hwndFtMgr == NULL); if (bJustCreated) diff --git a/src/modules/srurl/url.cpp b/src/modules/srurl/url.cpp index 5db30d7fda..4ad806c111 100644 --- a/src/modules/srurl/url.cpp +++ b/src/modules/srurl/url.cpp @@ -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. @@ -34,39 +34,39 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP static INT_PTR ReadUrlCommand(WPARAM, LPARAM lParam) { - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_URLRECV),NULL,DlgProcUrlRecv,lParam); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_URLRECV), NULL, DlgProcUrlRecv, lParam); return 0; } -static int UrlEventAdded(WPARAM wParam,LPARAM lParam) +static int UrlEventAdded(WPARAM wParam, LPARAM lParam) { CLISTEVENT cle; DBEVENTINFO dbei; TCHAR szTooltip[256]; - ZeroMemory(&dbei,sizeof(dbei)); + ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize=sizeof(dbei); dbei.cbBlob=0; - CallService(MS_DB_EVENT_GET,lParam,(LPARAM)&dbei); + CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei); if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_URL) return 0; SkinPlaySound("RecvUrl"); - ZeroMemory(&cle,sizeof(cle)); + ZeroMemory(&cle, sizeof(cle)); cle.cbSize=sizeof(cle); cle.flags = CLEF_TCHAR; cle.hContact=(HANDLE)wParam; cle.hDbEvent=(HANDLE)lParam; cle.hIcon = LoadSkinIcon( SKINICON_EVENT_URL ); cle.pszService="SRUrl/ReadUrl"; - mir_sntprintf(szTooltip,SIZEOF(szTooltip),TranslateT("URL from %s"), cli.pfnGetContactDisplayName(( HANDLE )wParam, 0 )); + mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), cli.pfnGetContactDisplayName(( HANDLE )wParam, 0 )); cle.ptszTooltip=szTooltip; - CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); return 0; } static INT_PTR SendUrlCommand(WPARAM wParam, LPARAM) { - CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_URLSEND),NULL,DlgProcUrlSend,wParam); + CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_URLSEND), NULL, DlgProcUrlSend, wParam); return 0; } @@ -75,30 +75,30 @@ static void RestoreUnreadUrlAlerts(void) CLISTEVENT cle={0}; DBEVENTINFO dbei={0}; TCHAR toolTip[256]; - HANDLE hDbEvent,hContact; + HANDLE hDbEvent, hContact; dbei.cbSize=sizeof(dbei); cle.cbSize=sizeof(cle); cle.hIcon = LoadSkinIcon( SKINICON_EVENT_URL ); cle.pszService="SRUrl/ReadUrl"; - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact) { - hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0); + hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0); while (hDbEvent) { dbei.cbBlob=0; - CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei); + CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei); if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_URL) { cle.hContact=hContact; cle.hDbEvent=hDbEvent; cle.flags = CLEF_TCHAR; - mir_sntprintf(toolTip,SIZEOF(toolTip),TranslateT("URL from %s"), cli.pfnGetContactDisplayName( hContact, 0 )); + mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("URL from %s"), cli.pfnGetContactDisplayName( hContact, 0 )); cle.ptszTooltip=toolTip; - CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); } - hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0); + hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0); } - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); } } @@ -107,9 +107,9 @@ static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; char *szProto; - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - if (lstrcmpA(cws->szModule,"CList") && (szProto == NULL || lstrcmpA(cws->szModule,szProto))) return 0; - WindowList_Broadcast(hUrlWindowList,DM_UPDATETITLE,0,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); + if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) return 0; + WindowList_Broadcast(hUrlWindowList, DM_UPDATETITLE, 0, 0); return 0; } @@ -137,7 +137,7 @@ static int SRUrlModulesLoaded(WPARAM, LPARAM) mi.icolibItem = GetSkinIconHandle( SKINICON_EVENT_URL ); mi.pszName = LPGEN("Web Page Address (&URL)"); mi.pszService = MS_URL_SENDURL; - hSRUrlMenuItem = (HANDLE)CallService( MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi ); + hSRUrlMenuItem = Menu_AddContactMenuItem(&mi); RestoreUnreadUrlAlerts(); return 0; @@ -159,24 +159,24 @@ static int SRUrlShutdown(WPARAM, LPARAM) int UrlContactDeleted(WPARAM wParam, LPARAM) { - HWND h = WindowList_Find(hUrlWindowList,(HANDLE)wParam); + HWND h = WindowList_Find(hUrlWindowList, (HANDLE)wParam); if ( h ) - SendMessage(h,WM_CLOSE,0,0); + SendMessage(h, WM_CLOSE, 0, 0); return 0; } int LoadSendRecvUrlModule(void) { - hUrlWindowList=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0); - HookEvent(ME_SYSTEM_MODULESLOADED,SRUrlModulesLoaded); - HookEvent(ME_DB_EVENT_ADDED,UrlEventAdded); - HookEvent(ME_CLIST_PREBUILDCONTACTMENU,SRUrlPreBuildMenu); + hUrlWindowList=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + HookEvent(ME_SYSTEM_MODULESLOADED, SRUrlModulesLoaded); + HookEvent(ME_DB_EVENT_ADDED, UrlEventAdded); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRUrlPreBuildMenu); hEventContactSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); hContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, UrlContactDeleted); - HookEvent(ME_SYSTEM_PRESHUTDOWN,SRUrlShutdown); - CreateServiceFunction(MS_URL_SENDURL,SendUrlCommand); - CreateServiceFunction("SRUrl/ReadUrl",ReadUrlCommand); - SkinAddNewSoundEx("RecvUrl","URL","Incoming"); + HookEvent(ME_SYSTEM_PRESHUTDOWN, SRUrlShutdown); + CreateServiceFunction(MS_URL_SENDURL, SendUrlCommand); + CreateServiceFunction("SRUrl/ReadUrl", ReadUrlCommand); + SkinAddNewSoundEx("RecvUrl", "URL", "Incoming"); return 0; } diff --git a/src/modules/srurl/url.h b/src/modules/srurl/url.h index 98c5566f53..4e00c38c56 100644 --- a/src/modules/srurl/url.h +++ b/src/modules/srurl/url.h @@ -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. diff --git a/src/modules/srurl/urldialogs.cpp b/src/modules/srurl/urldialogs.cpp index 6fcef0b088..54ef22c5cc 100644 --- a/src/modules/srurl/urldialogs.cpp +++ b/src/modules/srurl/urldialogs.cpp @@ -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,23 +29,23 @@ extern HANDLE hUrlWindowList; static void sttUpdateTitle( HWND hwndDlg, HANDLE hContact ) { - TCHAR newtitle[256],oldtitle[256]; + TCHAR newtitle[256], oldtitle[256]; TCHAR *szStatus, *contactName, *pszNewTitleStart = TranslateT("Send URL to"); char *szProto; if ( hContact ) { - szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if ( szProto ) { CONTACTINFO ci; int hasName = 0; char buf[128]; - ZeroMemory(&ci,sizeof(ci)); + ZeroMemory(&ci, sizeof(ci)); ci.cbSize = sizeof(ci); ci.hContact = hContact; ci.szProto = szProto; ci.dwFlag = CNF_UNIQUEID; - if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { switch(ci.type) { case CNFT_ASCIIZ: hasName = 1; @@ -54,7 +54,7 @@ static void sttUpdateTitle( HWND hwndDlg, HANDLE hContact ) break; case CNFT_DWORD: hasName = 1; - mir_snprintf(buf, SIZEOF(buf),"%u",ci.dVal); + mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal); break; } } @@ -101,22 +101,22 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR* contactName; TCHAR msg[128]; - ZeroMemory(&dbei,sizeof(dbei)); + ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize=sizeof(dbei); - dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)dat->hDbEvent,0); + dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)dat->hDbEvent, 0); dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob); - CallService(MS_DB_EVENT_GET,(WPARAM)dat->hDbEvent,(LPARAM)&dbei); - SetDlgItemTextA(hwndDlg,IDC_URL,(char*)dbei.pBlob); - SetDlgItemTextA(hwndDlg,IDC_MSG,(char*)dbei.pBlob+lstrlenA((char*)dbei.pBlob)+1); + CallService(MS_DB_EVENT_GET, (WPARAM)dat->hDbEvent, (LPARAM)&dbei); + SetDlgItemTextA(hwndDlg, IDC_URL, (char*)dbei.pBlob); + SetDlgItemTextA(hwndDlg, IDC_MSG, (char*)dbei.pBlob+lstrlenA((char*)dbei.pBlob)+1); mir_free(dbei.pBlob); - CallService(MS_DB_EVENT_MARKREAD,(WPARAM)dat->hContact,(LPARAM)dat->hDbEvent); + CallService(MS_DB_EVENT_MARKREAD, (WPARAM)dat->hContact, (LPARAM)dat->hDbEvent); contactName = cli.pfnGetContactDisplayName( dat->hContact, 0 ); - mir_sntprintf(msg,SIZEOF(msg),TranslateT("URL from %s"),contactName); - SetWindowText(hwndDlg,msg); - SetDlgItemText(hwndDlg,IDC_FROM,contactName); - SendDlgItemMessage(hwndDlg,IDOK,BUTTONSETARROW,1,0); + mir_sntprintf(msg, SIZEOF(msg), TranslateT("URL from %s"), contactName); + SetWindowText(hwndDlg, msg); + SetDlgItemText(hwndDlg, IDC_FROM, contactName); + SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETARROW, 1, 0); { TCHAR str[128]; tmi.printTimeStamp(NULL, dbei.timestamp, _T("t d"), str, SIZEOF(str), 0); SetDlgItemText(hwndDlg, IDC_DATE, str); @@ -126,14 +126,14 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); - SendMessage(hwndDlg,DM_UPDATETITLE,0,0); + SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0); // From message dlg end - Utils_RestoreWindowPositionNoSize(hwndDlg,NULL,"SRUrl","recv"); + Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "SRUrl", "recv"); return TRUE; case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); case WM_DRAWITEM: { @@ -141,16 +141,16 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) { char *szProto; - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); if (szProto) { HICON hIcon; - hIcon = ( HICON )CallProtoService(szProto,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0); + hIcon = ( HICON )CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); if (hIcon) { - DrawIconEx(dis->hDC,dis->rcItem.left,dis->rcItem.top,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); DestroyIcon( hIcon ); } } } } - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); case DM_UPDATETITLE: sttUpdateTitle( hwndDlg, dat->hContact ); @@ -158,34 +158,34 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_COMMAND: if (dat) - if (CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU),(LPARAM)dat->hContact)) + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact)) break; switch(LOWORD(wParam)) { case IDOK: - { HMENU hMenu,hSubMenu; + { HMENU hMenu, hSubMenu; RECT rc; char url[256]; - hMenu=LoadMenu(hMirandaInst,MAKEINTRESOURCE(IDR_CONTEXT)); - hSubMenu=GetSubMenu(hMenu,6); - CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hSubMenu,0); + hMenu=LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_CONTEXT)); + hSubMenu=GetSubMenu(hMenu, 6); + CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM)hSubMenu, 0); GetWindowRect((HWND)lParam, &rc); GetDlgItemTextA(hwndDlg, IDC_URL, url, SIZEOF(url)); - switch(TrackPopupMenu(hSubMenu,TPM_RETURNCMD,rc.left,rc.bottom,0,hwndDlg,NULL)) { + switch(TrackPopupMenu(hSubMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL)) { case IDM_OPENNEW: - CallService(MS_UTILS_OPENURL,1,(LPARAM)url); + CallService(MS_UTILS_OPENURL, 1, (LPARAM)url); break; case IDM_OPENEXISTING: - CallService(MS_UTILS_OPENURL,0,(LPARAM)url); + CallService(MS_UTILS_OPENURL, 0, (LPARAM)url); break; case IDM_COPYLINK: { HGLOBAL hData; if (!OpenClipboard(hwndDlg)) break; EmptyClipboard(); - hData=GlobalAlloc(GMEM_MOVEABLE,lstrlenA(url)+1); - lstrcpyA((char*)GlobalLock(hData),url); + hData=GlobalAlloc(GMEM_MOVEABLE, lstrlenA(url)+1); + lstrcpyA((char*)GlobalLock(hData), url); GlobalUnlock(hData); - SetClipboardData(CF_TEXT,hData); + SetClipboardData(CF_TEXT, hData); CloseClipboard(); break; } @@ -197,19 +197,19 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_USERMENU: { RECT rc; - HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)dat->hContact,0); - GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU),&rc); - TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL); + HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); + GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); DestroyMenu(hMenu); } break; case IDC_HISTORY: - CallService(MS_HISTORY_SHOWCONTACTHISTORY,(WPARAM)dat->hContact,0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0); break; case IDC_DETAILS: - CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)dat->hContact,0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0); break; case IDC_ADD: @@ -219,15 +219,15 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.handle=dat->hContact; acs.handleType=HANDLE_CONTACT; acs.szProto=0; - CallService(MS_ADDCONTACT_SHOW,(WPARAM)hwndDlg,(LPARAM)&acs); + CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); } - if (!DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) { - ShowWindow(GetDlgItem(hwndDlg,IDC_ADD),FALSE); + if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) { + ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); } break; case IDC_REPLY: - CallService(MS_MSG_SENDMESSAGE,(WPARAM)dat->hContact,0); + CallService(MS_MSG_SENDMESSAGE, (WPARAM)dat->hContact, 0); //fall through case IDCANCEL: DestroyWindow(hwndDlg); @@ -237,24 +237,24 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_DESTROY: Window_FreeIcon_IcoLib(hwndDlg); - Button_FreeIcon_IcoLib(hwndDlg,IDC_ADD); - Button_FreeIcon_IcoLib(hwndDlg,IDC_DETAILS); - Button_FreeIcon_IcoLib(hwndDlg,IDC_HISTORY); - Button_FreeIcon_IcoLib(hwndDlg,IDC_USERMENU); + Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD); + Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS); + Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY); + Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU); WindowList_Remove(hUrlWindowList, hwndDlg); mir_free(dat); - Utils_SaveWindowPosition(hwndDlg,NULL,"SRUrl","recv"); + Utils_SaveWindowPosition(hwndDlg, NULL, "SRUrl", "recv"); break; } return FALSE; } -static int ddeAcked,ddeData; +static int ddeAcked, ddeData; static ATOM hSzDdeData; static HWND hwndDde; static HGLOBAL hGlobalDdeData; -static LRESULT DdeMessage(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT DdeMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { UINT_PTR hSzItem; @@ -265,7 +265,7 @@ static LRESULT DdeMessage(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) break; case WM_DDE_DATA: - UnpackDDElParam(msg,lParam,(PUINT_PTR)&hGlobalDdeData,(PUINT_PTR)&hSzItem); + UnpackDDElParam(msg, lParam, (PUINT_PTR)&hGlobalDdeData, (PUINT_PTR)&hSzItem); ddeData = 1; if ( hGlobalDdeData ) { DDEDATA* data = ( DDEDATA* )GlobalLock( hGlobalDdeData ); @@ -282,21 +282,21 @@ static LRESULT DdeMessage(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) return 0; } -static HGLOBAL DoDdeRequest(const char *szItemName,HWND hwndDlg) +static HGLOBAL DoDdeRequest(const char *szItemName, HWND hwndDlg) { ATOM hSzItemName; - DWORD timeoutTick,thisTick; + DWORD timeoutTick, thisTick; MSG msg; hSzItemName=GlobalAddAtomA(szItemName); - if (!PostMessage(hwndDde,WM_DDE_REQUEST,(WPARAM)hwndDlg,MAKELPARAM(CF_TEXT,hSzItemName))) { + if (!PostMessage(hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDlg, MAKELPARAM(CF_TEXT, hSzItemName))) { GlobalDeleteAtom(hSzItemName); return NULL; } timeoutTick=GetTickCount()+5000; ddeData=0; ddeAcked=0; do { - if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } @@ -304,7 +304,7 @@ static HGLOBAL DoDdeRequest(const char *szItemName,HWND hwndDlg) thisTick=GetTickCount(); if (thisTick>timeoutTick) break; } - while (MsgWaitForMultipleObjects(0,NULL,FALSE,timeoutTick-thisTick,QS_ALLINPUT) == WAIT_OBJECT_0); + while (MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutTick-thisTick, QS_ALLINPUT) == WAIT_OBJECT_0); if (!ddeData) { GlobalDeleteAtom(hSzItemName); @@ -325,23 +325,23 @@ static void FreeDdeRequestData(HGLOBAL hData) else GlobalUnlock(hData); } -static void AddBrowserPageToCombo(char *url,HWND hwndCombo) +static void AddBrowserPageToCombo(char *url, HWND hwndCombo) { - char *title,*frame,*end; + char *title, *frame, *end; if (url[0] != '"') return; url++; - title=strchr(url,'"'); + title=strchr(url, '"'); if (title == NULL) return; *title='\0'; title++; if (*title) { title+=2; - frame=strchr(title,'"'); + frame=strchr(title, '"'); if (frame == NULL) return; *frame='\0'; frame++; if (*frame) { frame+=2; - end=strchr(frame,'"'); + end=strchr(frame, '"'); if (end == NULL) return; *end='\0'; } @@ -353,23 +353,23 @@ static void AddBrowserPageToCombo(char *url,HWND hwndCombo) int i; char szExistingUrl[1024]; - for (i=SendMessage(hwndCombo,CB_GETCOUNT,0,0)-1;i>=0;i--) { - if (SendMessage(hwndCombo,CB_GETLBTEXTLEN,i,0) >= SIZEOF(szExistingUrl)) + for (i=SendMessage(hwndCombo, CB_GETCOUNT, 0, 0)-1;i>=0;i--) { + if (SendMessage(hwndCombo, CB_GETLBTEXTLEN, i, 0) >= SIZEOF(szExistingUrl)) continue; - SendMessageA(hwndCombo,CB_GETLBTEXT,i,(LPARAM)szExistingUrl); - if (!lstrcmpA(szExistingUrl,url)) return; + SendMessageA(hwndCombo, CB_GETLBTEXT, i, (LPARAM)szExistingUrl); + if (!lstrcmpA(szExistingUrl, url)) return; } - i=SendMessageA(hwndCombo,CB_ADDSTRING,0,(LPARAM)url); + i=SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LPARAM)url); szItemData=mir_strdup(title); - SendMessage(hwndCombo,CB_SETITEMDATA,i,(LPARAM)szItemData); + SendMessage(hwndCombo, CB_SETITEMDATA, i, (LPARAM)szItemData); } } //see Q160957 and http://developer.netscape.com/docs/manuals/communicator/DDE/index.htm -static void GetOpenBrowserUrlsForBrowser(const char *szBrowser,HWND hwndDlg,HWND hwndCombo) +static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HWND hwndCombo) { - ATOM hSzBrowser,hSzTopic; - int windowCount,i; + ATOM hSzBrowser, hSzTopic; + int windowCount, i; DWORD *windowId; DWORD dwResult; HGLOBAL hData; @@ -380,31 +380,31 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser,HWND hwndDlg,HWND hSzTopic=GlobalAddAtomA("WWW_ListWindows"); ddeAcked=0; - if (!SendMessageTimeout(HWND_BROADCAST,WM_DDE_INITIATE,(WPARAM)hwndDlg,MAKELPARAM(hSzBrowser,hSzTopic),SMTO_ABORTIFHUNG|SMTO_NORMAL,DDEMESSAGETIMEOUT,(PDWORD_PTR)&dwResult) + if (!SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDlg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, (PDWORD_PTR)&dwResult) || !ddeAcked) { GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); return; } - hData=DoDdeRequest("WWW_ListWindows",hwndDlg); + hData=DoDdeRequest("WWW_ListWindows", hwndDlg); if (hData == NULL) { GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); return; } - dataLength=GlobalSize(hData)-offsetof(DDEDATA,Value); + dataLength=GlobalSize(hData)-offsetof(DDEDATA, Value); data=(DDEDATA*)GlobalLock(hData); windowCount=dataLength/sizeof(DWORD); windowId=(PDWORD)mir_alloc(sizeof(DWORD)*windowCount); - memcpy(windowId,data->Value,windowCount*sizeof(DWORD)); + memcpy(windowId, data->Value, windowCount*sizeof(DWORD)); GlobalUnlock(hData); FreeDdeRequestData(hData); - PostMessage(hwndDde,WM_DDE_TERMINATE,(WPARAM)hwndDlg,0); + PostMessage(hwndDde, WM_DDE_TERMINATE, (WPARAM)hwndDlg, 0); GlobalDeleteAtom(hSzTopic); hSzTopic=GlobalAddAtomA("WWW_GetWindowInfo"); ddeAcked=0; - if (!SendMessageTimeout(HWND_BROADCAST,WM_DDE_INITIATE,(WPARAM)hwndDlg,MAKELPARAM(hSzBrowser,hSzTopic),SMTO_ABORTIFHUNG|SMTO_NORMAL,DDEMESSAGETIMEOUT,(PDWORD_PTR)&dwResult) + if (!SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDlg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, (PDWORD_PTR)&dwResult) || !ddeAcked) { GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); @@ -414,53 +414,53 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser,HWND hwndDlg,HWND for (i=0;iValue,hwndCombo); + AddBrowserPageToCombo((char*)data->Value, hwndCombo); GlobalUnlock(hData); FreeDdeRequestData(hData); } } - PostMessage(hwndDde,WM_DDE_TERMINATE,(WPARAM)hwndDlg,0); + PostMessage(hwndDde, WM_DDE_TERMINATE, (WPARAM)hwndDlg, 0); GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); mir_free(windowId); } -static void GetOpenBrowserUrls(HWND hwndDlg,HWND hwndCombo) +static void GetOpenBrowserUrls(HWND hwndDlg, HWND hwndCombo) { - GetOpenBrowserUrlsForBrowser("opera",hwndDlg,hwndCombo); - GetOpenBrowserUrlsForBrowser("netscape",hwndDlg,hwndCombo); - GetOpenBrowserUrlsForBrowser("iexplore",hwndDlg,hwndCombo); + GetOpenBrowserUrlsForBrowser("opera", hwndDlg, hwndCombo); + GetOpenBrowserUrlsForBrowser("netscape", hwndDlg, hwndCombo); + GetOpenBrowserUrlsForBrowser("iexplore", hwndDlg, hwndCombo); } static WNDPROC OldSendEditProc; -static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CHAR: if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) { - PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0); + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } break; case WM_SYSCHAR: if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) { - PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0); + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } break; } - return CallWindowProc(OldSendEditProc,hwnd,msg,wParam,lParam); + return CallWindowProc(OldSendEditProc, hwnd, msg, wParam, lParam); } INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - struct UrlSendData* dat = (struct UrlSendData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + struct UrlSendData* dat = (struct UrlSendData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -472,7 +472,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, 450, 0); dat=(struct UrlSendData*)mir_alloc(sizeof(struct UrlSendData)); - SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)dat); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->hContact=(HANDLE)lParam; dat->hAckEvent=NULL; dat->hSendId=NULL; @@ -481,94 +481,94 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP WindowList_Add(hUrlWindowList, hwndDlg, dat->hContact); { TCHAR *str = cli.pfnGetContactDisplayName( dat->hContact, 0 ); - SetDlgItemText(hwndDlg,IDC_NAME,str); + SetDlgItemText(hwndDlg, IDC_NAME, str); } - GetOpenBrowserUrls(hwndDlg,GetDlgItem(hwndDlg,IDC_URLS)); + GetOpenBrowserUrls(hwndDlg, GetDlgItem(hwndDlg, IDC_URLS)); SendDlgItemMessage(hwndDlg, IDC_URLS, CB_SETCURSEL, 0, 0); - if (SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETCOUNT,0,0))SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_URLS,CBN_SELCHANGE),0); + if (SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCOUNT, 0, 0))SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_URLS, CBN_SELCHANGE), 0); EnableWindow(GetDlgItem(hwndDlg, IDOK), (SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCURSEL, 0, 0) == CB_ERR)?FALSE:TRUE); - Utils_RestoreWindowPositionNoSize(hwndDlg,NULL,"SRUrl","send"); - OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MESSAGE),GWLP_WNDPROC,(LONG_PTR)SendEditSubclassProc); - OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg,IDC_URLS),GW_CHILD),GWLP_WNDPROC,(LONG_PTR)SendEditSubclassProc); + Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "SRUrl", "send"); + OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc); + OldSendEditProc=(WNDPROC)SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), GWLP_WNDPROC, (LONG_PTR)SendEditSubclassProc); // From message dlg if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); - SendMessage(hwndDlg,DM_UPDATETITLE,0,0); + SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0); // From message dlg end return TRUE; case WM_DDE_DATA: case WM_DDE_ACK: - return DdeMessage(hwndDlg,msg,wParam,lParam); + return DdeMessage(hwndDlg, msg, wParam, lParam); case WM_TIMER: if ( wParam == 0 ) { //ICQ sendurl timed out - KillTimer(hwndDlg,0); - MessageBox(hwndDlg,TranslateT("Send timed out"),_T(""),MB_OK); - EnableWindow(GetDlgItem(hwndDlg,IDOK),TRUE); - EnableWindow(GetDlgItem(hwndDlg,IDC_URLS),TRUE); - SendDlgItemMessage(hwndDlg,IDC_MESSAGE,EM_SETREADONLY,FALSE,0); + KillTimer(hwndDlg, 0); + MessageBox(hwndDlg, TranslateT("Send timed out"), _T(""), MB_OK); + EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_URLS), TRUE); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, FALSE, 0); } break; case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); case WM_DRAWITEM: { LPDRAWITEMSTRUCT dis = ( LPDRAWITEMSTRUCT )lParam; if ( dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) { - char *szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + char *szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); if (szProto) { - HICON hIcon = (HICON)CallProtoService(szProto,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0); + HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); if ( hIcon ) { - DrawIconEx(dis->hDC,dis->rcItem.left,dis->rcItem.top,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); + DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); DestroyIcon(hIcon); } } } } - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); case DM_UPDATETITLE: sttUpdateTitle( hwndDlg, dat->hContact ); break; case WM_COMMAND: - if (CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU),(LPARAM)dat->hContact)) + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact)) break; switch (LOWORD(wParam)) { case IDOK: { - char *body,*url; - int bodySize,urlSize; + char *body, *url; + int bodySize, urlSize; - urlSize=GetWindowTextLength(GetDlgItem(hwndDlg,IDC_URLS))+1; + urlSize=GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS))+1; url=(char*)mir_alloc(urlSize); - GetDlgItemTextA(hwndDlg,IDC_URLS,url,urlSize); + GetDlgItemTextA(hwndDlg, IDC_URLS, url, urlSize); if (url[0] == 0) { mir_free(url); break; } - bodySize=GetWindowTextLength(GetDlgItem(hwndDlg,IDC_MESSAGE))+1; + bodySize=GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE))+1; body=(char*)mir_alloc(bodySize); - GetDlgItemTextA(hwndDlg,IDC_MESSAGE,body,bodySize); + GetDlgItemTextA(hwndDlg, IDC_MESSAGE, body, bodySize); - dat->sendBuffer=(char*)mir_realloc(dat->sendBuffer,lstrlenA(url)+lstrlenA(body)+2); - lstrcpyA(dat->sendBuffer,url); - lstrcpyA(dat->sendBuffer+lstrlenA(url)+1,body); - dat->hAckEvent=HookEventMessage(ME_PROTO_ACK,hwndDlg,HM_EVENTSENT); - dat->hSendId=(HANDLE)CallContactService(dat->hContact,PSS_URL,0,(LPARAM)dat->sendBuffer); + dat->sendBuffer=(char*)mir_realloc(dat->sendBuffer, lstrlenA(url)+lstrlenA(body)+2); + lstrcpyA(dat->sendBuffer, url); + lstrcpyA(dat->sendBuffer+lstrlenA(url)+1, body); + dat->hAckEvent=HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_EVENTSENT); + dat->hSendId=(HANDLE)CallContactService(dat->hContact, PSS_URL, 0, (LPARAM)dat->sendBuffer); mir_free(url); mir_free(body); //create a timeout timer - SetTimer(hwndDlg,0,TIMEOUT_URLSEND,NULL); - EnableWindow(GetDlgItem(hwndDlg,IDOK),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_URLS),FALSE); - SendDlgItemMessage(hwndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0); + SetTimer(hwndDlg, 0, TIMEOUT_URLSEND, NULL); + EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_URLS), FALSE); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0); return TRUE; } @@ -580,30 +580,30 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (HIWORD(wParam) == CBN_SELCHANGE) { int i, urlSize; char *title; - i=SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETCURSEL,0,0); - title=(char*)SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETITEMDATA,(WPARAM)i,0); - SetDlgItemTextA(hwndDlg,IDC_MESSAGE,title); - urlSize=SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETLBTEXTLEN,(WPARAM)i,0); - EnableWindow(GetDlgItem(hwndDlg,IDOK), (urlSize>0)); + i=SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCURSEL, 0, 0); + title=(char*)SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETITEMDATA, (WPARAM)i, 0); + SetDlgItemTextA(hwndDlg, IDC_MESSAGE, title); + urlSize=SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETLBTEXTLEN, (WPARAM)i, 0); + EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0)); } else if (HIWORD(wParam) == CBN_EDITCHANGE) { - int urlSize = GetWindowTextLength(GetDlgItem(hwndDlg,IDC_URLS)); - EnableWindow(GetDlgItem(hwndDlg,IDOK), (urlSize>0)); + int urlSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS)); + EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0)); } break; case IDC_USERMENU: { RECT rc; - HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)dat->hContact,0); - GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU),&rc); - TrackPopupMenu(hMenu,0,rc.left,rc.bottom,0,hwndDlg,NULL); + HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); + GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); DestroyMenu(hMenu); } break; case IDC_HISTORY: - CallService(MS_HISTORY_SHOWCONTACTHISTORY,(WPARAM)dat->hContact,0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0); break; case IDC_DETAILS: - CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)dat->hContact,0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0); break; case IDC_ADD: { ADDCONTACTSTRUCT acs={0}; @@ -611,10 +611,10 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.handle=dat->hContact; acs.handleType=HANDLE_CONTACT; acs.szProto=0; - CallService(MS_ADDCONTACT_SHOW,(WPARAM)hwndDlg,(LPARAM)&acs); + CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); } - if (!DBGetContactSettingByte(dat->hContact,"CList","NotOnList",0)) { - ShowWindow(GetDlgItem(hwndDlg,IDC_ADD),FALSE); + if (!DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) { + ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); } break; } @@ -626,36 +626,36 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (ack->hContact != dat->hContact) break; if (ack->type != ACKTYPE_URL || ack->result != ACKRESULT_SUCCESS) break; - ZeroMemory(&dbei,sizeof(dbei)); + ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize=sizeof(dbei); dbei.eventType=EVENTTYPE_URL; dbei.flags=DBEF_SENT; - dbei.szModule=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)dat->hContact,0); + dbei.szModule=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); dbei.timestamp=time(NULL); dbei.cbBlob=(DWORD)(strlen(dat->sendBuffer)+strlen(dat->sendBuffer+strlen(dat->sendBuffer)+1)+2); dbei.pBlob=(PBYTE)dat->sendBuffer; - CallService(MS_DB_EVENT_ADD,(WPARAM)dat->hContact,(LPARAM)&dbei); - KillTimer(hwndDlg,0); + CallService(MS_DB_EVENT_ADD, (WPARAM)dat->hContact, (LPARAM)&dbei); + KillTimer(hwndDlg, 0); DestroyWindow(hwndDlg); break; } case WM_DESTROY: Window_FreeIcon_IcoLib(hwndDlg); - Button_FreeIcon_IcoLib(hwndDlg,IDC_ADD); - Button_FreeIcon_IcoLib(hwndDlg,IDC_DETAILS); - Button_FreeIcon_IcoLib(hwndDlg,IDC_HISTORY); - Button_FreeIcon_IcoLib(hwndDlg,IDC_USERMENU); + Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD); + Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS); + Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY); + Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU); WindowList_Remove(hUrlWindowList, hwndDlg); - SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg,IDC_URLS),GW_CHILD),GWLP_WNDPROC,(LONG_PTR)OldSendEditProc); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MESSAGE),GWLP_WNDPROC,(LONG_PTR)OldSendEditProc); + SetWindowLongPtr(GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MESSAGE), GWLP_WNDPROC, (LONG_PTR)OldSendEditProc); if (dat->hAckEvent) UnhookEvent(dat->hAckEvent); if (dat->sendBuffer != NULL) mir_free(dat->sendBuffer); mir_free(dat); - Utils_SaveWindowPosition(hwndDlg,NULL,"SRUrl","send"); + Utils_SaveWindowPosition(hwndDlg, NULL, "SRUrl", "send"); { int i; - for (i=SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETCOUNT,0,0)-1;i>=0;i--) - mir_free((char*)SendDlgItemMessage(hwndDlg,IDC_URLS,CB_GETITEMDATA,i,0)); + for (i=SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCOUNT, 0, 0)-1;i>=0;i--) + mir_free((char*)SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETITEMDATA, i, 0)); } break; } diff --git a/src/modules/updatenotify/updatenotify.cpp b/src/modules/updatenotify/updatenotify.cpp index 123903c937..910b168687 100644 --- a/src/modules/updatenotify/updatenotify.cpp +++ b/src/modules/updatenotify/updatenotify.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. @@ -116,7 +116,7 @@ int LoadUpdateNotifyModule(void) { mi.position = 2000030000; mi.pszName = LPGEN("Check for Update"); mi.pszService = "UpdateNotify/UpdateCommand"; - CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + Menu_AddMainMenuItem(&mi); hHookModules = HookEvent(ME_SYSTEM_MODULESLOADED, UpdateNotifyModulesLoaded); hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, UpdateNotifyPreShutdown); @@ -163,7 +163,7 @@ static INT_PTR UpdateNotifyMenuCommand(WPARAM, LPARAM) { DBWriteContactSettingDword(NULL, UN_MOD, UN_CURRENTVERSIONFND, und.reqTime); } und.isManual = 1; - DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc,(LPARAM)&und); + DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc, (LPARAM)&und); hwndManualUpdateDlg = 0; return 0; } @@ -207,7 +207,7 @@ static VOID CALLBACK UpdateNotifyTimerCheck(HWND, UINT, UINT_PTR, DWORD) } static DWORD UpdateNotifyMakeVersion(char *str) { - DWORD a1,a2,a3,a4; + DWORD a1, a2, a3, a4; if (!str) return 0; sscanf(str, "%u.%u.%u.%u", &a1, &a2, &a3, &a4); @@ -274,8 +274,8 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) { isBetaCheck = DBGetContactSettingByte(NULL, UN_MOD, UN_NOTIFYTYPE, UN_NOTIFYTYPE_DEF) == UN_NOTIFYTYPE_BETA?1:0; isAlphaCheck = DBGetContactSettingByte(NULL, UN_MOD, UN_NOTIFYTYPE, UN_NOTIFYTYPE_DEF) == UN_NOTIFYTYPE_ALPHA?1:0; dwVersion = CallService(MS_SYSTEM_GETVERSION, 0, 0); - mir_snprintf(szVersion, sizeof(szVersion), "%d.%d.%d.%d", - HIBYTE(HIWORD(dwVersion)), LOBYTE(HIWORD(dwVersion)), + mir_snprintf(szVersion, sizeof(szVersion), "%d.%d.%d.%d", + HIBYTE(HIWORD(dwVersion)), LOBYTE(HIWORD(dwVersion)), HIBYTE(LOWORD(dwVersion)), LOBYTE(LOWORD(dwVersion))); if (!DBGetContactSettingString(NULL, UN_MOD, UN_CUSTOMXMLURL, &dbv)) { mir_snprintf(szUrl, sizeof(szUrl), "%s", dbv.pszVal?dbv.pszVal:UN_URLXML); @@ -535,7 +535,7 @@ static void UpdateNotifyPerform(void *) if (notify) { DBWriteContactSettingString(NULL, UN_MOD, UN_CURRENTVERSION, und.versionReal); DBWriteContactSettingDword(NULL, UN_MOD, UN_CURRENTVERSIONFND, und.reqTime); - DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc,(LPARAM)&und); + DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc, (LPARAM)&und); hwndUpdateDlg = 0; } } 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; } diff --git a/src/modules/useronline/useronline.cpp b/src/modules/useronline/useronline.cpp index 5fec748a17..c3a4562ae4 100644 --- a/src/modules/useronline/useronline.cpp +++ b/src/modules/useronline/useronline.cpp @@ -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. @@ -24,24 +24,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int uniqueEventId=0; -static int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) +static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - int newStatus,oldStatus; + int newStatus, oldStatus; - if ((HANDLE)wParam == NULL || strcmp(cws->szSetting,"Status")) return 0; + if ((HANDLE)wParam == NULL || strcmp(cws->szSetting, "Status")) return 0; newStatus=cws->value.wVal; - oldStatus=DBGetContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE); - DBWriteContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",(WORD)newStatus); - if (CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE)) return 0; - if (DBGetContactSettingByte((HANDLE)wParam,"CList","Hidden",0)) return 0; + oldStatus=DBGetContactSettingWord((HANDLE)wParam, "UserOnline", "OldStatus", ID_STATUS_OFFLINE); + DBWriteContactSettingWord((HANDLE)wParam, "UserOnline", "OldStatus", (WORD)newStatus); + if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_USERONLINE)) return 0; + if (DBGetContactSettingByte((HANDLE)wParam, "CList", "Hidden", 0)) return 0; if (newStatus == ID_STATUS_OFFLINE&&oldStatus != ID_STATUS_OFFLINE) { // Remove the event from the queue if it exists since they are now offline - int lastEvent = (int)DBGetContactSettingDword((HANDLE)wParam,"UserOnline","LastEvent",0); + int lastEvent = (int)DBGetContactSettingDword((HANDLE)wParam, "UserOnline", "LastEvent", 0); if (lastEvent) { - CallService(MS_CLIST_REMOVEEVENT,wParam,(LPARAM)lastEvent); - DBWriteContactSettingDword((HANDLE)wParam,"UserOnline", "LastEvent", 0); + CallService(MS_CLIST_REMOVEEVENT, wParam, (LPARAM)lastEvent); + DBWriteContactSettingDword((HANDLE)wParam, "UserOnline", "LastEvent", 0); } } if ((newStatus == ID_STATUS_ONLINE || newStatus == ID_STATUS_FREECHAT) && @@ -53,18 +53,18 @@ static int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) CLISTEVENT cle; TCHAR tooltip[256]; - ZeroMemory(&cle,sizeof(cle)); + ZeroMemory(&cle, sizeof(cle)); cle.cbSize=sizeof(cle); cle.flags=CLEF_ONLYAFEW | CLEF_TCHAR; cle.hContact=(HANDLE)wParam; cle.hDbEvent=(HANDLE)(uniqueEventId++); cle.hIcon = LoadSkinIcon( SKINICON_OTHER_USERONLINE, false ); cle.pszService="UserOnline/Description"; - mir_sntprintf(tooltip,SIZEOF(tooltip),TranslateT("%s is Online"), cli.pfnGetContactDisplayName(( HANDLE )wParam, 0 )); + mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is Online"), cli.pfnGetContactDisplayName(( HANDLE )wParam, 0 )); cle.ptszTooltip=tooltip; - CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); IconLib_ReleaseIcon( cle.hIcon, 0 ); - DBWriteContactSettingDword(cle.hContact,"UserOnline", "LastEvent", (DWORD)cle.hDbEvent); + DBWriteContactSettingDword(cle.hContact, "UserOnline", "LastEvent", (DWORD)cle.hDbEvent); SkinPlaySound("UserOnline"); } } @@ -108,10 +108,10 @@ static int UserOnlineAccountsChanged( WPARAM eventCode, LPARAM lParam ) int LoadUserOnlineModule(void) { - HookEvent(ME_DB_CONTACT_SETTINGCHANGED,UserOnlineSettingChanged); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UserOnlineSettingChanged); HookEvent(ME_PROTO_ACK, UserOnlineAck); HookEvent(ME_SYSTEM_MODULESLOADED, UserOnlineModulesLoaded); HookEvent(ME_PROTO_ACCLISTCHANGED, UserOnlineAccountsChanged); - SkinAddNewSoundEx("UserOnline","Alerts","Online"); + SkinAddNewSoundEx("UserOnline", "Alerts", "Online"); return 0; } diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index 1ea930baf9..5dbf37b12f 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -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,10 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) { IPicture *pic; - HBITMAP hBmp,hBmpCopy; + HBITMAP hBmp, hBmpCopy; HBITMAP hOldBitmap, hOldBitmap2; BITMAP bmpInfo; - HDC hdc,hdcMem1,hdcMem2; + HDC hdc, hdcMem1, hdcMem2; short picType; TCHAR szFilename[MAX_PATH]; @@ -103,21 +103,21 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) OLE_HANDLE hOleBmp; pic->get_Handle(&hOleBmp); hBmp = (HBITMAP)hOleBmp; - GetObject(hBmp,sizeof(bmpInfo),&bmpInfo); + GetObject(hBmp, sizeof(bmpInfo), &bmpInfo); //need to copy bitmap so we can free the IPicture hdc=GetDC(NULL); hdcMem1=CreateCompatibleDC(hdc); hdcMem2=CreateCompatibleDC(hdc); - hOldBitmap=( HBITMAP )SelectObject(hdcMem1,hBmp); - hBmpCopy=CreateCompatibleBitmap(hdcMem1,bmpInfo.bmWidth,bmpInfo.bmHeight); - hOldBitmap2=( HBITMAP )SelectObject(hdcMem2,hBmpCopy); - BitBlt(hdcMem2,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,hdcMem1,0,0,SRCCOPY); - SelectObject(hdcMem1,hOldBitmap); - SelectObject(hdcMem2,hOldBitmap2); + hOldBitmap=( HBITMAP )SelectObject(hdcMem1, hBmp); + hBmpCopy=CreateCompatibleBitmap(hdcMem1, bmpInfo.bmWidth, bmpInfo.bmHeight); + hOldBitmap2=( HBITMAP )SelectObject(hdcMem2, hBmpCopy); + BitBlt(hdcMem2, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, hdcMem1, 0, 0, SRCCOPY); + SelectObject(hdcMem1, hOldBitmap); + SelectObject(hdcMem2, hOldBitmap2); DeleteDC(hdcMem2); DeleteDC(hdcMem1); - ReleaseDC(NULL,hdc); + ReleaseDC(NULL, hdc); DeleteObject(hBmp); pic->Release(); @@ -138,45 +138,45 @@ static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR BmpFilterGetStrings(WPARAM wParam,LPARAM lParam) +static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam) { int bytesLeft=wParam; - char *filter=(char*)lParam,*pfilter; + char *filter=(char*)lParam, *pfilter; - lstrcpynA(filter,Translate("All Bitmaps"),bytesLeft); bytesLeft-=lstrlenA(filter); - strncat(filter," (*.bmp;*.jpg;*.gif;*.png)",bytesLeft); + lstrcpynA(filter, Translate("All Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(filter); + strncat(filter, " (*.bmp;*.jpg;*.gif;*.png)", bytesLeft); pfilter=filter+lstrlenA(filter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,"*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG",bytesLeft); + lstrcpynA(pfilter, "*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,Translate("Windows Bitmaps"),bytesLeft); bytesLeft-=lstrlenA(pfilter); - strncat(pfilter," (*.bmp;*.rle)",bytesLeft); + lstrcpynA(pfilter, Translate("Windows Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + strncat(pfilter, " (*.bmp;*.rle)", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,"*.BMP;*.RLE",bytesLeft); + lstrcpynA(pfilter, "*.BMP;*.RLE", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,Translate("JPEG Bitmaps"),bytesLeft); bytesLeft-=lstrlenA(pfilter); - strncat(pfilter," (*.jpg;*.jpeg)",bytesLeft); + lstrcpynA(pfilter, Translate("JPEG Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + strncat(pfilter, " (*.jpg;*.jpeg)", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,"*.JPG;*.JPEG",bytesLeft); + lstrcpynA(pfilter, "*.JPG;*.JPEG", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,Translate("GIF Bitmaps"),bytesLeft); bytesLeft-=lstrlenA(pfilter); - strncat(pfilter," (*.gif)",bytesLeft); + lstrcpynA(pfilter, Translate("GIF Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + strncat(pfilter, " (*.gif)", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,"*.GIF",bytesLeft); + lstrcpynA(pfilter, "*.GIF", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,Translate("PNG Bitmaps"),bytesLeft); bytesLeft-=lstrlenA(pfilter); - strncat(pfilter," (*.png)",bytesLeft); + lstrcpynA(pfilter, Translate("PNG Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + strncat(pfilter, " (*.png)", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,"*.PNG",bytesLeft); + lstrcpynA(pfilter, "*.PNG", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,Translate("All Files"),bytesLeft); bytesLeft-=lstrlenA(pfilter); - strncat(pfilter," (*)",bytesLeft); + lstrcpynA(pfilter, Translate("All Files"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + strncat(pfilter, " (*)", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpynA(pfilter,"*",bytesLeft); + lstrcpynA(pfilter, "*", bytesLeft); pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter); if (bytesLeft) *pfilter='\0'; @@ -184,45 +184,45 @@ static INT_PTR BmpFilterGetStrings(WPARAM wParam,LPARAM lParam) } #if defined( _UNICODE ) -static INT_PTR BmpFilterGetStringsW(WPARAM wParam,LPARAM lParam) +static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam) { int bytesLeft=wParam; - TCHAR *filter=(TCHAR*)lParam,*pfilter; + TCHAR *filter=(TCHAR*)lParam, *pfilter; - lstrcpyn(filter,TranslateT("All Bitmaps"),bytesLeft); bytesLeft-=lstrlen(filter); + lstrcpyn(filter, TranslateT("All Bitmaps"), bytesLeft); bytesLeft-=lstrlen(filter); _tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft ); pfilter=filter+lstrlen(filter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,_T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"),bytesLeft); + lstrcpyn(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,TranslateT("Windows Bitmaps"),bytesLeft); bytesLeft-=lstrlen(pfilter); - _tcsncat(pfilter,_T(" (*.bmp;*.rle)"),bytesLeft); + lstrcpyn(pfilter, TranslateT("Windows Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + _tcsncat(pfilter, _T(" (*.bmp;*.rle)"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,_T("*.BMP;*.RLE"),bytesLeft); + lstrcpyn(pfilter, _T("*.BMP;*.RLE"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,TranslateT("JPEG Bitmaps"),bytesLeft); bytesLeft-=lstrlen(pfilter); - _tcsncat(pfilter,_T(" (*.jpg;*.jpeg)"),bytesLeft); + lstrcpyn(pfilter, TranslateT("JPEG Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + _tcsncat(pfilter, _T(" (*.jpg;*.jpeg)"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,_T("*.JPG;*.JPEG"),bytesLeft); + lstrcpyn(pfilter, _T("*.JPG;*.JPEG"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,TranslateT("GIF Bitmaps"),bytesLeft); bytesLeft-=lstrlen(pfilter); - _tcsncat(pfilter,_T(" (*.gif)"),bytesLeft); + lstrcpyn(pfilter, TranslateT("GIF Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + _tcsncat(pfilter, _T(" (*.gif)"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,_T("*.GIF"),bytesLeft); + lstrcpyn(pfilter, _T("*.GIF"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,TranslateT("PNG Bitmaps"),bytesLeft); bytesLeft-=lstrlen(pfilter); - _tcsncat(pfilter,_T(" (*.png)"),bytesLeft); + lstrcpyn(pfilter, TranslateT("PNG Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + _tcsncat(pfilter, _T(" (*.png)"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,_T("*.PNG"),bytesLeft); + lstrcpyn(pfilter, _T("*.PNG"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,TranslateT("All Files"),bytesLeft); bytesLeft-=lstrlen(pfilter); - _tcsncat(pfilter,_T(" (*)"),bytesLeft); + lstrcpyn(pfilter, TranslateT("All Files"), bytesLeft); bytesLeft-=lstrlen(pfilter); + _tcsncat(pfilter, _T(" (*)"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); - lstrcpyn(pfilter,_T("*"),bytesLeft); + lstrcpyn(pfilter, _T("*"), bytesLeft); pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter); if (bytesLeft) *pfilter='\0'; @@ -232,11 +232,11 @@ static INT_PTR BmpFilterGetStringsW(WPARAM wParam,LPARAM lParam) int InitBitmapFilter(void) { - CreateServiceFunction(MS_UTILS_LOADBITMAP,BmpFilterLoadBitmap); - CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGS,BmpFilterGetStrings); + CreateServiceFunction(MS_UTILS_LOADBITMAP, BmpFilterLoadBitmap); + CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGS, BmpFilterGetStrings); #if defined( _UNICODE ) - CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGSW,BmpFilterGetStringsW); - CreateServiceFunction(MS_UTILS_LOADBITMAPW,BmpFilterLoadBitmapW); + CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGSW, BmpFilterGetStringsW); + CreateServiceFunction(MS_UTILS_LOADBITMAPW, BmpFilterLoadBitmapW); #endif return 0; } diff --git a/src/modules/utils/colourpicker.cpp b/src/modules/utils/colourpicker.cpp index 29d25a175f..731f61f1e1 100644 --- a/src/modules/utils/colourpicker.cpp +++ b/src/modules/utils/colourpicker.cpp @@ -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. @@ -22,44 +22,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "..\..\core\commonheaders.h" -static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_CREATE: - SetWindowLongPtr(hwnd,0,0); - SetWindowLongPtr(hwnd,sizeof(COLORREF),0); + SetWindowLongPtr(hwnd, 0, 0); + SetWindowLongPtr(hwnd, sizeof(COLORREF), 0); break; case CPM_SETDEFAULTCOLOUR: - SetWindowLongPtr(hwnd,sizeof(COLORREF),lParam); + SetWindowLongPtr(hwnd, sizeof(COLORREF), lParam); break; case CPM_GETDEFAULTCOLOUR: - return GetWindowLongPtr(hwnd,sizeof(COLORREF)); + return GetWindowLongPtr(hwnd, sizeof(COLORREF)); case CPM_SETCOLOUR: - SetWindowLongPtr(hwnd,0,lParam); - InvalidateRect(hwnd,NULL,FALSE); + SetWindowLongPtr(hwnd, 0, lParam); + InvalidateRect(hwnd, NULL, FALSE); break; case CPM_GETCOLOUR: - return GetWindowLongPtr(hwnd,0); + return GetWindowLongPtr(hwnd, 0); case WM_LBUTTONUP: { CHOOSECOLOR cc={0}; COLORREF custColours[16]={0}; - custColours[0]=GetWindowLongPtr(hwnd,sizeof(COLORREF)); + custColours[0]=GetWindowLongPtr(hwnd, sizeof(COLORREF)); cc.lStructSize=sizeof(CHOOSECOLOR); cc.hwndOwner=hwnd; cc.hInstance=(HWND)hMirandaInst; - cc.rgbResult=GetWindowLongPtr(hwnd,0); + cc.rgbResult=GetWindowLongPtr(hwnd, 0); cc.lpCustColors=custColours; cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT; if (ChooseColor(&cc)) { - SetWindowLongPtr(hwnd,0,cc.rgbResult); - SendMessage(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetDlgCtrlID(hwnd),CPN_COLOURCHANGED),(LPARAM)hwnd); - InvalidateRect(hwnd,NULL,FALSE); + SetWindowLongPtr(hwnd, 0, cc.rgbResult); + SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), CPN_COLOURCHANGED), (LPARAM)hwnd); + InvalidateRect(hwnd, NULL, FALSE); } break; } case WM_ENABLE: - InvalidateRect(hwnd,NULL,FALSE); + InvalidateRect(hwnd, NULL, FALSE); break; case WM_NCPAINT: case WM_PAINT: @@ -68,24 +68,24 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd,UINT message,WPARAM wParam RECT rc; HBRUSH hBrush; - hdc1=BeginPaint(hwnd,&ps); - GetClientRect(hwnd,&rc); - DrawEdge(hdc1,&rc,EDGE_ETCHED,BF_RECT); - InflateRect(&rc,-2,-2); + hdc1=BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rc); + DrawEdge(hdc1, &rc, EDGE_ETCHED, BF_RECT); + InflateRect(&rc, -2, -2); if (IsWindowEnabled(hwnd)) - hBrush=CreateSolidBrush(GetWindowLongPtr(hwnd,0)); + hBrush=CreateSolidBrush(GetWindowLongPtr(hwnd, 0)); else - hBrush=CreateHatchBrush(HS_BDIAGONAL,GetSysColor(COLOR_GRAYTEXT)); - SetBkColor(hdc1,GetSysColor(COLOR_BTNFACE)); - FillRect(hdc1,&rc,hBrush); + hBrush=CreateHatchBrush(HS_BDIAGONAL, GetSysColor(COLOR_GRAYTEXT)); + SetBkColor(hdc1, GetSysColor(COLOR_BTNFACE)); + FillRect(hdc1, &rc, hBrush); DeleteObject(hBrush); - EndPaint(hwnd,&ps); + EndPaint(hwnd, &ps); break; } case WM_DESTROY: break; } - return DefWindowProc(hwnd,message,wParam,lParam); + return DefWindowProc(hwnd, message, wParam, lParam); } int InitColourPicker(void) diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index 8100fe1f48..bde00a35ef 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -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" struct HyperlinkWndData { - HFONT hEnableFont,hDisableFont; + HFONT hEnableFont, hDisableFont; RECT rcText; COLORREF enableColor, disableColor, focusColor; BYTE flags; /* see HLKF_* */ @@ -37,18 +37,18 @@ struct HyperlinkWndData { #define HLK_MEASURETEXT (WM_USER+1) #define HLK_INVALIDATE (WM_USER+2) -static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - struct HyperlinkWndData *dat=(struct HyperlinkWndData*)GetWindowLongPtr(hwnd,0); + struct HyperlinkWndData *dat=(struct HyperlinkWndData*)GetWindowLongPtr(hwnd, 0); switch(msg) { case WM_NCCREATE: dat=(struct HyperlinkWndData*)mir_calloc(sizeof(struct HyperlinkWndData)); if (dat == NULL) return FALSE; /* fail creation */ - SetWindowLongPtr(hwnd,0,(LONG_PTR)dat); /* always succeeds */ + SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); /* always succeeds */ /* fall thru */ case WM_SYSCOLORCHANGE: if (!(dat->flags&HLKF_HASENABLECOLOR)) { - if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor=RGB(0,0,255); + if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor=RGB(0, 0, 255); else dat->enableColor=GetSysColor(COLOR_HOTLIGHT); dat->focusColor = RGB(GetRValue(dat->enableColor) / 2, GetGValue(dat->enableColor) / 2, GetBValue(dat->enableColor) / 2); } @@ -92,7 +92,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM { case VK_SPACE: case VK_RETURN: - SendMessage(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetDlgCtrlID(hwnd),STN_CLICKED),(LPARAM)hwnd); + SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), STN_CLICKED), (LPARAM)hwnd); break; } return 0; @@ -100,9 +100,9 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM case WM_LBUTTONDOWN: { POINT pt; - POINTSTOPOINT(pt,MAKEPOINTS(lParam)); - if (!PtInRect(&dat->rcText,pt)) break; - SendMessage(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetDlgCtrlID(hwnd),STN_CLICKED),(LPARAM)hwnd); + POINTSTOPOINT(pt, MAKEPOINTS(lParam)); + if (!PtInRect(&dat->rcText, pt)) break; + SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), STN_CLICKED), (LPARAM)hwnd); return 0; } case WM_SETFONT: @@ -112,14 +112,14 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM dat->hEnableFont=dat->hDisableFont=NULL; return 0; } - if (GetObject((HFONT)wParam,sizeof(lf),&lf)) { + if (GetObject((HFONT)wParam, sizeof(lf), &lf)) { lf.lfUnderline=1; hFont=CreateFontIndirect(&lf); if (hFont != NULL) { dat->hEnableFont=hFont; dat->hDisableFont=(HFONT)wParam; - if (LOWORD(lParam)) SendMessage(hwnd,HLK_INVALIDATE,0,0); - SendMessage(hwnd,HLK_MEASURETEXT,0,0); + if (LOWORD(lParam)) SendMessage(hwnd, HLK_INVALIDATE, 0, 0); + SendMessage(hwnd, HLK_MEASURETEXT, 0, 0); } } return 0; @@ -131,17 +131,17 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM { RECT rcWnd; POINT pt; HWND hwndParent; - if (!GetWindowRect(hwnd,&rcWnd)) break; + if (!GetWindowRect(hwnd, &rcWnd)) break; pt.x=rcWnd.left; pt.y=rcWnd.top; hwndParent=GetParent(hwnd); if (hwndParent == NULL) hwndParent=hwnd; - if (!ScreenToClient(hwndParent,&pt)) break; + if (!ScreenToClient(hwndParent, &pt)) break; rcWnd.right=pt.x+(rcWnd.right-rcWnd.left); rcWnd.bottom=pt.y+(rcWnd.bottom-rcWnd.top); rcWnd.left=pt.x; rcWnd.top=pt.y; - InvalidateRect(hwndParent,&rcWnd,TRUE); + InvalidateRect(hwndParent, &rcWnd, TRUE); return 0; } case WM_GETFONT: @@ -149,7 +149,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM case WM_CREATE: case HLK_MEASURETEXT: { TCHAR szText[256]; - if (!GetWindowText(hwnd,szText,SIZEOF(szText))) return 0; + if (!GetWindowText(hwnd, szText, SIZEOF(szText))) return 0; lParam=(LPARAM)szText; /* fall thru */ case WM_SETTEXT: @@ -161,35 +161,35 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM BOOL fMeasured=FALSE; hdc=GetDC(hwnd); if (hdc == NULL) return 0; /* text change failed */ - if (dat->hEnableFont != NULL) hPrevFont=(HFONT)SelectObject(hdc,dat->hEnableFont); + if (dat->hEnableFont != NULL) hPrevFont=(HFONT)SelectObject(hdc, dat->hEnableFont); if (dat->hEnableFont == NULL || hPrevFont != NULL) /* select failed? */ - if (GetTextExtentPoint32(hdc,(TCHAR*)lParam,lstrlen((TCHAR*)lParam),&textSize)) - if (GetClientRect(hwnd,&rc)) { + if (GetTextExtentPoint32(hdc, (TCHAR*)lParam, lstrlen((TCHAR*)lParam), &textSize)) + if (GetClientRect(hwnd, &rc)) { dat->rcText.top=0; dat->rcText.bottom=dat->rcText.top+textSize.cy; - style=GetWindowLongPtr(hwnd,GWL_STYLE); + style=GetWindowLongPtr(hwnd, GWL_STYLE); if (style&SS_CENTER) dat->rcText.left=(rc.right-textSize.cx)/2; else if (style&SS_RIGHT) dat->rcText.left=rc.right-textSize.cx; else dat->rcText.left=0; dat->rcText.right=dat->rcText.left+textSize.cx; fMeasured=TRUE; } - if (dat->hEnableFont != NULL && hPrevFont != NULL) SelectObject(hdc,hPrevFont); - ReleaseDC(hwnd,hdc); + if (dat->hEnableFont != NULL && hPrevFont != NULL) SelectObject(hdc, hPrevFont); + ReleaseDC(hwnd, hdc); if (!fMeasured) return 0; /* text change failed */ - SendMessage(hwnd,HLK_INVALIDATE,0,0); + SendMessage(hwnd, HLK_INVALIDATE, 0, 0); break; }} case WM_SETCURSOR: { POINT pt; HCURSOR hCursor; if (!GetCursorPos(&pt)) return FALSE; - if (!ScreenToClient(hwnd,&pt)) return FALSE; - if (PtInRect(&dat->rcText,pt)) { - hCursor=(HCURSOR)GetClassLongPtr(hwnd,GCLP_HCURSOR); - if (hCursor == NULL) hCursor=LoadCursor(NULL,IDC_HAND); /* Win2000+ */ + if (!ScreenToClient(hwnd, &pt)) return FALSE; + if (PtInRect(&dat->rcText, pt)) { + hCursor=(HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR); + if (hCursor == NULL) hCursor=LoadCursor(NULL, IDC_HAND); /* Win2000+ */ } - else hCursor=LoadCursor(NULL,IDC_ARROW); + else hCursor=LoadCursor(NULL, IDC_ARROW); SetCursor(hCursor); return TRUE; } @@ -217,16 +217,16 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM PAINTSTRUCT ps; HDC hdc; - hdc=BeginPaint(hwnd,&ps); + hdc=BeginPaint(hwnd, &ps); if (hdc != NULL) { if (IsWindowEnabled(hwnd)) { - hPrevFont=(HFONT)SelectObject(hdc,dat->hEnableFont); + hPrevFont=(HFONT)SelectObject(hdc, dat->hEnableFont); textColor = (GetFocus() == hwnd) ? dat->focusColor : dat->enableColor; } else { - hPrevFont=(HFONT)SelectObject(hdc,dat->hDisableFont); + hPrevFont=(HFONT)SelectObject(hdc, dat->hDisableFont); textColor=dat->disableColor; } - if (GetClientRect(hwnd,&rc) && GetWindowText(hwnd,szText,SIZEOF(szText))) { + if (GetClientRect(hwnd, &rc) && GetWindowText(hwnd, szText, SIZEOF(szText))) { if (drawThemeParentBackground && IsWinVerXPPlus()) { BOOL fSmoothing; @@ -236,13 +236,13 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM if (fSmoothing && fSmoothingType == FE_FONTSMOOTHINGCLEARTYPE) drawThemeParentBackground(hwnd, hdc, &rc); } - SetBkMode(hdc,TRANSPARENT); - SetTextColor(hdc,textColor); - alignFlag=(GetWindowLongPtr(hwnd,GWL_STYLE)&(SS_CENTER|SS_RIGHT|SS_LEFT)); - DrawText(hdc,szText,-1,&rc,alignFlag|DT_NOPREFIX|DT_SINGLELINE|DT_TOP); + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, textColor); + alignFlag=(GetWindowLongPtr(hwnd, GWL_STYLE)&(SS_CENTER|SS_RIGHT|SS_LEFT)); + DrawText(hdc, szText, -1, &rc, alignFlag|DT_NOPREFIX|DT_SINGLELINE|DT_TOP); } - if (hPrevFont != NULL) SelectObject(hdc,hPrevFont); - EndPaint(hwnd,&ps); + if (hPrevFont != NULL) SelectObject(hdc, hPrevFont); + EndPaint(hwnd, &ps); } return 0; } @@ -251,7 +251,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM mir_free(dat); break; } - return DefWindowProc(hwnd,msg,wParam,lParam); + return DefWindowProc(hwnd, msg, wParam, lParam); } int InitHyperlink(void) @@ -263,7 +263,7 @@ int InitHyperlink(void) wcl.cbWndExtra=sizeof(struct HyperlinkWndData*); wcl.hInstance=hMirandaInst; if (IsWinVer2000Plus()) wcl.hCursor=NULL; - else wcl.hCursor=LoadCursor(wcl.hInstance,MAKEINTRESOURCE(IDC_HYPERLINKHAND)); + else wcl.hCursor=LoadCursor(wcl.hInstance, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); wcl.lpszClassName=WNDCLASS_HYPERLINK; wcl.hbrBackground=NULL; wcl.hIcon=NULL; diff --git a/src/modules/utils/imgconv.cpp b/src/modules/utils/imgconv.cpp index 431ae3343d..118ffc3acb 100644 --- a/src/modules/utils/imgconv.cpp +++ b/src/modules/utils/imgconv.cpp @@ -10,7 +10,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. diff --git a/src/modules/utils/md5.cpp b/src/modules/utils/md5.cpp index 3fb835abdd..241aa2270f 100644 --- a/src/modules/utils/md5.cpp +++ b/src/modules/utils/md5.cpp @@ -5,7 +5,7 @@ warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -126,7 +126,7 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]*/) { mir_md5_word_t - a = pms->abcd[0], b = pms->abcd[1], + a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], d = pms->abcd[3]; mir_md5_word_t t; /* Define storage for little-endian or both types of CPUs. */ @@ -175,10 +175,10 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]* /* Round 1. */ /* Let [abcd k s i] denote the operation - a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ + a = b + ((a + F(b, c, d) + X[k] + T[i]) <<< s). */ #define F(x, y, z) (((x) & (y)) | (~(x) & (z))) #define SET1(a, b, c, d, k, s, Ti)\ - t = a + F(b,c,d) + X[k] + Ti;\ + t = a + F(b, c, d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET1(a, b, c, d, 0, 7, T1); @@ -200,10 +200,10 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]* /* Round 2. */ /* Let [abcd k s i] denote the operation - a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ + a = b + ((a + G(b, c, d) + X[k] + T[i]) <<< s). */ #define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define SET2(a, b, c, d, k, s, Ti)\ - t = a + G(b,c,d) + X[k] + Ti;\ + t = a + G(b, c, d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET2(a, b, c, d, 1, 5, T17); @@ -225,10 +225,10 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]* /* Round 3. */ /* Let [abcd k s t] denote the operation - a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ + a = b + ((a + H(b, c, d) + X[k] + T[i]) <<< s). */ #define H(x, y, z) ((x) ^ (y) ^ (z)) #define SET3(a, b, c, d, k, s, Ti)\ - t = a + H(b,c,d) + X[k] + Ti;\ + t = a + H(b, c, d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET3(a, b, c, d, 5, 4, T33); @@ -250,10 +250,10 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]* /* Round 4. */ /* Let [abcd k s t] denote the operation - a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ + a = b + ((a + I(b, c, d) + X[k] + T[i]) <<< s). */ #define I(x, y, z) ((y) ^ ((x) | ~(z))) #define SET4(a, b, c, d, k, s, Ti)\ - t = a + I(b,c,d) + X[k] + Ti;\ + t = a + I(b, c, d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET4(a, b, c, d, 0, 6, T49); @@ -331,9 +331,9 @@ void md5_append(mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes) void md5_finish(mir_md5_state_t *pms, mir_md5_byte_t digest[16]) { static const mir_md5_byte_t pad[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; mir_md5_byte_t data[8]; diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index fb10c5f43c..46e95f954e 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -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. @@ -27,24 +27,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WNDCLASS_DDEMSGWINDOW _T("MirandaDdeMsgWindow") struct DdeMsgWindowData { - int fAcked,fData; + int fAcked, fData; HWND hwndDde; }; -static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +static LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct DdeMsgWindowData *dat; ATOM hSzItem; HGLOBAL hDdeData; - dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwnd,0); + dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwnd, 0); switch(msg) { case WM_DDE_ACK: dat->fAcked=1; dat->hwndDde=(HWND)wParam; return 0; case WM_DDE_DATA: - UnpackDDElParam(msg,lParam,(PUINT_PTR)&hDdeData,(PUINT_PTR)&hSzItem); + UnpackDDElParam(msg, lParam, (PUINT_PTR)&hDdeData, (PUINT_PTR)&hSzItem); dat->fData=1; if (hDdeData) { DDEDATA *data; @@ -52,7 +52,7 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM data=(DDEDATA*)GlobalLock(hDdeData); if (data->fAckReq) { DDEACK ack={0}; - PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,PackDDElParam(WM_DDE_ACK,*(PUINT)&ack,(UINT)hSzItem)); + PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, PackDDElParam(WM_DDE_ACK, *(PUINT)&ack, (UINT)hSzItem)); } else GlobalDeleteAtom(hSzItem); release=data->fRelease; @@ -62,32 +62,32 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM else GlobalDeleteAtom(hSzItem); return 0; } - return DefWindowProc(hwnd,msg,wParam,lParam); + return DefWindowProc(hwnd, msg, wParam, lParam); } -static int DoDdeRequest(const char *szItemName,HWND hwndDdeMsg) +static int DoDdeRequest(const char *szItemName, HWND hwndDdeMsg) { ATOM hSzItemName; - DWORD timeoutTick,thisTick; + DWORD timeoutTick, thisTick; MSG msg; - struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg,0); + struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg, 0); hSzItemName=GlobalAddAtomA(szItemName); - if (!PostMessage(dat->hwndDde,WM_DDE_REQUEST,(WPARAM)hwndDdeMsg,MAKELPARAM(CF_TEXT,hSzItemName))) { + if (!PostMessage(dat->hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDdeMsg, MAKELPARAM(CF_TEXT, hSzItemName))) { GlobalDeleteAtom(hSzItemName); return 1; } timeoutTick=GetTickCount()+5000; dat->fData=0; dat->fAcked=0; do { - if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if (dat->fData || dat->fAcked) break; thisTick=GetTickCount(); if (thisTick>timeoutTick) break; - } while (MsgWaitForMultipleObjects(0,NULL,FALSE,timeoutTick-thisTick,QS_ALLINPUT) == WAIT_OBJECT_0); + } while (MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutTick-thisTick, QS_ALLINPUT) == WAIT_OBJECT_0); if (!dat->fData) { GlobalDeleteAtom(hSzItemName); @@ -97,31 +97,31 @@ static int DoDdeRequest(const char *szItemName,HWND hwndDdeMsg) } //see Q160957 and http://developer.netscape.com/docs/manuals/communicator/DDE/index.htm -static int DdeOpenUrl(const char *szBrowser,char *szUrl,int newWindow,HWND hwndDdeMsg) +static int DdeOpenUrl(const char *szBrowser, char *szUrl, int newWindow, HWND hwndDdeMsg) { - ATOM hSzBrowser,hSzTopic; + ATOM hSzBrowser, hSzTopic; DWORD_PTR dwResult; char *szItemName; - struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg,0); + struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg, 0); hSzBrowser=GlobalAddAtomA(szBrowser); hSzTopic=GlobalAddAtomA("WWW_OpenURL"); dat->fAcked=0; - if (!SendMessageTimeout(HWND_BROADCAST,WM_DDE_INITIATE,(WPARAM)hwndDdeMsg,MAKELPARAM(hSzBrowser,hSzTopic),SMTO_ABORTIFHUNG|SMTO_NORMAL,DDEMESSAGETIMEOUT,&dwResult) + if (!SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDdeMsg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, &dwResult) || !dat->fAcked) { GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); return 1; } szItemName=(char*)mir_alloc(lstrlenA(szUrl)+7); - wsprintfA(szItemName,"\"%s\",,%d",szUrl,newWindow?0:-1); - if (DoDdeRequest(szItemName,hwndDdeMsg)) { + wsprintfA(szItemName, "\"%s\", , %d", szUrl, newWindow?0:-1); + if (DoDdeRequest(szItemName, hwndDdeMsg)) { mir_free(szItemName); GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); return 1; } - PostMessage(dat->hwndDde,WM_DDE_TERMINATE,(WPARAM)hwndDdeMsg,0); + PostMessage(dat->hwndDde, WM_DDE_TERMINATE, (WPARAM)hwndDdeMsg, 0); GlobalDeleteAtom(hSzTopic); GlobalDeleteAtom(hSzBrowser); mir_free(szItemName); @@ -147,25 +147,25 @@ static void OpenURLThread(void *arg) int success=0; if (!hUrlInfo->szUrl) return; - hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW,_T(""),0,0,0,0,0,NULL,NULL,hMirandaInst,NULL); - SetWindowLongPtr(hwndDdeMsg,0,(LONG_PTR)&msgWndData); + hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW, _T(""), 0, 0, 0, 0, 0, NULL, NULL, hMirandaInst, NULL); + SetWindowLongPtr(hwndDdeMsg, 0, (LONG_PTR)&msgWndData); - if (!_strnicmp(hUrlInfo->szUrl,"ftp:",4) || !_strnicmp(hUrlInfo->szUrl,"ftp.",4)) pszProtocol="ftp"; - if (!_strnicmp(hUrlInfo->szUrl,"mailto:",7)) pszProtocol="mailto"; - if (!_strnicmp(hUrlInfo->szUrl,"news:",5)) pszProtocol="news"; + if (!_strnicmp(hUrlInfo->szUrl, "ftp:", 4) || !_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) pszProtocol="ftp"; + if (!_strnicmp(hUrlInfo->szUrl, "mailto:", 7)) pszProtocol="mailto"; + if (!_strnicmp(hUrlInfo->szUrl, "news:", 5)) pszProtocol="news"; else pszProtocol="http"; - wsprintfA(szSubkey,"%s\\shell\\open\\command",pszProtocol); - if (RegOpenKeyExA(HKEY_CURRENT_USER,szSubkey,0,KEY_QUERY_VALUE,&hKey) == ERROR_SUCCESS - || RegOpenKeyExA(HKEY_CLASSES_ROOT,szSubkey,0,KEY_QUERY_VALUE,&hKey) == ERROR_SUCCESS) { + wsprintfA(szSubkey, "%s\\shell\\open\\command", pszProtocol); + if (RegOpenKeyExA(HKEY_CURRENT_USER, szSubkey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS + || RegOpenKeyExA(HKEY_CLASSES_ROOT, szSubkey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { dataLength=SIZEOF(szCommandName); - if (RegQueryValueEx(hKey,NULL,NULL,NULL,(PBYTE)szCommandName,&dataLength) == ERROR_SUCCESS) { + if (RegQueryValueEx(hKey, NULL, NULL, NULL, (PBYTE)szCommandName, &dataLength) == ERROR_SUCCESS) { _strlwr(szCommandName); - if (strstr(szCommandName,"mozilla") || strstr(szCommandName,"netscape")) - success=(DdeOpenUrl("mozilla",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg) == 0 || DdeOpenUrl("netscape",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg) == 0); - else if (strstr(szCommandName,"iexplore") || strstr(szCommandName,"msimn")) - success=0 == DdeOpenUrl("iexplore",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg); - else if (strstr(szCommandName,"opera")) - success=0 == DdeOpenUrl("opera",hUrlInfo->szUrl,hUrlInfo->newWindow,hwndDdeMsg); + if (strstr(szCommandName, "mozilla") || strstr(szCommandName, "netscape")) + success=(DdeOpenUrl("mozilla", hUrlInfo->szUrl, hUrlInfo->newWindow, hwndDdeMsg) == 0 || DdeOpenUrl("netscape", hUrlInfo->szUrl, hUrlInfo->newWindow, hwndDdeMsg) == 0); + else if (strstr(szCommandName, "iexplore") || strstr(szCommandName, "msimn")) + success=0 == DdeOpenUrl("iexplore", hUrlInfo->szUrl, hUrlInfo->newWindow, hwndDdeMsg); + else if (strstr(szCommandName, "opera")) + success=0 == DdeOpenUrl("opera", hUrlInfo->szUrl, hUrlInfo->newWindow, hwndDdeMsg); //opera's the default anyway } RegCloseKey(hKey); @@ -177,20 +177,20 @@ static void OpenURLThread(void *arg) //wack a protocol on it if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\') { szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+9); - wsprintfA(szResult,"file:///%s",hUrlInfo->szUrl); + wsprintfA(szResult, "file:///%s", hUrlInfo->szUrl); } else { int i; for (i=0;isalpha(hUrlInfo->szUrl[i]);i++); if (hUrlInfo->szUrl[i] == ':') szResult=mir_strdup(hUrlInfo->szUrl); else { - if (!_strnicmp(hUrlInfo->szUrl,"ftp.",4)) { + if (!_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) { szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+7); - wsprintfA(szResult,"ftp://%s",hUrlInfo->szUrl); + wsprintfA(szResult, "ftp://%s", hUrlInfo->szUrl); } else { szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+8); - wsprintfA(szResult,"http://%s",hUrlInfo->szUrl); + wsprintfA(szResult, "http://%s", hUrlInfo->szUrl); } } } @@ -201,7 +201,7 @@ static void OpenURLThread(void *arg) return; } -static INT_PTR OpenURL(WPARAM wParam,LPARAM lParam) { +static INT_PTR OpenURL(WPARAM wParam, LPARAM lParam) { TOpenUrlInfo *hUrlInfo = (TOpenUrlInfo*)mir_alloc(sizeof(TOpenUrlInfo)); hUrlInfo->szUrl = (char*)lParam?mir_strdup((char*)lParam):NULL; hUrlInfo->newWindow = (int)wParam; @@ -223,6 +223,6 @@ int InitOpenUrl(void) wcl.lpszMenuName=NULL; wcl.style=0; RegisterClass(&wcl); - CreateServiceFunction(MS_UTILS_OPENURL,OpenURL); + CreateServiceFunction(MS_UTILS_OPENURL, OpenURL); return 0; } diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index ed29b7fa24..49e5ae8bf4 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -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. @@ -231,7 +231,7 @@ static INT_PTR createDirTreeW(WPARAM, LPARAM lParam) int InitPathUtilsW(void) { GetModuleFileName(hMirandaInst, szMirandaPathW, SIZEOF(szMirandaPathW)); - TCHAR *p = _tcsrchr(szMirandaPathW,'\\'); + TCHAR *p = _tcsrchr(szMirandaPathW, '\\'); if ( p ) p[1] = 0; mir_sntprintf(szMirandaPathWLower, SIZEOF(szMirandaPathWLower), _T("%s"), szMirandaPathW); @@ -457,7 +457,7 @@ XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact) if (!_xcscmp(theKey, XSTR(key, "nick"))) theValue = GetContactNickX(key, hContact); else if (!_xcscmp(theKey, XSTR(key, "proto"))) - theValue = mir_a2x(key, (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact,0)); + theValue = mir_a2x(key, (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); else if (!_xcscmp(theKey, XSTR(key, "userid"))) theValue = GetContactIDX(key, hContact); } @@ -478,11 +478,11 @@ XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact) else if (!_xcscmp(theKey, XSTR(key, "username"))) theValue = GetUserNameX(key); else if (!_xcscmp(theKey, XSTR(key, "miranda_avatarcache"))) - theValue = GetPathVarX(key,1); + theValue = GetPathVarX(key, 1); else if (!_xcscmp(theKey, XSTR(key, "miranda_logpath"))) - theValue = GetPathVarX(key,2); + theValue = GetPathVarX(key, 2); else if (!_xcscmp(theKey, XSTR(key, "miranda_userdata"))) - theValue = GetPathVarX(key,3); + theValue = GetPathVarX(key, 3); } if (!theValue) @@ -583,7 +583,7 @@ int InitPathUtils(void) { char *p = 0; GetModuleFileNameA(hMirandaInst, szMirandaPath, SIZEOF(szMirandaPath)); - p = strrchr(szMirandaPath,'\\'); + p = strrchr(szMirandaPath, '\\'); if ( p ) p[1] = 0; mir_snprintf(szMirandaPathLower, MAX_PATH, "%s", szMirandaPath); diff --git a/src/modules/utils/resizer.cpp b/src/modules/utils/resizer.cpp index b68e874753..1ddfa3fb75 100644 --- a/src/modules/utils/resizer.cpp +++ b/src/modules/utils/resizer.cpp @@ -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. @@ -59,10 +59,10 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) START_OF_DLGTEMPLATEEX *pTemplateEx; UTILRESIZECONTROL urc; int procResult; - int extendedDlg,itemCount; + int extendedDlg, itemCount; if (urd == NULL||urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1; - pTemplate=(DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance,FindResourceA(urd->hInstance,urd->lpTemplate,MAKEINTRESOURCEA(5)))); + pTemplate=(DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance, FindResourceA(urd->hInstance, urd->lpTemplate, MAKEINTRESOURCEA(5)))); pTemplateEx=(START_OF_DLGTEMPLATEEX*)pTemplate; extendedDlg=pTemplateEx->signature == 0xFFFF; if (extendedDlg && pTemplateEx->dlgVer != 1) @@ -75,7 +75,7 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) while (*pWord++); //title if (extendedDlg) { if (pTemplateEx->style&DS_SETFONT) { - pWord+=3; //font size,weight,italic + pWord+=3; //font size, weight, italic while (*pWord++); //font name } } @@ -90,9 +90,9 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) rc.left=0; rc.top=0; if (extendedDlg) {rc.right=pTemplateEx->cx; rc.bottom=pTemplateEx->cy;} else {rc.right=pTemplate->cx; rc.bottom=pTemplate->cy;} - MapDialogRect(urd->hwndDlg,&rc); + MapDialogRect(urd->hwndDlg, &rc); urc.dlgOriginalSize.cx=rc.right; urc.dlgOriginalSize.cy=rc.bottom; - GetClientRect(urd->hwndDlg,&rc); + GetClientRect(urd->hwndDlg, &rc); urc.dlgNewSize.cx=rc.right; urc.dlgNewSize.cy=rc.bottom; if (extendedDlg) itemCount=pTemplateEx->cDlgItems; @@ -123,8 +123,8 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) if (urc.wId == 65535) continue; //using this breaks the dwp, so just ignore it - MapDialogRect(urd->hwndDlg,&urc.rcItem); - procResult=(urd->pfnResizer)(urd->hwndDlg,urd->lParam,&urc); + MapDialogRect(urd->hwndDlg, &urc.rcItem); + procResult=(urd->pfnResizer)(urd->hwndDlg, urd->lParam, &urc); if (procResult&RD_ANCHORX_RIGHT) { urc.rcItem.left+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx; urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx; @@ -145,7 +145,7 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) urc.rcItem.top+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2; urc.rcItem.bottom+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2; } - hDwp = DeferWindowPos(hDwp,GetDlgItem(urd->hwndDlg,extendedDlg?pItemEx->id:pItem->id),0,urc.rcItem.left,urc.rcItem.top,urc.rcItem.right-urc.rcItem.left,urc.rcItem.bottom-urc.rcItem.top,SWP_NOZORDER); + hDwp = DeferWindowPos(hDwp, GetDlgItem(urd->hwndDlg, extendedDlg?pItemEx->id:pItem->id), 0, urc.rcItem.left, urc.rcItem.top, urc.rcItem.right-urc.rcItem.left, urc.rcItem.bottom-urc.rcItem.top, SWP_NOZORDER); } EndDeferWindowPos(hDwp); return 0; diff --git a/src/modules/utils/sha1.cpp b/src/modules/utils/sha1.cpp index 3900d67fff..3d71239bab 100644 --- a/src/modules/utils/sha1.cpp +++ b/src/modules/utils/sha1.cpp @@ -6,7 +6,7 @@ * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * - * Software distributed under the License is distributed on an "AS IS" basis, + * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. @@ -22,7 +22,7 @@ * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to @@ -119,11 +119,11 @@ void shaBlock(mir_sha1_byte_t *dataIn, int len, mir_sha1_byte_t hashout[20]) { } -#define SHA_ROTL(X,n) (((X) << (n)) | ((X) >> (32-(n)))) +#define SHA_ROTL(X, n) (((X) << (n)) | ((X) >> (32-(n)))) static void shaHashBlock(mir_sha1_ctx *ctx) { int t; - unsigned long A,B,C,D,E,TEMP; + unsigned long A, B, C, D, E, TEMP; for (t = 16; t <= 79; t++) ctx->W[t] = @@ -136,19 +136,19 @@ static void shaHashBlock(mir_sha1_ctx *ctx) { E = ctx->H[4]; for (t = 0; t <= 19; t++) { - TEMP = SHA_ROTL(A,5) + (((C^D)&B)^D) + E + ctx->W[t] + 0x5a827999L; + TEMP = SHA_ROTL(A, 5) + (((C^D)&B)^D) + E + ctx->W[t] + 0x5a827999L; E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; } for (t = 20; t <= 39; t++) { - TEMP = SHA_ROTL(A,5) + (B^C^D) + E + ctx->W[t] + 0x6ed9eba1L; + TEMP = SHA_ROTL(A, 5) + (B^C^D) + E + ctx->W[t] + 0x6ed9eba1L; E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; } for (t = 40; t <= 59; t++) { - TEMP = SHA_ROTL(A,5) + ((B&C)|(D&(B|C))) + E + ctx->W[t] + 0x8f1bbcdcL; + TEMP = SHA_ROTL(A, 5) + ((B&C)|(D&(B|C))) + E + ctx->W[t] + 0x8f1bbcdcL; E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; } for (t = 60; t <= 79; t++) { - TEMP = SHA_ROTL(A,5) + (B^C^D) + E + ctx->W[t] + 0xca62c1d6L; + TEMP = SHA_ROTL(A, 5) + (B^C^D) + E + ctx->W[t] + 0xca62c1d6L; E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; } diff --git a/src/modules/utils/timeutils.cpp b/src/modules/utils/timeutils.cpp index 0b39d47ea9..cea409ef82 100644 --- a/src/modules/utils/timeutils.cpp +++ b/src/modules/utils/timeutils.cpp @@ -1,7 +1,7 @@ /* Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2010 Miranda ICQ/IM project, +Copyright 2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -10,7 +10,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. @@ -93,16 +93,16 @@ void FormatTime(const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, int if (iso) { - dateTimeStrLen = mir_sntprintf(dateTimeStr, SIZEOF(dateTimeStr), + dateTimeStrLen = mir_sntprintf(dateTimeStr, SIZEOF(dateTimeStr), _T("%d-%02d-%02dT%02d:%02d:%02dZ"), st->wYear, st->wMonth, st->wDay, st->wHour, st->wMinute, st->wSecond) + 1; } else if (date) - dateTimeStrLen = GetDateFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, + dateTimeStrLen = GetDateFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, SIZEOF(dateTimeStr)); else - dateTimeStrLen = GetTimeFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, + dateTimeStrLen = GetTimeFormat(LOCALE_USER_DEFAULT, fmt, st, NULL, dateTimeStr, SIZEOF(dateTimeStr)); if (dateTimeStrLen) --dateTimeStrLen; @@ -158,7 +158,7 @@ void ConvertToAbsolute (const SYSTEMTIME * pstLoc, const SYSTEMTIME * pstDst, SY // Now iDay is a day of the month ranging from 1 to 7. // Recall that the wDay field of the structure can range - // from 1 to 5, 1 meaning "first", 2 meaning "second", + // from 1 to 5, 1 meaning "first", 2 meaning "second", // and 5 meaning "last". // So, increase iDay so it's the proper day of the month. diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index b7947d6e98..1fe186d633 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -1,7 +1,7 @@ /* Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2010 Miranda ICQ/IM project, +Copyright 2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -10,7 +10,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. diff --git a/src/modules/utils/utf.cpp b/src/modules/utils/utf.cpp index 670f9f5edf..4c86e1c4ee 100644 --- a/src/modules/utils/utf.cpp +++ b/src/modules/utils/utf.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. @@ -14,7 +14,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,14 +29,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* number of following bytes in sequence based on first byte value (for bytes above 0x7f) */ static const char utf8_length[128] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80-0x8f */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x90-0x9f */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xa0-0xaf */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xb0-0xbf */ - 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0xc0-0xcf */ - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0xd0-0xdf */ - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, /* 0xe0-0xef */ - 3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0 /* 0xf0-0xff */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80-0x8f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x9f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xaf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0-0xbf */ + 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xc0-0xcf */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xd0-0xdf */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xe0-0xef */ + 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 0xf0-0xff */ }; /* first byte mask depending on UTF-8 sequence length */ diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 2e113f877a..de49be7ab1 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.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. @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "..\..\core\commonheaders.h" -INT_PTR ResizeDialog(WPARAM wParam,LPARAM lParam); +INT_PTR ResizeDialog(WPARAM wParam, LPARAM lParam); int InitOpenUrl(void); int InitWindowList(void); void FreeWindowList(void); @@ -39,262 +39,262 @@ INT_PTR GetSHA1Interface(WPARAM, LPARAM); static BOOL bModuleInitialized = FALSE; static struct CountryListEntry countries[]={ - {0 ,"Unspecified"}, - {9999,"Other"}, - {0xFFFF,"Unknown"}, - {93 ,"Afghanistan"}, - {355 ,"Albania"}, - {213 ,"Algeria"}, - {376 ,"Andorra"}, - {244 ,"Angola"}, - {1264,"Anguilla"}, /* change county code to NANP (from 101) */ - {1268,"Antigua and Barbuda"}, /* change county code to NANP (from 1021) */ -// {5902,"Antilles"}, /* removed: it is not a country, it's a group of islands from diffrent countries (all are included in the list)*/ - {54 ,"Argentina"}, - {374 ,"Armenia"}, - {297 ,"Aruba"}, - {247 ,"Ascension Island"}, - {61 ,"Australia"}, - {6720 ,"Australia, Antarctic Territory"}, /* added country code 672(0)*/ - {614 ,"Australia, Christmas Island"}, /* rename (from Christmas Island) and change to official county code 61(4) (from 672) */ - {61891,"Australia, Cocos (Keeling) Islands"}, /* rename and change to official county code 61(891) (from 6102) */ - {6723 ,"Australia, Norfolk Island"}, /* rename (from Norfolk Island) and change to official county code 672(3) (from 6722) */ - {43 ,"Austria"}, - {994 ,"Azerbaijan"}, - {1242,"Bahamas"}, /* change county code to NANP (from 103) */ - {973 ,"Bahrain"}, - {880 ,"Bangladesh"}, - {1246,"Barbados"}, /* change county code to NANP (from 103) */ -// {120 ,"Barbuda"}, /* removed: it is not a country and no special island, see Antigua and Barbuda*/ - {375 ,"Belarus"}, - {32 ,"Belgium"}, - {501 ,"Belize"}, - {229 ,"Benin"}, - {1441,"Bermuda"}, /* change county code to NANP (from 105) */ - {975 ,"Bhutan"}, - {591 ,"Bolivia"}, - {387 ,"Bosnia and Herzegovina"}, - {267 ,"Botswana"}, - {55 ,"Brazil"}, - {673 ,"Brunei"}, - {359 ,"Bulgaria"}, - {226 ,"Burkina Faso"}, - {257 ,"Burundi"}, - {855 ,"Cambodia"}, - {237 ,"Cameroon"}, - {1002,"Canada"}, /* change county code to NANP (from 107 to virtual 1(002) -> reflect NANP*/ - {238 ,"Cape Verde Islands"}, - {1345,"Cayman Islands"}, /* change county code to NANP (from 108) */ - {236 ,"Central African Republic"}, - {235 ,"Chad"}, - {56 ,"Chile, Republic of"}, - {86 ,"China"}, -// {6101,"Cocos-Keeling Islands"}, /* removed (double): see Australia, Cocos (Keeling) Islands */ - {57 ,"Colombia"}, - {269 ,"Comoros"}, /* change county code (from 2691) */ - {243 ,"Congo, Democratic Republic of (Zaire)"}, - {242 ,"Congo, Republic of the"}, - {682 ,"Cook Islands"}, - {506 ,"Costa Rica"}, - {225 ,"Cote d'Ivoire (Ivory Coast)"}, - {385 ,"Croatia"}, - {53 ,"Cuba"}, - {357 ,"Greek, Republic of South Cyprus"}, /* rename coz Turkey, Republic of Northern Cyprus */ - {420 ,"Czech Republic"}, - {45 ,"Denmark"}, - {246 ,"Diego Garcia"}, - {253 ,"Djibouti"}, - {1767,"Dominica"}, /* change county code to NANP (from 109) */ - {1809,"Dominican Republic"}, /* change county code to NANP 809, 829, 849 (from 110) */ - {593 ,"Ecuador"}, - {20 ,"Egypt"}, - {503 ,"El Salvador"}, - {240 ,"Equatorial Guinea"}, - {291 ,"Eritrea"}, - {372 ,"Estonia"}, - {251 ,"Ethiopia"}, - {3883,"Europe"}, /* add county code +388 3 official European Telephony Numbering Space*/ - {298 ,"Faeroe Islands"}, - {500 ,"Falkland Islands"}, - {679 ,"Fiji"}, - {358 ,"Finland"}, - {33 ,"France"}, - {5901,"French Antilles"}, - {594 ,"French Guiana"}, - {689 ,"French Polynesia"}, - {241 ,"Gabon"}, - {220 ,"Gambia"}, - {995 ,"Georgia"}, - {49 ,"Germany"}, - {233 ,"Ghana"}, - {350 ,"Gibraltar"}, - {30 ,"Greece"}, - {299 ,"Greenland"}, - {1473,"Grenada"}, /* change county code to NANP (from 111) */ - {590 ,"Guadeloupe"}, - {1671,"Guam, US Territory of"}, /* change county code to NANP (from 671) */ - {502 ,"Guatemala"}, - {224 ,"Guinea"}, - {245 ,"Guinea-Bissau"}, - {592 ,"Guyana"}, - {509 ,"Haiti"}, - {504 ,"Honduras"}, - {852 ,"Hong Kong"}, - {36 ,"Hungary"}, - {354 ,"Iceland"}, - {91 ,"India"}, - {62 ,"Indonesia"}, - {98 ,"Iran (Islamic Republic of)"}, - {964 ,"Iraq"}, - {353 ,"Ireland"}, - {972 ,"Israel"}, - {39 ,"Italy"}, - {1876,"Jamaica"}, /* change county code to NANP (from 112) */ - {81 ,"Japan"}, - {962 ,"Jordan"}, - {705 ,"Kazakhstan"}, - {254 ,"Kenya"}, - {686 ,"Kiribati"}, - {850 ,"Korea, North"}, - {82 ,"Korea, South"}, - {965 ,"Kuwait"}, - {996 ,"Kyrgyzstan"}, /* change county code (from 706) */ - {856 ,"Laos"}, - {371 ,"Latvia"}, - {961 ,"Lebanon"}, - {266 ,"Lesotho"}, - {231 ,"Liberia"}, - {218 ,"Libyan Arab Jamahiriya"}, - {423 ,"Liechtenstein"}, /* change county code (from 4101) */ - {370 ,"Lithuania"}, - {352 ,"Luxembourg"}, - {853 ,"Macau"}, - {389 ,"Macedonia, Republic of"}, /* rename coz war */ - {261 ,"Madagascar"}, - {265 ,"Malawi"}, - {60 ,"Malaysia"}, - {960 ,"Maldives"}, - {223 ,"Mali"}, - {356 ,"Malta"}, - {692 ,"Marshall Islands"}, - {596 ,"Martinique"}, - {222 ,"Mauritania"}, - {230 ,"Mauritius"}, - {262 ,"Mayotte Island"}, /* change county code coz bug (from 269) */ - {52 ,"Mexico"}, - {691 ,"Micronesia, Federated States of"}, - {373 ,"Moldova, Republic of"}, - {377 ,"Monaco"}, - {976 ,"Mongolia"}, - {1664,"Montserrat"}, /* change county code to NANP (from 113) */ - {212 ,"Morocco"}, - {258 ,"Mozambique"}, - {95 ,"Myanmar"}, - {264 ,"Namibia"}, - {674 ,"Nauru"}, - {977 ,"Nepal"}, - {31 ,"Netherlands"}, - {599 ,"Netherlands Antilles"}, /* dissolved 2010 */ - {5995 ,"St. Maarten"}, /* add new country in 2010 (from Netherlands Antilles) */ - {5999 ,"Curacao"}, /* add new country in 2010 (from Netherlands Antilles) */ - {5997 ,"Netherlands (Bonaire Island)"}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ - {59946,"Netherlands (Saba Island)"}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ - {59938,"Netherlands (St. Eustatius Island)"}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ - // {114 ,"Nevis"}, /* removed: it is not a country, it's part of Saint Kitts and Nevis*/ - {687 ,"New Caledonia"}, - {64 ,"New Zealand"}, - {505 ,"Nicaragua"}, - {227 ,"Niger"}, - {234 ,"Nigeria"}, - {683 ,"Niue"}, - {1670,"Northern Mariana Islands, US Territory of"}, /* added NANP */ - {47 ,"Norway"}, - {968 ,"Oman"}, - {92 ,"Pakistan"}, - {680 ,"Palau"}, - {507 ,"Panama"}, - {675 ,"Papua New Guinea"}, - {595 ,"Paraguay"}, - {51 ,"Peru"}, - {63 ,"Philippines"}, - {48 ,"Poland"}, - {351 ,"Portugal"}, - {1939,"Puerto Rico"}, /* change county code to NANP 939, 787 (from 121) */ - {974 ,"Qatar"}, - {262 ,"Reunion Island"}, - {40 ,"Romania"}, -// {6701,"Rota Island"}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ - {7 ,"Russia"}, - {250 ,"Rwanda"}, - {1684,"Samoa (USA)"}, /* rename (from American Samoa) change county code to NANP (from 684) */ - {685 ,"Samoa, Western"}, /* rename (from Western Samoa) */ - {290 ,"Saint Helena"}, -// {115 ,"Saint Kitts"}, /* removed: it is not a country it is part of Saint Kitts and Nevis*/ - {1869,"Saint Kitts and Nevis"}, /* change county code to NANP (from 1141) */ - {1758,"Saint Lucia"}, /* change county code to NANP (from 122) */ - {508 ,"Saint Pierre and Miquelon"}, - {1784,"Saint Vincent and the Grenadines"}, /* change county code to NANP (from 116) */ -// {670 ,"Saipan Island"}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ - {378 ,"San Marino"}, - {239 ,"Sao Tome and Principe"}, - {966 ,"Saudi Arabia"}, - {442 ,"Scotland"}, - {221 ,"Senegal"}, - {248 ,"Seychelles"}, - {232 ,"Sierra Leone"}, - {65 ,"Singapore"}, - {421 ,"Slovakia"}, - {386 ,"Slovenia"}, - {677 ,"Solomon Islands"}, - {252 ,"Somalia"}, - {27 ,"South Africa"}, - {34 ,"Spain"}, - {3492,"Spain, Canary Islands"}, /*rename and change county code to 34(92) spain + canary code*/ - {94 ,"Sri Lanka"}, - {249 ,"Sudan"}, - {597 ,"Suriname"}, - {268 ,"Swaziland"}, - {46 ,"Sweden"}, - {41 ,"Switzerland"}, - {963 ,"Syrian Arab Republic"}, - {886 ,"Taiwan"}, - {992 ,"Tajikistan"}, /* change county code (from 708) */ - {255 ,"Tanzania"}, - {66 ,"Thailand"}, -// {6702,"Tinian Island"}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ - {670 ,"Timor, East"}, /* added (is part off Northern Mariana Islands but not US Territory*/ - {228 ,"Togo"}, - {690 ,"Tokelau"}, - {676 ,"Tonga"}, - {1868,"Trinidad and Tobago"}, /* change county code to NANP (from 1141) */ - {216 ,"Tunisia"}, - {90 ,"Turkey"}, - {90392,"Turkey, Republic of Northern Cyprus"}, /* added (is diffrent from Greek part)*/ - {993 ,"Turkmenistan"}, /* change county code (from 709) */ - {1649,"Turks and Caicos Islands"}, /* change county code to NANP (from 118) */ - {688 ,"Tuvalu"}, - {256 ,"Uganda"}, - {380 ,"Ukraine"}, - {971 ,"United Arab Emirates"}, - {44 ,"United Kingdom"}, - {598 ,"Uruguay"}, - {1 ,"USA"}, - {998 ,"Uzbekistan"}, /* change county code (from 711) */ - {678 ,"Vanuatu"}, - {379 ,"Vatican City"}, - {58 ,"Venezuela"}, - {84 ,"Vietnam"}, - {1284,"Virgin Islands (UK)"}, /* change county code to NANP (from 105) - rename coz Virgin Islands (USA) */ - {1340,"Virgin Islands (USA)"}, /* change county code to NANP (from 123) */ - {441 ,"Wales"}, - {681 ,"Wallis and Futuna Islands"}, - {967 ,"Yemen"}, - {38 ,"Yugoslavia"}, /* added for old values like birth-country */ - {381 ,"Serbia, Republic of"}, /* rename need (from Yugoslavia)*/ - {383 ,"Kosovo, Republic of"}, /*change country code (from 3811), rename need (from Yugoslavia - Serbia) */ - {382 ,"Montenegro, Republic of"}, /* rename need (from Yugoslavia - Montenegro) */ - {260 ,"Zambia"}, - {263 ,"Zimbabwe"}, + {0 , "Unspecified"}, + {9999, "Other"}, + {0xFFFF, "Unknown"}, + {93 , "Afghanistan"}, + {355 , "Albania"}, + {213 , "Algeria"}, + {376 , "Andorra"}, + {244 , "Angola"}, + {1264, "Anguilla"}, /* change county code to NANP (from 101) */ + {1268, "Antigua and Barbuda"}, /* change county code to NANP (from 1021) */ +// {5902, "Antilles"}, /* removed: it is not a country, it's a group of islands from diffrent countries (all are included in the list)*/ + {54 , "Argentina"}, + {374 , "Armenia"}, + {297 , "Aruba"}, + {247 , "Ascension Island"}, + {61 , "Australia"}, + {6720 , "Australia, Antarctic Territory"}, /* added country code 672(0)*/ + {614 , "Australia, Christmas Island"}, /* rename (from Christmas Island) and change to official county code 61(4) (from 672) */ + {61891, "Australia, Cocos (Keeling) Islands"}, /* rename and change to official county code 61(891) (from 6102) */ + {6723 , "Australia, Norfolk Island"}, /* rename (from Norfolk Island) and change to official county code 672(3) (from 6722) */ + {43 , "Austria"}, + {994 , "Azerbaijan"}, + {1242, "Bahamas"}, /* change county code to NANP (from 103) */ + {973 , "Bahrain"}, + {880 , "Bangladesh"}, + {1246, "Barbados"}, /* change county code to NANP (from 103) */ +// {120 , "Barbuda"}, /* removed: it is not a country and no special island, see Antigua and Barbuda*/ + {375 , "Belarus"}, + {32 , "Belgium"}, + {501 , "Belize"}, + {229 , "Benin"}, + {1441, "Bermuda"}, /* change county code to NANP (from 105) */ + {975 , "Bhutan"}, + {591 , "Bolivia"}, + {387 , "Bosnia and Herzegovina"}, + {267 , "Botswana"}, + {55 , "Brazil"}, + {673 , "Brunei"}, + {359 , "Bulgaria"}, + {226 , "Burkina Faso"}, + {257 , "Burundi"}, + {855 , "Cambodia"}, + {237 , "Cameroon"}, + {1002, "Canada"}, /* change county code to NANP (from 107 to virtual 1(002) -> reflect NANP*/ + {238 , "Cape Verde Islands"}, + {1345, "Cayman Islands"}, /* change county code to NANP (from 108) */ + {236 , "Central African Republic"}, + {235 , "Chad"}, + {56 , "Chile, Republic of"}, + {86 , "China"}, +// {6101, "Cocos-Keeling Islands"}, /* removed (double): see Australia, Cocos (Keeling) Islands */ + {57 , "Colombia"}, + {269 , "Comoros"}, /* change county code (from 2691) */ + {243 , "Congo, Democratic Republic of (Zaire)"}, + {242 , "Congo, Republic of the"}, + {682 , "Cook Islands"}, + {506 , "Costa Rica"}, + {225 , "Cote d'Ivoire (Ivory Coast)"}, + {385 , "Croatia"}, + {53 , "Cuba"}, + {357 , "Greek, Republic of South Cyprus"}, /* rename coz Turkey, Republic of Northern Cyprus */ + {420 , "Czech Republic"}, + {45 , "Denmark"}, + {246 , "Diego Garcia"}, + {253 , "Djibouti"}, + {1767, "Dominica"}, /* change county code to NANP (from 109) */ + {1809, "Dominican Republic"}, /* change county code to NANP 809, 829, 849 (from 110) */ + {593 , "Ecuador"}, + {20 , "Egypt"}, + {503 , "El Salvador"}, + {240 , "Equatorial Guinea"}, + {291 , "Eritrea"}, + {372 , "Estonia"}, + {251 , "Ethiopia"}, + {3883, "Europe"}, /* add county code +388 3 official European Telephony Numbering Space*/ + {298 , "Faeroe Islands"}, + {500 , "Falkland Islands"}, + {679 , "Fiji"}, + {358 , "Finland"}, + {33 , "France"}, + {5901, "French Antilles"}, + {594 , "French Guiana"}, + {689 , "French Polynesia"}, + {241 , "Gabon"}, + {220 , "Gambia"}, + {995 , "Georgia"}, + {49 , "Germany"}, + {233 , "Ghana"}, + {350 , "Gibraltar"}, + {30 , "Greece"}, + {299 , "Greenland"}, + {1473, "Grenada"}, /* change county code to NANP (from 111) */ + {590 , "Guadeloupe"}, + {1671, "Guam, US Territory of"}, /* change county code to NANP (from 671) */ + {502 , "Guatemala"}, + {224 , "Guinea"}, + {245 , "Guinea-Bissau"}, + {592 , "Guyana"}, + {509 , "Haiti"}, + {504 , "Honduras"}, + {852 , "Hong Kong"}, + {36 , "Hungary"}, + {354 , "Iceland"}, + {91 , "India"}, + {62 , "Indonesia"}, + {98 , "Iran (Islamic Republic of)"}, + {964 , "Iraq"}, + {353 , "Ireland"}, + {972 , "Israel"}, + {39 , "Italy"}, + {1876, "Jamaica"}, /* change county code to NANP (from 112) */ + {81 , "Japan"}, + {962 , "Jordan"}, + {705 , "Kazakhstan"}, + {254 , "Kenya"}, + {686 , "Kiribati"}, + {850 , "Korea, North"}, + {82 , "Korea, South"}, + {965 , "Kuwait"}, + {996 , "Kyrgyzstan"}, /* change county code (from 706) */ + {856 , "Laos"}, + {371 , "Latvia"}, + {961 , "Lebanon"}, + {266 , "Lesotho"}, + {231 , "Liberia"}, + {218 , "Libyan Arab Jamahiriya"}, + {423 , "Liechtenstein"}, /* change county code (from 4101) */ + {370 , "Lithuania"}, + {352 , "Luxembourg"}, + {853 , "Macau"}, + {389 , "Macedonia, Republic of"}, /* rename coz war */ + {261 , "Madagascar"}, + {265 , "Malawi"}, + {60 , "Malaysia"}, + {960 , "Maldives"}, + {223 , "Mali"}, + {356 , "Malta"}, + {692 , "Marshall Islands"}, + {596 , "Martinique"}, + {222 , "Mauritania"}, + {230 , "Mauritius"}, + {262 , "Mayotte Island"}, /* change county code coz bug (from 269) */ + {52 , "Mexico"}, + {691 , "Micronesia, Federated States of"}, + {373 , "Moldova, Republic of"}, + {377 , "Monaco"}, + {976 , "Mongolia"}, + {1664, "Montserrat"}, /* change county code to NANP (from 113) */ + {212 , "Morocco"}, + {258 , "Mozambique"}, + {95 , "Myanmar"}, + {264 , "Namibia"}, + {674 , "Nauru"}, + {977 , "Nepal"}, + {31 , "Netherlands"}, + {599 , "Netherlands Antilles"}, /* dissolved 2010 */ + {5995 , "St. Maarten"}, /* add new country in 2010 (from Netherlands Antilles) */ + {5999 , "Curacao"}, /* add new country in 2010 (from Netherlands Antilles) */ + {5997 , "Netherlands (Bonaire Island)"}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ + {59946, "Netherlands (Saba Island)"}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ + {59938, "Netherlands (St. Eustatius Island)"}, /* add new Part of Netherlands in 2010 (from Netherlands Antilles) */ + // {114 , "Nevis"}, /* removed: it is not a country, it's part of Saint Kitts and Nevis*/ + {687 , "New Caledonia"}, + {64 , "New Zealand"}, + {505 , "Nicaragua"}, + {227 , "Niger"}, + {234 , "Nigeria"}, + {683 , "Niue"}, + {1670, "Northern Mariana Islands, US Territory of"}, /* added NANP */ + {47 , "Norway"}, + {968 , "Oman"}, + {92 , "Pakistan"}, + {680 , "Palau"}, + {507 , "Panama"}, + {675 , "Papua New Guinea"}, + {595 , "Paraguay"}, + {51 , "Peru"}, + {63 , "Philippines"}, + {48 , "Poland"}, + {351 , "Portugal"}, + {1939, "Puerto Rico"}, /* change county code to NANP 939, 787 (from 121) */ + {974 , "Qatar"}, + {262 , "Reunion Island"}, + {40 , "Romania"}, +// {6701, "Rota Island"}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ + {7 , "Russia"}, + {250 , "Rwanda"}, + {1684, "Samoa (USA)"}, /* rename (from American Samoa) change county code to NANP (from 684) */ + {685 , "Samoa, Western"}, /* rename (from Western Samoa) */ + {290 , "Saint Helena"}, +// {115 , "Saint Kitts"}, /* removed: it is not a country it is part of Saint Kitts and Nevis*/ + {1869, "Saint Kitts and Nevis"}, /* change county code to NANP (from 1141) */ + {1758, "Saint Lucia"}, /* change county code to NANP (from 122) */ + {508 , "Saint Pierre and Miquelon"}, + {1784, "Saint Vincent and the Grenadines"}, /* change county code to NANP (from 116) */ +// {670 , "Saipan Island"}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ + {378 , "San Marino"}, + {239 , "Sao Tome and Principe"}, + {966 , "Saudi Arabia"}, + {442 , "Scotland"}, + {221 , "Senegal"}, + {248 , "Seychelles"}, + {232 , "Sierra Leone"}, + {65 , "Singapore"}, + {421 , "Slovakia"}, + {386 , "Slovenia"}, + {677 , "Solomon Islands"}, + {252 , "Somalia"}, + {27 , "South Africa"}, + {34 , "Spain"}, + {3492, "Spain, Canary Islands"}, /*rename and change county code to 34(92) spain + canary code*/ + {94 , "Sri Lanka"}, + {249 , "Sudan"}, + {597 , "Suriname"}, + {268 , "Swaziland"}, + {46 , "Sweden"}, + {41 , "Switzerland"}, + {963 , "Syrian Arab Republic"}, + {886 , "Taiwan"}, + {992 , "Tajikistan"}, /* change county code (from 708) */ + {255 , "Tanzania"}, + {66 , "Thailand"}, +// {6702, "Tinian Island"}, /* removed: it is not a country it is part of Northern Mariana Islands, US Territory of */ + {670 , "Timor, East"}, /* added (is part off Northern Mariana Islands but not US Territory*/ + {228 , "Togo"}, + {690 , "Tokelau"}, + {676 , "Tonga"}, + {1868, "Trinidad and Tobago"}, /* change county code to NANP (from 1141) */ + {216 , "Tunisia"}, + {90 , "Turkey"}, + {90392, "Turkey, Republic of Northern Cyprus"}, /* added (is diffrent from Greek part)*/ + {993 , "Turkmenistan"}, /* change county code (from 709) */ + {1649, "Turks and Caicos Islands"}, /* change county code to NANP (from 118) */ + {688 , "Tuvalu"}, + {256 , "Uganda"}, + {380 , "Ukraine"}, + {971 , "United Arab Emirates"}, + {44 , "United Kingdom"}, + {598 , "Uruguay"}, + {1 , "USA"}, + {998 , "Uzbekistan"}, /* change county code (from 711) */ + {678 , "Vanuatu"}, + {379 , "Vatican City"}, + {58 , "Venezuela"}, + {84 , "Vietnam"}, + {1284, "Virgin Islands (UK)"}, /* change county code to NANP (from 105) - rename coz Virgin Islands (USA) */ + {1340, "Virgin Islands (USA)"}, /* change county code to NANP (from 123) */ + {441 , "Wales"}, + {681 , "Wallis and Futuna Islands"}, + {967 , "Yemen"}, + {38 , "Yugoslavia"}, /* added for old values like birth-country */ + {381 , "Serbia, Republic of"}, /* rename need (from Yugoslavia)*/ + {383 , "Kosovo, Republic of"}, /*change country code (from 3811), rename need (from Yugoslavia - Serbia) */ + {382 , "Montenegro, Republic of"}, /* rename need (from Yugoslavia - Montenegro) */ + {260 , "Zambia"}, + {263 , "Zimbabwe"}, }; static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM) @@ -306,7 +306,7 @@ static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM) return (INT_PTR)NULL; } -static INT_PTR GetCountryList(WPARAM wParam,LPARAM lParam) +static INT_PTR GetCountryList(WPARAM wParam, LPARAM lParam) { *(int*)wParam = SIZEOF(countries); *(struct CountryListEntry**)lParam=countries; @@ -322,15 +322,15 @@ static INT_PTR SaveWindowPosition(WPARAM, LPARAM lParam) char szSettingName[64]; wp.length=sizeof(wp); - GetWindowPlacement(swp->hwnd,&wp); + GetWindowPlacement(swp->hwnd, &wp); mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", swp->szNamePrefix); - DBWriteContactSettingDword(swp->hContact,swp->szModule,szSettingName,wp.rcNormalPosition.left); + DBWriteContactSettingDword(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.left); mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", swp->szNamePrefix); - DBWriteContactSettingDword(swp->hContact,swp->szModule,szSettingName,wp.rcNormalPosition.top); + DBWriteContactSettingDword(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.top); mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", swp->szNamePrefix); - DBWriteContactSettingDword(swp->hContact,swp->szModule,szSettingName,wp.rcNormalPosition.right-wp.rcNormalPosition.left); + DBWriteContactSettingDword(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.right-wp.rcNormalPosition.left); mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", swp->szNamePrefix); - DBWriteContactSettingDword(swp->hContact,swp->szModule,szSettingName,wp.rcNormalPosition.bottom-wp.rcNormalPosition.top); + DBWriteContactSettingDword(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.bottom-wp.rcNormalPosition.top); return 0; } @@ -375,30 +375,30 @@ static INT_PTR AssertInsideScreen(WPARAM wParam, LPARAM lParam) } -static INT_PTR RestoreWindowPosition(WPARAM wParam,LPARAM lParam) +static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam) { SAVEWINDOWPOS *swp=(SAVEWINDOWPOS*)lParam; WINDOWPLACEMENT wp; char szSettingName[64]; - int x,y; + int x, y; wp.length=sizeof(wp); - GetWindowPlacement(swp->hwnd,&wp); + GetWindowPlacement(swp->hwnd, &wp); mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", swp->szNamePrefix); - x=DBGetContactSettingDword(swp->hContact,swp->szModule,szSettingName,-1); + x=DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1); mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", swp->szNamePrefix); - y=(int)DBGetContactSettingDword(swp->hContact,swp->szModule,szSettingName,-1); + y=(int)DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1); if (x == -1) return 1; if (wParam&RWPF_NOSIZE) { - OffsetRect(&wp.rcNormalPosition,x-wp.rcNormalPosition.left,y-wp.rcNormalPosition.top); + OffsetRect(&wp.rcNormalPosition, x-wp.rcNormalPosition.left, y-wp.rcNormalPosition.top); } else { wp.rcNormalPosition.left=x; wp.rcNormalPosition.top=y; mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", swp->szNamePrefix); - wp.rcNormalPosition.right=wp.rcNormalPosition.left+DBGetContactSettingDword(swp->hContact,swp->szModule,szSettingName,-1); + wp.rcNormalPosition.right=wp.rcNormalPosition.left+DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1); mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", swp->szNamePrefix); - wp.rcNormalPosition.bottom=wp.rcNormalPosition.top+DBGetContactSettingDword(swp->hContact,swp->szModule,szSettingName,-1); + wp.rcNormalPosition.bottom=wp.rcNormalPosition.top+DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1); } wp.flags=0; if (wParam & RWPF_HIDDEN) @@ -409,7 +409,7 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam,LPARAM lParam) if (!(wParam & RWPF_NOMOVE)) AssertInsideScreen((WPARAM) &wp.rcNormalPosition, 0); - SetWindowPlacement(swp->hwnd,&wp); + SetWindowPlacement(swp->hwnd, &wp); return 0; } @@ -558,16 +558,16 @@ int LoadUtilsModule(void) { bModuleInitialized = TRUE; - CreateServiceFunction(MS_UTILS_RESIZEDIALOG,ResizeDialog); - CreateServiceFunction(MS_UTILS_SAVEWINDOWPOSITION,SaveWindowPosition); - CreateServiceFunction(MS_UTILS_RESTOREWINDOWPOSITION,RestoreWindowPosition); - CreateServiceFunction(MS_UTILS_ASSERTINSIDESCREEN,AssertInsideScreen); - CreateServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER,GetCountryByNumber); - CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST,GetCountryList); - CreateServiceFunction(MS_UTILS_GETRANDOM,GenerateRandom); - CreateServiceFunction(MS_SYSTEM_RESTART,RestartMiranda); - CreateServiceFunction(MS_SYSTEM_GET_MD5I,GetMD5Interface); - CreateServiceFunction(MS_SYSTEM_GET_SHA1I,GetSHA1Interface); + CreateServiceFunction(MS_UTILS_RESIZEDIALOG, ResizeDialog); + CreateServiceFunction(MS_UTILS_SAVEWINDOWPOSITION, SaveWindowPosition); + CreateServiceFunction(MS_UTILS_RESTOREWINDOWPOSITION, RestoreWindowPosition); + CreateServiceFunction(MS_UTILS_ASSERTINSIDESCREEN, AssertInsideScreen); + CreateServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER, GetCountryByNumber); + CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST, GetCountryList); + CreateServiceFunction(MS_UTILS_GETRANDOM, GenerateRandom); + CreateServiceFunction(MS_SYSTEM_RESTART, RestartMiranda); + CreateServiceFunction(MS_SYSTEM_GET_MD5I, GetMD5Interface); + CreateServiceFunction(MS_SYSTEM_GET_SHA1I, GetSHA1Interface); InitOpenUrl(); InitWindowList(); InitHyperlink(); diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp index e67f13c5e8..059d3dd1d7 100644 --- a/src/modules/utils/windowlist.cpp +++ b/src/modules/utils/windowlist.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,24 +33,24 @@ static INT_PTR AllocWindowList(WPARAM, LPARAM) static INT_PTR AddToWindowList(WPARAM, LPARAM lParam) { - windowList=(WINDOWLISTENTRY*)mir_realloc(windowList,sizeof(WINDOWLISTENTRY)*(windowListCount+1)); + windowList=(WINDOWLISTENTRY*)mir_realloc(windowList, sizeof(WINDOWLISTENTRY)*(windowListCount+1)); windowList[windowListCount++]=*(WINDOWLISTENTRY*)lParam; return 0; } -static INT_PTR RemoveFromWindowList(WPARAM wParam,LPARAM lParam) +static INT_PTR RemoveFromWindowList(WPARAM wParam, LPARAM lParam) { int i; for (i=0;imessage,msg->wParam,msg->lParam); + SendMessage(windowList[i].hwnd, msg->message, msg->wParam, msg->lParam); return 0; } -static INT_PTR BroadcastToWindowListAsync(WPARAM wParam,LPARAM lParam) +static INT_PTR BroadcastToWindowListAsync(WPARAM wParam, LPARAM lParam) { int i; MSG *msg=(MSG*)lParam; for (i=0;imessage,msg->wParam,msg->lParam); + PostMessage(windowList[i].hwnd, msg->message, msg->wParam, msg->lParam); return 0; } int InitWindowList(void) { - CreateServiceFunction(MS_UTILS_ALLOCWINDOWLIST,AllocWindowList); - CreateServiceFunction(MS_UTILS_ADDTOWINDOWLIST,AddToWindowList); - CreateServiceFunction(MS_UTILS_REMOVEFROMWINDOWLIST,RemoveFromWindowList); - CreateServiceFunction(MS_UTILS_BROADCASTTOWINDOWLIST,BroadcastToWindowList); - CreateServiceFunction(MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC,BroadcastToWindowListAsync); - CreateServiceFunction(MS_UTILS_FINDWINDOWINLIST,FindInWindowList); + CreateServiceFunction(MS_UTILS_ALLOCWINDOWLIST, AllocWindowList); + CreateServiceFunction(MS_UTILS_ADDTOWINDOWLIST, AddToWindowList); + CreateServiceFunction(MS_UTILS_REMOVEFROMWINDOWLIST, RemoveFromWindowList); + CreateServiceFunction(MS_UTILS_BROADCASTTOWINDOWLIST, BroadcastToWindowList); + CreateServiceFunction(MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC, BroadcastToWindowListAsync); + CreateServiceFunction(MS_UTILS_FINDWINDOWINLIST, FindInWindowList); return 0; } diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index 5d5719bfd7..f3b581947c 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -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. @@ -22,64 +22,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "..\..\core\commonheaders.h" -static void SetListGroupIcons(HWND hwndList,HANDLE hFirstItem,HANDLE hParentItem,int *groupChildCount) +static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount) { int typeOfFirst; - int iconOn[2]={1,1}; - int childCount[2]={0,0},i; + int iconOn[2]={1, 1}; + int childCount[2]={0, 0}, i; int iImage; - HANDLE hItem,hChildItem; + HANDLE hItem, hChildItem; - typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0); + typeOfFirst=SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0); //check groups if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem); while (hItem) { - hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); - if (hChildItem) SetListGroupIcons(hwndList,hChildItem,hItem,childCount); + hChildItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount); for ( i=0; i < SIZEOF(iconOn); i++) - if (iconOn[i] && SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i) == 0) iconOn[i]=0; - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem); + if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0) iconOn[i]=0; + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem); } //check contacts if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem); while (hItem) { for ( i=0; i < SIZEOF(iconOn); i++) { - iImage=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,i); + iImage=SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i); if (iconOn[i] && iImage == 0) iconOn[i]=0; if (iImage != 0xFF) childCount[i]++; } - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem); + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem); } //set icons for ( i=0; i < SIZEOF(iconOn); i++) { - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hParentItem,MAKELPARAM(i,childCount[i]?(iconOn[i]?i+1:0):0xFF)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+1:0):0xFF)); if (groupChildCount) groupChildCount[i]+=childCount[i]; } } -static void SetAllChildIcons(HWND hwndList,HANDLE hFirstItem,int iColumn,int iImage) +static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage) { - int typeOfFirst,iOldIcon; - HANDLE hItem,hChildItem; + int typeOfFirst, iOldIcon; + HANDLE hItem, hChildItem; - typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0); + typeOfFirst=SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0); //check groups if (typeOfFirst == CLCIT_GROUP) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem); while (hItem) { - hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); - if (hChildItem) SetAllChildIcons(hwndList,hChildItem,iColumn,iImage); - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem); + hChildItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hChildItem) SetAllChildIcons(hwndList, hChildItem, iColumn, iImage); + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem); } //check contacts if (typeOfFirst == CLCIT_CONTACT) hItem=hFirstItem; - else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem); + else hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem); while (hItem) { - iOldIcon=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); - if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); - hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem); + iOldIcon=SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn); + if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage)); + hItem=(HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem); } } @@ -87,48 +87,48 @@ static void ResetListOptions(HWND hwndList) { int i; - SendMessage(hwndList,CLM_SETBKBITMAP,0,(LPARAM)(HBITMAP)NULL); - SendMessage(hwndList,CLM_SETBKCOLOR,GetSysColor(COLOR_WINDOW),0); - SendMessage(hwndList,CLM_SETGREYOUTFLAGS,0,0); - SendMessage(hwndList,CLM_SETLEFTMARGIN,2,0); - SendMessage(hwndList,CLM_SETINDENT,10,0); + SendMessage(hwndList, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP)NULL); + SendMessage(hwndList, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0); + SendMessage(hwndList, CLM_SETGREYOUTFLAGS, 0, 0); + SendMessage(hwndList, CLM_SETLEFTMARGIN, 2, 0); + SendMessage(hwndList, CLM_SETINDENT, 10, 0); for (i=0;i<=FONTID_MAX;i++) - SendMessage(hwndList,CLM_SETTEXTCOLOR,i,GetSysColor(COLOR_WINDOWTEXT)); - SetWindowLongPtr(hwndList,GWL_STYLE,GetWindowLongPtr(hwndList,GWL_STYLE)|CLS_SHOWHIDDEN); + SendMessage(hwndList, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT)); + SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList, GWL_STYLE)|CLS_SHOWHIDDEN); } static void SetAllContactIcons(HWND hwndList) { - HANDLE hContact,hItem; + HANDLE hContact, hItem; char *szProto; DWORD flags; WORD status; - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); do { - hItem=(HANDLE)SendMessage(hwndList,CLM_FINDCONTACT,(WPARAM)hContact,0); + hItem=(HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto == NULL) {flags=0; status=0;} else { - flags=CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0); - status=DBGetContactSettingWord(hContact,szProto,"ApparentMode",0); + flags=CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0); + status=DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0); } if (flags&PF1_INVISLIST) { - if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,0)) == 0xFF) - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(0,status == ID_STATUS_ONLINE?1:0)); + if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, 0)) == 0xFF) + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, status == ID_STATUS_ONLINE?1:0)); } if (flags&PF1_VISLIST) { - if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,0)) == 0xFF) - SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(1,status == ID_STATUS_OFFLINE?2:0)); + if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, 0)) == 0xFF) + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, status == ID_STATUS_OFFLINE?2:0)); } } - } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); + } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)); } static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) { - static HICON hVisibleIcon,hInvisibleIcon; + static HICON hVisibleIcon, hInvisibleIcon; static HANDLE hItemAll; switch (msg) @@ -136,32 +136,32 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { HIMAGELIST hIml; - hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),(IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK,3,3); - ImageList_AddIcon_IconLibLoaded(hIml,SKINICON_OTHER_SMALLDOT); - ImageList_AddIcon_IconLibLoaded(hIml,SKINICON_STATUS_INVISIBLE); - ImageList_AddIcon_IconLibLoaded(hIml,SKINICON_STATUS_OFFLINE); - SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_SETEXTRAIMAGELIST,0,(LPARAM)hIml); - hVisibleIcon=ImageList_GetIcon(hIml,1,ILD_NORMAL); - SendDlgItemMessage(hwndDlg,IDC_VISIBLEICON,STM_SETICON,(WPARAM)hVisibleIcon,0); - hInvisibleIcon=ImageList_GetIcon(hIml,2,ILD_NORMAL); - SendDlgItemMessage(hwndDlg,IDC_INVISIBLEICON,STM_SETICON,(WPARAM)hInvisibleIcon,0); + hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, 3, 3); + ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_SMALLDOT); + ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_STATUS_INVISIBLE); + ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_STATUS_OFFLINE); + SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); + hVisibleIcon=ImageList_GetIcon(hIml, 1, ILD_NORMAL); + SendDlgItemMessage(hwndDlg, IDC_VISIBLEICON, STM_SETICON, (WPARAM)hVisibleIcon, 0); + hInvisibleIcon=ImageList_GetIcon(hIml, 2, ILD_NORMAL); + SendDlgItemMessage(hwndDlg, IDC_INVISIBLEICON, STM_SETICON, (WPARAM)hInvisibleIcon, 0); } - ResetListOptions(GetDlgItem(hwndDlg,IDC_LIST)); - SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_SETEXTRACOLUMNS,2,0); + ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST)); + SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRACOLUMNS, 2, 0); { CLCINFOITEM cii={0}; cii.cbSize=sizeof(cii); cii.flags=CLCIIF_GROUPFONT; cii.pszText=TranslateT("** All contacts **"); - hItemAll=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_ADDINFOITEM,0,(LPARAM)&cii); + hItemAll=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii); } - SetAllContactIcons(GetDlgItem(hwndDlg,IDC_LIST)); - SetListGroupIcons(GetDlgItem(hwndDlg,IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL); + SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST)); + SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL); return TRUE; case WM_SETFOCUS: - SetFocus(GetDlgItem(hwndDlg,IDC_LIST)); + SetFocus(GetDlgItem(hwndDlg, IDC_LIST)); break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { @@ -170,13 +170,13 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP { case CLN_NEWCONTACT: case CLN_LISTREBUILT: - SetAllContactIcons(GetDlgItem(hwndDlg,IDC_LIST)); + SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST)); //fall through case CLN_CONTACTMOVED: - SetListGroupIcons(GetDlgItem(hwndDlg,IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL); + SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL); break; case CLN_OPTIONSCHANGED: - ResetListOptions(GetDlgItem(hwndDlg,IDC_LIST)); + ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST)); break; case NM_CLICK: { HANDLE hItem; @@ -190,7 +190,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP break; // Find clicked item - hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x,nm->pt.y)); + hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y)); // Nothing was clicked if (hItem == NULL) break; // It was not a visbility icon @@ -210,7 +210,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP // Update list, making sure that the options are mutually exclusive if (itemType == CLCIT_CONTACT) { // A contact SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage)); - if (iImage && SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn?0:1,0)) != 0xFF) + if (iImage && SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0)) != 0xFF) SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0)); } else if (itemType == CLCIT_INFO) { // All Contacts @@ -239,25 +239,25 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - { HANDLE hContact,hItem; - int set,i,iImage; + { HANDLE hContact, hItem; + int set, i, iImage; - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); do { - hItem=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_FINDCONTACT,(WPARAM)hContact,0); + hItem=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { set=0; for (i=0;i<2;i++) { - iImage=SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0)); + iImage=SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0)); if (iImage == i+1) { - CallContactService(hContact,PSS_SETAPPARENTMODE,iImage == 1?ID_STATUS_ONLINE:ID_STATUS_OFFLINE,0); + CallContactService(hContact, PSS_SETAPPARENTMODE, iImage == 1?ID_STATUS_ONLINE:ID_STATUS_OFFLINE, 0); set=1; break; } } - if (!set) CallContactService(hContact,PSS_SETAPPARENTMODE,0,0); + if (!set) CallContactService(hContact, PSS_SETAPPARENTMODE, 0, 0); } - } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); + } while (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)); return TRUE; } } @@ -267,7 +267,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP case WM_DESTROY: DestroyIcon(hVisibleIcon); DestroyIcon(hInvisibleIcon); - { HIMAGELIST hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGELIST,0,0); + { HIMAGELIST hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0); ImageList_Destroy(hIml); } break; @@ -292,6 +292,6 @@ static int VisibilityOptInitialise(WPARAM wParam, LPARAM) int LoadVisibilityModule(void) { - HookEvent(ME_OPT_INITIALISE,VisibilityOptInitialise); + HookEvent(ME_OPT_INITIALISE, VisibilityOptInitialise); return 0; } diff --git a/src/modules/xml/xmlApi.cpp b/src/modules/xml/xmlApi.cpp index 45acae2381..16cb936090 100644 --- a/src/modules/xml/xmlApi.cpp +++ b/src/modules/xml/xmlApi.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. diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index 2ff53f005b..c718b9c46c 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -77,12 +77,12 @@ inline int mmin( const int t1, const int t2 ) { return t1 < t2 ? t1 : t2; } typedef struct { XMLCSTR lpszOpen; int openTagLen; XMLCSTR lpszClose;} ALLXMLClearTag; static ALLXMLClearTag XMLClearTags[] = { - { _CXML("") }, - { _CXML("") }, - { _CXML("") }, - { _CXML("
")    ,5,  _CXML("
") }, - // { _CXML("")}, - { NULL ,0, NULL } + { _CXML("") }, + { _CXML("") }, + { _CXML("") }, + { _CXML("
")    , 5,  _CXML("
") }, + // { _CXML("")}, + { NULL , 0, NULL } }; // You can modify the initialization of the variable "XMLEntities" below @@ -92,15 +92,15 @@ static ALLXMLClearTag XMLClearTags[] = typedef struct { XMLCSTR s; int l; XMLCHAR c;} XMLCharacterEntity; static XMLCharacterEntity XMLEntities[] = { - { _CXML("&" ), 5, _CXML('&' )}, - { _CXML("<" ), 4, _CXML('<' )}, - { _CXML(">" ), 4, _CXML('>' )}, - { _CXML("""), 6, _CXML('\"')}, - { _CXML("'"), 6, _CXML('\'')}, + { _CXML("&" ), 5, _CXML('&' )}, + { _CXML("<" ), 4, _CXML('<' )}, + { _CXML(">" ), 4, _CXML('>' )}, + { _CXML("""), 6, _CXML('\"')}, + { _CXML("'"), 6, _CXML('\'')}, { NULL , 0, '\0' } }; -// When rendering the XMLNode to a string (using the "createXMLString" function), +// When rendering the XMLNode to a string (using the "createXMLString" function), // you can ask for a beautiful formatting. This formatting is using the // following indentation character: #define INDENTCHAR _CXML('\t') @@ -142,7 +142,7 @@ XMLCSTR XMLNode::getError(XMLError xerror) ///////////////////////////////////////////////////////////////////////// // Here is an abstraction layer to access some common string manipulation functions. -// The abstraction layer is currently working for gcc, Microsoft Visual Studio 6.0, +// The abstraction layer is currently working for gcc, Microsoft Visual Studio 6.0, // Microsoft Visual Studio .NET, CC (sun compiler) and Borland C++. // If you plan to "port" the library to a new system/compiler, all you have to do is // to edit the following lines. @@ -165,14 +165,14 @@ char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIs if (len&1) return FALSE; /* only checks the first 256 characters */ - len=mmin(256,len/sizeof(wchar_t)); + len=mmin(256, len/sizeof(wchar_t)); // Check for the special byte order: if (*((unsigned short*)s) == 0xFFFE) return TRUE; // IS_TEXT_UNICODE_REVERSE_SIGNATURE; if (*((unsigned short*)s) == 0xFEFF) return TRUE; // IS_TEXT_UNICODE_SIGNATURE // checks for ASCII characters in the UNICODE stream - int i,stats=0; + int i, stats=0; for (i=0; ilen/2) return TRUE; @@ -182,7 +182,7 @@ char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIs return FALSE; } #else -char myIsTextWideChar(const void *b,int l) { return (char)IsTextUnicode((CONST LPVOID)b,l,NULL); } +char myIsTextWideChar(const void *b, int l) { return (char)IsTextUnicode((CONST LPVOID)b, l, NULL); } #endif #endif @@ -192,22 +192,22 @@ char myIsTextWideChar(const void *b,int l) { return (char)IsTextUnicode((CONST L wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce) { int i; - if (ce == XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,NULL,0); - else i=(int)MultiByteToWideChar(CP_ACP ,MB_PRECOMPOSED,s,-1,NULL,0); + if (ce == XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8, 0 , s, -1, NULL, 0); + else i=(int)MultiByteToWideChar(CP_ACP , MB_PRECOMPOSED, s, -1, NULL, 0); if (i<0) return NULL; wchar_t *d=(wchar_t *)malloc((i+1)*sizeof(XMLCHAR)); - if (ce == XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8,0 ,s,-1,d,i); - else i=(int)MultiByteToWideChar(CP_ACP ,MB_PRECOMPOSED,s,-1,d,i); + if (ce == XMLNode::char_encoding_UTF8) i=(int)MultiByteToWideChar(CP_UTF8, 0 , s, -1, d, i); + else i=(int)MultiByteToWideChar(CP_ACP , MB_PRECOMPOSED, s, -1, d, i); d[i]=0; return d; } -static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode) { return _wfopen(filename,mode); } +static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return _wfopen(filename, mode); } static inline int xstrlen(XMLCSTR c) { return (int)wcslen(c); } -static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return _wcsnicmp(c1,c2,l);} -static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncmp(c1,c2,l);} -static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return _wcsicmp(c1,c2); } -static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)wcsstr(c1,c2); } -static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)wcscpy(c1,c2); } +static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return _wcsnicmp(c1, c2, l);} +static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncmp(c1, c2, l);} +static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return _wcsicmp(c1, c2); } +static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)wcsstr(c1, c2); } +static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)wcscpy(c1, c2); } #else char *myWideCharToMultiByte(const wchar_t *s) { @@ -235,18 +235,18 @@ char *myWideCharToMultiByte(const wchar_t *s) d[i]=0; return d; } -static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode) { return fopen(filename,mode); } +static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return fopen(filename, mode); } static inline int xstrlen(XMLCSTR c) { return (int)strlen(c); } #ifdef __BORLANDC__ -static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strnicmp(c1,c2,l);} -static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return stricmp(c1,c2); } +static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strnicmp(c1, c2, l);} +static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return stricmp(c1, c2); } #else -static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return _strnicmp(c1,c2,l);} -static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return _stricmp(c1,c2); } +static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return _strnicmp(c1, c2, l);} +static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return _stricmp(c1, c2); } #endif -static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncmp(c1,c2,l);} -static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)strstr(c1,c2); } -static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)strcpy(c1,c2); } +static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncmp(c1, c2, l);} +static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)strstr(c1, c2); } +static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)strcpy(c1, c2); } #endif #else // for gcc and CC @@ -256,10 +256,10 @@ char *myWideCharToMultiByte(const wchar_t *s) { return NULL; } char *myWideCharToMultiByte(const wchar_t *s) { const wchar_t *ss=s; - int i=(int)wcsrtombs(NULL,&ss,0,NULL); + int i=(int)wcsrtombs(NULL, &ss, 0, NULL); if (i<0) return NULL; char *d=(char *)malloc(i+1); - wcsrtombs(d,&s,i,NULL); + wcsrtombs(d, &s, i, NULL); d[i]=0; return d; } @@ -268,10 +268,10 @@ char *myWideCharToMultiByte(const wchar_t *s) wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce) { const char *ss=s; - int i=(int)mbsrtowcs(NULL,&ss,0,NULL); + int i=(int)mbsrtowcs(NULL, &ss, 0, NULL); if (i<0) return NULL; wchar_t *d=(wchar_t *)malloc((i+1)*sizeof(wchar_t)); - mbsrtowcs(d,&s,i,NULL); + mbsrtowcs(d, &s, i, NULL); d[i]=0; return d; } @@ -279,21 +279,21 @@ int xstrlen(XMLCSTR c) { return wcslen(c); } #ifdef sun // for CC #include -static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return wsncasecmp(c1,c2,l);} -static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wsncmp(c1,c2,l);} -static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return wscasecmp(c1,c2); } +static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return wsncasecmp(c1, c2, l);} +static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wsncmp(c1, c2, l);} +static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return wscasecmp(c1, c2); } #else -static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncmp(c1,c2,l);} +static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncmp(c1, c2, l);} #ifdef __linux__ // for gcc/linux -static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncasecmp(c1,c2,l);} -static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return wcscasecmp(c1,c2); } +static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return wcsncasecmp(c1, c2, l);} +static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return wcscasecmp(c1, c2); } #else #include // for gcc/non-linux (MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 4.3.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin, mingw) static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { - wchar_t left,right; + wchar_t left, right; do { left=towlower(*c1++); right=towlower(*c2++); @@ -302,7 +302,7 @@ static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) } static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { - wchar_t left,right; + wchar_t left, right; while (l--) { left=towlower(*c1++); right=towlower(*c2++); @@ -312,32 +312,32 @@ static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) } #endif #endif -static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)wcsstr(c1,c2); } -static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)wcscpy(c1,c2); } -static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode) +static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)wcsstr(c1, c2); } +static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)wcscpy(c1, c2); } +static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { char *filenameAscii=myWideCharToMultiByte(filename); FILE *f; - if (mode[0] == _CXML('r')) f=fopen(filenameAscii,"rb"); - else f=fopen(filenameAscii,"wb"); + if (mode[0] == _CXML('r')) f=fopen(filenameAscii, "rb"); + else f=fopen(filenameAscii, "wb"); free(filenameAscii); return f; } #else -static inline FILE *xfopen(XMLCSTR filename,XMLCSTR mode) { return fopen(filename,mode); } +static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return fopen(filename, mode); } static inline int xstrlen(XMLCSTR c) { return strlen(c); } -static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncasecmp(c1,c2,l);} -static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncmp(c1,c2,l);} -static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return strcasecmp(c1,c2); } -static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)strstr(c1,c2); } -static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)strcpy(c1,c2); } +static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncasecmp(c1, c2, l);} +static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncmp(c1, c2, l);} +static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return strcasecmp(c1, c2); } +static inline XMLSTR xstrstr(XMLCSTR c1, XMLCSTR c2) { return (XMLSTR)strstr(c1, c2); } +static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)strcpy(c1, c2); } #endif -static inline int _strnicmp(const char *c1,const char *c2, int l) { return strncasecmp(c1,c2,l);} +static inline int _strnicmp(const char *c1, const char *c2, int l) { return strncasecmp(c1, c2, l);} #endif /////////////////////////////////////////////////////////////////////////////// -// the "xmltoc,xmltob,xmltoi,xmltol,xmltof,xmltoa" functions // +// the "xmltoc, xmltob, xmltoi, xmltol, xmltof, xmltoa" functions // /////////////////////////////////////////////////////////////////////////////// // These 6 functions are not used inside the XMLparser. // There are only here as "convenience" functions for the user. @@ -345,33 +345,33 @@ static inline int _strnicmp(const char *c1,const char *c2, int l) { return strnc #ifdef _XMLWIDECHAR #ifdef _XMLWINDOWS // for Microsoft Visual Studio 6.0 and Microsoft Visual Studio .NET and Borland C++ Builder 6.0 -char xmltob(XMLCSTR t,char v) { if (t&&(*t)) return (char)_wtoi(t); return v; } -int xmltoi(XMLCSTR t,int v) { if (t&&(*t)) return _wtoi(t); return v; } -long xmltol(XMLCSTR t,long v) { if (t&&(*t)) return _wtol(t); return v; } -double xmltof(XMLCSTR t,double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; } +char xmltob(XMLCSTR t, char v) { if (t&&(*t)) return (char)_wtoi(t); return v; } +int xmltoi(XMLCSTR t, int v) { if (t&&(*t)) return _wtoi(t); return v; } +long xmltol(XMLCSTR t, long v) { if (t&&(*t)) return _wtol(t); return v; } +double xmltof(XMLCSTR t, double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; } #else #ifdef sun // for CC #include -char xmltob(XMLCSTR t,char v) { if (t) return (char)wstol(t,NULL,10); return v; } -int xmltoi(XMLCSTR t,int v) { if (t) return (int)wstol(t,NULL,10); return v; } -long xmltol(XMLCSTR t,long v) { if (t) return wstol(t,NULL,10); return v; } +char xmltob(XMLCSTR t, char v) { if (t) return (char)wstol(t, NULL, 10); return v; } +int xmltoi(XMLCSTR t, int v) { if (t) return (int)wstol(t, NULL, 10); return v; } +long xmltol(XMLCSTR t, long v) { if (t) return wstol(t, NULL, 10); return v; } #else // for gcc -char xmltob(XMLCSTR t,char v) { if (t) return (char)wcstol(t,NULL,10); return v; } -int xmltoi(XMLCSTR t,int v) { if (t) return (int)wcstol(t,NULL,10); return v; } -long xmltol(XMLCSTR t,long v) { if (t) return wcstol(t,NULL,10); return v; } +char xmltob(XMLCSTR t, char v) { if (t) return (char)wcstol(t, NULL, 10); return v; } +int xmltoi(XMLCSTR t, int v) { if (t) return (int)wcstol(t, NULL, 10); return v; } +long xmltol(XMLCSTR t, long v) { if (t) return wcstol(t, NULL, 10); return v; } #endif -double xmltof(XMLCSTR t,double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; } +double xmltof(XMLCSTR t, double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v=_wtof(t);*/ return v; } #endif #else -char xmltob(XMLCSTR t,char v) { if (t&&(*t)) return (char)atoi(t); return v; } -int xmltoi(XMLCSTR t,int v) { if (t&&(*t)) return atoi(t); return v; } -long xmltol(XMLCSTR t,long v) { if (t&&(*t)) return atol(t); return v; } -double xmltof(XMLCSTR t,double v) { if (t&&(*t)) return atof(t); return v; } +char xmltob(XMLCSTR t, char v) { if (t&&(*t)) return (char)atoi(t); return v; } +int xmltoi(XMLCSTR t, int v) { if (t&&(*t)) return atoi(t); return v; } +long xmltol(XMLCSTR t, long v) { if (t&&(*t)) return atol(t); return v; } +double xmltof(XMLCSTR t, double v) { if (t&&(*t)) return atof(t); return v; } #endif -XMLCSTR xmltoa(XMLCSTR t,XMLCSTR v) { if (t) return t; return v; } -XMLCHAR xmltoc(XMLCSTR t,const XMLCHAR v) { if (t&&(*t)) return *t; return v; } +XMLCSTR xmltoa(XMLCSTR t, XMLCSTR v) { if (t) return t; return v; } +XMLCHAR xmltoc(XMLCSTR t, const XMLCHAR v) { if (t&&(*t)) return *t; return v; } ///////////////////////////////////////////////////////////////////////// // the "openFileHelper" function // @@ -383,38 +383,38 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag) { // guess the value of the global parameter "characterEncoding" // (the guess is based on the first 200 bytes of the file). - FILE *f=xfopen(filename,_CXML("rb")); + FILE *f=xfopen(filename, _CXML("rb")); if (f) { char bb[205]; - int l=(int)fread(bb,1,200,f); - setGlobalOptions(guessCharEncoding(bb,l),guessWideCharChars,dropWhiteSpace,removeCommentsInMiddleOfText); + int l=(int)fread(bb, 1, 200, f); + setGlobalOptions(guessCharEncoding(bb, l), guessWideCharChars, dropWhiteSpace, removeCommentsInMiddleOfText); fclose(f); } // parse the file XMLResults pResults; - XMLNode xnode=XMLNode::parseFile(filename,tag,&pResults); + XMLNode xnode=XMLNode::parseFile(filename, tag, &pResults); // display error message (if any) if (pResults.error != eXMLErrorNone) { // create message - char message[2000],*s1=(char*)"",*s3=(char*)""; XMLCSTR s2=_CXML(""); + char message[2000], *s1=(char*)"", *s3=(char*)""; XMLCSTR s2=_CXML(""); if (pResults.error == eXMLErrorFirstTagNotFound) { s1=(char*)"First Tag should be '"; s2=tag; s3=(char*)"'.\n"; } - sprintf(message, + sprintf(message, #ifdef _XMLWIDECHAR "XML Parsing error inside file '%S'.\n%S\nAt line %i, column %i.\n%s%S%s" #else "XML Parsing error inside file '%s'.\n%s\nAt line %i, column %i.\n%s%s%s" #endif - ,filename,XMLNode::getError(pResults.error),pResults.nLine,pResults.nColumn,s1,s2,s3); + , filename, XMLNode::getError(pResults.error), pResults.nLine, pResults.nColumn, s1, s2, s3); // display message #if defined(_XMLWINDOWS) && !defined(UNDER_CE) && !defined(_XMLPARSER_NO_MESSAGEBOX_) - MessageBoxA(NULL,message,"XML Parsing error",MB_OK|MB_ICONERROR|MB_TOPMOST); + MessageBoxA(NULL, message, "XML Parsing error", MB_OK|MB_ICONERROR|MB_TOPMOST); #else - printf("%s",message); + printf("%s", message); #endif exit(255); } @@ -437,91 +437,91 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag) static const char XML_utf8ByteTable[256] = { // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x00 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x10 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x20 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x30 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x40 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x50 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x60 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x70 End of ASCII range - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x80 0x80 to 0xc1 invalid - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x90 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xa0 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xb0 - 1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xc0 0xc2 to 0xdf 2 byte - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xd0 - 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,// 0xe0 0xe0 to 0xef 3 byte - 4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte + 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid }; static const char XML_legacyByteTable[256] = { - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; static const char XML_sjisByteTable[256] = { // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x00 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x10 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x20 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x30 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x40 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x50 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x60 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x70 - 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0x80 0x81 to 0x9F 2 bytes - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0x90 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xa0 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xb0 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xc0 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0xd0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xe0 0xe0 to 0xef 2 bytes - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 // 0xf0 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0x80 0x81 to 0x9F 2 bytes + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0x90 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xc0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xd0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xe0 0xe0 to 0xef 2 bytes + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 }; static const char XML_gb2312ByteTable[256] = { // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x00 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x10 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x20 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x30 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x40 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x50 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x60 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x70 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x80 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x90 - 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xa0 0xa1 to 0xf7 2 bytes - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xb0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xc0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xd0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xe0 - 2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1 // 0xf0 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xa0 0xa1 to 0xf7 2 bytes + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xb0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xe0 + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 }; static const char XML_gbk_big5_ByteTable[256] = { // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x00 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x10 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x20 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x30 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x40 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x50 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x60 - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,// 0x70 - 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0x80 0x81 to 0xfe 2 bytes - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0x90 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xa0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xb0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xc0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xd0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,// 0xe0 - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1 // 0xf0 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0x80 0x81 to 0xfe 2 bytes + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0x90 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xa0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xb0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xe0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 // 0xf0 }; static const char *XML_ByteTable=(const char *)XML_utf8ByteTable; // the default is "characterEncoding=XMLNode::encoding_UTF8" #endif @@ -534,15 +534,15 @@ XMLAttribute XMLNode::emptyXMLAttribute={ NULL, NULL}; // Enumeration used to decipher what type a token is typedef enum XMLTokenTypeTag { - eTokenText = 0, - eTokenQuotedText, + eTokenText = 0, + eTokenQuotedText, eTokenTagStart, /* "<" */ eTokenTagEnd, /* "" */ eTokenEquals, /* "=" */ eTokenDeclaration, /* "" */ - eTokenClear, + eTokenClear, eTokenError } XMLTokenType; @@ -551,7 +551,7 @@ typedef struct XML { XMLCSTR lpXML; XMLCSTR lpszText; - int nIndex,nIndexMissigEndTag; + int nIndex, nIndexMissigEndTag; enum XMLError error; XMLCSTR lpEndTag; int cbEndTag; @@ -569,8 +569,8 @@ typedef struct // Enumeration used when parsing attributes typedef enum Attrib { - eAttribName = 0, - eAttribEquals, + eAttribName = 0, + eAttribEquals, eAttribValue } Attrib; @@ -578,25 +578,25 @@ typedef enum Attrib // inside a tag typedef enum XMLStatus { - eInsideTag = 0, + eInsideTag = 0, eOutsideTag } XMLStatus; XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nFormat) const { if (!d) return eXMLErrorNone; - FILE *f=xfopen(filename,_CXML("wb")); + FILE *f=xfopen(filename, _CXML("wb")); if (!f) return eXMLErrorCannotOpenWriteFile; #ifdef _XMLWIDECHAR unsigned char h[2]={ 0xFF, 0xFE }; - if (!fwrite(h,2,1,f)) + if (!fwrite(h, 2, 1, f)) { fclose(f); return eXMLErrorCannotWriteFile; } if ((!isDeclaration())&&((d->lpszName)||(!getChildNode().isDeclaration()))) { - if (!fwrite(L"\n",sizeof(wchar_t)*40,1,f)) + if (!fwrite(L"\n", sizeof(wchar_t)*40, 1, f)) { fclose(f); return eXMLErrorCannotWriteFile; @@ -608,8 +608,8 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm if (characterEncoding == char_encoding_UTF8) { // header so that windows recognize the file as UTF-8: - unsigned char h[3]={0xEF,0xBB,0xBF}; - if (!fwrite(h,3,1,f)) + unsigned char h[3]={0xEF, 0xBB, 0xBF}; + if (!fwrite(h, 3, 1, f)) { fclose(f); return eXMLErrorCannotWriteFile; @@ -618,7 +618,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm } else if (characterEncoding == char_encoding_ShiftJIS) encoding="SHIFT-JIS"; if (!encoding) encoding="ISO-8859-1"; - if (fprintf(f,"\n",encoding)<0) + if (fprintf(f, "\n", encoding)<0) { fclose(f); return eXMLErrorCannotWriteFile; @@ -627,8 +627,8 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm { if (characterEncoding == char_encoding_UTF8) { - unsigned char h[3]={0xEF,0xBB,0xBF}; - if (!fwrite(h,3,1,f)) + unsigned char h[3]={0xEF, 0xBB, 0xBF}; + if (!fwrite(h, 3, 1, f)) { fclose(f); return eXMLErrorCannotWriteFile; @@ -637,8 +637,8 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char *encoding, char nForm } #endif int i; - XMLSTR t=createXMLString(nFormat,&i); - if (!fwrite(t,sizeof(XMLCHAR)*i,1,f)) + XMLSTR t=createXMLString(nFormat, &i); + if (!fwrite(t, sizeof(XMLCHAR)*i, 1, f)) { free(t); fclose(f); @@ -669,7 +669,7 @@ XMLSTR stringDup(XMLCSTR lpszData, int cbData) return lpszNew; } -XMLSTR ToXMLStringTool::toXMLUnSafe(XMLSTR dest,XMLCSTR source) +XMLSTR ToXMLStringTool::toXMLUnSafe(XMLSTR dest, XMLCSTR source) { XMLSTR dd=dest; XMLCHAR ch; @@ -679,7 +679,7 @@ XMLSTR ToXMLStringTool::toXMLUnSafe(XMLSTR dest,XMLCSTR source) entity=XMLEntities; do { - if (ch == entity->c) {xstrcpy(dest,entity->s); dest+=entity->l; source++; goto out_of_loop1; } + if (ch == entity->c) {xstrcpy(dest, entity->s); dest+=entity->l; source++; goto out_of_loop1; } entity++; } while (entity->s); #ifdef _XMLWIDECHAR @@ -737,7 +737,7 @@ XMLSTR ToXMLStringTool::toXML(XMLCSTR source) } int l=lengthXMLString(source)+1; if (l>buflen) { freeBuffer(); buflen=l; buf=(XMLSTR)malloc(l*sizeof(XMLCHAR)); } - return toXMLUnSafe(buf,source); + return toXMLUnSafe(buf, source); } // private: @@ -745,14 +745,14 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) { // This function is the opposite of the function "toXMLString". It decodes the escape // sequences &, ", ', <, > and replace them by the characters - // &,",',<,>. This function is used internally by the XML Parser. All the calls to + // &, ", ', <, >. This function is used internally by the XML Parser. All the calls to // the XML library will always gives you back "decoded" strings. // // in: string (s) and length (lo) of string // out: new allocated string converted from xml if (!s) return NULL; - int ll=0,j; + int ll=0, j; XMLSTR d; XMLCSTR ss=s; XMLCharacterEntity *entity; @@ -776,7 +776,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) entity=XMLEntities; do { - if ((lo>=entity->l)&&(xstrnicmp(s,entity->s,entity->l) == 0)) { s+=entity->l; lo-=entity->l; break; } + if ((lo>=entity->l)&&(xstrnicmp(s, entity->s, entity->l) == 0)) { s+=entity->l; lo-=entity->l; break; } entity++; } while (entity->s); if (!entity->s) @@ -834,7 +834,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) entity=XMLEntities; do { - if (xstrnicmp(ss,entity->s,entity->l) == 0) { *(d++)=entity->c; ss+=entity->l; break; } + if (xstrnicmp(ss, entity->s, entity->l) == 0) { *(d++)=entity->c; ss+=entity->l; break; } entity++; } while (entity->s); } @@ -902,7 +902,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT NextToken result; XMLCHAR ch; XMLCHAR chTemp; - int indexStart,nFoundMatch,nIsText=FALSE; + int indexStart, nFoundMatch, nIsText=FALSE; result.pClr=NULL; // prevent warning // Find next non-white space character @@ -975,7 +975,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT ctag++; } while (ctag->lpszOpen); - // Peek at the next character to see if we have an end tag 'lpXML[pXML->nIndex]; @@ -1109,8 +1109,8 @@ XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration) } } -XMLNode XMLNode::createXMLTopNode_WOSD(XMLSTR lpszName, char isDeclaration) { return XMLNode(NULL,lpszName,isDeclaration); } -XMLNode XMLNode::createXMLTopNode(XMLCSTR lpszName, char isDeclaration) { return XMLNode(NULL,stringDup(lpszName),isDeclaration); } +XMLNode XMLNode::createXMLTopNode_WOSD(XMLSTR lpszName, char isDeclaration) { return XMLNode(NULL, lpszName, isDeclaration); } +XMLNode XMLNode::createXMLTopNode(XMLCSTR lpszName, char isDeclaration) { return XMLNode(NULL, stringDup(lpszName), isDeclaration); } #define MEMORYINCREASE 50 @@ -1118,7 +1118,7 @@ static inline void myFree(void *p) { if (p) free(p); } static inline void *myRealloc(void *p, int newsize, int memInc, int sizeofElem) { if (p == NULL) { if (memInc) return malloc(memInc*sizeofElem); return malloc(sizeofElem); } - if ((memInc == 0)||((newsize%memInc) == 0)) p=realloc(p,(newsize+memInc)*sizeofElem); + if ((memInc == 0)||((newsize%memInc) == 0)) p=realloc(p, (newsize+memInc)*sizeofElem); // if (!p) // { // printf("XMLParser Error: Not enough memory! Aborting...\n"); exit(220); @@ -1130,32 +1130,32 @@ static inline void *myRealloc(void *p, int newsize, int memInc, int sizeofElem) XMLElementPosition XMLNode::findPosition(XMLNodeData *d, int index, XMLElementType xxtype) { if (index<0) return -1; - int i=0,j=(int)((index<<2)+xxtype),*o=d->pOrder; while (o[i] != j) i++; return i; + int i=0, j=(int)((index<<2)+xxtype), *o=d->pOrder; while (o[i] != j) i++; return i; } // private: // update "order" information when deleting a content of a XMLNode int XMLNode::removeOrderElement(XMLNodeData *d, XMLElementType t, int index) { - int n=d->nChild+d->nText+d->nClear, *o=d->pOrder,i=findPosition(d,index,t); + int n=d->nChild+d->nText+d->nClear, *o=d->pOrder, i=findPosition(d, index, t); memmove(o+i, o+i+1, (n-i)*sizeof(int)); for (;ipOrder=(int)realloc(d->pOrder,n*sizeof(int)); + // d->pOrder=(int)realloc(d->pOrder, n*sizeof(int)); // but we skip reallocation because it's too time consuming. // Anyway, at the end, it will be free'd completely at once. return i; } -void *XMLNode::addToOrder(int memoryIncrease,int *_pos, int nc, void *p, int size, XMLElementType xtype) +void *XMLNode::addToOrder(int memoryIncrease, int *_pos, int nc, void *p, int size, XMLElementType xtype) { // in: *_pos is the position inside d->pOrder ("-1" means "EndOf") // out: *_pos is the index inside p - p=myRealloc(p,(nc+1),memoryIncrease,size); + p=myRealloc(p, (nc+1), memoryIncrease, size); int n=d->nChild+d->nText+d->nClear; - d->pOrder=(int*)myRealloc(d->pOrder,n+1,memoryIncrease*3,sizeof(int)); - int pos=*_pos,*o=d->pOrder; + d->pOrder=(int*)myRealloc(d->pOrder, n+1, memoryIncrease*3, sizeof(int)); + int pos=*_pos, *o=d->pOrder; if ((pos<0)||(pos>=n)) { *_pos=nc; o[n]=(int)((nc<<2)+xtype); return p; } @@ -1169,7 +1169,7 @@ void *XMLNode::addToOrder(int memoryIncrease,int *_pos, int nc, void *p, int siz for (i=pos+1;i<=n;i++) if ((o[i]&3) == (int)xtype) o[i]+=4; *_pos=pos=o[pos]>>2; - memmove(((char*)p)+(pos+1)*size,((char*)p)+pos*size,(nc-pos)*size); + memmove(((char*)p)+(pos+1)*size, ((char*)p)+pos*size, (nc-pos)*size); return p; } @@ -1178,20 +1178,20 @@ void *XMLNode::addToOrder(int memoryIncrease,int *_pos, int nc, void *p, int siz XMLNode XMLNode::addChild_priv(int memoryIncrease, XMLSTR lpszName, char isDeclaration, int pos) { if (!lpszName) return emptyXMLNode; - d->pChild=(XMLNode*)addToOrder(memoryIncrease,&pos,d->nChild,d->pChild,sizeof(XMLNode),eNodeChild); + d->pChild=(XMLNode*)addToOrder(memoryIncrease, &pos, d->nChild, d->pChild, sizeof(XMLNode), eNodeChild); d->pChild[pos].d=NULL; - d->pChild[pos]=XMLNode(d,lpszName,isDeclaration); + d->pChild[pos]=XMLNode(d, lpszName, isDeclaration); d->nChild++; return d->pChild[pos]; } // Add an attribute to an element. -XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease,XMLSTR lpszName, XMLSTR lpszValuev) +XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XMLSTR lpszValuev) { if (!lpszName) return &emptyXMLAttribute; if (!d) { myFree(lpszName); myFree(lpszValuev); return &emptyXMLAttribute; } int nc=d->nAttribute; - d->pAttribute=(XMLAttribute*)myRealloc(d->pAttribute,(nc+1),memoryIncrease,sizeof(XMLAttribute)); + d->pAttribute=(XMLAttribute*)myRealloc(d->pAttribute, (nc+1), memoryIncrease, sizeof(XMLAttribute)); XMLAttribute *pAttr=d->pAttribute+nc; pAttr->lpszName = lpszName; pAttr->lpszValue = lpszValuev; @@ -1211,7 +1211,7 @@ XMLCSTR XMLNode::addText_priv(int memoryIncrease, XMLSTR lpszValue, int pos) if (!lpszValue) return NULL; if (!d) { myFree(lpszValue); return NULL; } invalidateInnerText(); - d->pText=(XMLCSTR*)addToOrder(memoryIncrease,&pos,d->nText,d->pText,sizeof(XMLSTR),eNodeText); + d->pText=(XMLCSTR*)addToOrder(memoryIncrease, &pos, d->nText, d->pText, sizeof(XMLSTR), eNodeText); d->pText[pos]=lpszValue; d->nText++; return lpszValue; @@ -1223,7 +1223,7 @@ XMLClear *XMLNode::addClear_priv(int memoryIncrease, XMLSTR lpszValue, XMLCSTR l if (!lpszValue) return &emptyXMLClear; if (!d) { myFree(lpszValue); return &emptyXMLClear; } invalidateInnerText(); - d->pClear=(XMLClear *)addToOrder(memoryIncrease,&pos,d->nClear,d->pClear,sizeof(XMLClear),eNodeClear); + d->pClear=(XMLClear *)addToOrder(memoryIncrease, &pos, d->nClear, d->pClear, sizeof(XMLClear), eNodeClear); XMLClear *pNewClear=d->pClear+pos; pNewClear->lpszValue = lpszValue; if (!lpszOpen) lpszOpen=XMLClearTags->lpszOpen; @@ -1252,7 +1252,7 @@ char XMLNode::parseClearTag(void *px, void *_pClear) XMLCSTR pCh=lpXML; while (*pCh) { - if (*pCh == _CXML('<')) { pClear.lpszClose=docTypeEnd; lpszTemp=xstrstr(lpXML,docTypeEnd); break; } + if (*pCh == _CXML('<')) { pClear.lpszClose=docTypeEnd; lpszTemp=xstrstr(lpXML, docTypeEnd); break; } else if (*pCh == _CXML('>')) { lpszTemp=pCh; break; } #ifdef _XMLWIDECHAR pCh++; @@ -1270,7 +1270,7 @@ char XMLNode::parseClearTag(void *px, void *_pClear) pXML->nIndex += cbTemp+(int)xstrlen(pClear.lpszClose); // Add the clear node to the current element - addClear_priv(MEMORYINCREASE,cbTemp?stringDup(lpXML,cbTemp):NULL, pClear.lpszOpen, pClear.lpszClose,-1); + addClear_priv(MEMORYINCREASE, cbTemp?stringDup(lpXML, cbTemp):NULL, pClear.lpszOpen, pClear.lpszClose, -1); return 0; } @@ -1281,11 +1281,11 @@ char XMLNode::parseClearTag(void *px, void *_pClear) void XMLNode::exactMemory(XMLNodeData *d) { - if (d->pOrder) d->pOrder=(int*)realloc(d->pOrder,(d->nChild+d->nText+d->nClear)*sizeof(int)); - if (d->pChild) d->pChild=(XMLNode*)realloc(d->pChild,d->nChild*sizeof(XMLNode)); - if (d->pAttribute) d->pAttribute=(XMLAttribute*)realloc(d->pAttribute,d->nAttribute*sizeof(XMLAttribute)); - if (d->pText) d->pText=(XMLCSTR*)realloc(d->pText,d->nText*sizeof(XMLSTR)); - if (d->pClear) d->pClear=(XMLClear *)realloc(d->pClear,d->nClear*sizeof(XMLClear)); + if (d->pOrder) d->pOrder=(int*)realloc(d->pOrder, (d->nChild+d->nText+d->nClear)*sizeof(int)); + if (d->pChild) d->pChild=(XMLNode*)realloc(d->pChild, d->nChild*sizeof(XMLNode)); + if (d->pAttribute) d->pAttribute=(XMLAttribute*)realloc(d->pAttribute, d->nAttribute*sizeof(XMLAttribute)); + if (d->pText) d->pText=(XMLCSTR*)realloc(d->pText, d->nText*sizeof(XMLSTR)); + if (d->pClear) d->pClear=(XMLClear *)realloc(d->pClear, d->nClear*sizeof(XMLClear)); } char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) @@ -1298,14 +1298,14 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) if (!cbText) { pXML->lpszText=NULL; return 0; } if (dropWhiteSpace) { cbText--; while ((cbText)&&XML_isSPACECHAR(lpszText[cbText])) cbText--; cbText++; } if (!cbText) { pXML->lpszText=NULL; return 0; } - XMLSTR lpt=fromXMLString(lpszText,cbText,pXML); + XMLSTR lpt=fromXMLString(lpszText, cbText, pXML); if (!lpt) return 1; pXML->lpszText=NULL; if (removeCommentsInMiddleOfText && d->nText && d->nClear) { // if the previous insertion was a comment () AND // if the previous previous insertion was a text then, delete the comment and append the text - int n=d->nChild+d->nText+d->nClear-1,*o=d->pOrder; + int n=d->nChild+d->nText+d->nClear-1, *o=d->pOrder; if (((o[n]&3) == eNodeClear)&&((o[n-1]&3) == eNodeText)) { int i=o[n]>>2; @@ -1315,15 +1315,15 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) i=o[n-1]>>2; n=xstrlen(d->pText[i]); int n2=xstrlen(lpt)+1; - d->pText[i]=(XMLSTR)realloc((void*)d->pText[i],(n+n2)*sizeof(XMLCHAR)); + d->pText[i]=(XMLSTR)realloc((void*)d->pText[i], (n+n2)*sizeof(XMLCHAR)); if (!d->pText[i]) return 1; - memcpy((void*)(d->pText[i]+n),lpt,n2*sizeof(XMLCHAR)); + memcpy((void*)(d->pText[i]+n), lpt, n2*sizeof(XMLCHAR)); free(lpt); return 0; } } } - addText_priv(MEMORYINCREASE,lpt,-1); + addText_priv(MEMORYINCREASE, lpt, -1); return 0; } // private: @@ -1389,7 +1389,7 @@ int XMLNode::ParseXMLElement(void *pa) nDeclaration = (xtype == eTokenDeclaration); // If we have node text then add this to the element - if (maybeAddTxT(pXML,token.pStr)) return FALSE; + if (maybeAddTxT(pXML, token.pStr)) return FALSE; // Find the name of the tag token = GetNextToken(pXML, &cbToken, &xtype); @@ -1420,7 +1420,7 @@ int XMLNode::ParseXMLElement(void *pa) // If the name of the new element differs from the name of // the current element we need to add the new element to // the current one and recurse - pNew = addChild_priv(MEMORYINCREASE,stringDup(token.pStr,cbToken), nDeclaration,-1); + pNew = addChild_priv(MEMORYINCREASE, stringDup(token.pStr, cbToken), nDeclaration, -1); while (!pNew.isEmpty()) { @@ -1474,7 +1474,7 @@ int XMLNode::ParseXMLElement(void *pa) } // Add the new element and recurse - pNew = addChild_priv(MEMORYINCREASE,stringDup(pXML->lpNewElement,pXML->cbNewElement),0,-1); + pNew = addChild_priv(MEMORYINCREASE, stringDup(pXML->lpNewElement, pXML->cbNewElement), 0, -1); pXML->cbNewElement = 0; } else @@ -1492,7 +1492,7 @@ int XMLNode::ParseXMLElement(void *pa) case eTokenTagEnd: // If we have node text then add this to the element - if (maybeAddTxT(pXML,token.pStr)) return FALSE; + if (maybeAddTxT(pXML, token.pStr)) return FALSE; // Find the name of the end tag token = GetNextToken(pXML, &cbTemp, &xtype); @@ -1552,7 +1552,7 @@ LBL_Error: // If we found a clear (unformatted) token case eTokenClear: // If we have node text then add this to the element - if (maybeAddTxT(pXML,token.pStr)) return FALSE; + if (maybeAddTxT(pXML, token.pStr)) return FALSE; if (parseClearTag(pXML, token.pClr)) return FALSE; pXML->lpszText=pXML->lpXML+pXML->nIndex; break; @@ -1622,7 +1622,7 @@ LBL_Error: // Eg. 'Attribute AnotherAttribute' case eTokenText: // Add the unvalued attribute to the list - addAttribute_priv(MEMORYINCREASE,stringDup(lpszTemp,cbTemp), NULL); + addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), NULL); // Cache the token then indicate. We are next to // look for the equals attribute lpszTemp = token.pStr; @@ -1647,7 +1647,7 @@ LBL_Error: if (cbTemp) { // Add the unvalued attribute to the list - addAttribute_priv(MEMORYINCREASE,stringDup(lpszTemp,cbTemp), NULL); + addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), NULL); } // If this is the end of the tag then return to the caller @@ -1706,10 +1706,10 @@ LBL_Error: XMLSTR attrVal=(XMLSTR)token.pStr; if (attrVal) { - attrVal=fromXMLString(attrVal,cbToken,pXML); + attrVal=fromXMLString(attrVal, cbToken, pXML); if (!attrVal) return FALSE; } - addAttribute_priv(MEMORYINCREASE,stringDup(lpszTemp,cbTemp),attrVal); + addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), attrVal); } // Indicate we are searching for a new attribute @@ -1744,7 +1744,7 @@ LBL_Error: #endif pXML->nIndexMissigEndTag=pXML->nIndex; } - maybeAddTxT(pXML,pXML->lpXML+pXML->nIndex); + maybeAddTxT(pXML, pXML->lpXML+pXML->nIndex); return FALSE; } } @@ -1757,7 +1757,7 @@ static void CountLinesAndColumns(XMLCSTR lpXML, int nUpto, XMLResults *pResults) assert(lpXML); assert(pResults); - struct XML xml={ lpXML,lpXML, 0, 0, eXMLErrorNone, NULL, 0, NULL, 0, TRUE }; + struct XML xml={ lpXML, lpXML, 0, 0, eXMLErrorNone, NULL, 0, NULL, 0, TRUE }; pResults->nLine = 1; pResults->nColumn = 1; @@ -1787,7 +1787,7 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) return emptyXMLNode; } - XMLNode xnode(NULL,NULL,FALSE); + XMLNode xnode(NULL, NULL, FALSE); struct XML xml={ lpszXML, lpszXML, 0, 0, eXMLErrorNone, NULL, 0, NULL, 0, TRUE }; // Create header element @@ -1800,7 +1800,7 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) if ((error == eXMLErrorNone)||(error == eXMLErrorMissingEndTag)||(error == eXMLErrorNoXMLTagFound)) { XMLCSTR name=xnode.getName(); - if (tag&&(*tag)&&((!name)||(xstricmp(name,tag)))) + if (tag&&(*tag)&&((!name)||(xstricmp(name, tag)))) { xnode=xnode.getChildNode(tag); if (xnode.isEmpty()) @@ -1843,24 +1843,24 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) { if (pResults) { pResults->nLine=0; pResults->nColumn=0; } - FILE *f=xfopen(filename,_CXML("rb")); + FILE *f=xfopen(filename, _CXML("rb")); if (f == NULL) { if (pResults) pResults->error=eXMLErrorFileNotFound; return emptyXMLNode; } - fseek(f,0,SEEK_END); - int l=(int)ftell(f),headerSz=0; + fseek(f, 0, SEEK_END); + int l=(int)ftell(f), headerSz=0; if (!l) { if (pResults) pResults->error=eXMLErrorEmpty; fclose(f); return emptyXMLNode; } - fseek(f,0,SEEK_SET); + fseek(f, 0, SEEK_SET); unsigned char *buf=(unsigned char*)malloc(l+4); - l=(int)fread(buf,1,l,f); + l=(int)fread(buf, 1, l, f); fclose(f); buf[l]=0;buf[l+1]=0;buf[l+2]=0;buf[l+3]=0; #ifdef _XMLWIDECHAR if (guessWideCharChars) { - if (!myIsTextWideChar(buf,l)) + if (!myIsTextWideChar(buf, l)) { XMLNode::XMLCharEncoding ce=XMLNode::char_encoding_legacy; if ((buf[0] == 0xef)&&(buf[1] == 0xbb)&&(buf[2] == 0xbf)) { headerSz=3; ce=XMLNode::char_encoding_UTF8; } - XMLSTR b2=myMultiByteToWideChar((const char*)(buf+headerSz),ce); + XMLSTR b2=myMultiByteToWideChar((const char*)(buf+headerSz), ce); if (!b2) { // todo: unable to convert @@ -1880,7 +1880,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) #else if (guessWideCharChars) { - if (myIsTextWideChar(buf,l)) + if (myIsTextWideChar(buf, l)) { if ((buf[0] == 0xef)&&(buf[1] == 0xff)) headerSz=2; if ((buf[0] == 0xff)&&(buf[1] == 0xfe)) headerSz=2; @@ -1899,12 +1899,12 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) #endif if (!buf) { if (pResults) pResults->error=eXMLErrorCharConversionError; return emptyXMLNode; } - XMLNode x=parseString((XMLSTR)(buf+headerSz),tag,pResults); + XMLNode x=parseString((XMLSTR)(buf+headerSz), tag, pResults); free(buf); return x; } -static inline void charmemset(XMLSTR dest,XMLCHAR c,int l) { while (l--) *(dest++)=c; } +static inline void charmemset(XMLSTR dest, XMLCHAR c, int l) { while (l--) *(dest++)=c; } // private: // Creates an user friendly XML string from a given element with // appropriate white space and carriage returns. @@ -1918,7 +1918,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma int cbElement; int nChildFormat=-1; int nElementI=pEntry->nChild+pEntry->nText+pEntry->nClear; - int i,j; + int i, j; if ((nFormat>=0)&&(nElementI == 1)&&(pEntry->nText == 1)&&(!pEntry->isDeclaration)) nFormat=-2; assert(pEntry); @@ -1965,7 +1965,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma { lpszMarker[nResult]=_CXML('='); lpszMarker[nResult+1]=_CXML('"'); - if (cb) ToXMLStringTool::toXMLUnSafe(&lpszMarker[nResult+2],pAttr->lpszValue); + if (cb) ToXMLStringTool::toXMLUnSafe(&lpszMarker[nResult+2], pAttr->lpszValue); lpszMarker[nResult+cb+2]=_CXML('"'); } nResult+=cb+3; @@ -2028,8 +2028,8 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma { if (lpszMarker) { - charmemset(&lpszMarker[nResult],INDENTCHAR,nFormat+1); - ToXMLStringTool::toXMLUnSafe(&lpszMarker[nResult+nFormat+1],pChild); + charmemset(&lpszMarker[nResult], INDENTCHAR, nFormat+1); + ToXMLStringTool::toXMLUnSafe(&lpszMarker[nResult+nFormat+1], pChild); lpszMarker[nResult+nFormat+1+cb]=_CXML('\n'); } nResult+=cb+nFormat+2; @@ -2112,7 +2112,7 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma { if (nFormat >=0) { - charmemset(&lpszMarker[nResult], INDENTCHAR,nFormat); + charmemset(&lpszMarker[nResult], INDENTCHAR, nFormat); nResult+=nFormat; } @@ -2188,9 +2188,9 @@ int XMLNode::detachFromParent(XMLNodeData *d) int i=0; while (((void*)(pa[i].d)) != ((void*)d)) i++; d->pParent->nChild--; - if (d->pParent->nChild) memmove(pa+i,pa+i+1,(d->pParent->nChild-i)*sizeof(XMLNode)); + if (d->pParent->nChild) memmove(pa+i, pa+i+1, (d->pParent->nChild-i)*sizeof(XMLNode)); else { free(pa); d->pParent->pChild=NULL; } - return removeOrderElement(d->pParent,eNodeChild,i); + return removeOrderElement(d->pParent, eNodeChild, i); } XMLNode::~XMLNode() @@ -2276,7 +2276,7 @@ XMLNode::XMLNode(const XMLNode &A) XMLNode XMLNode::deepCopy() const { if (!d) return XMLNode::emptyXMLNode; - XMLNode x(NULL,stringDup(d->lpszName),d->isDeclaration); + XMLNode x(NULL, stringDup(d->lpszName), d->isDeclaration); XMLNodeData *p=x.d; int n=d->nAttribute; if (n) @@ -2290,7 +2290,7 @@ XMLNode XMLNode::deepCopy() const } if (d->pOrder) { - n=(d->nChild+d->nText+d->nClear)*sizeof(int); p->pOrder=(int*)malloc(n); memcpy(p->pOrder,d->pOrder,n); + n=(d->nChild+d->nText+d->nClear)*sizeof(int); p->pOrder=(int*)malloc(n); memcpy(p->pOrder, d->pOrder, n); } n=d->nText; if (n) @@ -2333,7 +2333,7 @@ XMLNode XMLNode::addChild(XMLNode childNode, int pos) int j=pos; while (dc->nChild) { - addChild(dc->pChild[0],j); + addChild(dc->pChild[0], j); if (pos>=0) j++; } return childNode; @@ -2341,8 +2341,8 @@ XMLNode XMLNode::addChild(XMLNode childNode, int pos) if (dc->pParent) { if ((detachFromParent(dc)<=pos)&&(dc->pParent == d)) pos--; } else dc->ref_count++; dc->pParent=d; // int nc=d->nChild; - // d->pChild=(XMLNode*)myRealloc(d->pChild,(nc+1),memoryIncrease,sizeof(XMLNode)); - d->pChild=(XMLNode*)addToOrder(0,&pos,d->nChild,d->pChild,sizeof(XMLNode),eNodeChild); + // d->pChild=(XMLNode*)myRealloc(d->pChild, (nc+1), memoryIncrease, sizeof(XMLNode)); + d->pChild=(XMLNode*)addToOrder(0, &pos, d->nChild, d->pChild, sizeof(XMLNode), eNodeChild); d->pChild[pos].d=dc; d->nChild++; return childNode; @@ -2355,23 +2355,23 @@ void XMLNode::deleteAttribute(int i) XMLAttribute *p=d->pAttribute+i; free((void*)p->lpszName); if (p->lpszValue) free((void*)p->lpszValue); - if (d->nAttribute) memmove(p,p+1,(d->nAttribute-i)*sizeof(XMLAttribute)); else { free(p); d->pAttribute=NULL; } + if (d->nAttribute) memmove(p, p+1, (d->nAttribute-i)*sizeof(XMLAttribute)); else { free(p); d->pAttribute=NULL; } } void XMLNode::deleteAttribute(XMLAttribute *a) { if (a) deleteAttribute(a->lpszName); } void XMLNode::deleteAttribute(XMLCSTR lpszName) { int j=0; - getAttribute(lpszName,&j); + getAttribute(lpszName, &j); if (j) deleteAttribute(j-1); } -XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName,int i) +XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, int i) { if (!d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return NULL; } if (i>=d->nAttribute) { - if (lpszNewName) return addAttribute_WOSD(lpszNewName,lpszNewValue); + if (lpszNewName) return addAttribute_WOSD(lpszNewName, lpszNewValue); return NULL; } XMLAttribute *p=d->pAttribute+i; @@ -2383,26 +2383,26 @@ XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewN XMLAttribute *XMLNode::updateAttribute_WOSD(XMLAttribute *newAttribute, XMLAttribute *oldAttribute) { - if (oldAttribute) return updateAttribute_WOSD((XMLSTR)newAttribute->lpszValue,(XMLSTR)newAttribute->lpszName,oldAttribute->lpszName); - return addAttribute_WOSD((XMLSTR)newAttribute->lpszName,(XMLSTR)newAttribute->lpszValue); + if (oldAttribute) return updateAttribute_WOSD((XMLSTR)newAttribute->lpszValue, (XMLSTR)newAttribute->lpszName, oldAttribute->lpszName); + return addAttribute_WOSD((XMLSTR)newAttribute->lpszName, (XMLSTR)newAttribute->lpszValue); } -XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName,XMLCSTR lpszOldName) +XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, XMLCSTR lpszOldName) { int j=0; - getAttribute(lpszOldName,&j); - if (j) return updateAttribute_WOSD(lpszNewValue,lpszNewName,j-1); + getAttribute(lpszOldName, &j); + if (j) return updateAttribute_WOSD(lpszNewValue, lpszNewName, j-1); else { - if (lpszNewName) return addAttribute_WOSD(lpszNewName,lpszNewValue); - else return addAttribute_WOSD(stringDup(lpszOldName),lpszNewValue); + if (lpszNewName) return addAttribute_WOSD(lpszNewName, lpszNewValue); + else return addAttribute_WOSD(stringDup(lpszOldName), lpszNewValue); } } int XMLNode::indexText(XMLCSTR lpszValue) const { if (!d) return -1; - int i,l=d->nText; + int i, l=d->nText; if (!lpszValue) { if (l) return 0; return -1; } XMLCSTR *p=d->pText; for (i=0; inText--; XMLCSTR *p=d->pText+i; free((void*)*p); - if (d->nText) memmove(p,p+1,(d->nText-i)*sizeof(XMLCSTR)); else { free(p); d->pText=NULL; } - removeOrderElement(d,eNodeText,i); + if (d->nText) memmove(p, p+1, (d->nText-i)*sizeof(XMLCSTR)); else { free(p); d->pText=NULL; } + removeOrderElement(d, eNodeText, i); } void XMLNode::deleteText(XMLCSTR lpszValue) { deleteText(indexText(lpszValue)); } @@ -2436,7 +2436,7 @@ XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue) { if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; } int i=indexText(lpszOldValue); - if (i>=0) return updateText_WOSD(lpszNewValue,i); + if (i>=0) return updateText_WOSD(lpszNewValue, i); return addText_WOSD(lpszNewValue); } @@ -2447,14 +2447,14 @@ void XMLNode::deleteClear(int i) d->nClear--; XMLClear *p=d->pClear+i; free((void*)p->lpszValue); - if (d->nClear) memmove(p,p+1,(d->nClear-i)*sizeof(XMLClear)); else { free(p); d->pClear=NULL; } - removeOrderElement(d,eNodeClear,i); + if (d->nClear) memmove(p, p+1, (d->nClear-i)*sizeof(XMLClear)); else { free(p); d->pClear=NULL; } + removeOrderElement(d, eNodeClear, i); } int XMLNode::indexClear(XMLCSTR lpszValue) const { if (!d) return -1; - int i,l=d->nClear; + int i, l=d->nClear; if (!lpszValue) { if (l) return 0; return -1; } XMLClear *p=d->pClear; for (i=0; i=0) return updateClear_WOSD(lpszNewContent,i); + if (i>=0) return updateClear_WOSD(lpszNewContent, i); return addClear_WOSD(lpszNewContent); } -XMLClear *XMLNode::updateClear_WOSD(XMLClear *newP,XMLClear *oldP) +XMLClear *XMLNode::updateClear_WOSD(XMLClear *newP, XMLClear *oldP) { - if (oldP) return updateClear_WOSD((XMLSTR)newP->lpszValue,(XMLSTR)oldP->lpszValue); + if (oldP) return updateClear_WOSD((XMLSTR)newP->lpszValue, (XMLSTR)oldP->lpszValue); return NULL; } int XMLNode::nChildNode(XMLCSTR name) const { if (!d) return 0; - int i,j=0,n=d->nChild; + int i, j=0, n=d->nChild; XMLNode *pc=d->pChild; for (i=0; inChild; + int i=0, n=d->nChild; if (j) i=*j; XMLNode *pc=d->pChild+i; for (; i=0) { int i=0; - while (j-->0) getChildNode(name,&i); - return getChildNode(name,&i); + while (j-->0) getChildNode(name, &i); + return getChildNode(name, &i); } int i=d->nChild; - while (i--) if (!xstricmp(name,d->pChild[i].d->lpszName)) break; + while (i--) if (!xstricmp(name, d->pChild[i].d->lpszName)) break; if (i<0) return emptyXMLNode; return getChildNode(i); } @@ -2539,7 +2539,7 @@ XMLNode XMLNode::getNextNode() const if (!d) return emptyXMLNode; XMLNodeDataTag *par=d->pParent; if (!par) return emptyXMLNode; - int i,n=par->nChild; + int i, n=par->nChild; for (i=0; ipChild[i].d == d) break; @@ -2550,7 +2550,7 @@ XMLNode XMLNode::getNextNode() const XMLNode XMLNode::getChildNodeByPath(XMLCSTR _path, char createMissing, XMLCHAR sep) { XMLSTR path=stringDup(_path); - XMLNode x=getChildNodeByPathNonConst(path,createMissing,sep); + XMLNode x=getChildNodeByPathNonConst(path, createMissing, sep); if (path) free(path); return x; } @@ -2558,9 +2558,9 @@ XMLNode XMLNode::getChildNodeByPath(XMLCSTR _path, char createMissing, XMLCHAR s XMLNode XMLNode::getChildNodeByPathNonConst(XMLSTR path, char createIfMissing, XMLCHAR sep) { if ((!path)||(!(*path))) return *this; - XMLNode xn,xbase=*this; - XMLCHAR *tend1,sepString[2]; sepString[0]=sep; sepString[1]=0; - tend1=xstrstr(path,sepString); + XMLNode xn, xbase=*this; + XMLCHAR *tend1, sepString[2]; sepString[0]=sep; sepString[1]=0; + tend1=xstrstr(path, sepString); while (tend1) { *tend1=0; @@ -2573,16 +2573,16 @@ XMLNode XMLNode::getChildNodeByPathNonConst(XMLSTR path, char createIfMissing, X *tend1=sep; xbase=xn; path=tend1+1; - tend1=xstrstr(path,sepString); + tend1=xstrstr(path, sepString); } xn=xbase.getChildNode(path); if (xn.isEmpty()&&createIfMissing) xn=xbase.addChild(path); return xn; } -XMLElementPosition XMLNode::positionOfText (int i) const { if (i>=d->nText ) i=d->nText-1; return findPosition(d,i,eNodeText ); } -XMLElementPosition XMLNode::positionOfClear (int i) const { if (i>=d->nClear) i=d->nClear-1; return findPosition(d,i,eNodeClear); } -XMLElementPosition XMLNode::positionOfChildNode(int i) const { if (i>=d->nChild) i=d->nChild-1; return findPosition(d,i,eNodeChild); } +XMLElementPosition XMLNode::positionOfText (int i) const { if (i>=d->nText ) i=d->nText-1; return findPosition(d, i, eNodeText ); } +XMLElementPosition XMLNode::positionOfClear (int i) const { if (i>=d->nClear) i=d->nClear-1; return findPosition(d, i, eNodeClear); } +XMLElementPosition XMLNode::positionOfChildNode(int i) const { if (i>=d->nChild) i=d->nChild-1; return findPosition(d, i, eNodeChild); } XMLElementPosition XMLNode::positionOfText (XMLCSTR lpszValue) const { return positionOfText (indexText (lpszValue)); } XMLElementPosition XMLNode::positionOfClear(XMLCSTR lpszValue) const { return positionOfClear(indexClear(lpszValue)); } XMLElementPosition XMLNode::positionOfClear(XMLClear *a) const { if (a) return positionOfClear(a->lpszValue); return positionOfClear(); } @@ -2592,26 +2592,26 @@ XMLElementPosition XMLNode::positionOfChildNode(XMLNode x) const XMLNodeData *dd=x.d; XMLNode *pc=d->pChild; int i=d->nChild; - while (i--) if (pc[i].d == dd) return findPosition(d,i,eNodeChild); + while (i--) if (pc[i].d == dd) return findPosition(d, i, eNodeChild); return -1; } XMLElementPosition XMLNode::positionOfChildNode(XMLCSTR name, int count) const { if (!name) return positionOfChildNode(count); int j=0; - do { getChildNode(name,&j); if (j<0) return -1; } while (count--); - return findPosition(d,j-1,eNodeChild); + do { getChildNode(name, &j); if (j<0) return -1; } while (count--); + return findPosition(d, j-1, eNodeChild); } -XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name,XMLCSTR attributeName,XMLCSTR attributeValue, int *k) const +XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name, XMLCSTR attributeName, XMLCSTR attributeValue, int *k) const { - int i=0,j; + int i=0, j; if (k) i=*k; XMLNode x; XMLCSTR t; do { - x=getChildNode(name,&i); + x=getChildNode(name, &i); if (!x.isEmpty()) { if (attributeValue) @@ -2619,8 +2619,8 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name,XMLCSTR attributeName,XM j=0; do { - t=x.getAttribute(attributeName,&j); - if (t&&(xstricmp(attributeValue,t) == 0)) { if (k) *k=i; return x; } + t=x.getAttribute(attributeName, &j); + if (t&&(xstricmp(attributeValue, t) == 0)) { if (k) *k=i; return x; } } while (t); } else { @@ -2635,7 +2635,7 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name,XMLCSTR attributeName,XM XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const { if (!d) return NULL; - int i=0,n=d->nAttribute; + int i=0, n=d->nAttribute; if (j) i=*j; XMLAttribute *pAttr=d->pAttribute+i; for (; inAttribute; + int i, n=d->nAttribute; XMLAttribute *pAttr=d->pAttribute; for (i=0; i0) getAttribute(name,&i); - return getAttribute(name,&i); + while (j-->0) getAttribute(name, &i); + return getAttribute(name, &i); } XMLNodeContents XMLNode::enumContents(int i) const @@ -2756,41 +2756,41 @@ char XMLNode::isEmpty ( ) const { return (d == NULL); } XMLNode XMLNode::emptyNode ( ) { return XMLNode::emptyXMLNode; } XMLNode XMLNode::addChild(XMLCSTR lpszName, char isDeclaration, XMLElementPosition pos) -{ return addChild_priv(0,stringDup(lpszName),isDeclaration,pos); } +{ return addChild_priv(0, stringDup(lpszName), isDeclaration, pos); } XMLNode XMLNode::addChild_WOSD(XMLSTR lpszName, char isDeclaration, XMLElementPosition pos) -{ return addChild_priv(0,lpszName,isDeclaration,pos); } +{ return addChild_priv(0, lpszName, isDeclaration, pos); } XMLAttribute *XMLNode::addAttribute(XMLCSTR lpszName, XMLCSTR lpszValue) -{ return addAttribute_priv(0,stringDup(lpszName),stringDup(lpszValue)); } +{ return addAttribute_priv(0, stringDup(lpszName), stringDup(lpszValue)); } XMLAttribute *XMLNode::addAttribute_WOSD(XMLSTR lpszName, XMLSTR lpszValuev) -{ return addAttribute_priv(0,lpszName,lpszValuev); } +{ return addAttribute_priv(0, lpszName, lpszValuev); } XMLCSTR XMLNode::addText(XMLCSTR lpszValue, XMLElementPosition pos) -{ return addText_priv(0,stringDup(lpszValue),pos); } +{ return addText_priv(0, stringDup(lpszValue), pos); } XMLCSTR XMLNode::addText_WOSD(XMLSTR lpszValue, XMLElementPosition pos) -{ return addText_priv(0,lpszValue,pos); } +{ return addText_priv(0, lpszValue, pos); } XMLClear *XMLNode::addClear(XMLCSTR lpszValue, XMLCSTR lpszOpen, XMLCSTR lpszClose, XMLElementPosition pos) -{ return addClear_priv(0,stringDup(lpszValue),lpszOpen,lpszClose,pos); } +{ return addClear_priv(0, stringDup(lpszValue), lpszOpen, lpszClose, pos); } XMLClear *XMLNode::addClear_WOSD(XMLSTR lpszValue, XMLCSTR lpszOpen, XMLCSTR lpszClose, XMLElementPosition pos) -{ return addClear_priv(0,lpszValue,lpszOpen,lpszClose,pos); } +{ return addClear_priv(0, lpszValue, lpszOpen, lpszClose, pos); } XMLCSTR XMLNode::updateName(XMLCSTR lpszName) { return updateName_WOSD(stringDup(lpszName)); } XMLAttribute *XMLNode::updateAttribute(XMLAttribute *newAttribute, XMLAttribute *oldAttribute) -{ return updateAttribute_WOSD(stringDup(newAttribute->lpszValue),stringDup(newAttribute->lpszName),oldAttribute->lpszName); } -XMLAttribute *XMLNode::updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName,int i) -{ return updateAttribute_WOSD(stringDup(lpszNewValue),stringDup(lpszNewName),i); } -XMLAttribute *XMLNode::updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName,XMLCSTR lpszOldName) -{ return updateAttribute_WOSD(stringDup(lpszNewValue),stringDup(lpszNewName),lpszOldName); } +{ return updateAttribute_WOSD(stringDup(newAttribute->lpszValue), stringDup(newAttribute->lpszName), oldAttribute->lpszName); } +XMLAttribute *XMLNode::updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName, int i) +{ return updateAttribute_WOSD(stringDup(lpszNewValue), stringDup(lpszNewName), i); } +XMLAttribute *XMLNode::updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName, XMLCSTR lpszOldName) +{ return updateAttribute_WOSD(stringDup(lpszNewValue), stringDup(lpszNewName), lpszOldName); } XMLCSTR XMLNode::updateText(XMLCSTR lpszNewValue, int i) -{ return updateText_WOSD(stringDup(lpszNewValue),i); } +{ return updateText_WOSD(stringDup(lpszNewValue), i); } XMLCSTR XMLNode::updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue) -{ return updateText_WOSD(stringDup(lpszNewValue),lpszOldValue); } +{ return updateText_WOSD(stringDup(lpszNewValue), lpszOldValue); } XMLClear *XMLNode::updateClear(XMLCSTR lpszNewContent, int i) -{ return updateClear_WOSD(stringDup(lpszNewContent),i); } +{ return updateClear_WOSD(stringDup(lpszNewContent), i); } XMLClear *XMLNode::updateClear(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue) -{ return updateClear_WOSD(stringDup(lpszNewValue),lpszOldValue); } -XMLClear *XMLNode::updateClear(XMLClear *newP,XMLClear *oldP) -{ return updateClear_WOSD(stringDup(newP->lpszValue),oldP->lpszValue); } +{ return updateClear_WOSD(stringDup(lpszNewValue), lpszOldValue); } +XMLClear *XMLNode::updateClear(XMLClear *newP, XMLClear *oldP) +{ return updateClear_WOSD(stringDup(newP->lpszValue), oldP->lpszValue); } -char XMLNode::setGlobalOptions(XMLCharEncoding _characterEncoding, char _guessWideCharChars, +char XMLNode::setGlobalOptions(XMLCharEncoding _characterEncoding, char _guessWideCharChars, char _dropWhiteSpace, char _removeCommentsInMiddleOfText) { guessWideCharChars=_guessWideCharChars; dropWhiteSpace=_dropWhiteSpace; removeCommentsInMiddleOfText=_removeCommentsInMiddleOfText; @@ -2811,13 +2811,13 @@ char XMLNode::setGlobalOptions(XMLCharEncoding _characterEncoding, char _guessWi return 0; } -XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf,int l, char useXMLEncodingAttribute) +XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf, int l, char useXMLEncodingAttribute) { #ifdef _XMLWIDECHAR return (XMLCharEncoding)0; #else if (l<25) return (XMLCharEncoding)0; - if (guessWideCharChars&&(myIsTextWideChar(buf,l))) return (XMLCharEncoding)0; + if (guessWideCharChars&&(myIsTextWideChar(buf, l))) return (XMLCharEncoding)0; unsigned char *b=(unsigned char*)buf; if ((b[0] == 0xef)&&(b[1] == 0xbb)&&(b[2] == 0xbf)) return char_encoding_UTF8; @@ -2837,29 +2837,29 @@ XMLNode::XMLCharEncoding XMLNode::guessCharEncoding(void *buf,int l, char useXML // if encoding is specified and different from utf-8 than it's non-utf8 // otherwise it's utf-8 char bb[201]; - l=mmin(l,200); - memcpy(bb,buf,l); // copy buf into bb to be able to do "bb[l]=0" + l=mmin(l, 200); + memcpy(bb, buf, l); // copy buf into bb to be able to do "bb[l]=0" bb[l]=0; - b=(unsigned char*)strstr(bb,"encoding"); + b=(unsigned char*)strstr(bb, "encoding"); if (!b) return bestGuess; b+=8; while XML_isSPACECHAR(*b) b++; if (*b != '=') return bestGuess; b++; while XML_isSPACECHAR(*b) b++; if ((*b != '\'')&&(*b != '"')) return bestGuess; b++; while XML_isSPACECHAR(*b) b++; - if ((xstrnicmp((char*)b,"utf-8",5) == 0)|| - (xstrnicmp((char*)b,"utf8",4) == 0)) + if ((xstrnicmp((char*)b, "utf-8", 5) == 0)|| + (xstrnicmp((char*)b, "utf8", 4) == 0)) { if (bestGuess == char_encoding_legacy) return char_encoding_error; return char_encoding_UTF8; } - if ((xstrnicmp((char*)b,"shiftjis",8) == 0)|| - (xstrnicmp((char*)b,"shift-jis",9) == 0)|| - (xstrnicmp((char*)b,"sjis",4) == 0)) return char_encoding_ShiftJIS; + if ((xstrnicmp((char*)b, "shiftjis", 8) == 0)|| + (xstrnicmp((char*)b, "shift-jis", 9) == 0)|| + (xstrnicmp((char*)b, "sjis", 4) == 0)) return char_encoding_ShiftJIS; - if (xstrnicmp((char*)b,"GB2312",6) == 0) return char_encoding_GB2312; - if (xstrnicmp((char*)b,"Big5",4) == 0) return char_encoding_Big5; - if (xstrnicmp((char*)b,"GBK",3) == 0) return char_encoding_GBK; + if (xstrnicmp((char*)b, "GB2312", 6) == 0) return char_encoding_GB2312; + if (xstrnicmp((char*)b, "Big5", 4) == 0) return char_encoding_Big5; + if (xstrnicmp((char*)b, "GBK", 3) == 0) return char_encoding_GBK; return char_encoding_legacy; #endif @@ -2878,15 +2878,15 @@ XMLCSTR base64EncodeTable=_CXML("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu // Decode Table gives the index of any valid base64 character in the Base64 table] // 96: '=' - 97: space char - 98: illegal char - 99: end of string const unsigned char base64DecodeTable[] = { - 99,98,98,98,98,98,98,98,98,97, 97,98,98,97,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, //00 -29 - 98,98,97,98,98,98,98,98,98,98, 98,98,98,62,98,98,98,63,52,53, 54,55,56,57,58,59,60,61,98,98, //30 -59 - 98,96,98,98,98, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, 15,16,17,18,19,20,21,22,23,24, //60 -89 - 25,98,98,98,98,98,98,26,27,28, 29,30,31,32,33,34,35,36,37,38, 39,40,41,42,43,44,45,46,47,48, //90 -119 - 49,50,51,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, //120 -149 - 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, //150 -179 - 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, //180 -209 - 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, //210 -239 - 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98 //240 -255 + 99, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 98, 98, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, //00 -29 + 98, 98, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 62, 98, 98, 98, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 98, 98, //30 -59 + 98, 96, 98, 98, 98, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, //60 -89 + 25, 98, 98, 98, 98, 98, 98, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, //90 -119 + 49, 50, 51, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, //120 -149 + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, //150 -179 + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, //180 -209 + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, //210 -239 + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98 //240 -255 }; XMLParserBase64Tool::~XMLParserBase64Tool() { freeBuffer(); } @@ -2902,7 +2902,7 @@ int XMLParserBase64Tool::encodeLength(int inlen, char formatted) XMLSTR XMLParserBase64Tool::encode(unsigned char *inbuf, unsigned int inlen, char formatted) { - int i=encodeLength(inlen,formatted),k=17,eLen=inlen/3,j; + int i=encodeLength(inlen, formatted), k=17, eLen=inlen/3, j; alloc(i*sizeof(XMLCHAR)); XMLSTR curr=(XMLSTR)buf; for (i=0;ibuflen) { buf=realloc(buf,newsize); buflen=newsize; } + if (newsize>buflen) { buf=realloc(buf, newsize); buflen=newsize; } } unsigned char *XMLParserBase64Tool::decode(XMLCSTR data, int *outlen, XMLError *xe) { if (xe) *xe=eXMLErrorNone; if (!data) { *outlen=0; return (unsigned char*)""; } - unsigned int len=decodeSize(data,xe); + unsigned int len=decodeSize(data, xe); if (outlen) *outlen=len; if (!len) return NULL; alloc(len+1); - if(!decode(data,(unsigned char*)buf,len,xe)) { return NULL; } + if(!decode(data, (unsigned char*)buf, len, xe)) { return NULL; } return (unsigned char*)buf; } diff --git a/src/modules/xml/xmlParser.h b/src/modules/xml/xmlParser.h index 55a3dca61a..5c13e603c0 100644 --- a/src/modules/xml/xmlParser.h +++ b/src/modules/xml/xmlParser.h @@ -66,7 +66,7 @@ * problem, during all the debugging session, I am now using a very fast DLL version of the * XMLParser Library (the DLL is compiled in release mode). Using the DLL version of * the XMLParser Library allows me to have lightening XML parsing speed even in debug! - * Other than that, the DLL version is useless: In the release version of my tool, + * Other than that, the DLL version is useless: In the release version of my tool, * I always use the normal, ".cpp"-based, XMLParser Library (I simply include the * xmlParser.cpp and * xmlParser.h files into the project). @@ -156,27 +156,27 @@ /// Enumeration for XML parse errors. typedef enum XMLError { - eXMLErrorNone = 0, - eXMLErrorMissingEndTag, - eXMLErrorNoXMLTagFound, - eXMLErrorEmpty, - eXMLErrorMissingTagName, - eXMLErrorMissingEndTagName, - eXMLErrorUnmatchedEndTag, - eXMLErrorUnmatchedEndClearTag, - eXMLErrorUnexpectedToken, - eXMLErrorNoElements, - eXMLErrorFileNotFound, - eXMLErrorFirstTagNotFound, - eXMLErrorUnknownCharacterEntity, - eXMLErrorCharacterCodeAbove255, - eXMLErrorCharConversionError, - eXMLErrorCannotOpenWriteFile, - eXMLErrorCannotWriteFile, - - eXMLErrorBase64DataSizeIsNotMultipleOf4, - eXMLErrorBase64DecodeIllegalCharacter, - eXMLErrorBase64DecodeTruncatedData, + eXMLErrorNone = 0, + eXMLErrorMissingEndTag, + eXMLErrorNoXMLTagFound, + eXMLErrorEmpty, + eXMLErrorMissingTagName, + eXMLErrorMissingEndTagName, + eXMLErrorUnmatchedEndTag, + eXMLErrorUnmatchedEndClearTag, + eXMLErrorUnexpectedToken, + eXMLErrorNoElements, + eXMLErrorFileNotFound, + eXMLErrorFirstTagNotFound, + eXMLErrorUnknownCharacterEntity, + eXMLErrorCharacterCodeAbove255, + eXMLErrorCharConversionError, + eXMLErrorCannotOpenWriteFile, + eXMLErrorCannotWriteFile, + + eXMLErrorBase64DataSizeIsNotMultipleOf4, + eXMLErrorBase64DecodeIllegalCharacter, + eXMLErrorBase64DecodeTruncatedData, eXMLErrorBase64DecodeBufferTooSmall } XMLError; @@ -184,10 +184,10 @@ typedef enum XMLError /// Enumeration used to manage type of data. Use in conjunction with structure XMLNodeContents typedef enum XMLElementType { - eNodeChild=0, - eNodeAttribute=1, - eNodeText=2, - eNodeClear=3, + eNodeChild=0, + eNodeAttribute=1, + eNodeText=2, + eNodeClear=3, eNodeNULL=4 } XMLElementType; @@ -195,7 +195,7 @@ typedef enum XMLElementType typedef struct XMLResults { enum XMLError error; - int nLine,nColumn,nChars; + int nLine, nColumn, nChars; } XMLResults; /// Structure for XML clear (unformatted) node (usually comments) @@ -298,8 +298,8 @@ public: * with appropriate white spaces and carriage returns. if pnSize is given it returns the size in character of the string. */ /// Save the content of an xmlNode inside a file - XMLError writeToFile(XMLCSTR filename, - const char *encoding=NULL, + XMLError writeToFile(XMLCSTR filename, + const char *encoding=NULL, char nFormat=1) const; /**< If nFormat == 0, no formatting is required otherwise this returns an user friendly XML string from a given element with appropriate white spaces and carriage returns. * If the global parameter "characterEncoding == encoding_UTF8", then the "encoding" parameter is ignored and always set to "utf-8". @@ -319,9 +319,9 @@ public: XMLNode getChildNode(int i=0) const; ///< return ith child node XMLNode getChildNode(XMLCSTR name, int i) const; ///< return ith child node with specific name (return an empty node if failing). If i == -1, this returns the last XMLNode with the given name. XMLNode getChildNode(XMLCSTR name, int *i=NULL) const; ///< return next child node with specific name (return an empty node if failing) - XMLNode getChildNodeWithAttribute(XMLCSTR tagName, - XMLCSTR attributeName, - XMLCSTR attributeValue=NULL, + XMLNode getChildNodeWithAttribute(XMLCSTR tagName, + XMLCSTR attributeName, + XMLCSTR attributeValue=NULL, int *i=NULL) const; ///< return child node with specific name/attribute (return an empty node if failing) XMLNode getChildNodeByPath(XMLSTR path, char createNodeIfMissing=0, XMLCHAR sep='/'); ///< return the first child node with specific path. WARNING: the value of the parameter "path" is destroyed! @@ -342,7 +342,7 @@ public: int nAttribute() const; ///< nbr of attribute XMLClear getClear(int i=0) const; ///< return ith clear field (comments) int nClear() const; ///< nbr of clear field - XMLNodeContents enumContents(XMLElementPosition i) const; ///< enumerate all the different contents (attribute,child,text, clear) of the current XMLNode. The order is reflecting the order of the original file/string. NOTE: 0 <= i < nElement(); + XMLNodeContents enumContents(XMLElementPosition i) const; ///< enumerate all the different contents (attribute, child, text, clear) of the current XMLNode. The order is reflecting the order of the original file/string. NOTE: 0 <= i < nElement(); int nElement() const; ///< nbr of different contents for current node char isEmpty() const; ///< is this node Empty? char isDeclaration() const; ///< is this node a declaration @@ -397,12 +397,12 @@ public: */ XMLCSTR updateName(XMLCSTR lpszName); ///< change node's name XMLAttribute *updateAttribute(XMLAttribute *newAttribute, XMLAttribute *oldAttribute); ///< if the attribute to update is missing, a new one will be added - XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName=NULL,int i=0); ///< if the attribute to update is missing, a new one will be added - XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName,XMLCSTR lpszOldName);///< set lpszNewName=NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added + XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName=NULL, int i=0); ///< if the attribute to update is missing, a new one will be added + XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName, XMLCSTR lpszOldName);///< set lpszNewName=NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added XMLCSTR updateText(XMLCSTR lpszNewValue, int i=0); ///< if the text to update is missing, a new one will be added XMLCSTR updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update is missing, a new one will be added XMLClear *updateClear(XMLCSTR lpszNewContent, int i=0); ///< if the clearTag to update is missing, a new one will be added - XMLClear *updateClear(XMLClear *newP,XMLClear *oldP); ///< if the clearTag to update is missing, a new one will be added + XMLClear *updateClear(XMLClear *newP, XMLClear *oldP); ///< if the clearTag to update is missing, a new one will be added XMLClear *updateClear(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the clearTag to update is missing, a new one will be added /** @} */ @@ -431,14 +431,14 @@ public: * will be free'd by the XMLNode class. For example, it means that this is incorrect: * \code * xNode.addText_WOSD("foo"); - * xNode.updateAttribute_WOSD("#newcolor" ,NULL,"color"); + * xNode.updateAttribute_WOSD("#newcolor" , NULL, "color"); * \endcode * In opposition, this is correct: * \code * xNode.addText("foo"); * xNode.addText_WOSD(stringDup("foo")); - * xNode.updateAttribute("#newcolor" ,NULL,"color"); - * xNode.updateAttribute_WOSD(stringDup("#newcolor"),NULL,"color"); + * xNode.updateAttribute("#newcolor" , NULL, "color"); + * xNode.updateAttribute_WOSD(stringDup("#newcolor"), NULL, "color"); * \endcode * Typically, you will never do: * \code @@ -461,12 +461,12 @@ public: XMLCSTR updateName_WOSD(XMLSTR lpszName); ///< change node's name XMLAttribute *updateAttribute_WOSD(XMLAttribute *newAttribute, XMLAttribute *oldAttribute); ///< if the attribute to update is missing, a new one will be added - XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName=NULL,int i=0); ///< if the attribute to update is missing, a new one will be added - XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName,XMLCSTR lpszOldName); ///< set lpszNewName=NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added + XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName=NULL, int i=0); ///< if the attribute to update is missing, a new one will be added + XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, XMLCSTR lpszOldName); ///< set lpszNewName=NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added XMLCSTR updateText_WOSD(XMLSTR lpszNewValue, int i=0); ///< if the text to update is missing, a new one will be added XMLCSTR updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update is missing, a new one will be added XMLClear *updateClear_WOSD(XMLSTR lpszNewContent, int i=0); ///< if the clearTag to update is missing, a new one will be added - XMLClear *updateClear_WOSD(XMLClear *newP,XMLClear *oldP); ///< if the clearTag to update is missing, a new one will be added + XMLClear *updateClear_WOSD(XMLClear *newP, XMLClear *oldP); ///< if the clearTag to update is missing, a new one will be added XMLClear *updateClear_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the clearTag to update is missing, a new one will be added /** @} */ @@ -489,12 +489,12 @@ public: /// Enumeration for XML character encoding. typedef enum XMLCharEncoding { - char_encoding_error=0, - char_encoding_UTF8=1, - char_encoding_legacy=2, - char_encoding_ShiftJIS=3, - char_encoding_GB2312=4, - char_encoding_Big5=5, + char_encoding_error=0, + char_encoding_UTF8=1, + char_encoding_legacy=2, + char_encoding_ShiftJIS=3, + char_encoding_GB2312=4, + char_encoding_Big5=5, char_encoding_GBK=6 // this is actually the same as Big5 } XMLCharEncoding; @@ -502,7 +502,7 @@ public: * @{ */ /// Sets the global options for the conversions - static char setGlobalOptions(XMLCharEncoding characterEncoding=XMLNode::char_encoding_UTF8, char guessWideCharChars=1, + static char setGlobalOptions(XMLCharEncoding characterEncoding=XMLNode::char_encoding_UTF8, char guessWideCharChars=1, char dropWhiteSpace=1, char removeCommentsInMiddleOfText=1); /**< The "setGlobalOptions" function allows you to change four global parameters that affect string & file * parsing. First of all, you most-probably will never have to change these 3 global parameters. @@ -519,7 +519,7 @@ public: * * @param characterEncoding This parameter is only meaningful when compiling in char* mode (multibyte character mode). * In wchar_t* (wide char mode), this parameter is ignored. This parameter should be one of the - * three currently recognized encodings: XMLNode::encoding_UTF8, XMLNode::encoding_ascii, + * three currently recognized encodings: XMLNode::encoding_UTF8, XMLNode::encoding_ascii, * XMLNode::encoding_ShiftJIS. * * @param dropWhiteSpace In most situations, text fields containing only white spaces (and carriage returns) @@ -532,7 +532,7 @@ public: * * @param removeCommentsInMiddleOfText To explain this parameter, let's consider this code: * \code - * XMLNode x=XMLNode::parseString("foobarchu","a"); + * XMLNode x=XMLNode::parseString("foobarchu", "a"); * \endcode * If removeCommentsInMiddleOfText=0, then we will have: * \code @@ -585,7 +585,7 @@ private: XMLCSTR *pText; // Array of text fields XMLClear *pClear; // Array of clear fields XMLAttribute *pAttribute; // Array of attributes - int *pOrder; // order of the child_nodes,text_fields,clear_fields + int *pOrder; // order of the child_nodes, text_fields, clear_fields int ref_count; // for garbage collection (smart pointers) XMLSTR pInnerText; // cached value of inner text, for memory manadgement purposes } XMLNodeData; @@ -597,10 +597,10 @@ private: void *addToOrder(int memInc, int *_pos, int nc, void *p, int size, XMLElementType xtype); int indexText(XMLCSTR lpszValue) const; int indexClear(XMLCSTR lpszValue) const; - XMLNode addChild_priv(int,XMLSTR,char,int); - XMLAttribute *addAttribute_priv(int,XMLSTR,XMLSTR); - XMLCSTR addText_priv(int,XMLSTR,int); - XMLClear *addClear_priv(int,XMLSTR,XMLCSTR,XMLCSTR,int); + XMLNode addChild_priv(int, XMLSTR, char, int); + XMLAttribute *addAttribute_priv(int, XMLSTR, XMLSTR); + XMLCSTR addText_priv(int, XMLSTR, int); + XMLClear *addClear_priv(int, XMLSTR, XMLCSTR, XMLCSTR, int); void emptyTheNode(char force); void invalidateInnerText(); static inline XMLElementPosition findPosition(XMLNodeData *d, int index, XMLElementType xtype); @@ -646,21 +646,21 @@ XMLDLLENTRY void freeXMLString(XMLSTR t); // {free(t);} * delete them without any trouble. * * @{ */ -XMLDLLENTRY char xmltob(XMLCSTR xmlString,char defautValue=0); -XMLDLLENTRY int xmltoi(XMLCSTR xmlString,int defautValue=0); -XMLDLLENTRY long xmltol(XMLCSTR xmlString,long defautValue=0); -XMLDLLENTRY double xmltof(XMLCSTR xmlString,double defautValue=.0); -XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString,XMLCSTR defautValue=_CXML("")); -XMLDLLENTRY XMLCHAR xmltoc(XMLCSTR xmlString,const XMLCHAR defautValue=_CXML('\0')); +XMLDLLENTRY char xmltob(XMLCSTR xmlString, char defautValue=0); +XMLDLLENTRY int xmltoi(XMLCSTR xmlString, int defautValue=0); +XMLDLLENTRY long xmltol(XMLCSTR xmlString, long defautValue=0); +XMLDLLENTRY double xmltof(XMLCSTR xmlString, double defautValue=.0); +XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString, XMLCSTR defautValue=_CXML("")); +XMLDLLENTRY XMLCHAR xmltoc(XMLCSTR xmlString, const XMLCHAR defautValue=_CXML('\0')); /** @} */ -/** @defgroup ToXMLStringTool Helper class to create XML files using "printf", "fprintf", "cout",... functions. +/** @defgroup ToXMLStringTool Helper class to create XML files using "printf", "fprintf", "cout", ... functions. * @ingroup XMLParserGeneral * @{ */ -/// Helper class to create XML files using "printf", "fprintf", "cout",... functions. -/** The ToXMLStringTool class helps you creating XML files using "printf", "fprintf", "cout",... functions. +/// Helper class to create XML files using "printf", "fprintf", "cout", ... functions. +/** The ToXMLStringTool class helps you creating XML files using "printf", "fprintf", "cout", ... functions. * The "ToXMLStringTool" class is processing strings so that all the characters -* &,",',<,> are replaced by their XML equivalent: +* &, ", ', <, > are replaced by their XML equivalent: * \verbatim &, ", ', <, > \endverbatim * Using the "ToXMLStringTool class" and the "fprintf function" is THE most efficient * way to produce VERY large XML documents VERY fast. @@ -670,7 +670,7 @@ XMLDLLENTRY XMLCHAR xmltoc(XMLCSTR xmlString,const XMLCHAR defautValue=_CXML('\0 typedef struct XMLDLLENTRY ToXMLStringTool { public: - ToXMLStringTool(): buf(NULL),buflen(0) {} + ToXMLStringTool(): buf(NULL), buflen(0) {} ~ToXMLStringTool(); void freeBuffer();///