diff options
author | George Hazan <ghazan@miranda.im> | 2020-06-18 18:25:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-06-18 18:25:38 +0300 |
commit | 6f30a7bd4808c85932900aa05b511371610be973 (patch) | |
tree | c1471f75ae6fb76e75ea9a98cdff981a23d91242 /plugins/New_GPG/src | |
parent | d180b5d2ffdcf9ad3d98e22e68c8bd6662731b5d (diff) |
we don't insert parasite '\n' when a pipe is empty
Diffstat (limited to 'plugins/New_GPG/src')
-rwxr-xr-x | plugins/New_GPG/src/gpg_wrapper.cpp | 13 | ||||
-rwxr-xr-x | plugins/New_GPG/src/messages.cpp | 15 |
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) { |