summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/delphi/m_protocols.inc16
-rw-r--r--include/m_protocols.h16
-rw-r--r--plugins/Utils.pas/mirutils.pas2
-rw-r--r--src/modules/metacontacts/meta_menu.cpp3
-rw-r--r--src/modules/protocols/protoaccs.cpp15
-rw-r--r--src/modules/protocols/protocols.cpp5
6 files changed, 32 insertions, 25 deletions
diff --git a/include/delphi/m_protocols.inc b/include/delphi/m_protocols.inc
index b247c1ebcf..a361b98389 100644
--- a/include/delphi/m_protocols.inc
+++ b/include/delphi/m_protocols.inc
@@ -261,15 +261,17 @@ type
szModuleName :PAnsiChar; // unique physical account name (matches database module name)
tszAccountName :TChar; // user-defined account name
szProtoName :PAnsiChar; // physical protocol name
- bIsEnabled :int; // is account enabled?
- bIsVisible :int; // is account visible?
- iOrder :int; // account order in various menus & lists
- bOldProto :bool; // old-styled account (one instance per dll)
- ppro :PPROTO_INTERFACE; // pointer to the underlying object
+ bIsEnabled :byte; // is account enabled?
+ bIsVisible :byte; // is account visible?
+ bIsVirtual :byte; // is account virtual?
+ bOldProto :byte; // old-styled account (one instance per dll)
+ bDynDisabled :byte; // dynamic disable flag, is never written to db
+ bAccMgrUIChanged:byte;
hwndAccMgrUI :HWND;
- bAccMgrUIChanged:bool;
- bDynDisabled :bool; // dynamic disable flag, is never written to db
+
+ iOrder :int; // account order in various menus & lists
+ ppro :PPROTO_INTERFACE; // pointer to the underlying object
end;
tagACCOUNT = TPROTOACCOUNT;
diff --git a/include/m_protocols.h b/include/m_protocols.h
index 67ffd950ff..0897e0e199 100644
--- a/include/m_protocols.h
+++ b/include/m_protocols.h
@@ -281,15 +281,17 @@ typedef struct tagACCOUNT
char* szModuleName; // unique physical account name (matches database module name)
TCHAR* tszAccountName; // user-defined account name
char* szProtoName; // physical protocol name
- int bIsEnabled; // is account enabled?
- int bIsVisible; // is account visible?
- int iOrder; // account order in various menus & lists
- BOOL bOldProto; // old-styled account (one instance per dll)
- PROTO_INTERFACE *ppro; // pointer to the underlying object
+ bool bIsEnabled; // is account enabled?
+ bool bIsVisible; // is account visible?
+ bool bIsVirtual; // is account virtual?
+ bool bOldProto; // old-styled account (one instance per dll)
+ bool bDynDisabled; // dynamic disable flag, is never written to db
+ bool bAccMgrUIChanged;
HWND hwndAccMgrUI;
- BOOL bAccMgrUIChanged;
- BOOL bDynDisabled; // dynamic disable flag, is never written to db
+
+ int iOrder; // account order in various menus & lists
+ PROTO_INTERFACE *ppro; // pointer to the underlying object
}
PROTOACCOUNT;
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas
index e035b6f8cd..dbd80d991e 100644
--- a/plugins/Utils.pas/mirutils.pas
+++ b/plugins/Utils.pas/mirutils.pas
@@ -707,7 +707,7 @@ begin
p:=PPROTOACCOUNT(CallService(MS_PROTO_GETACCOUNT,0,lparam(@name)));
if p=nil then
result:=-2 // deleted
- else if (p^.bIsEnabled=0) or p^.bDynDisabled then
+ else if (p^.bIsEnabled=0) or (p^.bDynDisabled<>0) then
result:=-1; // disabled
end
else
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;