summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-06-18 18:25:38 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-06-18 18:25:38 +0300
commit6f30a7bd4808c85932900aa05b511371610be973 (patch)
treec1471f75ae6fb76e75ea9a98cdff981a23d91242 /plugins/New_GPG/src
parentd180b5d2ffdcf9ad3d98e22e68c8bd6662731b5d (diff)
we don't insert parasite '\n' when a pipe is empty
Diffstat (limited to 'plugins/New_GPG/src')
-rwxr-xr-xplugins/New_GPG/src/gpg_wrapper.cpp13
-rwxr-xr-xplugins/New_GPG/src/messages.cpp15
2 files changed, 12 insertions, 16 deletions
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp
index 136f7928db..53a68fe4ea 100755
--- a/plugins/New_GPG/src/gpg_wrapper.cpp
+++ b/plugins/New_GPG/src/gpg_wrapper.cpp
@@ -84,10 +84,15 @@ void pxEexcute_thread(gpg_execution_params *params)
c->wait();
if (!params->bNoOutput) {
- params->out.Append(pout.get().c_str());
- params->out.Append("\n");
- params->out.Append(perr.get().c_str());
- params->out.Append("\n");
+ std::string s = pout.get();
+ if (!s.empty())
+ params->out.Append(s.c_str());
+
+ s = perr.get();
+ if (!s.empty())
+ params->out.Append(s.c_str());
+
+ params->out.Replace("\r\n", "\n");
params->out.Replace("\r\r", "");
if (globals.debuglog)
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index de10d1b2b7..1eb4f942eb 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -567,6 +567,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
strip_tags(str);
}
+LBL_Relaunch:
wstring file = toUTF16(get_random(10));
gpg_execution_params params;
{
@@ -630,18 +631,8 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
return;
g_plugin.setByte(hContact, "bAlwaysTrust", 1);
-
- params.addParam(L"--trust-model");
- params.addParam(L"always");
- if (!gpg_launcher(params)) {
- ProtoChainSend(hContact, PSS_MESSAGE, flags, (LPARAM)msg);
- return;
- }
- if (params.result == pxNotFound) {
- ProtoChainSend(hContact, PSS_MESSAGE, flags, (LPARAM)msg);
- return;
- }
- //TODO: check gpg output for errors
+ params.aargv.clear();
+ goto LBL_Relaunch;
}
if (params.out.Find("usage: ") != -1) {