summaryrefslogtreecommitdiff
path: root/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'init.cpp')
-rwxr-xr-x[-rw-r--r--]init.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/init.cpp b/init.cpp
index 6f591ac..d04c437 100644..100755
--- a/init.cpp
+++ b/init.cpp
@@ -1,4 +1,4 @@
-// Copyright © 2010-2011 sss
+// Copyright © 2010-2012 sss
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -17,13 +17,13 @@
#include "commonheaders.h"
//global variables
-bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false;
+bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL;
list <JabberAccount*> Accounts;
HINSTANCE hInst;
-HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL, g_hCLIcon = NULL;
+HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL, g_hCLIcon = NULL, hExportGpgKeys = NULL, hImportGpgKeys = NULL;
PLUGINLINK *pluginLink;
IconExtraColumn g_IEC = {0};
static int OnModulesLoaded(WPARAM wParam,LPARAM lParam);
@@ -33,7 +33,7 @@ UTF8_INTERFACE utfi = {0};
RECT key_from_keyserver_rect = {0}, firstrun_rect = {0}, new_key_rect = {0}, key_gen_rect = {0}, load_key_rect = {0}, import_key_rect = {0}, key_password_rect = {0}, load_existing_key_rect = {0};
XML_API xi = {0};
logtofile debuglog;
-bool gpg_configured = false;
+bool gpg_valid = false, gpg_keyexist = false;
std::map<HANDLE, contact_data> hcontact_data;
@@ -46,7 +46,7 @@ PLUGININFOEX pluginInfo={
"new GPG encryption support plugin, based on code from old gpg plugin and secureim",
"sss",
"sss123next@list.ru",
- "© 2010-2011 sss",
+ "© 2010-2012 sss",
"http://sss.chaoslab.ru/tracker/mim_plugs/",
1, //unicode
0, //doesn't replace anything built-in
@@ -81,19 +81,24 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
int LoadKey(WPARAM w, LPARAM l);
int ToggleEncryption(WPARAM w, LPARAM l);
int SendKey(WPARAM w, LPARAM l);
+int ExportGpGKeys(WPARAM w, LPARAM l);
+int ImportGpGKeys(WPARAM w, LPARAM l);
void init_vars()
{
bAppendTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bAppendTags", 0);
+ bStripTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bStripTags", 0);
inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("<GPGdec>"));
inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>"));
outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>"));
outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
bDebugLog = DBGetContactSettingByte(NULL, szGPGModuleName, "bDebugLog", 0);
bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0);
+ password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
debuglog.init();
bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0);
- bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1);
+ bPresenceSigning = DBGetContactSettingByte(NULL, szGPGModuleName, "bPresenceSigning", 0);
+ bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0);
firstrun_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowX", 0);
firstrun_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowY", 0);
key_password_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "PasswordWindowX", 0);
@@ -108,19 +113,22 @@ void init_vars()
new_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowY", 0);
load_existing_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0);
load_existing_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0);
+ tabsrmm_used = isTabsrmmUsed();
}
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
pluginLink=link;
- init_vars();
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
mir_getMMI(&mmi);
mir_getUTFI(&utfi);
mir_getXI(&xi); //TODO: check if we have access to api
+ init_vars();
CreateServiceFunction("/LoadPubKey",(MIRANDASERVICE)LoadKey);
CreateServiceFunction("/ToggleEncryption",(MIRANDASERVICE)ToggleEncryption);
CreateServiceFunction("/SendKey",(MIRANDASERVICE)SendKey);
+ CreateServiceFunction("/ExportGPGKeys",(MIRANDASERVICE)ExportGpGKeys);
+ CreateServiceFunction("/ImportGPGKeys",(MIRANDASERVICE)ImportGpGKeys);
CLISTMENUITEM mi = {0};
mi.cbSize=sizeof(mi);
mi.position=-0x7FFFFFFF;
@@ -145,6 +153,23 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
mi.pszName="Send public key";
mi.pszService="/SendKey";
hSendKey = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ ZeroMemory(&mi,sizeof(mi));
+ mi.cbSize=sizeof(mi);
+ mi.position=-0x7FFFFFFF;
+ mi.flags=0;
+ mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ mi.pszName="Export GPG Public keys from all users";
+ mi.pszService="/ExportGPGKeys";
+ hExportGpgKeys = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ ZeroMemory(&mi,sizeof(mi));
+ mi.cbSize=sizeof(mi);
+ mi.position=-0x7FFFFFFF;
+ mi.flags=0;
+ mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ mi.pszName="Import GPG Public keys from all users";
+ mi.pszService="/ImportGPGKeys";
+ hImportGpgKeys = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+
return 0;
}