diff options
Diffstat (limited to 'plugins/Dbx_tree')
-rw-r--r-- | plugins/Dbx_tree/Compatibility.cpp | 5 | ||||
-rw-r--r-- | plugins/Dbx_tree/Compatibility.h | 1 | ||||
-rw-r--r-- | plugins/Dbx_tree/DatabaseLink.cpp | 57 | ||||
-rw-r--r-- | plugins/Dbx_tree/init.cpp | 15 |
4 files changed, 15 insertions, 63 deletions
diff --git a/plugins/Dbx_tree/Compatibility.cpp b/plugins/Dbx_tree/Compatibility.cpp index 9247e4d744..759e44012c 100644 --- a/plugins/Dbx_tree/Compatibility.cpp +++ b/plugins/Dbx_tree/Compatibility.cpp @@ -797,8 +797,3 @@ bool CompatibilityRegister() hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED);
return true;
}
-
-bool CompatibilityUnRegister()
-{
- return true;
-}
diff --git a/plugins/Dbx_tree/Compatibility.h b/plugins/Dbx_tree/Compatibility.h index 4d89ca6cda..a23fa9284b 100644 --- a/plugins/Dbx_tree/Compatibility.h +++ b/plugins/Dbx_tree/Compatibility.h @@ -27,5 +27,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Services.h"
bool CompatibilityRegister();
-bool CompatibilityUnRegister();
diff --git a/plugins/Dbx_tree/DatabaseLink.cpp b/plugins/Dbx_tree/DatabaseLink.cpp index 850e798ef9..e2947bb72c 100644 --- a/plugins/Dbx_tree/DatabaseLink.cpp +++ b/plugins/Dbx_tree/DatabaseLink.cpp @@ -25,42 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "savestrings_gcc.h"
#endif
-HANDLE hSystemModulesLoaded = 0;
-
-static int SystemModulesLoaded(WPARAM wParam, LPARAM lParam)
-{
-
- UnhookEvent(hSystemModulesLoaded);
- hSystemModulesLoaded = 0;
-
- return 0;
-}
-
-/*
-returns what the driver can do given the flag
-*/
-static int getCapability(int flag)
-{
- return 0;
-}
-
-/*
- buf: pointer to a string buffer
- cch: length of buffer
- shortName: if true, the driver should return a short but descriptive name, e.g. "3.xx profile"
- Affect: The database plugin must return a "friendly name" into buf and not exceed cch bytes,
- e.g. "Database driver for 3.xx profiles"
- Returns: 0 on success, non zero on failure
-*/
-
-static int getFriendlyName(TCHAR *buf, size_t cch, int shortName)
-{
- if (shortName)
- _tcsncpy_s(buf, cch, _T(gInternalName), SIZEOF(gInternalName));
- else
- _tcsncpy_s(buf, cch, _T(gInternalNameLong), SIZEOF(gInternalNameLong));
- return 0;
-}
/*
profile: pointer to a string which contains full path + name
@@ -70,7 +34,7 @@ static int getFriendlyName(TCHAR *buf, size_t cch, int shortName) Note: Do not initialise internal data structures at this point!
Returns: 0 on success, non zero on failure - error contains extended error information, see EMKPRF_*
*/
-static int makeDatabase(TCHAR *profile, int* error)
+static int makeDatabase(const TCHAR *profile, int* error)
{
if (gDataBase) delete gDataBase;
gDataBase = new CDataBase(profile);
@@ -89,7 +53,7 @@ static int makeDatabase(TCHAR *profile, int* error) etc.
Returns: 0 on success, non zero on failure
*/
-static int grokHeader(TCHAR *profile, int* error)
+static int grokHeader(const TCHAR *profile, int* error)
{
if (gDataBase) delete gDataBase;
gDataBase = new CDataBase(profile);
@@ -104,16 +68,11 @@ Affect: Tell the database to create all services/hooks that a 3.xx legecy databa Returns: 0 on success, nonzero on failure
*/
-static MIDatabase* Load(TCHAR *profile)
+static MIDatabase* LoadDatabase(const TCHAR *profile)
{
if (gDataBase) delete gDataBase;
gDataBase = new CDataBase(profile);
- RegisterServices();
- CompatibilityRegister();
-
- hSystemModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, SystemModulesLoaded);
-
gDataBase->OpenDB();
return gDataBase;
}
@@ -123,7 +82,7 @@ Affect: The database plugin should shutdown, unloading things from the core and Returns: 0 on success, nonzero on failure
Note: Unload() might be called even if Load(void) was never called, wasLoaded is set to 1 if Load(void) was ever called.
*/
-static int Unload(int wasLoaded)
+static int UnloadDatabase(MIDatabase* db)
{
if (gDataBase)
delete gDataBase;
@@ -134,10 +93,10 @@ static int Unload(int wasLoaded) DATABASELINK gDBLink = {
sizeof(DATABASELINK),
- getCapability,
- getFriendlyName,
+ gInternalName,
+ _T(gInternalNameLong),
makeDatabase,
grokHeader,
- Load,
- Unload,
+ LoadDatabase,
+ UnloadDatabase,
};
diff --git a/plugins/Dbx_tree/init.cpp b/plugins/Dbx_tree/init.cpp index 0ad9e6721b..eca96fac97 100644 --- a/plugins/Dbx_tree/init.cpp +++ b/plugins/Dbx_tree/init.cpp @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "Interface.h"
+#include "DatabaseLink.h"
HINSTANCE hInstance = NULL;
int hLangpack;
@@ -34,7 +35,7 @@ static PLUGININFOEX gPluginInfoEx = { sizeof(PLUGININFOEX),
gInternalNameLong,
gVersion,
- gDescription " - build " __DATE__ " @ " __TIME__,
+ gDescription,
gAutor,
gAutorEmail,
gCopyright,
@@ -43,11 +44,6 @@ static PLUGININFOEX gPluginInfoEx = { gGUID
};
-extern "C" __declspec(dllexport) DATABASELINK* DatabasePluginInfo(void * Reserved)
-{
- return &gDBLink;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD MirandaVersion)
{
return &gPluginInfoEx;
@@ -58,7 +54,11 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_DATABAS extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&gPluginInfoEx);
- return 1;
+
+ RegisterDatabasePlugin(&gDBLink);
+ RegisterServices();
+ CompatibilityRegister();
+ return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
@@ -66,7 +66,6 @@ extern "C" __declspec(dllexport) int Unload(void) return 0;
}
-
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved)
{
hInstance = hInstDLL;
|