diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-28 20:17:40 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-28 20:17:40 +0300 |
commit | 380ea39ed5a269e7caf32d9063b389650233fdbe (patch) | |
tree | 320b5284baa6c950f72d037e40cf723b7d541528 /src | |
parent | e7b69721b0d390cec3f81f97134a51bfef228cf8 (diff) |
Import now works without accounts' activation, without calling Load() of protocol plugins, just on CMPlugin information
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/modules.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 37 | ||||
-rw-r--r-- | src/mir_app/src/plugins.h | 2 |
3 files changed, 21 insertions, 22 deletions
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp index 9f77361280..a8abaac4c9 100644 --- a/src/mir_app/src/modules.cpp +++ b/src/mir_app/src/modules.cpp @@ -147,10 +147,6 @@ int LoadDefaultModules(void) return 1;
}
- for (auto &it : pluginList.rev_iter())
- if (!it->bIsLast && it->bOk)
- Plugin_UnloadDyn(it, false);
-
plugin_service = nullptr;
}
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 1710e71a3d..192b916ab7 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -342,7 +342,7 @@ void Plugin_Uninit(pluginEntry *p) pluginList.remove(p);
}
-int Plugin_UnloadDyn(pluginEntry *p, bool bFreeDll)
+int Plugin_UnloadDyn(pluginEntry *p)
{
if (p->bpi.hInst) {
if (CallPluginEventHook(p->bpi.hInst, hOkToExitEvent, 0, 0) != 0)
@@ -374,19 +374,13 @@ int Plugin_UnloadDyn(pluginEntry *p, bool bFreeDll) NotifyFastHook(hevUnloadModule, (WPARAM)p->bpi.pluginInfo, (LPARAM)p->bpi.hInst);
- if (bFreeDll) {
- Plugin_Uninit(p);
+ Plugin_Uninit(p);
- // mark default plugins to be loaded
- if (!p->bIsCore)
- for (auto &it : pluginDefault)
- if (it.pImpl == p)
- it.pImpl = nullptr;
- }
- else if (p->bLoaded) {
- p->bpi.Unload();
- p->bLoaded = false;
- }
+ // mark default plugins to be loaded
+ if (!p->bIsCore)
+ for (auto &it : pluginDefault)
+ if (it.pImpl == p)
+ it.pImpl = nullptr;
return TRUE;
}
@@ -772,15 +766,24 @@ void UnloadNewPlugins(void) int LoadProtocolPlugins(void)
{
+ wchar_t exe[MAX_PATH];
+ GetModuleFileName(nullptr, exe, _countof(exe));
+ wchar_t* slice = wcsrchr(exe, '\\');
+ if (slice) *slice = 0;
+
/* now loop thru and load all the other plugins, do this in one pass */
for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
- if (!p->bIsProtocol)
+ if (!p->bIsProtocol || p->bpi.hInst != nullptr)
continue;
- if (!TryLoadPlugin(p, false)) {
- Plugin_Uninit(p);
- i--;
+ wchar_t tszFullPath[MAX_PATH];
+ mir_snwprintf(tszFullPath, L"%s\\%s\\%s", exe, L"Plugins", p->pluginname);
+
+ BASIC_PLUGIN_INFO bpi;
+ if (checkAPI(tszFullPath, &bpi, 0, CHECKAPI_NONE)) {
+ p->bOk = p->bHasBasicApi = true;
+ p->bpi = bpi;
}
}
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index 9be88a225f..d860df1a67 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -74,7 +74,7 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path); bool TryLoadPlugin(pluginEntry *p, bool bDynamic);
void Plugin_Uninit(pluginEntry *p);
-int Plugin_UnloadDyn(pluginEntry *p, bool bFreeDll = true);
+int Plugin_UnloadDyn(pluginEntry *p);
typedef BOOL (*SCAN_PLUGINS_CALLBACK) (WIN32_FIND_DATA * fd, wchar_t *path, WPARAM wParam, LPARAM lParam);
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam);
|