From c6fb861d7159279b6ee4a4dd678d4693ee56bac6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 7 Oct 2012 12:50:40 +0000 Subject: death of old nasty clutch with MS_PROTO_ENUMPROTOCOLS & PROTOACCOUNT::type git-svn-id: http://svn.miranda-ng.org/main/trunk@1799 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/KeyboardNotify/src/EnumProc.cpp | 4 +-- plugins/KeyboardNotify/src/EnumProc.h | 2 +- plugins/KeyboardNotify/src/main.cpp | 64 +++++++++++++++------------------ plugins/KeyboardNotify/src/options.cpp | 7 ++-- plugins/KeyboardNotify/src/protolist.h | 2 +- 5 files changed, 34 insertions(+), 45 deletions(-) (limited to 'plugins/KeyboardNotify') diff --git a/plugins/KeyboardNotify/src/EnumProc.cpp b/plugins/KeyboardNotify/src/EnumProc.cpp index 3802569101..8681f7d1ba 100644 --- a/plugins/KeyboardNotify/src/EnumProc.cpp +++ b/plugins/KeyboardNotify/src/EnumProc.cpp @@ -231,9 +231,7 @@ BOOL WINAPI Enum16(DWORD dwThreadId, WORD hMod16, WORD hTask16, TCHAR *szModName BOOL findFilename(TCHAR *fileName) { - unsigned int i; - - for (i=0; i < ProcessList.count; i++) + for (int i=0; i < ProcessList.count; i++) if (ProcessList.szFileName[i] && !_wcsicmp(ProcessList.szFileName[i], fileName)) return TRUE; diff --git a/plugins/KeyboardNotify/src/EnumProc.h b/plugins/KeyboardNotify/src/EnumProc.h index 09b3cba8d6..3770d7b694 100644 --- a/plugins/KeyboardNotify/src/EnumProc.h +++ b/plugins/KeyboardNotify/src/EnumProc.h @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ typedef struct { - unsigned int count; + int count; TCHAR **szFileName; } PROCESS_LIST; diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 53d135252c..d312b35903 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -452,7 +452,7 @@ BOOL checkGlobalStatus() BOOL checkGlobalXstatus() { ICQ_CUSTOM_STATUS xstatus={0}; - unsigned int i, protosSupporting; int status=0; + int i, protosSupporting, status=0; for(i=0, protosSupporting=0; i < ProtoList.protoCount; i++) { if (!ProtoList.protoInfo[i].enabled || !ProtoList.protoInfo[i].xstatus.count) continue; @@ -510,12 +510,10 @@ BOOL checkIgnore(HANDLE hContact, WORD eventType) BOOL checkProtocol(char *szProto) { - unsigned int i; - if (!szProto) return FALSE; - for(i=0; i < ProtoList.protoCount; i++) + for(int i=0; i < ProtoList.protoCount; i++) if (ProtoList.protoInfo[i].szProto && !strcmp(ProtoList.protoInfo[i].szProto, szProto)) return ProtoList.protoInfo[i].enabled; @@ -677,13 +675,13 @@ BOOL checkStatus(char *szProto) BOOL checkXstatus(char *szProto) { - unsigned int i; int status=0; + int status=0; ICQ_CUSTOM_STATUS xstatus={0}; if (!szProto) return checkGlobalXstatus(); - for(i=0; i < ProtoList.protoCount; i++) + for(int i=0; i < ProtoList.protoCount; i++) if (ProtoList.protoInfo[i].szProto && !strcmp(ProtoList.protoInfo[i].szProto, szProto)) { if (!ProtoList.protoInfo[i].xstatus.count) return TRUE; @@ -879,8 +877,6 @@ void destroyProcessList(void) void LoadSettings(void) { - unsigned int i; - bFlashOnMsg = DBGetContactSettingByte(NULL, KEYBDMODULE, "onmsg", DEF_SETTING_ONMSG); bFlashOnURL = DBGetContactSettingByte(NULL, KEYBDMODULE, "onurl", DEF_SETTING_ONURL); bFlashOnFile = DBGetContactSettingByte(NULL, KEYBDMODULE, "onfile", DEF_SETTING_ONFILE); @@ -927,7 +923,7 @@ void LoadSettings(void) DBWriteContactSettingByte(NULL, KEYBDMODULE, "testnum", DEF_SETTING_TESTNUM); if (DBGetContactSettingByte(NULL, KEYBDMODULE, "testsecs", -1) == -1) DBWriteContactSettingByte(NULL, KEYBDMODULE, "testsecs", DEF_SETTING_TESTSECS); - for(i=0; i < ProtoList.protoCount; i++) + for(int i=0; i < ProtoList.protoCount; i++) if (ProtoList.protoInfo[i].visible) { unsigned int j; ProtoList.protoInfo[i].enabled = DBGetContactSettingByte(NULL, KEYBDMODULE, ProtoList.protoInfo[i].szProto, DEF_SETTING_PROTOCOL); @@ -991,39 +987,37 @@ void updateXstatusProto(PROTOCOL_INFO *protoInfo) void createProtocolList(void) { - unsigned int i; - PROTOCOLDESCRIPTOR **proto; + PROTOACCOUNT **proto; if (ServiceExists(MS_MC_GETPROTOCOLNAME)) szMetaProto = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&ProtoList.protoCount, (LPARAM)&proto); + ProtoEnumAccounts(&ProtoList.protoCount, &proto); ProtoList.protoInfo = (PROTOCOL_INFO *)malloc(ProtoList.protoCount * sizeof(PROTOCOL_INFO)); - if (!ProtoList.protoInfo) + if (!ProtoList.protoInfo) { ProtoList.protoCount = 0; - else - for(i=0; i < ProtoList.protoCount; i++) { - ProtoList.protoInfo[i].xstatus.count = 0; - ProtoList.protoInfo[i].xstatus.enabled = NULL; - ProtoList.protoInfo[i].szProto = (char *)malloc(strlen(proto[i]->szName) + 1); - if (!ProtoList.protoInfo[i].szProto) { - ProtoList.protoInfo[i].enabled = FALSE; + return; + } + + for(int i=0; i < ProtoList.protoCount; i++) { + ProtoList.protoInfo[i].xstatus.count = 0; + ProtoList.protoInfo[i].xstatus.enabled = NULL; + ProtoList.protoInfo[i].szProto = (char *)malloc(strlen(proto[i]->szModuleName) + 1); + if (!ProtoList.protoInfo[i].szProto) { + ProtoList.protoInfo[i].enabled = FALSE; + ProtoList.protoInfo[i].visible = FALSE; + } + else { + strcpy(ProtoList.protoInfo[i].szProto, proto[i]->szModuleName); + ProtoList.protoInfo[i].enabled = FALSE; + if (szMetaProto && !strcmp(proto[i]->szModuleName, szMetaProto)) ProtoList.protoInfo[i].visible = FALSE; - } else { - strcpy(ProtoList.protoInfo[i].szProto, proto[i]->szName); - ProtoList.protoInfo[i].enabled = FALSE; - if (proto[i]->type != PROTOTYPE_PROTOCOL) - ProtoList.protoInfo[i].visible = FALSE; - else - if (szMetaProto && !strcmp(proto[i]->szName, szMetaProto)) - ProtoList.protoInfo[i].visible = FALSE; - else { - ProtoList.protoInfo[i].visible = TRUE; - updateXstatusProto(&(ProtoList.protoInfo[i])); - } + else { + ProtoList.protoInfo[i].visible = TRUE; + updateXstatusProto(&(ProtoList.protoInfo[i])); } } - + } } @@ -1123,9 +1117,7 @@ extern "C" __declspec(dllexport) int Load(void) void destroyProtocolList(void) { - unsigned int i; - - for(i=0; i < ProtoList.protoCount; i++) { + for(int i=0; i < ProtoList.protoCount; i++) { if (ProtoList.protoInfo[i].szProto) free(ProtoList.protoInfo[i].szProto); if (ProtoList.protoInfo[i].xstatus.enabled) diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index ff9c245df7..3fb480a787 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -265,7 +265,6 @@ INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // proto list { - unsigned int i; LVCOLUMN lvCol; LVITEM lvItem; HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); @@ -283,7 +282,7 @@ INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR lvItem.cchTextMax = 256; lvItem.iItem = 0; lvItem.iSubItem = 0; - for(i=0; i < ProtoList.protoCount; i++) { + for(int i=0; i < ProtoList.protoCount; i++) { int count; PROTOACCOUNT** protos; ProtoEnumAccounts( &count, &protos ); if(ProtoList.protoInfo[i].visible) { @@ -352,7 +351,7 @@ INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - unsigned int i; + int i; static BOOL initDlg=FALSE; switch (msg) { @@ -513,7 +512,7 @@ INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_NOTIFY: { - unsigned int j; + int j; BYTE untilMap = 0; WORD statusMap = 0; //Here we have pressed either the OK or the APPLY button. diff --git a/plugins/KeyboardNotify/src/protolist.h b/plugins/KeyboardNotify/src/protolist.h index 5a08d929da..d3f816009d 100644 --- a/plugins/KeyboardNotify/src/protolist.h +++ b/plugins/KeyboardNotify/src/protolist.h @@ -29,6 +29,6 @@ typedef struct { } PROTOCOL_INFO; typedef struct { - unsigned int protoCount; + int protoCount; PROTOCOL_INFO *protoInfo; } PROTOCOL_LIST; -- cgit v1.2.3