diff options
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r-- | plugins/MirOTR/src/dialogs.cpp | 10 | ||||
-rw-r--r-- | plugins/MirOTR/src/dllmain.cpp | 22 | ||||
-rw-r--r-- | plugins/MirOTR/src/icons.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/mirotrmenu.cpp | 6 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/otr.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/stdafx.h | 11 |
7 files changed, 26 insertions, 29 deletions
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp index 7bd50fefbd..35d7b32c42 100644 --- a/plugins/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/src/dialogs.cpp @@ -153,7 +153,7 @@ static void SMPInitUpdateDialog(ConnContext *context, bool responder) data->context = context; data->oldlevel = otr_context_get_trust(context); data->responder = responder; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), nullptr, DlgSMPUpdateProc, (LPARAM)data); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_PROGRESS), nullptr, DlgSMPUpdateProc, (LPARAM)data); } static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -304,7 +304,7 @@ void SMPInitResponseDialog(ConnContext *context, const wchar_t *question) { data->oldlevel = TRUST_NOT_PRIVATE; data->responder = true; data->question = (question) ? mir_wstrdup(question) : NULL; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM) data); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM) data); } */ @@ -570,7 +570,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam void SMPInitDialog(ConnContext *context) { if (context) - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgProcSMPInitProc, (LPARAM)context); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgProcSMPInitProc, (LPARAM)context); } void SMPDialogUpdate(ConnContext *context, int percent) @@ -609,7 +609,7 @@ void SMPDialogReply(ConnContext *context, const char* question) data->oldlevel = TRUST_NOT_PRIVATE; data->responder = true; data->question = (question) ? mir_utf8decodeW(question) : nullptr; - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgSMPResponseProc, (LPARAM)data); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgSMPResponseProc, (LPARAM)data); /* ShowError(L"SMP requires user password (NOT IMPL YET)"); otr_abort_smp(context); @@ -729,7 +729,7 @@ static unsigned int CALLBACK verify_context_thread(void *param) ConnContext *context = (ConnContext *)param; MCONTACT hContact = (UINT_PTR)context->app_data; wchar_t msg[1024]; - switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgBoxProcVerifyContext, (LPARAM)param)) { + switch (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgBoxProcVerifyContext, (LPARAM)param)) { case IDOK: case IDYES: lib_cs_lock(); diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp index e548c017dc..92dadd48a2 100644 --- a/plugins/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/src/dllmain.cpp @@ -1,10 +1,10 @@ // dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
#include "stdafx.h"
-HANDLE hEventWindow;
-HINSTANCE hInst;
-
int hLangpack;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -19,17 +19,13 @@ PLUGININFOEX pluginInfo={ {0x12d8faad, 0x78ab, 0x4e3c, {0x98, 0x54, 0x32, 0xe, 0x9e, 0xa5, 0xcc, 0x9f}}
};
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD, LPVOID)
-{
- hInst = hModule;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int ModulesLoaded(WPARAM, LPARAM)
{
lib_cs_lock();
@@ -43,7 +39,7 @@ int ModulesLoaded(WPARAM, LPARAM) InitSRMM();
- hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
+ HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
if (options.bHaveSecureIM && !db_get_b(0, MODULENAME, "sim_warned", 0)) {
db_set_b(0, MODULENAME, "sim_warned", 1);
@@ -91,12 +87,10 @@ extern "C" __declspec(dllexport) int Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
- //UnhookEvent(hSettingChanged);
- UnhookEvent(hEventWindow);
- //UnhookEvent(hEventDbEventAddedFilter);
- //UnhookEvent(hEventDbEventAdded);
DEBUGOUTA("UNLOAD MIROTR");
DeinitSRMM();
DeinitDBFilter();
diff --git a/plugins/MirOTR/src/icons.cpp b/plugins/MirOTR/src/icons.cpp index 9b952736b1..5fa631ecb6 100644 --- a/plugins/MirOTR/src/icons.cpp +++ b/plugins/MirOTR/src/icons.cpp @@ -11,5 +11,5 @@ static IconItem iconList[] = { void InitIcons()
{
- Icon_Register(hInst, "OTR", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "OTR", iconList, _countof(iconList));
}
diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 21ae10a7f9..899b41e5c4 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -148,11 +148,11 @@ void ShowOTRMenu(MCONTACT hContact, POINT pt) void InitMirOTRMenu(void) { WNDCLASS wc = { 0 }; - wc.hInstance = hInst; + wc.hInstance = g_plugin.getInst(); wc.lpfnWndProc = PopupMenuWndProc; wc.lpszClassName = L"MirOTRPopupMenuProcessor"; RegisterClass(&wc); - hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", nullptr, 0, 0, 0, 1, 1, nullptr, nullptr, hInst, nullptr); + hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", nullptr, 0, 0, 0, 1, 1, nullptr, nullptr, g_plugin.getInst(), nullptr); CreateServiceFunction("MirOTRMenuExecService", MirOTRMenuExecService); CreateServiceFunction("MirOTRMenuCheckService", MirOTRMenuCheckService); @@ -208,7 +208,7 @@ void UninitMirOTRMenu(void) DestroyWindow(hDummyPaintWin); hDummyPaintWin = nullptr; - UnregisterClass(L"MirOTRPopupMenuProcessor", hInst); + UnregisterClass(L"MirOTRPopupMenuProcessor", g_plugin.getInst()); Menu_RemoveObject(hMirOTRMenuObject); hMirOTRMenuObject = 0; diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 3092cdd8e9..f8419c40c1 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -828,7 +828,7 @@ static int OpenOptions(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 100; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.szGroup.w = LPGENW("Services"); odp.szTitle.w = L"OTR"; odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp index 5350bca1bb..56c51be1a8 100644 --- a/plugins/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/src/otr.cpp @@ -108,7 +108,7 @@ extern "C" { protocol = GetContactProto((UINT_PTR)opdata); } if (!protocol) return; - DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), nullptr, GenKeyDlgBoxProc, (LPARAM)protocol); + DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_GENKEYNOTIFY), nullptr, GenKeyDlgBoxProc, (LPARAM)protocol); } diff --git a/plugins/MirOTR/src/stdafx.h b/plugins/MirOTR/src/stdafx.h index 73bed096c4..06d1f2f45b 100644 --- a/plugins/MirOTR/src/stdafx.h +++ b/plugins/MirOTR/src/stdafx.h @@ -23,8 +23,6 @@ extern "C" { }
using namespace std;
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_langpack.h>
#include <m_database.h>
@@ -76,7 +74,12 @@ using namespace std; #define MODULENAME "MirOTR"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#define PREF_BYPASS_OTR 0x8000
#define PREF_NO_HISTORY 0x10000
-
-extern HINSTANCE hInst;
|