summaryrefslogtreecommitdiff
path: root/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'init.cpp')
-rw-r--r--init.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/init.cpp b/init.cpp
index 801b1c7..86b189f 100644
--- a/init.cpp
+++ b/init.cpp
@@ -16,6 +16,9 @@
#include "commonheaders.h"
+//global variables
+bool bAppendTags = false;
+TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag;
HINSTANCE hInst;
HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL;
@@ -31,7 +34,7 @@ UTF8_INTERFACE utfi = {0};
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
0,
- PLUGIN_MAKE_VERSION(0,0,0,1),
+ PLUGIN_MAKE_VERSION(0,0,0,2),
"new GPG encryption support plugin, used code from http://addons.miranda-im.org/details.php?action=viewfile&id=3485",
"sss",
"sss123next@list.ru",
@@ -71,9 +74,19 @@ int LoadKey(WPARAM w, LPARAM l);
int ToggleEncryption(WPARAM w, LPARAM l);
int SendKey(WPARAM w, LPARAM l);
+void init_vars()
+{
+ bAppendTags = DBGetContactSettingByte(NULL, szModuleName, "bAppendTags", 0);
+ inopentag = UniGetContactSettingUtf(NULL, szModuleName, "szInOpenTag", _T("<GPGdec>"));
+ inclosetag = UniGetContactSettingUtf(NULL, szModuleName, "szInCloseTag", _T("</GnuPGdec>"));
+ outopentag = UniGetContactSettingUtf(NULL, szModuleName, "szOutOpenTag", _T("<GPGenc>"));
+ outclosetag = UniGetContactSettingUtf(NULL, szModuleName, "szOutCloseTag", _T("</GnuPgenc>"));
+}
+
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
pluginLink=link;
+ init_vars();
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
mir_getMMI(&mmi);
mir_getUTFI(&utfi);
@@ -121,15 +134,17 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
int OnPreBuildContactMenu(WPARAM w, LPARAM l);
int RecvMsgSvc(WPARAM w, LPARAM l);
int SendMsgSvc(WPARAM w, LPARAM l);
+ int HookSendMsg(WPARAM w, LPARAM l);
- void test();
+// void test();
void FirstRun();
FirstRun();
- test();
+// test();
HookEvent(ME_OPT_INITIALISE, GpgOptInit);
+ HookEvent(ME_DB_EVENT_FILTER_ADD, HookSendMsg);
hOnPreBuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu);
PROTOCOLDESCRIPTOR pd = {0};
@@ -157,5 +172,9 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
extern "C" int __declspec(dllexport) Unload(void)
{
+ mir_free(inopentag);
+ mir_free(inclosetag);
+ mir_free(outopentag);
+ mir_free(outclosetag);
return 0;
}