From 8e71ba6e620317052a0122135270e6fd4275e74a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Aug 2012 11:32:21 +0000 Subject: fix to load stdmsg / stdchat when no SRMM plugins are present git-svn-id: http://svn.miranda-ng.org/main/trunk@1425 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/plugins/newplugins.cpp | 53 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'src/modules/plugins/newplugins.cpp') diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index b7425cc9a1..461eca7bb1 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -120,6 +120,10 @@ int LoadStdPlugins() if ( !LoadCorePlugin(pluginDefault[i])) return 1; } + + if (pluginDefault[13].pImpl == NULL) + MessageBox(NULL, TranslateT("No messaging plugins loaded. Please install/enable one of the messaging plugins, for instance, \"srmm.dll\""), _T("Miranda NG"), MB_OK | MB_ICONINFORMATION); + return 0; } @@ -550,6 +554,9 @@ LBL_Error: return TRUE; } +///////////////////////////////////////////////////////////////////////////////////////// +// Contact list plugins support + static bool loadClistModule(TCHAR* exe, pluginEntry *p) { BASIC_PLUGIN_INFO bpi; @@ -580,11 +587,13 @@ static pluginEntry* getCListModule(TCHAR *exe, TCHAR *slice, int useWhiteList) return p; } - MuuidReplacement& stdClist = pluginDefault[11]; - if ( LoadCorePlugin(stdClist)) { - mir_sntprintf(slice, &exe[MAX_PATH] - slice, _T("\\Core\\%s.dll"), stdClist.stdplugname); - if ( loadClistModule(exe, stdClist.pImpl)) - return stdClist.pImpl; + if ( !useWhiteList) { + MuuidReplacement& stdClist = pluginDefault[11]; + if ( LoadCorePlugin(stdClist)) { + mir_sntprintf(slice, &exe[MAX_PATH] - slice, _T("\\Core\\%s.dll"), stdClist.stdplugname); + if ( loadClistModule(exe, stdClist.pImpl)) + return stdClist.pImpl; + } } return NULL; @@ -605,8 +614,7 @@ int UnloadPlugin(TCHAR* buf, int bufLen) } ///////////////////////////////////////////////////////////////////////////////////////// -// -// Service plugins functions +// Service plugins functions void SetServiceModePlugin(pluginEntry *p) { @@ -681,8 +689,8 @@ void EnsureCheckerLoaded(bool bEnable) } ///////////////////////////////////////////////////////////////////////////////////////// -// Event hook to unload all non-core plugins -// hooked very late, after all the internal plugins, blah +// Event hook to unload all non-core plugins +// hooked very late, after all the internal plugins, blah void UnloadNewPlugins(void) { @@ -694,20 +702,16 @@ void UnloadNewPlugins(void) } } ///////////////////////////////////////////////////////////////////////////////////////// -// Loads all plugins +// Loads all plugins int LoadNewPluginsModule(void) { - TCHAR exe[MAX_PATH]; - TCHAR* slice; - pluginEntry* p; - pluginEntry* clist = NULL; int useWhiteList, i; - bool msgModule = false; // make full path to the plugin + TCHAR exe[MAX_PATH]; GetModuleFileName(NULL, exe, SIZEOF(exe)); - slice = _tcsrchr(exe, '\\'); + TCHAR *slice = _tcsrchr(exe, '\\'); if (slice) *slice = 0; // remember some useful options @@ -735,8 +739,10 @@ int LoadNewPluginsModule(void) } } // first load the clist cos alot of plugins need that to be present at Load(void) + pluginEntry* clist = NULL; for (useWhiteList = 1; useWhiteList >= 0 && clist == NULL; useWhiteList--) clist = getCListModule(exe, slice, useWhiteList); + /* the loop above will try and get one clist DLL to work, if all fail then just bail now */ if (clist == NULL) { // result = 0, no clist_* can be found @@ -753,25 +759,20 @@ int LoadNewPluginsModule(void) /* now loop thru and load all the other plugins, do this in one pass */ for (i=0; i < pluginList.getCount(); i++) { - p = pluginList[i]; + pluginEntry *p = pluginList[i]; if ( !TryLoadPlugin(p, false)) { Plugin_Uninit(p); i--; } - else if (p->pclass & PCLASS_LOADED) - msgModule |= hasMuuid(p->bpi, miid_srmm); } - if ( !msgModule) - MessageBox(NULL, TranslateT("No messaging plugins loaded. Please install/enable one of the messaging plugins, for instance, \"srmm.dll\""), _T("Miranda NG"), MB_OK | MB_ICONINFORMATION); - HookEvent(ME_OPT_INITIALISE, PluginOptionsInit); return 0; } ///////////////////////////////////////////////////////////////////////////////////////// -// Plugins module initialization -// called before anything real is loaded, incl. database +// Plugins module initialization +// called before anything real is loaded, incl. database static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM) { @@ -806,8 +807,8 @@ int LoadNewPluginsModuleInfos(void) } ///////////////////////////////////////////////////////////////////////////////////////// -// Plugins module unloading -// called at the end of module chain unloading, just modular engine left at this point +// Plugins module unloading +// called at the end of module chain unloading, just modular engine left at this point void UnloadDatabase(void) { -- cgit v1.2.3