From 4ba7149826b0f006d698e1055cfaf19ecd422cf4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Oct 2012 17:56:29 +0000 Subject: fix for the protocols list git-svn-id: http://svn.miranda-ng.org/main/trunk@1986 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CrashDumper/src/dumper.cpp | 90 +++++++++++++++----------------------- 1 file changed, 35 insertions(+), 55 deletions(-) (limited to 'plugins') diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index b1539a3658..b82f10defb 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -326,67 +326,47 @@ static void GetProtocolStrings(bkstring& buffer) int i, j; ProtoEnumAccounts(&accCount, &accList); - if (accCount > 0) - { - for (i = 0; i < accCount; i++) - { - TCHAR* nm; - crsi_a2t(nm, accList[i]->szModuleName); - buffer.appendfmt(TEXT(" 1 - %s\r\n"), nm); - } - } - else - { - int protoCount; - PROTOCOLDESCRIPTOR **protoList; - CallService(MS_PROTO_ENUMPROTOS, (WPARAM)&protoCount, (LPARAM)&protoList); - - int protoCountMy = 0; - char** protoListMy = (char**)alloca((protoCount + accCount) * sizeof(char*)); - for (i = 0; i < protoCount; i++) - { - if (protoList[i]->type != PROTOTYPE_PROTOCOL) continue; - protoListMy[protoCountMy++] = protoList[i]->szName; - } + int protoCount; + PROTOCOLDESCRIPTOR **protoList; + CallService(MS_PROTO_ENUMPROTOS, (WPARAM)&protoCount, (LPARAM)&protoList); - for (j = 0; j < accCount; j++) - { - for (i = 0; i < protoCountMy; i++) - { - if (strcmp(protoListMy[i], accList[j]->szProtoName) == 0) - break; - } - if (i == protoCountMy) - protoListMy[protoCountMy++] = accList[j]->szProtoName; - } + int protoCountMy = 0; + char** protoListMy = (char**)alloca((protoCount + accCount) * sizeof(char*)); - ProtoCount *protos = (ProtoCount*)alloca(sizeof(ProtoCount) * protoCountMy); - memset(protos, 0, sizeof(ProtoCount) * protoCountMy); + for (i = 0; i < protoCount; i++) { + if (protoList[i]->type != PROTOTYPE_PROTOCOL) + continue; + protoListMy[protoCountMy++] = protoList[i]->szName; + } - for (j = 0; j < accCount; j++) - { - for (i = 0; i < protoCountMy; i++) - { - if (strcmp(protoListMy[i], accList[j]->szProtoName) == 0) - { - protos[i].nloaded = accList[j]->bDynDisabled != 0; - if (IsAccountEnabled(accList[j])) - ++protos[i].countse; - else - ++protos[i].countsd; - break; - } - } - } + for (j = 0; j < accCount; j++) { for (i = 0; i < protoCountMy; i++) - { - TCHAR* nm; - crsi_a2t(nm, protoListMy[i]); - buffer.appendfmt(TEXT("%-24s %d - Enabled %d - Disabled %sLoaded\r\n"), nm, protos[i].countse, - protos[i].countsd, protos[i].nloaded ? _T("Not ") : _T("")); - } + if ( !strcmp(protoListMy[i], accList[j]->szProtoName)) + break; + + if (i == protoCountMy) + protoListMy[protoCountMy++] = accList[j]->szProtoName; } + + ProtoCount *protos = (ProtoCount*)alloca(sizeof(ProtoCount) * protoCountMy); + memset(protos, 0, sizeof(ProtoCount) * protoCountMy); + + for (j = 0; j < accCount; j++) + for (i = 0; i < protoCountMy; i++) + if ( !strcmp(protoListMy[i], accList[j]->szProtoName)) { + protos[i].nloaded = accList[j]->bDynDisabled != 0; + if ( IsAccountEnabled(accList[j])) + ++protos[i].countse; + else + ++protos[i].countsd; + break; + } + + for (i = 0; i < protoCountMy; i++) + buffer.appendfmt(TEXT("%-24s %d - Enabled %d - Disabled %sLoaded\r\n"), + (TCHAR*)_A2T(protoListMy[i]), protos[i].countse, + protos[i].countsd, protos[i].nloaded ? _T("Not ") : _T("")); } -- cgit v1.2.3