summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-08-18 08:26:47 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-08-18 08:26:47 +0300
commit45ff7b504d79072bfbd24cf12f5818ed356f94bc (patch)
treeb3e51aa789863f95d48d5e3775216fa336911c9d /messages.cpp
parente07a374f12258c3798c9f49ea926db29f90d93ec (diff)
modified: gpg_wrapper.cpp
modified: init.cpp modified: main.cpp modified: messages.cpp modified: new_gpg.rc modified: new_gpg.sln modified: new_gpg.vcproj modified: options.cpp modified: resource.h modified: utilities.cpp
Diffstat (limited to 'messages.cpp')
-rw-r--r--messages.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/messages.cpp b/messages.cpp
index fa4f8e3..f523778 100644
--- a/messages.cpp
+++ b/messages.cpp
@@ -31,7 +31,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
char *msg = pre->szMessage;
if (!msg)
return CallService(MS_PROTO_CHAINRECV, w, l);
- bool unicode = (bool)(pre->flags&PREF_UNICODE);
+ BOOL unicode = (BOOL)(pre->flags&PREF_UNICODE);
{ //check for gpg related data
wchar_t *tmp = mir_utf8decodeW(msg);
@@ -167,8 +167,12 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
{
if(errno == ENOENT)
{
+ string str = pre->szMessage;
mir_free((void**)pre->szMessage);
- pre->szMessage = "Failed to decrypt GPG encrypted message";
+ str.insert(0, "Failed to decrypt GPG encrypted message:\n");
+ char *tmp = new char [str.length()+1];
+ strcpy(tmp, str.c_str());
+ pre->szMessage = tmp;
return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs);
}
}
@@ -232,13 +236,12 @@ int SendMsgSvc(WPARAM w, LPARAM l)
char *msg = (char*)(ccs->lParam);
if (!msg)
return CallService(MS_PROTO_CHAINSEND, w, l);
- bool unicode = (bool)(ccs->wParam&PREF_UNICODE);
+ BOOL unicode = (BOOL)(ccs->wParam&PREF_UNICODE);
{ //encrypt data here
wchar_t *tmp = mir_utf8decodeW(msg);
wstring str = tmp;
mir_free(tmp);
- wstring::size_type s1, s2;
{ //not xmpp, just replace whole message
string out;
DWORD code;
@@ -253,7 +256,7 @@ int SendMsgSvc(WPARAM w, LPARAM l)
// cmd += _T("--comment \"\" --no-version ");
if(DBGetContactSettingByte(ccs->hContact, szGPGModuleName, "bAlwaysTrust", 0))
cmd += _T("--trust-model always ");
- cmd += _T("--batch --yes -e -a -r ");
+ cmd += _T("--comment \"\" --no-version --batch --yes -e -a -r ");
TCHAR *tmp2 = mir_a2t(tmp);
mir_free(tmp);
cmd += tmp2;
@@ -277,13 +280,11 @@ int SendMsgSvc(WPARAM w, LPARAM l)
mir_free(tmp);
f.close();
}
- //MessageBox(0, cmd.c_str(), _T("in"), MB_OK);
if(pxExecute(&cmd, "", &out, &code) == pxNotFound)
{
MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
return CallService(MS_PROTO_CHAINSEND, w, l);
}
- //MessageBoxA(0, out.c_str(), "out", MB_OK);
if(out.find("There is no assurance this key belongs to the named user") != string::npos)
{
out.clear();
@@ -415,6 +416,8 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L
{
switch (((LPNMHDR)lParam)->code)
{
+ default:
+ break;
}
}
break;