summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dbx_tree/src/Compatibility.cpp34
-rw-r--r--plugins/Dbx_tree/src/DataBase.cpp1
-rw-r--r--plugins/Dbx_tree/src/DataBase.h48
-rw-r--r--plugins/Dbx_tree/src/DatabaseLink.cpp8
-rw-r--r--plugins/Dbx_tree/src/Services.cpp275
-rw-r--r--plugins/Dbx_tree/src/Services.h43
-rw-r--r--plugins/Dbx_tree/src/init.cpp1
7 files changed, 209 insertions, 201 deletions
diff --git a/plugins/Dbx_tree/src/Compatibility.cpp b/plugins/Dbx_tree/src/Compatibility.cpp
index 759e44012c..3ce47b6ac6 100644
--- a/plugins/Dbx_tree/src/Compatibility.cpp
+++ b/plugins/Dbx_tree/src/Compatibility.cpp
@@ -45,7 +45,7 @@ STDMETHODIMP_(HANDLE) CDataBase::AddContact(void)
entity.hParentEntity = DBEntityGetRoot(0, 0);
entity.hAccountEntity = entity.hParentEntity;
- TDBTEntityHandle res = gDataBase->getEntities().CreateEntity(entity);
+ TDBTEntityHandle res = getEntities().CreateEntity(entity);
if (res == DBT_INVALIDPARAM)
return (HANDLE)1;
@@ -78,7 +78,7 @@ STDMETHODIMP_(LONG) CDataBase::GetContactCount(void)
f.fDontHasFlags = DBT_NF_IsGroup | DBT_NF_IsVirtual | DBT_NF_IsAccount | DBT_NF_IsRoot;
f.Options = DBT_NIFO_OSC_AC | DBT_NIFO_OC_AC;
- TDBTEntityIterationHandle hiter = DBEntityIterInit((WPARAM)&f, gDataBase->getEntities().getRootEntity());
+ TDBTEntityIterationHandle hiter = DBEntityIterInit((WPARAM)&f, getEntities().getRootEntity());
int c = 0;
if ((hiter != 0) && (hiter != DBT_INVALIDPARAM))
{
@@ -99,13 +99,13 @@ STDMETHODIMP_(LONG) CDataBase::GetContactCount(void)
//!!!!!!!!!!!!!!!!!!!! szProto ignored
STDMETHODIMP_(HANDLE) CDataBase::FindFirstContact(const char* szProto)
{
- return (HANDLE)gDataBase->getEntities().compFirstContact();
+ return (HANDLE)getEntities().compFirstContact();
}
//!!!!!!!!!!!!!!!!!!!! szProto ignored
STDMETHODIMP_(HANDLE) CDataBase::FindNextContact(HANDLE hContact, const char* szProto)
{
- return (HANDLE)gDataBase->getEntities().compNextContact((WPARAM)hContact);
+ return (HANDLE)getEntities().compNextContact((WPARAM)hContact);
}
STDMETHODIMP_(BOOL) CDataBase::GetContactSetting(HANDLE hContact, DBCONTACTGETSETTING *dbcgs)
@@ -623,7 +623,7 @@ STDMETHODIMP_(BOOL) CDataBase::EnumContactSettings(HANDLE hContact, DBCONTACTENU
STDMETHODIMP_(LONG) CDataBase::GetEventCount(HANDLE hContact)
{
if (hContact == 0)
- hContact = (HANDLE)gDataBase->getEntities().getRootEntity();
+ hContact = (HANDLE)getEntities().getRootEntity();
return DBEventGetCount((WPARAM)hContact, 0);
}
@@ -638,7 +638,7 @@ STDMETHODIMP_(HANDLE) CDataBase::AddEvent(HANDLE hContact, DBEVENTINFO *dbei)
return (HANDLE)tmp;
if (hContact == 0)
- hContact = (HANDLE)gDataBase->getEntities().getRootEntity();
+ hContact = (HANDLE)getEntities().getRootEntity();
TDBTEvent ev = {0,0,0,0,0,0,0};
@@ -666,7 +666,7 @@ STDMETHODIMP_(BOOL) CDataBase::DeleteEvent(HANDLE hContact, HANDLE hDbEvent)
int res = NotifyEventHooks(hEventDeletedEvent, (WPARAM)hContact, (WPARAM)hDbEvent);
if (hContact == 0)
- hContact = (HANDLE)gDataBase->getEntities().getRootEntity();
+ hContact = (HANDLE)getEntities().getRootEntity();
if (res == 0)
return DBEventDelete((WPARAM)hDbEvent, 0);
@@ -729,7 +729,7 @@ STDMETHODIMP_(BOOL) CDataBase::MarkEventRead(HANDLE hContact, HANDLE hDbEvent)
STDMETHODIMP_(HANDLE) CDataBase::GetEventContact(HANDLE hDbEvent)
{
TDBTEntityHandle res = DBEventGetEntity((WPARAM)hDbEvent, 0);
- if (res == gDataBase->getEntities().getRootEntity())
+ if (res == getEntities().getRootEntity())
res = 0;
return (HANDLE)res;
@@ -738,33 +738,33 @@ STDMETHODIMP_(HANDLE) CDataBase::GetEventContact(HANDLE hDbEvent)
STDMETHODIMP_(HANDLE) CDataBase::FindFirstEvent(HANDLE hContact)
{
if (hContact == 0)
- hContact = (HANDLE)gDataBase->getEntities().getRootEntity();
+ hContact = (HANDLE)getEntities().getRootEntity();
- return (HANDLE)gDataBase->getEvents().compFirstEvent((WPARAM)hContact);
+ return (HANDLE)getEvents().compFirstEvent((WPARAM)hContact);
}
STDMETHODIMP_(HANDLE) CDataBase::FindFirstUnreadEvent(HANDLE hContact)
{
if (hContact == 0)
- hContact = (HANDLE)gDataBase->getEntities().getRootEntity();
- return (HANDLE)gDataBase->getEvents().compFirstUnreadEvent((WPARAM)hContact);
+ hContact = (HANDLE)getEntities().getRootEntity();
+ return (HANDLE)getEvents().compFirstUnreadEvent((WPARAM)hContact);
}
STDMETHODIMP_(HANDLE) CDataBase::FindLastEvent(HANDLE hContact)
{
if (hContact == 0)
- hContact = (HANDLE)gDataBase->getEntities().getRootEntity();
- return (HANDLE)gDataBase->getEvents().compLastEvent((WPARAM)hContact);
+ hContact = (HANDLE)getEntities().getRootEntity();
+ return (HANDLE)getEvents().compLastEvent((WPARAM)hContact);
}
STDMETHODIMP_(HANDLE) CDataBase::FindNextEvent(HANDLE hDbEvent)
{
- return (HANDLE)gDataBase->getEvents().compNextEvent((WPARAM)hDbEvent);
+ return (HANDLE)getEvents().compNextEvent((WPARAM)hDbEvent);
}
STDMETHODIMP_(HANDLE) CDataBase::FindPrevEvent(HANDLE hDbEvent)
{
- return (HANDLE)gDataBase->getEvents().compPrevEvent((WPARAM)hDbEvent);
+ return (HANDLE)getEvents().compPrevEvent((WPARAM)hDbEvent);
}
STDMETHODIMP_(BOOL) CDataBase::EnumModuleNames(DBMODULEENUMPROC pCallback, void *pParam)
@@ -772,7 +772,7 @@ STDMETHODIMP_(BOOL) CDataBase::EnumModuleNames(DBMODULEENUMPROC pCallback, void
if (!pCallback)
return -1;
- return gDataBase->getSettings().CompEnumModules(pCallback, (WPARAM)pParam);
+ return getSettings().CompEnumModules(pCallback, (WPARAM)pParam);
}
STDMETHODIMP_(BOOL) CDataBase::SetSettingResident(BOOL bIsResident, const char *pszSettingName)
diff --git a/plugins/Dbx_tree/src/DataBase.cpp b/plugins/Dbx_tree/src/DataBase.cpp
index 50fe494b3c..b8b0648b30 100644
--- a/plugins/Dbx_tree/src/DataBase.cpp
+++ b/plugins/Dbx_tree/src/DataBase.cpp
@@ -32,6 +32,7 @@ CDataBase *gDataBase = NULL;
CDataBase::CDataBase(const TCHAR *FileName)
{
InitDbInstance(this);
+ //RegisterServices();
size_t len = _tcslen(FileName);
m_FileName[0] = new TCHAR[len + 1];
diff --git a/plugins/Dbx_tree/src/DataBase.h b/plugins/Dbx_tree/src/DataBase.h
index 124fee4f9d..cf0832877e 100644
--- a/plugins/Dbx_tree/src/DataBase.h
+++ b/plugins/Dbx_tree/src/DataBase.h
@@ -150,6 +150,52 @@ public:
int getProfileName(int BufferSize, char * Buffer);
int getProfilePath(int BufferSize, char * Buffer);
+public: // services
+ INT_PTR __cdecl DBEntityGetRoot(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl DBEntityChildCount(WPARAM hEntity, LPARAM lParam);
+ INT_PTR __cdecl DBEntityGetParent(WPARAM hEntity, LPARAM lParam);
+ INT_PTR __cdecl DBEntityMove(WPARAM hEntity, LPARAM hParent);
+ INT_PTR __cdecl DBEntityGetFlags(WPARAM hEntity, LPARAM lParam);
+ INT_PTR __cdecl DBEntityIterInit(WPARAM pFilter, LPARAM hParent);
+ INT_PTR __cdecl DBEntityIterNext(WPARAM hIteration, LPARAM lParam);
+ INT_PTR __cdecl DBEntityIterClose(WPARAM hIteration, LPARAM lParam);
+ INT_PTR __cdecl DBEntityDelete(WPARAM hEntity, LPARAM lParam);
+ INT_PTR __cdecl DBEntityCreate(WPARAM pEntity, LPARAM lParam);
+ INT_PTR __cdecl DBEntityGetAccount(WPARAM hEntity, LPARAM lParam);
+
+ INT_PTR __cdecl DBVirtualEntityCreate(WPARAM hEntity, LPARAM hParent);
+ INT_PTR __cdecl DBVirtualEntityGetParent(WPARAM hVirtualEntity, LPARAM lParam);
+ INT_PTR __cdecl DBVirtualEntityGetFirst(WPARAM hEntity, LPARAM lParam);
+ INT_PTR __cdecl DBVirtualEntityGetNext(WPARAM hVirtualEntity, LPARAM lParam);
+
+ INT_PTR __cdecl DBSettingFind(WPARAM pSettingDescriptor, LPARAM lParam);
+ INT_PTR __cdecl DBSettingDelete(WPARAM pSettingDescriptor, LPARAM lParam);
+ INT_PTR __cdecl DBSettingDeleteHandle(WPARAM hSetting, LPARAM lParam);
+ INT_PTR __cdecl DBSettingWrite(WPARAM pSetting, LPARAM lParam);
+ INT_PTR __cdecl DBSettingWriteHandle(WPARAM pSetting, LPARAM hSetting);
+ INT_PTR __cdecl DBSettingRead(WPARAM pSetting, LPARAM lParam);
+ INT_PTR __cdecl DBSettingReadHandle(WPARAM pSetting, LPARAM hSetting);
+ INT_PTR __cdecl DBSettingIterInit(WPARAM pFilter, LPARAM lParam);
+ INT_PTR __cdecl DBSettingIterNext(WPARAM hIteration, LPARAM lParam);
+ INT_PTR __cdecl DBSettingIterClose(WPARAM hIteration, LPARAM lParam);
+
+ INT_PTR __cdecl DBEventGetBlobSize(WPARAM hEvent, LPARAM lParam);
+ INT_PTR __cdecl DBEventGet(WPARAM hEvent, LPARAM pEvent);
+ INT_PTR __cdecl DBEventGetCount(WPARAM hEntity, LPARAM lParam);
+ INT_PTR __cdecl DBEventDelete(WPARAM hEvent, LPARAM lParam);
+ INT_PTR __cdecl DBEventAdd(WPARAM hEntity, LPARAM pEvent);
+ INT_PTR __cdecl DBEventMarkRead(WPARAM hEvent, LPARAM lParam);
+ INT_PTR __cdecl DBEventWriteToDisk(WPARAM hEvent, LPARAM lParam);
+ INT_PTR __cdecl DBEventGetEntity(WPARAM hEvent, LPARAM lParam);
+ INT_PTR __cdecl DBEventIterInit(WPARAM pFilter, LPARAM lParam);
+ INT_PTR __cdecl DBEventIterNext(WPARAM hIteration, LPARAM lParam);
+ INT_PTR __cdecl DBEventIterClose(WPARAM hIteration, LPARAM lParam);
+
+ bool RegisterServices();
+
+ typedef INT_PTR ( __cdecl CDataBase::*DbServiceFunc )( WPARAM, LPARAM );
+ void CreateDbService(const char *szServiceName, DbServiceFunc pFunc);
+
protected: // to be compatible with the standard Miranda databases
STDMETHODIMP_(void) SetCacheSafetyMode(BOOL);
@@ -185,5 +231,3 @@ protected: // to be compatible with the standard Miranda databases
STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName);
STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
};
-
-extern CDataBase *gDataBase;
diff --git a/plugins/Dbx_tree/src/DatabaseLink.cpp b/plugins/Dbx_tree/src/DatabaseLink.cpp
index cc944cc305..8c99052eb6 100644
--- a/plugins/Dbx_tree/src/DatabaseLink.cpp
+++ b/plugins/Dbx_tree/src/DatabaseLink.cpp
@@ -65,9 +65,9 @@ Returns: 0 on success, nonzero on failure
static MIDatabase* LoadDatabase(const TCHAR *profile)
{
- gDataBase = new CDataBase(profile);
- gDataBase->OpenDB();
- return gDataBase;
+ CDataBase* pDb = new CDataBase(profile);
+ pDb->OpenDB();
+ return pDb;
}
/*
@@ -78,8 +78,6 @@ Note: Unload() might be called even if Load(void) was never called, wasLoaded is
static int UnloadDatabase(MIDatabase* db)
{
- if (gDataBase == db)
- gDataBase = NULL;
delete (CDataBase*)db;
return 0;
}
diff --git a/plugins/Dbx_tree/src/Services.cpp b/plugins/Dbx_tree/src/Services.cpp
index d8b734795d..93fb89e257 100644
--- a/plugins/Dbx_tree/src/Services.cpp
+++ b/plugins/Dbx_tree/src/Services.cpp
@@ -22,44 +22,47 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Services.h"
-HANDLE gServices[40] = {0};
-
-INT_PTR DBEntityGetRoot(WPARAM wParam, LPARAM lParam)
+INT_PTR CDataBase::DBEntityGetRoot(WPARAM wParam, LPARAM lParam)
{
- return gDataBase->getEntities().getRootEntity();
+ return getEntities().getRootEntity();
}
-INT_PTR DBEntityChildCount(WPARAM hEntity, LPARAM lParam)
+
+INT_PTR CDataBase::DBEntityChildCount(WPARAM hEntity, LPARAM lParam)
{
if (hEntity == 0)
- hEntity = gDataBase->getEntities().getRootEntity();
+ hEntity = getEntities().getRootEntity();
- return gDataBase->getEntities().getChildCount(hEntity);
+ return getEntities().getChildCount(hEntity);
}
-INT_PTR DBEntityGetParent(WPARAM hEntity, LPARAM lParam)
+
+INT_PTR CDataBase::DBEntityGetParent(WPARAM hEntity, LPARAM lParam)
{
if (hEntity == 0)
- hEntity = gDataBase->getEntities().getRootEntity();
+ hEntity = getEntities().getRootEntity();
- return gDataBase->getEntities().getParent(hEntity);
+ return getEntities().getParent(hEntity);
}
-INT_PTR DBEntityMove(WPARAM hEntity, LPARAM hParent)
+
+INT_PTR CDataBase::DBEntityMove(WPARAM hEntity, LPARAM hParent)
{
- if ((hEntity == 0) || (hEntity == gDataBase->getEntities().getRootEntity()))
+ if ((hEntity == 0) || (hEntity == getEntities().getRootEntity()))
return DBT_INVALIDPARAM;
if (hParent == 0)
- hParent = gDataBase->getEntities().getRootEntity();
+ hParent = getEntities().getRootEntity();
- return gDataBase->getEntities().setParent(hEntity, hParent);
+ return getEntities().setParent(hEntity, hParent);
}
-INT_PTR DBEntityGetFlags(WPARAM hEntity, LPARAM lParam)
+
+INT_PTR CDataBase::DBEntityGetFlags(WPARAM hEntity, LPARAM lParam)
{
if (hEntity == 0)
- hEntity = gDataBase->getEntities().getRootEntity();
+ hEntity = getEntities().getRootEntity();
- return gDataBase->getEntities().getFlags(hEntity);
+ return getEntities().getFlags(hEntity);
}
-INT_PTR DBEntityIterInit(WPARAM pFilter, LPARAM hParent)
+
+INT_PTR CDataBase::DBEntityIterInit(WPARAM pFilter, LPARAM hParent)
{
TDBTEntityIterFilter fil = {0,0,0,0};
if (pFilter == NULL)
@@ -75,82 +78,86 @@ INT_PTR DBEntityIterInit(WPARAM pFilter, LPARAM hParent)
return DBT_INVALIDPARAM;
if (hParent == 0)
- hParent = gDataBase->getEntities().getRootEntity();
+ hParent = getEntities().getRootEntity();
- return gDataBase->getEntities().IterationInit(*reinterpret_cast<PDBTEntityIterFilter>(pFilter), hParent);
+ return getEntities().IterationInit(*reinterpret_cast<PDBTEntityIterFilter>(pFilter), hParent);
}
-INT_PTR DBEntityIterNext(WPARAM hIteration, LPARAM lParam)
+
+INT_PTR CDataBase::DBEntityIterNext(WPARAM hIteration, LPARAM lParam)
{
if ((hIteration == 0) || (hIteration == DBT_INVALIDPARAM))
return hIteration;
- return gDataBase->getEntities().IterationNext(hIteration);
+ return getEntities().IterationNext(hIteration);
}
-INT_PTR DBEntityIterClose(WPARAM hIteration, LPARAM lParam)
+
+INT_PTR CDataBase::DBEntityIterClose(WPARAM hIteration, LPARAM lParam)
{
if ((hIteration == 0) || (hIteration == DBT_INVALIDPARAM))
return hIteration;
- return gDataBase->getEntities().IterationClose(hIteration);
+ return getEntities().IterationClose(hIteration);
}
-INT_PTR DBEntityDelete(WPARAM hEntity, LPARAM lParam)
+
+INT_PTR CDataBase::DBEntityDelete(WPARAM hEntity, LPARAM lParam)
{
- if ((hEntity == 0) || (hEntity == gDataBase->getEntities().getRootEntity()))
+ if ((hEntity == 0) || (hEntity == getEntities().getRootEntity()))
return DBT_INVALIDPARAM;
- return gDataBase->getEntities().DeleteEntity(hEntity);
+ return getEntities().DeleteEntity(hEntity);
}
-INT_PTR DBEntityCreate(WPARAM pEntity, LPARAM lParam)
+
+INT_PTR CDataBase::DBEntityCreate(WPARAM pEntity, LPARAM lParam)
{
if (reinterpret_cast<PDBTEntity>(pEntity)->bcSize != sizeof(TDBTEntity))
return DBT_INVALIDPARAM;
if (reinterpret_cast<PDBTEntity>(pEntity)->hParentEntity == 0)
- reinterpret_cast<PDBTEntity>(pEntity)->hParentEntity = gDataBase->getEntities().getRootEntity();
+ reinterpret_cast<PDBTEntity>(pEntity)->hParentEntity = getEntities().getRootEntity();
reinterpret_cast<PDBTEntity>(pEntity)->fFlags = reinterpret_cast<PDBTEntity>(pEntity)->fFlags & ~(DBT_NF_IsRoot | DBT_NF_HasChildren | DBT_NF_IsVirtual | DBT_NF_HasVirtuals); // forbidden flags...
- return gDataBase->getEntities().CreateEntity(*reinterpret_cast<PDBTEntity>(pEntity));
+ return getEntities().CreateEntity(*reinterpret_cast<PDBTEntity>(pEntity));
}
-INT_PTR DBEntityGetAccount(WPARAM hEntity, LPARAM lParam)
+INT_PTR CDataBase::DBEntityGetAccount(WPARAM hEntity, LPARAM lParam)
{
- return gDataBase->getEntities().getAccount(hEntity);
+ return getEntities().getAccount(hEntity);
}
-INT_PTR DBVirtualEntityCreate(WPARAM hEntity, LPARAM hParent)
+INT_PTR CDataBase::DBVirtualEntityCreate(WPARAM hEntity, LPARAM hParent)
{
- if ((hEntity == 0) || (hEntity == gDataBase->getEntities().getRootEntity()))
+ if ((hEntity == 0) || (hEntity == getEntities().getRootEntity()))
return DBT_INVALIDPARAM;
if (hParent == 0)
- hParent = gDataBase->getEntities().getRootEntity();
+ hParent = getEntities().getRootEntity();
- return gDataBase->getEntities().VirtualCreate(hEntity, hParent);
+ return getEntities().VirtualCreate(hEntity, hParent);
}
-INT_PTR DBVirtualEntityGetParent(WPARAM hVirtualEntity, LPARAM lParam)
+INT_PTR CDataBase::DBVirtualEntityGetParent(WPARAM hVirtualEntity, LPARAM lParam)
{
- if ((hVirtualEntity == 0) || (hVirtualEntity == gDataBase->getEntities().getRootEntity()))
+ if ((hVirtualEntity == 0) || (hVirtualEntity == getEntities().getRootEntity()))
return DBT_INVALIDPARAM;
- return gDataBase->getEntities().VirtualGetParent(hVirtualEntity);
+ return getEntities().VirtualGetParent(hVirtualEntity);
}
-INT_PTR DBVirtualEntityGetFirst(WPARAM hEntity, LPARAM lParam)
+INT_PTR CDataBase::DBVirtualEntityGetFirst(WPARAM hEntity, LPARAM lParam)
{
- if ((hEntity == 0) || (hEntity == gDataBase->getEntities().getRootEntity()))
+ if ((hEntity == 0) || (hEntity == getEntities().getRootEntity()))
return DBT_INVALIDPARAM;
- return gDataBase->getEntities().VirtualGetFirst(hEntity);
+ return getEntities().VirtualGetFirst(hEntity);
}
-INT_PTR DBVirtualEntityGetNext(WPARAM hVirtualEntity, LPARAM lParam)
+INT_PTR CDataBase::DBVirtualEntityGetNext(WPARAM hVirtualEntity, LPARAM lParam)
{
- if ((hVirtualEntity == 0) || (hVirtualEntity == gDataBase->getEntities().getRootEntity()))
+ if ((hVirtualEntity == 0) || (hVirtualEntity == getEntities().getRootEntity()))
return DBT_INVALIDPARAM;
- return gDataBase->getEntities().VirtualGetNext(hVirtualEntity);
+ return getEntities().VirtualGetNext(hVirtualEntity);
}
-INT_PTR DBSettingFind(WPARAM pSettingDescriptor, LPARAM lParam)
+INT_PTR CDataBase::DBSettingFind(WPARAM pSettingDescriptor, LPARAM lParam)
{
if (pSettingDescriptor == NULL)
return DBT_INVALIDPARAM;
@@ -161,9 +168,9 @@ INT_PTR DBSettingFind(WPARAM pSettingDescriptor, LPARAM lParam)
if (reinterpret_cast<PDBTSettingDescriptor>(pSettingDescriptor)->pszSettingName == NULL)
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().FindSetting(*reinterpret_cast<PDBTSettingDescriptor>(pSettingDescriptor));
+ return getSettings().FindSetting(*reinterpret_cast<PDBTSettingDescriptor>(pSettingDescriptor));
}
-INT_PTR DBSettingDelete(WPARAM pSettingDescriptor, LPARAM lParam)
+INT_PTR CDataBase::DBSettingDelete(WPARAM pSettingDescriptor, LPARAM lParam)
{
if (pSettingDescriptor == NULL)
return DBT_INVALIDPARAM;
@@ -174,16 +181,16 @@ INT_PTR DBSettingDelete(WPARAM pSettingDescriptor, LPARAM lParam)
if (reinterpret_cast<PDBTSettingDescriptor>(pSettingDescriptor)->pszSettingName == NULL)
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().DeleteSetting(*reinterpret_cast<PDBTSettingDescriptor>(pSettingDescriptor));
+ return getSettings().DeleteSetting(*reinterpret_cast<PDBTSettingDescriptor>(pSettingDescriptor));
}
-INT_PTR DBSettingDeleteHandle(WPARAM hSetting, LPARAM lParam)
+INT_PTR CDataBase::DBSettingDeleteHandle(WPARAM hSetting, LPARAM lParam)
{
if (hSetting == 0)
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().DeleteSetting(hSetting);
+ return getSettings().DeleteSetting(hSetting);
}
-INT_PTR DBSettingWrite(WPARAM pSetting, LPARAM lParam)
+INT_PTR CDataBase::DBSettingWrite(WPARAM pSetting, LPARAM lParam)
{
if (pSetting == NULL)
return DBT_INVALIDPARAM;
@@ -203,9 +210,9 @@ INT_PTR DBSettingWrite(WPARAM pSetting, LPARAM lParam)
if ((reinterpret_cast<PDBTSetting>(pSetting)->Type & DBT_STF_VariableLength) && (reinterpret_cast<PDBTSetting>(pSetting)->Value.pBlob == NULL))
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().WriteSetting(*reinterpret_cast<PDBTSetting>(pSetting));
+ return getSettings().WriteSetting(*reinterpret_cast<PDBTSetting>(pSetting));
}
-INT_PTR DBSettingWriteHandle(WPARAM pSetting, LPARAM hSetting)
+INT_PTR CDataBase::DBSettingWriteHandle(WPARAM pSetting, LPARAM hSetting)
{
if (pSetting == NULL)
return DBT_INVALIDPARAM;
@@ -213,9 +220,9 @@ INT_PTR DBSettingWriteHandle(WPARAM pSetting, LPARAM hSetting)
if (reinterpret_cast<PDBTSetting>(pSetting)->cbSize != sizeof(TDBTSetting))
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().WriteSetting(*reinterpret_cast<PDBTSetting>(pSetting), hSetting);
+ return getSettings().WriteSetting(*reinterpret_cast<PDBTSetting>(pSetting), hSetting);
}
-INT_PTR DBSettingRead(WPARAM pSetting, LPARAM lParam)
+INT_PTR CDataBase::DBSettingRead(WPARAM pSetting, LPARAM lParam)
{
if (pSetting == NULL)
return DBT_INVALIDPARAM;
@@ -232,9 +239,9 @@ INT_PTR DBSettingRead(WPARAM pSetting, LPARAM lParam)
if (reinterpret_cast<PDBTSetting>(pSetting)->Descriptor->pszSettingName == NULL)
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().ReadSetting(*reinterpret_cast<PDBTSetting>(pSetting));
+ return getSettings().ReadSetting(*reinterpret_cast<PDBTSetting>(pSetting));
}
-INT_PTR DBSettingReadHandle(WPARAM pSetting, LPARAM hSetting)
+INT_PTR CDataBase::DBSettingReadHandle(WPARAM pSetting, LPARAM hSetting)
{
if ((pSetting == NULL) || (hSetting == 0))
return DBT_INVALIDPARAM;
@@ -245,9 +252,9 @@ INT_PTR DBSettingReadHandle(WPARAM pSetting, LPARAM hSetting)
if ((reinterpret_cast<PDBTSetting>(pSetting)->Descriptor != NULL) && (reinterpret_cast<PDBTSetting>(pSetting)->Descriptor->cbSize != sizeof(TDBTSettingDescriptor)))
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().ReadSetting(*((PDBTSetting)pSetting), hSetting);
+ return getSettings().ReadSetting(*((PDBTSetting)pSetting), hSetting);
}
-INT_PTR DBSettingIterInit(WPARAM pFilter, LPARAM lParam)
+INT_PTR CDataBase::DBSettingIterInit(WPARAM pFilter, LPARAM lParam)
{
if (pFilter == NULL)
return DBT_INVALIDPARAM;
@@ -264,70 +271,70 @@ INT_PTR DBSettingIterInit(WPARAM pFilter, LPARAM lParam)
if ((reinterpret_cast<PDBTSettingIterFilter>(pFilter)->Setting != NULL) && (reinterpret_cast<PDBTSettingIterFilter>(pFilter)->Setting->Descriptor != NULL) && (reinterpret_cast<PDBTSettingIterFilter>(pFilter)->Setting->Descriptor->cbSize != sizeof(TDBTSettingIterFilter)))
return DBT_INVALIDPARAM;
- return gDataBase->getSettings().IterationInit(*reinterpret_cast<PDBTSettingIterFilter>(pFilter));
+ return getSettings().IterationInit(*reinterpret_cast<PDBTSettingIterFilter>(pFilter));
}
-INT_PTR DBSettingIterNext(WPARAM hIteration, LPARAM lParam)
+INT_PTR CDataBase::DBSettingIterNext(WPARAM hIteration, LPARAM lParam)
{
if ((hIteration == 0) || (hIteration == DBT_INVALIDPARAM))
return hIteration;
- return gDataBase->getSettings().IterationNext(hIteration);
+ return getSettings().IterationNext(hIteration);
}
-INT_PTR DBSettingIterClose(WPARAM hIteration, LPARAM lParam)
+INT_PTR CDataBase::DBSettingIterClose(WPARAM hIteration, LPARAM lParam)
{
if ((hIteration == 0) || (hIteration == DBT_INVALIDPARAM))
return hIteration;
- return gDataBase->getSettings().IterationClose(hIteration);
+ return getSettings().IterationClose(hIteration);
}
-INT_PTR DBEventGetBlobSize(WPARAM hEvent, LPARAM lParam)
+INT_PTR CDataBase::DBEventGetBlobSize(WPARAM hEvent, LPARAM lParam)
{
- return gDataBase->getEvents().GetBlobSize(hEvent);
+ return getEvents().GetBlobSize(hEvent);
}
-INT_PTR DBEventGet(WPARAM hEvent, LPARAM pEvent)
+INT_PTR CDataBase::DBEventGet(WPARAM hEvent, LPARAM pEvent)
{
if ((pEvent == NULL) || (reinterpret_cast<PDBTEvent>(pEvent)->cbSize != sizeof(TDBTEvent)))
return DBT_INVALIDPARAM;
- return gDataBase->getEvents().Get(hEvent, *reinterpret_cast<PDBTEvent>(pEvent));
+ return getEvents().Get(hEvent, *reinterpret_cast<PDBTEvent>(pEvent));
}
-INT_PTR DBEventGetCount(WPARAM hEntity, LPARAM lParam)
+INT_PTR CDataBase::DBEventGetCount(WPARAM hEntity, LPARAM lParam)
{
- return gDataBase->getEvents().GetCount(hEntity);
+ return getEvents().GetCount(hEntity);
}
-INT_PTR DBEventDelete(WPARAM hEvent, LPARAM lParam)
+INT_PTR CDataBase::DBEventDelete(WPARAM hEvent, LPARAM lParam)
{
- return gDataBase->getEvents().Delete(hEvent);
+ return getEvents().Delete(hEvent);
}
-INT_PTR DBEventAdd(WPARAM hEntity, LPARAM pEvent)
+INT_PTR CDataBase::DBEventAdd(WPARAM hEntity, LPARAM pEvent)
{
if ((pEvent == NULL) || (reinterpret_cast<PDBTEvent>(pEvent)->cbSize != sizeof(TDBTEvent)) || (reinterpret_cast<PDBTEvent>(pEvent)->pBlob == NULL) || (reinterpret_cast<PDBTEvent>(pEvent)->cbBlob == 0))
return DBT_INVALIDPARAM;
- return gDataBase->getEvents().Add(hEntity, *((PDBTEvent)pEvent));
+ return getEvents().Add(hEntity, *((PDBTEvent)pEvent));
}
-INT_PTR DBEventMarkRead(WPARAM hEvent, LPARAM lParam)
+INT_PTR CDataBase::DBEventMarkRead(WPARAM hEvent, LPARAM lParam)
{
- return gDataBase->getEvents().MarkRead(hEvent);
+ return getEvents().MarkRead(hEvent);
}
-INT_PTR DBEventWriteToDisk(WPARAM hEvent, LPARAM lParam)
+INT_PTR CDataBase::DBEventWriteToDisk(WPARAM hEvent, LPARAM lParam)
{
- return gDataBase->getEvents().WriteToDisk(hEvent);
+ return getEvents().WriteToDisk(hEvent);
}
-INT_PTR DBEventGetEntity(WPARAM hEvent, LPARAM lParam)
+INT_PTR CDataBase::DBEventGetEntity(WPARAM hEvent, LPARAM lParam)
{
- return gDataBase->getEvents().getEntity(hEvent);
+ return getEvents().getEntity(hEvent);
}
-INT_PTR DBEventIterInit(WPARAM pFilter, LPARAM lParam)
+INT_PTR CDataBase::DBEventIterInit(WPARAM pFilter, LPARAM lParam)
{
if ((pFilter == NULL) || (reinterpret_cast<PDBTEventIterFilter>(pFilter)->cbSize != sizeof(TDBTEventIterFilter)))
return DBT_INVALIDPARAM;
@@ -335,68 +342,70 @@ INT_PTR DBEventIterInit(WPARAM pFilter, LPARAM lParam)
if ((reinterpret_cast<PDBTEventIterFilter>(pFilter)->Event != NULL) && (reinterpret_cast<PDBTEventIterFilter>(pFilter)->Event->cbSize != sizeof(TDBTEvent)))
return DBT_INVALIDPARAM;
- return gDataBase->getEvents().IterationInit(*reinterpret_cast<PDBTEventIterFilter>(pFilter));
+ return getEvents().IterationInit(*reinterpret_cast<PDBTEventIterFilter>(pFilter));
}
-INT_PTR DBEventIterNext(WPARAM hIteration, LPARAM lParam)
+INT_PTR CDataBase::DBEventIterNext(WPARAM hIteration, LPARAM lParam)
{
if ((hIteration == 0) || (hIteration == DBT_INVALIDPARAM))
return hIteration;
- return gDataBase->getEvents().IterationNext(hIteration);
+ return getEvents().IterationNext(hIteration);
}
-INT_PTR DBEventIterClose(WPARAM hIteration, LPARAM lParam)
+INT_PTR CDataBase::DBEventIterClose(WPARAM hIteration, LPARAM lParam)
{
if ((hIteration == 0) || (hIteration == DBT_INVALIDPARAM))
return hIteration;
- return gDataBase->getEvents().IterationClose(hIteration);
-}
-
-
-bool RegisterServices()
-{
- gServices[ 0] = CreateServiceFunction(MS_DBT_ENTITY_GETROOT, DBEntityGetRoot);
- gServices[ 1] = CreateServiceFunction(MS_DBT_ENTITY_CHILDCOUNT, DBEntityChildCount);
- gServices[ 2] = CreateServiceFunction(MS_DBT_ENTITY_GETPARENT, DBEntityGetParent);
- gServices[ 3] = CreateServiceFunction(MS_DBT_ENTITY_MOVE, DBEntityMove);
- gServices[ 8] = CreateServiceFunction(MS_DBT_ENTITY_GETFLAGS, DBEntityGetFlags);
- gServices[ 9] = CreateServiceFunction(MS_DBT_ENTITY_ITER_INIT, DBEntityIterInit);
- gServices[10] = CreateServiceFunction(MS_DBT_ENTITY_ITER_NEXT, DBEntityIterNext);
- gServices[11] = CreateServiceFunction(MS_DBT_ENTITY_ITER_CLOSE, DBEntityIterClose);
- gServices[12] = CreateServiceFunction(MS_DBT_ENTITY_DELETE, DBEntityDelete);
- gServices[13] = CreateServiceFunction(MS_DBT_ENTITY_CREATE, DBEntityCreate);
- gServices[13] = CreateServiceFunction(MS_DBT_ENTITY_GETACCOUNT, DBEntityGetAccount);
-
- gServices[14] = CreateServiceFunction(MS_DBT_VIRTUALENTITY_CREATE, DBVirtualEntityCreate);
- gServices[15] = CreateServiceFunction(MS_DBT_VIRTUALENTITY_GETPARENT, DBVirtualEntityGetParent);
- gServices[16] = CreateServiceFunction(MS_DBT_VIRTUALENTITY_GETFIRST, DBVirtualEntityGetFirst);
- gServices[17] = CreateServiceFunction(MS_DBT_VIRTUALENTITY_GETNEXT, DBVirtualEntityGetNext);
-
- gServices[18] = CreateServiceFunction(MS_DBT_SETTING_FIND, DBSettingFind);
- gServices[19] = CreateServiceFunction(MS_DBT_SETTING_DELETE, DBSettingDelete);
- gServices[20] = CreateServiceFunction(MS_DBT_SETTING_DELETEHANDLE, DBSettingDeleteHandle);
- gServices[21] = CreateServiceFunction(MS_DBT_SETTING_WRITE, DBSettingWrite);
- gServices[22] = CreateServiceFunction(MS_DBT_SETTING_WRITEHANDLE, DBSettingWriteHandle);
- gServices[23] = CreateServiceFunction(MS_DBT_SETTING_READ, DBSettingRead);
- gServices[24] = CreateServiceFunction(MS_DBT_SETTING_READHANDLE, DBSettingReadHandle);
- gServices[25] = CreateServiceFunction(MS_DBT_SETTING_ITER_INIT, DBSettingIterInit);
- gServices[26] = CreateServiceFunction(MS_DBT_SETTING_ITER_NEXT, DBSettingIterNext);
- gServices[27] = CreateServiceFunction(MS_DBT_SETTING_ITER_CLOSE, DBSettingIterClose);
-
- gServices[28] = CreateServiceFunction(MS_DBT_EVENT_GETBLOBSIZE, DBEventGetBlobSize);
- gServices[29] = CreateServiceFunction(MS_DBT_EVENT_GET, DBEventGet);
- gServices[30] = CreateServiceFunction(MS_DBT_EVENT_GETCOUNT, DBEventGetCount);
- gServices[31] = CreateServiceFunction(MS_DBT_EVENT_DELETE, DBEventDelete);
- gServices[32] = CreateServiceFunction(MS_DBT_EVENT_ADD, DBEventAdd);
- gServices[33] = CreateServiceFunction(MS_DBT_EVENT_MARKREAD, DBEventMarkRead);
- gServices[34] = CreateServiceFunction(MS_DBT_EVENT_WRITETODISK, DBEventWriteToDisk);
- gServices[35] = CreateServiceFunction(MS_DBT_EVENT_GETENTITY, DBEventGetEntity);
- gServices[36] = CreateServiceFunction(MS_DBT_EVENT_ITER_INIT, DBEventIterInit);
- gServices[37] = CreateServiceFunction(MS_DBT_EVENT_ITER_NEXT, DBEventIterNext);
- gServices[38] = CreateServiceFunction(MS_DBT_EVENT_ITER_CLOSE, DBEventIterClose);
-
-
+ return getEvents().IterationClose(hIteration);
+}
+
+void CDataBase::CreateDbService(const char* szService, DbServiceFunc serviceProc)
+{
+ ::CreateServiceFunctionObj(szService, ( MIRANDASERVICEOBJ )*( void** )&serviceProc, this );
+}
+
+bool CDataBase::RegisterServices()
+{
+ CreateDbService(MS_DBT_ENTITY_GETROOT, &CDataBase::DBEntityGetRoot);
+ CreateDbService(MS_DBT_ENTITY_CHILDCOUNT, &CDataBase::DBEntityChildCount);
+ CreateDbService(MS_DBT_ENTITY_GETPARENT, &CDataBase::DBEntityGetParent);
+ CreateDbService(MS_DBT_ENTITY_MOVE, &CDataBase::DBEntityMove);
+ CreateDbService(MS_DBT_ENTITY_GETFLAGS, &CDataBase::DBEntityGetFlags);
+ CreateDbService(MS_DBT_ENTITY_ITER_INIT, &CDataBase::DBEntityIterInit);
+ CreateDbService(MS_DBT_ENTITY_ITER_NEXT, &CDataBase::DBEntityIterNext);
+ CreateDbService(MS_DBT_ENTITY_ITER_CLOSE, &CDataBase::DBEntityIterClose);
+ CreateDbService(MS_DBT_ENTITY_DELETE, &CDataBase::DBEntityDelete);
+ CreateDbService(MS_DBT_ENTITY_CREATE, &CDataBase::DBEntityCreate);
+ CreateDbService(MS_DBT_ENTITY_GETACCOUNT, &CDataBase::DBEntityGetAccount);
+
+ CreateDbService(MS_DBT_VIRTUALENTITY_CREATE, &CDataBase::DBVirtualEntityCreate);
+ CreateDbService(MS_DBT_VIRTUALENTITY_GETPARENT, &CDataBase::DBVirtualEntityGetParent);
+ CreateDbService(MS_DBT_VIRTUALENTITY_GETFIRST, &CDataBase::DBVirtualEntityGetFirst);
+ CreateDbService(MS_DBT_VIRTUALENTITY_GETNEXT, &CDataBase::DBVirtualEntityGetNext);
+
+ CreateDbService(MS_DBT_SETTING_FIND, &CDataBase::DBSettingFind);
+ CreateDbService(MS_DBT_SETTING_DELETE, &CDataBase::DBSettingDelete);
+ CreateDbService(MS_DBT_SETTING_DELETEHANDLE, &CDataBase::DBSettingDeleteHandle);
+ CreateDbService(MS_DBT_SETTING_WRITE, &CDataBase::DBSettingWrite);
+ CreateDbService(MS_DBT_SETTING_WRITEHANDLE, &CDataBase::DBSettingWriteHandle);
+ CreateDbService(MS_DBT_SETTING_READ, &CDataBase::DBSettingRead);
+ CreateDbService(MS_DBT_SETTING_READHANDLE, &CDataBase::DBSettingReadHandle);
+ CreateDbService(MS_DBT_SETTING_ITER_INIT, &CDataBase::DBSettingIterInit);
+ CreateDbService(MS_DBT_SETTING_ITER_NEXT, &CDataBase::DBSettingIterNext);
+ CreateDbService(MS_DBT_SETTING_ITER_CLOSE, &CDataBase::DBSettingIterClose);
+
+ CreateDbService(MS_DBT_EVENT_GETBLOBSIZE, &CDataBase::DBEventGetBlobSize);
+ CreateDbService(MS_DBT_EVENT_GET, &CDataBase::DBEventGet);
+ CreateDbService(MS_DBT_EVENT_GETCOUNT, &CDataBase::DBEventGetCount);
+ CreateDbService(MS_DBT_EVENT_DELETE, &CDataBase::DBEventDelete);
+ CreateDbService(MS_DBT_EVENT_ADD, &CDataBase::DBEventAdd);
+ CreateDbService(MS_DBT_EVENT_MARKREAD, &CDataBase::DBEventMarkRead);
+ CreateDbService(MS_DBT_EVENT_WRITETODISK, &CDataBase::DBEventWriteToDisk);
+ CreateDbService(MS_DBT_EVENT_GETENTITY, &CDataBase::DBEventGetEntity);
+ CreateDbService(MS_DBT_EVENT_ITER_INIT, &CDataBase::DBEventIterInit);
+ CreateDbService(MS_DBT_EVENT_ITER_NEXT, &CDataBase::DBEventIterNext);
+ CreateDbService(MS_DBT_EVENT_ITER_CLOSE, &CDataBase::DBEventIterClose);
return true;
}
diff --git a/plugins/Dbx_tree/src/Services.h b/plugins/Dbx_tree/src/Services.h
index 0d75552fd4..0c500e2573 100644
--- a/plugins/Dbx_tree/src/Services.h
+++ b/plugins/Dbx_tree/src/Services.h
@@ -24,46 +24,3 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Interface.h"
#include "DataBase.h"
-
-bool RegisterServices();
-
-
-INT_PTR DBEntityGetRoot(WPARAM wParam, LPARAM lParam);
-INT_PTR DBEntityChildCount(WPARAM hEntity, LPARAM lParam);
-INT_PTR DBEntityGetParent(WPARAM hEntity, LPARAM lParam);
-INT_PTR DBEntityMove(WPARAM hEntity, LPARAM hParent);
-INT_PTR DBEntityGetFlags(WPARAM hEntity, LPARAM lParam);
-INT_PTR DBEntityIterInit(WPARAM pFilter, LPARAM hParent);
-INT_PTR DBEntityIterNext(WPARAM hIteration, LPARAM lParam);
-INT_PTR DBEntityIterClose(WPARAM hIteration, LPARAM lParam);
-INT_PTR DBEntityDelete(WPARAM hEntity, LPARAM lParam);
-INT_PTR DBEntityCreate(WPARAM pEntity, LPARAM lParam);
-INT_PTR DBEntityGetAccount(WPARAM hEntity, LPARAM lParam);
-
-INT_PTR DBVirtualEntityCreate(WPARAM hEntity, LPARAM hParent);
-INT_PTR DBVirtualEntityGetParent(WPARAM hVirtualEntity, LPARAM lParam);
-INT_PTR DBVirtualEntityGetFirst(WPARAM hEntity, LPARAM lParam);
-INT_PTR DBVirtualEntityGetNext(WPARAM hVirtualEntity, LPARAM lParam);
-
-INT_PTR DBSettingFind(WPARAM pSettingDescriptor, LPARAM lParam);
-INT_PTR DBSettingDelete(WPARAM pSettingDescriptor, LPARAM lParam);
-INT_PTR DBSettingDeleteHandle(WPARAM hSetting, LPARAM lParam);
-INT_PTR DBSettingWrite(WPARAM pSetting, LPARAM lParam);
-INT_PTR DBSettingWriteHandle(WPARAM pSetting, LPARAM hSetting);
-INT_PTR DBSettingRead(WPARAM pSetting, LPARAM lParam);
-INT_PTR DBSettingReadHandle(WPARAM pSetting, LPARAM hSetting);
-INT_PTR DBSettingIterInit(WPARAM pFilter, LPARAM lParam);
-INT_PTR DBSettingIterNext(WPARAM hIteration, LPARAM lParam);
-INT_PTR DBSettingIterClose(WPARAM hIteration, LPARAM lParam);
-
-INT_PTR DBEventGetBlobSize(WPARAM hEvent, LPARAM lParam);
-INT_PTR DBEventGet(WPARAM hEvent, LPARAM pEvent);
-INT_PTR DBEventGetCount(WPARAM hEntity, LPARAM lParam);
-INT_PTR DBEventDelete(WPARAM hEvent, LPARAM lParam);
-INT_PTR DBEventAdd(WPARAM hEntity, LPARAM pEvent);
-INT_PTR DBEventMarkRead(WPARAM hEvent, LPARAM lParam);
-INT_PTR DBEventWriteToDisk(WPARAM hEvent, LPARAM lParam);
-INT_PTR DBEventGetEntity(WPARAM hEvent, LPARAM lParam);
-INT_PTR DBEventIterInit(WPARAM pFilter, LPARAM lParam);
-INT_PTR DBEventIterNext(WPARAM hIteration, LPARAM lParam);
-INT_PTR DBEventIterClose(WPARAM hIteration, LPARAM lParam);
diff --git a/plugins/Dbx_tree/src/init.cpp b/plugins/Dbx_tree/src/init.cpp
index 3e1f4cc6a6..348c678249 100644
--- a/plugins/Dbx_tree/src/init.cpp
+++ b/plugins/Dbx_tree/src/init.cpp
@@ -56,7 +56,6 @@ extern "C" __declspec(dllexport) int Load(void)
mir_getLP(&gPluginInfoEx);
RegisterDatabasePlugin(&gDBLink);
- RegisterServices();
CompatibilityRegister();
return 0;
}