diff options
author | René Schümann <white06tiger@gmail.com> | 2015-03-26 20:39:36 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2015-03-26 20:39:36 +0000 |
commit | 958b2c8f49e4b05dd047e016def67690e31e09ca (patch) | |
tree | 449dedd80287206fc11da655e53ad6993d7f7190 /plugins/MirOTR/src/dllmain.cpp | |
parent | a02de2743a09366b17473f77567a8ca47a8db0d9 (diff) |
MirOTR:
! fixed SMP user cancel (we didn't inform our buddy about cancel actions) (dialogs.cpp)
! fixed SMP window handle leaks with all SMP dialogs (CreateDialog() uses DestroyWindow(), not EndDialog()) (dialogs.cpp)
tried to make it clear how a dialog was created by using "DlgProc" for CreateDialog() and "DlgBoxProc" for DialogBox() dialogs
git-svn-id: http://svn.miranda-ng.org/main/trunk@12505 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src/dllmain.cpp')
-rw-r--r-- | plugins/MirOTR/src/dllmain.cpp | 242 |
1 files changed, 121 insertions, 121 deletions
diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp index 55f8eef436..3e90e5c17b 100644 --- a/plugins/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/src/dllmain.cpp @@ -1,121 +1,121 @@ -// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
-#include "stdafx.h"
-
-HANDLE hEventWindow;
-HINSTANCE hInst;
-
-int hLangpack;
-
-PLUGININFOEX pluginInfo={
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {12D8FAAD-78AB-4E3C-9854-320E9EA5CC9F}
- {0x12d8faad, 0x78ab, 0x4e3c, {0x98, 0x54, 0x32, 0xe, 0x9e, 0xa5, 0xcc, 0x9f}}
-};
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- hInst = hModule;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- return &pluginInfo;
-}
-
-int ModulesLoaded(WPARAM wParam, LPARAM lParam)
-{
- InitUtils();
-
- lib_cs_lock();
- otr_user_state = otrl_userstate_create();
- lib_cs_unlock();
-
- // this calls ReadPrivkeyFiles (above) to set filename values (also called on ME_FOLDERS_PATH_CHANGED)
- InitOptions();
-
- InitDBFilter();
- InitMenu();
-
- InitSRMM();
-
- hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
-
- if (options.bHaveSecureIM && !db_get_b(0, MODULENAME, "sim_warned", 0)) {
- db_set_b(0, MODULENAME, "sim_warned", 1);
- options.default_policy = OTRL_POLICY_MANUAL_MOD;
- SaveOptions();
- MessageBox(0, TranslateT(LANG_OTR_SECUREIM_TEXT), TranslateT(LANG_OTR_SECUREIM_TITLE), 0x30);
- }
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Load(void)
-{
- DEBUGOUT_T("LOAD MIROTR")
-
- mir_getLP( &pluginInfo );
- /* for timezones
- mir_getTMI(&tmi); */
-
- InitIcons();
-
- OTRL_INIT;
- INITCOMMONCONTROLSEX icce = {0};
- icce.dwSize = sizeof(icce);
- icce.dwICC = ICC_LISTVIEW_CLASSES|ICC_PROGRESS_CLASS;
- InitCommonControlsEx(&icce);
-
- db_set_resident(MODULENAME, "TrustLevel");
-
- /////////////
- ////// init plugin
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
- pd.szName = MODULENAME;
- pd.type = PROTOTYPE_ENCRYPTION;
- CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
-
- // remove us as a filter to all contacts - fix filter type problem
- if(db_get_b(0, MODULENAME, "FilterOrderFix", 0) != 2) {
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- CallService(MS_PROTO_REMOVEFROMCONTACT, hContact, (LPARAM)MODULENAME);
- db_set_b(0, MODULENAME, "FilterOrderFix", 2);
- }
-
- // create our services
- CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, SVC_OTRSendMessage);
- CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, SVC_OTRRecvMessage);
-
- // hook modules loaded for updater support
- HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
-
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Unload(void)
-{
- //UnhookEvent(hSettingChanged);
- UnhookEvent(hEventWindow);
- //UnhookEvent(hEventDbEventAddedFilter);
- //UnhookEvent(hEventDbEventAdded);
- DEBUGOUT_T("UNLOAD MIROTR")
- DeinitSRMM();
- DeinitOptions();
- DeinitDBFilter();
-
- lib_cs_lock();
- otrl_userstate_free(otr_user_state);
- lib_cs_unlock();
-
- DeinitUtils();
-
- return 0;
-}
\ No newline at end of file +// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung. +#include "stdafx.h" + +HANDLE hEventWindow; +HINSTANCE hInst; + +int hLangpack; + +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {12D8FAAD-78AB-4E3C-9854-320E9EA5CC9F} + {0x12d8faad, 0x78ab, 0x4e3c, {0x98, 0x54, 0x32, 0xe, 0x9e, 0xa5, 0xcc, 0x9f}} +}; + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + hInst = hModule; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +int ModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + InitUtils(); + + lib_cs_lock(); + otr_user_state = otrl_userstate_create(); + lib_cs_unlock(); + + // this calls ReadPrivkeyFiles (above) to set filename values (also called on ME_FOLDERS_PATH_CHANGED) + InitOptions(); + + InitDBFilter(); + InitMenu(); + + InitSRMM(); + + hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent); + + if (options.bHaveSecureIM && !db_get_b(0, MODULENAME, "sim_warned", 0)) { + db_set_b(0, MODULENAME, "sim_warned", 1); + options.default_policy = OTRL_POLICY_MANUAL_MOD; + SaveOptions(); + MessageBox(0, TranslateT(LANG_OTR_SECUREIM_TEXT), TranslateT(LANG_OTR_SECUREIM_TITLE), 0x30); + } + return 0; +} + +extern "C" __declspec(dllexport) int Load(void) +{ + DEBUGOUT_T("LOAD MIROTR"); + + mir_getLP( &pluginInfo ); + /* for timezones + mir_getTMI(&tmi); */ + + InitIcons(); + + OTRL_INIT; + INITCOMMONCONTROLSEX icce = {0}; + icce.dwSize = sizeof(icce); + icce.dwICC = ICC_LISTVIEW_CLASSES|ICC_PROGRESS_CLASS; + InitCommonControlsEx(&icce); + + db_set_resident(MODULENAME, "TrustLevel"); + + ///////////// + ////// init plugin + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + pd.szName = MODULENAME; + pd.type = PROTOTYPE_ENCRYPTION; + CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); + + // remove us as a filter to all contacts - fix filter type problem + if(db_get_b(0, MODULENAME, "FilterOrderFix", 0) != 2) { + for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + CallService(MS_PROTO_REMOVEFROMCONTACT, hContact, (LPARAM)MODULENAME); + db_set_b(0, MODULENAME, "FilterOrderFix", 2); + } + + // create our services + CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, SVC_OTRSendMessage); + CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, SVC_OTRRecvMessage); + + // hook modules loaded for updater support + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + + return 0; +} + +extern "C" __declspec(dllexport) int Unload(void) +{ + //UnhookEvent(hSettingChanged); + UnhookEvent(hEventWindow); + //UnhookEvent(hEventDbEventAddedFilter); + //UnhookEvent(hEventDbEventAdded); + DEBUGOUT_T("UNLOAD MIROTR"); + DeinitSRMM(); + DeinitOptions(); + DeinitDBFilter(); + + lib_cs_lock(); + otrl_userstate_free(otr_user_state); + lib_cs_unlock(); + + DeinitUtils(); + + return 0; +} |