diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-17 18:23:34 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-17 18:23:34 +0300 |
commit | 2aa59179945482dee30935c991f9317dfbf31946 (patch) | |
tree | 49fc2b77d68b636c7842a1af462af59c94ff6da5 /plugins/Spamotron/src | |
parent | 4c4735a232c680e60a85d0f85e2cb392e012c6e0 (diff) |
Tipper, StopSpamMod, StopSpam, StatusManager, StatusChange, StartupSilence, StartPosition, SplashScreen, SpellChecker, Spamotron => CMPlugin
Diffstat (limited to 'plugins/Spamotron/src')
-rw-r--r-- | plugins/Spamotron/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/Spamotron/src/spamotron.cpp | 24 | ||||
-rw-r--r-- | plugins/Spamotron/src/stdafx.h | 7 |
3 files changed, 21 insertions, 14 deletions
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 43035e9f59..dcaca0087b 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -87,8 +87,6 @@ BOOL _saveDlgItemScore(HWND hDialog, int controlID, char* option) return TRUE;
}
-extern HINSTANCE hInst;
-
INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing = 0, i, j;
@@ -554,7 +552,7 @@ extern INT_PTR CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wPara int OnOptInitialize(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Message sessions");
odp.szTitle.a = PLUGIN_NAME;
odp.flags = ODPF_BOLDGROUPS;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index f23b7861e9..a67fdd2b8c 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -1,9 +1,12 @@ #include "stdafx.h"
-HINSTANCE hInst;
HANDLE hOptInitialize, hModulesLoaded, hDBContactAdded, hDBEventAdded, hDBEventFilterAdd;
time_t last_queue_check = 0;
+
int hLangpack;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -18,18 +21,18 @@ PLUGININFOEX pluginInfo = { {0x14331048, 0x5a73, 0x4fdb, {0xb9, 0x09, 0x2d, 0x7e, 0x18, 0x25, 0xa0, 0x12}}
};
-extern int OnOptInitialize(WPARAM wParam, LPARAM lParam);
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- hInst = hinstDLL;
- return TRUE;
+ return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern int OnOptInitialize(WPARAM wParam, LPARAM lParam);
+
int OnModulesLoaded(WPARAM, LPARAM)
{
hOptInitialize = HookEvent(ME_OPT_INITIALISE, OnOptInitialize);
-
return 0;
}
@@ -498,10 +501,7 @@ void RemoveNotOnListSettings() }
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) int Load()
{
@@ -524,6 +524,8 @@ extern "C" __declspec(dllexport) int Load() return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" _declspec(dllexport) int Unload(void)
{
RemoveNotOnListSettings();
diff --git a/plugins/Spamotron/src/stdafx.h b/plugins/Spamotron/src/stdafx.h index 64f97f4c96..859d41a792 100644 --- a/plugins/Spamotron/src/stdafx.h +++ b/plugins/Spamotron/src/stdafx.h @@ -150,6 +150,13 @@ void queue_message(MCONTACT hContact, DWORD msgtime, wchar_t *message); void bayes_approve_contact(MCONTACT hContact);
void dequeue_messages();
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(PLUGIN_NAME)
+ {}
+};
+
#ifdef _DEBUG
extern sqlite3 *bayesdbg;
#define BAYESDBG_FILENAME "bayes.dbg"
|