From e624b1dcc719be421ed8530885ca1b259fe59fdf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 15 Mar 2014 09:15:41 +0000 Subject: PROTOACCOUNT::bIsVirtual - new flag to mark virtual protocols git-svn-id: http://svn.miranda-ng.org/main/trunk@8609 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/metacontacts/meta_menu.cpp | 3 ++- src/modules/protocols/protoaccs.cpp | 15 ++++++++------- src/modules/protocols/protocols.cpp | 5 +++-- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index c71c452c81..c185867947 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -345,7 +345,8 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM lParam) return 0; } - if (!options.bEnabled) { + PROTOACCOUNT *pa = Proto_GetAccount(cc->szProto); + if (!options.bEnabled || pa->bIsVirtual) { // groups disabled - all meta menu options hidden Menu_ShowItem(hMenuDefault, false); Menu_ShowItem(hMenuDelete, false); diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 33c5a83ba2..183e72b0f8 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -84,7 +84,7 @@ void LoadDbAccounts(void) db_free(&dbv); _itoa(OFFSET_VISIBLE+i, buf, 10); - pa->bIsVisible = db_get_dw(NULL, "Protocols", buf, 1); + pa->bIsVisible = db_get_dw(NULL, "Protocols", buf, 1) != 0; _itoa(OFFSET_PROTOPOS+i, buf, 10); pa->iOrder = db_get_dw(NULL, "Protocols", buf, 1); @@ -98,14 +98,14 @@ void LoadDbAccounts(void) } _itoa(OFFSET_ENABLED+i, buf, 10); - pa->bIsEnabled = db_get_dw(NULL, "Protocols", buf, 1); + pa->bIsEnabled = db_get_dw(NULL, "Protocols", buf, 1) != 0; if (!db_get_s(NULL, pa->szModuleName, "AM_BaseProto", &dbv)) { pa->szProtoName = mir_strdup(dbv.pszVal); db_free(&dbv); } } - else pa->bIsEnabled = TRUE; + else pa->bIsEnabled = true; if (!pa->szProtoName) { pa->szProtoName = mir_strdup(pa->szModuleName); @@ -118,11 +118,13 @@ void LoadDbAccounts(void) accounts.insert(pa); } - if (CheckProtocolOrder()) WriteDbAccounts(); + if (CheckProtocolOrder()) + WriteDbAccounts(); int anum = accounts.getCount(); CallService(MS_DB_MODULES_ENUM, 0, (LPARAM)EnumDbModules); - if (anum != accounts.getCount()) WriteDbAccounts(); + if (anum != accounts.getCount()) + WriteDbAccounts(); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -422,7 +424,6 @@ static HANDLE CreateProtoServiceEx(const char* szModule, const char* szService, BOOL ActivateAccount(PROTOACCOUNT *pa) { - PROTO_INTERFACE* ppi; PROTOCOLDESCRIPTOR* ppd = Proto_IsProtocolLoaded(pa->szProtoName); if (ppd == NULL) return FALSE; @@ -430,7 +431,7 @@ BOOL ActivateAccount(PROTOACCOUNT *pa) if (ppd->fnInit == NULL) return FALSE; - ppi = ppd->fnInit(pa->szModuleName, pa->tszAccountName); + PROTO_INTERFACE *ppi = ppd->fnInit(pa->szModuleName, pa->tszAccountName); if (ppi == NULL) return FALSE; diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 0191d62d7c..b93b9dc25a 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -120,11 +120,12 @@ static INT_PTR Proto_RegisterModule(WPARAM, LPARAM lParam) pa->szModuleName = mir_strdup(pd->szName); pa->szProtoName = mir_strdup(pd->szName); pa->tszAccountName = mir_a2t(pd->szName); - pa->bIsVisible = pa->bIsEnabled = TRUE; + pa->bIsVisible = pa->bIsEnabled = true; + pa->bIsVirtual = (p->type == PROTOTYPE_VIRTUAL); pa->iOrder = accounts.getCount(); accounts.insert(pa); } - pa->bOldProto = TRUE; + pa->bOldProto = true; pa->ppro = ppi; p->fnInit = defInitProto; p->fnUninit = FreeDefaultAccount; -- cgit v1.2.3