summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-03-18 15:33:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-03-18 15:33:48 +0300
commit4be051a155c0fbc47c1e0eab75da6b4ba8bb2327 (patch)
tree6bd02758efeec37f6bf1b7483f5c046d5b2990cd /plugins/New_GPG/src
parent18e00b8e27272dde88c47560130298ddf8515474 (diff)
NewGPG:
- fixes #2259 (New_GPG лезет на другие аккаунты и пытается расшифровывать чаты); - fixes #2258 (New_GPG is broken after chat window redesign); - version bump
Diffstat (limited to 'plugins/New_GPG/src')
-rwxr-xr-xplugins/New_GPG/src/messages.cpp17
-rwxr-xr-xplugins/New_GPG/src/options.cpp4
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp29
-rwxr-xr-xplugins/New_GPG/src/version.h8
4 files changed, 14 insertions, 44 deletions
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index 81b0c94a58..a8520d510b 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -339,6 +339,7 @@ static void RecvMsgSvc_func(RecvParams *param)
}
}
}
+
if (g_plugin.getByte(db_mc_isMeta(hContact) ? metaGetMostOnline(hContact) : hContact, "GPGEncryption")) {
HistoryLog(hContact, db_event(param->msg, param->timestamp, 0, dbflags | DBEF_READ));
delete param;
@@ -507,6 +508,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
HistoryLog(ccs->hContact, db_event(msg, 0, 0, dbflags));
return 0;
}
+
if (globals.bAutoExchange && strstr(msg, "-----PGP KEY REQUEST-----") && globals.gpg_valid && globals.gpg_keyexist) {
if (globals.bDebugLog)
globals.debuglog << "info(autoexchange): received key request from: " + toUTF8(Clist_GetContactDisplayName(ccs->hContact));
@@ -575,11 +577,10 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
return;
}
- if (!globals.bJabberAPI) { //force jabber to handle encrypted message by itself
- params.addParam(L"--comment");
- params.addParam(L"\"\"");
- params.addParam(L"--no-version");
- }
+ params.addParam(L"--comment");
+ params.addParam(L"\"\"");
+ params.addParam(L"--no-version");
+
if (g_plugin.getByte(hContact, "bAlwaysTrust", 0)) {
params.addParam(L"--trust-model");
params.addParam(L"always");
@@ -587,10 +588,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
params.addParam(L"--batch");
params.addParam(L"--yes");
params.addParam(L"-eatr");
- wchar_t *tmp2 = mir_a2u(tmp);
-
- params.addParam(tmp2);
- mir_free(tmp2);
+ params.addParam(_A2T(tmp).get());
}
CMStringW path(g_plugin.getMStringW("szHomePath"));
@@ -787,6 +785,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
if (!isContactHaveKey(hContact)) {
if (globals.bDebugLog)
globals.debuglog << "info: contact have not key, name: " + toUTF8(Clist_GetContactDisplayName(hContact));
+
if (globals.bAutoExchange && !strstr((char*)dbei->pBlob, "-----PGP KEY REQUEST-----") && !strstr((char*)dbei->pBlob, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && globals.gpg_valid) {
if (globals.bDebugLog)
globals.debuglog << "info: checking for autoexchange possibility, name: " + toUTF8(Clist_GetContactDisplayName(hContact));
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index c936e30c5a..fe924e710a 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -118,10 +118,10 @@ public:
bool OnApply() override
{
g_plugin.setByte("bDebugLog", globals.bDebugLog = check_DEBUG_LOG.GetState());
+ globals.debuglog.init();
- if (globals.bDebugLog)
- globals.debuglog.init();
g_plugin.setByte("bJabberAPI", globals.bJabberAPI = check_JABBER_API.GetState());
+
bool old_bFileTransfers = g_plugin.getByte("bFileTransfers", 0) != 0;
g_plugin.setByte("bFileTransfers", globals.bFileTransfers = check_FILE_TRANSFERS.GetState());
if (globals.bFileTransfers != old_bFileTransfers) {
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 63b1abc71c..899095e3b2 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -558,35 +558,6 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, TiXmlElement *node,
continue;
// TODO: make following block more readable
- if (strstr(str, "-----BEGIN PGP MESSAGE-----") && strstr(str, "-----END PGP MESSAGE-----")) {
- string data = str;
- local_node->SetText("This message is encrypted.");
- string::size_type p1 = data.find("-----BEGIN PGP MESSAGE-----") + mir_strlen("-----BEGIN PGP MESSAGE-----");
- while (data.find("Version: ", p1) != wstring::npos) {
- p1 = data.find("Version: ", p1);
- p1 = data.find("\n", p1);
- }
- while (data.find("Comment: ", p1) != wstring::npos) {
- p1 = data.find("Comment: ", p1);
- p1 = data.find("\n", p1);
- }
- while (data.find("Encoding: ", p1) != wstring::npos) {
- p1 = data.find("Encoding: ", p1);
- p1 = data.find("\n", p1);
- }
- p1 += 3;
- string::size_type p2 = data.find("-----END PGP MESSAGE-----");
- string data2 = data.substr(p1, p2 - p1 - 2);
- strip_line_term(data2);
- if (globals.bDebugLog)
- globals.debuglog << "jabber_api: attaching:\r\n\r\n" + data2 + "\n\n\t to outgoing xml";
-
- TiXmlElement *encrypted_data = pDoc->NewElement("x"); node->InsertEndChild(encrypted_data);
- encrypted_data->SetText(data2.c_str());
- encrypted_data->SetAttribute("xmlns", "jabber:x:encrypted");
- break;
- }
-
if (globals.bPresenceSigning && nodename && strstr(nodename, "status")) {
string path_out = ptrA(g_plugin.getUStringA("szHomePath", ""));
string file = get_random(10);
diff --git a/plugins/New_GPG/src/version.h b/plugins/New_GPG/src/version.h
index 946c4645c3..345aae4638 100755
--- a/plugins/New_GPG/src/version.h
+++ b/plugins/New_GPG/src/version.h
@@ -1,13 +1,13 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 1
+#define __MINOR_VERSION 2
#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __BUILD_NUM 1
#include <stdver.h>
#define __PLUGIN_NAME "GPG"
#define __FILENAME "New_GPG.dll"
#define __DESCRIPTION "New GPG encryption support plugin, based on code from old GPG plugin and SecureIM."
-#define __AUTHOR "sss"
+#define __AUTHOR "sss, Miranda NG Team"
#define __AUTHORWEB "https://miranda-ng.org/p/New_GPG/"
-#define __COPYRIGHT "© 2010-20 sss"
+#define __COPYRIGHT "© 2010-20 sss, Miranda NG Team"