summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirOTR/src/dllmain.cpp224
-rw-r--r--plugins/MirOTR/src/mirotrmenu.cpp7
-rw-r--r--plugins/MirOTR/src/otr.cpp8
-rw-r--r--plugins/MirOTR/src/stdafx.h164
-rw-r--r--plugins/MirOTR/src/utils.cpp7
5 files changed, 205 insertions, 205 deletions
diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp
index 8b80f078cc..6e0e771756 100644
--- a/plugins/MirOTR/src/dllmain.cpp
+++ b/plugins/MirOTR/src/dllmain.cpp
@@ -1,115 +1,115 @@
-// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
-#include "stdafx.h"
-
+// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
+#include "stdafx.h"
+
CLIST_INTERFACE *pcli;
-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)
-{
- lib_cs_lock();
- otr_user_state = otrl_userstate_create();
-
- // 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);
- mir_getCLI();
-
- 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
+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)
+{
+ lib_cs_lock();
+ otr_user_state = otrl_userstate_create();
+
+ // 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);
+ mir_getCLI();
+
+ 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 = { 0 };
pd.cbSize = sizeof(pd);
- pd.szName = MODULENAME;
- pd.type = PROTOTYPE_ENCRYPTION;
- Proto_RegisterModule(&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))
- Proto_RemoveFromContact(hContact, 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();
- DeinitDBFilter();
-
- lib_cs_lock();
- otrl_userstate_free(otr_user_state);
-
- return 0;
-}
+ pd.szName = MODULENAME;
+ pd.type = PROTOTYPE_ENCRYPTION;
+ Proto_RegisterModule(&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))
+ Proto_RemoveFromContact(hContact, 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();
+ DeinitDBFilter();
+
+ lib_cs_lock();
+ otrl_userstate_free(otr_user_state);
+
+ return 0;
+}
diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp
index 60c8747b35..93ea2f2696 100644
--- a/plugins/MirOTR/src/mirotrmenu.cpp
+++ b/plugins/MirOTR/src/mirotrmenu.cpp
@@ -85,10 +85,8 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM)
Menu_ModifyItem(hStatusInfoItem, TranslateT(LANG_STATUS_DISABLED), IcoLib_GetIconHandle(ICON_NOT_PRIVATE));
}
}
- else if (pcpp->MenuItemHandle == hHTMLConvMenuItem) {
- int flags = db_get_b(hContact, MODULENAME, "HTMLConv", 0) ? CMIF_CHECKED : 0;
- Menu_ModifyItem(hHTMLConvMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- }
+ else if (pcpp->MenuItemHandle == hHTMLConvMenuItem)
+ Menu_SetChecked(hHTMLConvMenuItem, db_get_b(hContact, MODULENAME, "HTMLConv", 0) != 0);
}
return TRUE;
}
@@ -201,6 +199,7 @@ void InitMirOTRMenu(void)
mi.flags = CMIF_TCHAR | CMIF_CHECKED;
mi.name.t = LANG_MENU_TOGGLEHTML;
mi.position = 300001;
+ mi.hIcolibItem = 0;
hHTMLConvMenuItem = AddMirOTRMenuItem(&mi, MS_OTR_MENUTOGGLEHTML);
}
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index b7ee6b3963..26a4a9423d 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -64,7 +64,7 @@ INT_PTR CALLBACK GenKeyDlgBoxProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM
GenKeyData *data = (GenKeyData *)mir_calloc(sizeof(GenKeyData));
data->dialog = hWndDlg;
data->proto = (char*)lParam;
- CloseHandle((HANDLE)_beginthreadex(0, 0, generate_key_thread, (void*)data, 0, 0));
+ CloseHandle((HANDLE)_beginthreadex(0, 0, generate_key_thread, data, 0, 0));
}break;
case WMU_ENDDIALOG:
EndDialog(hWndDlg, 0);
@@ -72,6 +72,7 @@ INT_PTR CALLBACK GenKeyDlgBoxProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_DESTROY:
SetClassLongPtr(hWndDlg, GCLP_HICON, 0);
IcoLib_Release(ICON_OTR, 1);
+ mir_free((char*)lParam);
}
return FALSE;
}
@@ -103,7 +104,10 @@ extern "C" {
* desired. */
void otr_gui_create_privkey(void *opdata, const char *account_name, const char *protocol) {
DEBUGOUT_T("OTR_GUI_CREATE_PRIVKEY\n");
- if (opdata) protocol = GetContactProto((MCONTACT)opdata);
+ if (opdata) {
+ mir_free((char*)protocol);
+ protocol = mir_strdup(GetContactProto((MCONTACT)opdata));
+ }
if (!protocol) return;
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), 0, GenKeyDlgBoxProc, (LPARAM)protocol);
diff --git a/plugins/MirOTR/src/stdafx.h b/plugins/MirOTR/src/stdafx.h
index 4d1be59d91..1641a2e04e 100644
--- a/plugins/MirOTR/src/stdafx.h
+++ b/plugins/MirOTR/src/stdafx.h
@@ -1,83 +1,83 @@
-// stdafx.h : Includedatei für Standardsystem-Includedateien
-// oder häufig verwendete projektspezifische Includedateien,
-// die nur in unregelmäßigen Abständen geändert werden.
-//
-
-#pragma once
-
-#define _CRT_NON_CONFORMING_SWPRINTFS
-#define _CRT_SECURE_NO_WARNINGS
-#define WIN32_LEAN_AND_MEAN
-
-#include <windows.h>
-#include <commctrl.h>
-#include <process.h>
-#include <stack>
-#include <gcrypt.h>
-extern "C" {
- #include <privkey.h>
- #include <proto.h>
- #include <tlv.h>
- #include <message.h>
- #include <userstate.h>
-}
-using namespace std;
-
-#include <newpluginapi.h>
-#include <m_langpack.h>
-#include <m_database.h>
-#include <m_message.h>
+// stdafx.h : Includedatei für Standardsystem-Includedateien
+// oder häufig verwendete projektspezifische Includedateien,
+// die nur in unregelmäßigen Abständen geändert werden.
+//
+
+#pragma once
+
+#define _CRT_NON_CONFORMING_SWPRINTFS
+#define _CRT_SECURE_NO_WARNINGS
+#define WIN32_LEAN_AND_MEAN
+
+#include <windows.h>
+#include <commctrl.h>
+#include <process.h>
+#include <stack>
+#include <gcrypt.h>
+extern "C" {
+ #include <privkey.h>
+ #include <proto.h>
+ #include <tlv.h>
+ #include <message.h>
+ #include <userstate.h>
+}
+using namespace std;
+
+#include <newpluginapi.h>
+#include <m_langpack.h>
+#include <m_database.h>
+#include <m_message.h>
#include <m_clist.h>
-#include <m_popup.h>
-#include <m_protosvc.h>
-#include <m_contacts.h>
-#include <m_icolib.h>
-#include <m_skin.h>
-#include <win2k.h>
-#include <m_genmenu.h>
-#include <m_options.h>
-
-//ExternalAPI
-#include <m_folders.h>
-#include <m_msg_buttonsbar.h>
-#include <m_metacontacts.h>
-
-#include "otr.h"
-#include "dbfilter.h"
-#include "language.h"
-#include "options.h"
-#include "utils.h"
-#include "svcs_menu.h"
-#include "svcs_proto.h"
-#include "svcs_srmm.h"
-#include "resource.h"
-#include "otr.h"
-#include "icons.h"
-#include "dialogs.h"
-#include "version.h"
-#include "entities.h"
-#include "icons.h"
-#include "mirotrmenu.h"
-#include "striphtml.h"
-#include "ekhtml.h"
-#include "svcs_proto.h"
-
-#ifdef _DEBUG
- #define DEBUGOUTA(x) OutputDebugStringA(x)
- #define DEBUGOUT(x) OutputDebugString(x)
- #define DEBUGOUT_T(x) OutputDebugString(__T(x))
-#else
- #define DEBUGOUTA(x);
- #define DEBUGOUT(x)
- #define DEBUGOUT_T(x)
-#endif
-
-// modified manual policy - so that users set to 'opportunistic' will automatically start OTR with users set to 'manual'
-#define OTRL_POLICY_MANUAL_MOD (OTRL_POLICY_MANUAL | OTRL_POLICY_WHITESPACE_START_AKE | OTRL_POLICY_ERROR_START_AKE)
-
-#define MODULENAME "MirOTR"
-
-#define PREF_BYPASS_OTR 0x8000
-#define PREF_NO_HISTORY 0x10000
-
-extern HINSTANCE hInst;
+#include <m_popup.h>
+#include <m_protosvc.h>
+#include <m_contacts.h>
+#include <m_icolib.h>
+#include <m_skin.h>
+#include <win2k.h>
+#include <m_genmenu.h>
+#include <m_options.h>
+
+//ExternalAPI
+#include <m_folders.h>
+#include <m_msg_buttonsbar.h>
+#include <m_metacontacts.h>
+
+#include "otr.h"
+#include "dbfilter.h"
+#include "language.h"
+#include "options.h"
+#include "utils.h"
+#include "svcs_menu.h"
+#include "svcs_proto.h"
+#include "svcs_srmm.h"
+#include "resource.h"
+#include "otr.h"
+#include "icons.h"
+#include "dialogs.h"
+#include "version.h"
+#include "entities.h"
+#include "icons.h"
+#include "mirotrmenu.h"
+#include "striphtml.h"
+#include "ekhtml.h"
+#include "svcs_proto.h"
+
+#ifdef _DEBUG
+ #define DEBUGOUTA(x) OutputDebugStringA(x)
+ #define DEBUGOUT(x) OutputDebugString(x)
+ #define DEBUGOUT_T(x) OutputDebugString(__T(x))
+#else
+ #define DEBUGOUTA(x);
+ #define DEBUGOUT(x)
+ #define DEBUGOUT_T(x)
+#endif
+
+// modified manual policy - so that users set to 'opportunistic' will automatically start OTR with users set to 'manual'
+#define OTRL_POLICY_MANUAL_MOD (OTRL_POLICY_MANUAL | OTRL_POLICY_WHITESPACE_START_AKE | OTRL_POLICY_ERROR_START_AKE)
+
+#define MODULENAME "MirOTR"
+
+#define PREF_BYPASS_OTR 0x8000
+#define PREF_NO_HISTORY 0x10000
+
+extern HINSTANCE hInst;
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index 37edfd734a..ffdb5e33ec 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -348,19 +348,16 @@ const TCHAR *policy_to_string(OtrlPolicy policy) {
switch (policy) {
case OTRL_POLICY_NEVER:
return TranslateT(LANG_POLICY_NEVER);
- break;
case OTRL_POLICY_OPPORTUNISTIC:
return TranslateT(LANG_POLICY_OPP);
- break;
case OTRL_POLICY_MANUAL:
case OTRL_POLICY_MANUAL_MOD:
return TranslateT(LANG_POLICY_MANUAL);
- break;
case OTRL_POLICY_ALWAYS:
return TranslateT(LANG_POLICY_ALWAYS);
- break;
+ default:
+ return TranslateT(LANG_POLICY_DEFAULT);
}
- return TranslateT(LANG_POLICY_DEFAULT);
}
OtrlPolicy policy_from_string(const TCHAR *polstring) {