diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-17 12:51:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-17 12:51:21 +0000 |
commit | 7a65cbd15d4f808f973d782deea2a5e1a02accd6 (patch) | |
tree | db84b5fe05afc63d1d17bec16363410ce799cfe8 /src/modules | |
parent | 1afab9fe8e14637b5b9b9c4a7d1b16399184fac4 (diff) |
obsolete heaader file, m_plugins.h, removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@1005 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/database/database.cpp | 22 | ||||
-rw-r--r-- | src/modules/database/profilemanager.cpp | 22 | ||||
-rw-r--r-- | src/modules/database/profilemanager.h | 18 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 17 |
4 files changed, 40 insertions, 39 deletions
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 2a8acd4a37..ec25931527 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -414,10 +414,9 @@ int makeDatabase(TCHAR *profile, DATABASELINK * link, HWND hwndDlg) }
// enumerate all plugins that had valid DatabasePluginInfo()
-static int FindDbPluginForProfile(const char*, DATABASELINK * dblink, LPARAM lParam)
+static int FindDbPluginForProfile(const TCHAR*, DATABASELINK *dblink, LPARAM lParam)
{
TCHAR* tszProfile = (TCHAR*)lParam;
-
int res = DBPE_CONT;
if (dblink && dblink->cbSize == sizeof(DATABASELINK)) {
char* szProfile = makeFileName(tszProfile);
@@ -450,12 +449,11 @@ static int FindDbPluginForProfile(const char*, DATABASELINK * dblink, LPARAM lPa }
// enumerate all plugins that had valid DatabasePluginInfo()
-static int FindDbPluginAutoCreate(const char*, DATABASELINK * dblink, LPARAM lParam)
+static int FindDbPluginAutoCreate(const TCHAR* ptszProfile, DATABASELINK * dblink, LPARAM lParam)
{
- TCHAR* tszProfile = (TCHAR*)lParam;
-
int res = DBPE_CONT;
if (dblink && dblink->cbSize == sizeof(DATABASELINK)) {
+ TCHAR* tszProfile = NEWTSTR_ALLOCA(ptszProfile);
CreatePathToFileT(tszProfile);
int err;
@@ -519,21 +517,18 @@ int LoadDatabaseModule(void) if ( !getProfile(szProfile, SIZEOF(szProfile)))
return 1;
- PLUGIN_DB_ENUM dbe;
- dbe.cbSize = sizeof(PLUGIN_DB_ENUM);
- dbe.lParam = (LPARAM)szProfile;
-
+ pfnDbEnumCallback pFunc;
if (_taccess(szProfile, 0) && shouldAutoCreate(szProfile))
- dbe.pfnEnumCallback = (int(*) (const char*, void*, LPARAM))FindDbPluginAutoCreate;
+ pFunc = FindDbPluginAutoCreate;
else
- dbe.pfnEnumCallback = (int(*) (const char*, void*, LPARAM))FindDbPluginForProfile;
+ pFunc = FindDbPluginForProfile;
// find a driver to support the given profile
bool retry;
int rc;
do {
retry = false;
- rc = CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe);
+ rc = enumDbPlugins(pFunc, (LPARAM)szProfile);
switch (rc) {
case -1: {
// no plugins at all
@@ -560,7 +555,8 @@ int LoadDatabaseModule(void) }
break;
}
- } while (retry);
+ }
+ while (retry);
return (rc != 0);
}
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 558646e510..63e6cd1c4d 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -115,7 +115,7 @@ static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, return CallWindowProc((WNDPROC)GetWindowLongPtr(edit, GWLP_USERDATA), edit, msg, wParam, lParam);
}
-static int FindDbProviders(const char*, DATABASELINK * dblink, LPARAM lParam)
+static int FindDbProviders(const TCHAR* tszProfileName, DATABASELINK *dblink, LPARAM lParam)
{
HWND hwndDlg = (HWND)lParam;
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS);
@@ -141,12 +141,8 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA dat = (struct DlgProfData *)lParam;
{
// fill in the db plugins present
- PLUGIN_DB_ENUM dbe;
- dbe.cbSize = sizeof(dbe);
- dbe.pfnEnumCallback = (int(*)(const char*, void*, LPARAM))FindDbProviders;
- dbe.lParam = (LPARAM)hwndDlg;
- if (CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe) == -1) {
- // no plugins?!
+ if (enumDbPlugins(FindDbProviders, (LPARAM)hwndDlg) == -1) {
+ // what, no plugins?!
EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILENAME), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_NODBDRIVERS), TRUE);
@@ -222,11 +218,11 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA return FALSE;
}
-static int DetectDbProvider(const char*, DATABASELINK * dblink, LPARAM lParam)
+static int DetectDbProvider(const TCHAR*, DATABASELINK * dblink, LPARAM lParam)
{
int error;
-char* fullpath = makeFileName((TCHAR*)lParam);
+ char* fullpath = makeFileName((TCHAR*)lParam);
int ret = dblink->grokHeader(fullpath, &error);
mir_free(fullpath);
@@ -287,18 +283,14 @@ BOOL EnumProfilesForList(TCHAR *fullpath, TCHAR *profile, LPARAM lParam) SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item);
if (bFileExists) {
- PLUGIN_DB_ENUM dbe;
TCHAR szPath[MAX_PATH];
+ _tcscpy(szPath, fullpath);
LVITEM item2;
item2.mask = LVIF_TEXT;
item2.iItem = iItem;
- dbe.cbSize = sizeof(dbe);
- dbe.pfnEnumCallback = (int(*)(const char*, void*, LPARAM))DetectDbProvider;
- dbe.lParam = (LPARAM)szPath;
- _tcscpy(szPath, fullpath);
- if (CallService(MS_PLUGINS_ENUMDBPLUGINS, 0, (LPARAM)&dbe) == 1) {
+ if ( enumDbPlugins(DetectDbProvider, (LPARAM)szPath) == 1) {
if (bFileLocked) {
// file locked
item2.pszText = TranslateT("<In Use>");
diff --git a/src/modules/database/profilemanager.h b/src/modules/database/profilemanager.h index 416403f057..64e4960fdc 100644 --- a/src/modules/database/profilemanager.h +++ b/src/modules/database/profilemanager.h @@ -21,13 +21,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-typedef struct {
+struct PROFILEMANAGERDATA
+{
TCHAR *szProfile; // in/out
TCHAR *szProfileDir; // in/out
BOOL noProfiles; // in
BOOL newProfile; // out
- DATABASELINK * dblink; // out
-} PROFILEMANAGERDATA;
+ DATABASELINK *dblink; // out
+};
int InitUtils(void);
@@ -41,3 +42,14 @@ bool shouldAutoCreate(TCHAR *szProfile); extern TCHAR g_profileDir[MAX_PATH];
extern TCHAR g_profileName[MAX_PATH];
+
+///////////////////////////////////////////////////////////////////////////////
+// former m_plugins.h
+
+#define DBPE_DONE 1
+#define DBPE_CONT 0
+#define DBPE_HALT (-1)
+
+typedef int (*pfnDbEnumCallback) (const TCHAR *pluginname, DATABASELINK* link, LPARAM lParam);
+
+int enumDbPlugins(pfnDbEnumCallback pFunc, LPARAM lParam);
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index d890de5157..083338614d 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -21,7 +21,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "..\..\core\commonheaders.h"
+
#include "plugins.h"
+#include "..\database\profilemanager.h"
extern bool bModulesLoadedFired;
@@ -405,16 +407,17 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) }
// this is called by the db module to return all DBs plugins, then when it finds the one it likes the others are unloaded
-static INT_PTR PluginsEnum(WPARAM, LPARAM lParam)
+int enumDbPlugins(pfnDbEnumCallback pFunc, LPARAM lParam)
{
- PLUGIN_DB_ENUM * de = (PLUGIN_DB_ENUM *) lParam;
- pluginEntry * x = pluginListDb;
- if (de == NULL || de->cbSize != sizeof(PLUGIN_DB_ENUM) || de->pfnEnumCallback == NULL) return 1;
+ pluginEntry *x = pluginListDb;
+ if (pFunc == NULL)
+ return 1;
+
while (x != NULL) {
- int rc = de->pfnEnumCallback(StrConvA(x->pluginname), x->bpi.dblink, de->lParam);
+ int rc = pFunc(x->pluginname, x->bpi.dblink, lParam);
if (rc == DBPE_DONE) {
// this db has been picked, get rid of all the others
- pluginEntry * y = pluginListDb, * n;
+ pluginEntry *y = pluginListDb, *n;
while (y != NULL) {
n = y->nextclass;
if (x != y)
@@ -823,8 +826,6 @@ int LoadNewPluginsModuleInfos(void) hPluginListHeap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
mirandaVersion = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
- CreateServiceFunction(MS_PLUGINS_ENUMDBPLUGINS, PluginsEnum);
-
// remember where the mirandaboot.ini goes
PathToAbsoluteT(_T("mirandaboot.ini"), mirandabootini, NULL);
// look for all *.dll's
|