diff options
Diffstat (limited to 'messages.cpp')
-rw-r--r-- | messages.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/messages.cpp b/messages.cpp index c4a890d..2b81167 100644 --- a/messages.cpp +++ b/messages.cpp @@ -37,12 +37,18 @@ int RecvMsgSvc(WPARAM w, LPARAM l) if(((s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) != wstring::npos) && ((s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) != wstring::npos))
{ //this is public key
+ if(!DBGetContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 0))
+ ;//
}
else if(((s2 = str.find(_T("-/ENCRYPTED-"))) != wstring::npos) && ((s1 = str.find(_T("-ENCRYPTED-"))) != wstring::npos))
{ //this is generic encrypted data block
+ if(!DBGetContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 0))
+ ;//
}
else if(((s1 = str.find(_T("<body>This message is encrypted.</body>"))) != wstring::npos))
{ //this is jabber encrypted data
+ if(!DBGetContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 0))
+ ;//
}
char *utf = mir_utf8encodeW(str.c_str()); //for later usage
@@ -69,11 +75,55 @@ int SendMsgSvc(WPARAM w, LPARAM l) { //encrypt data here
wchar_t *tmp = mir_utf8decodeW(msg);
wstring str = tmp;
+ MessageBox(0, str.c_str(), _T(""), MB_OK);
mir_free(tmp);
wstring::size_type s1, s2;
+ { //not xmpp
+ string out;
+ DWORD code;
+ TCHAR cmd[128];
+ wstring path;
+ char *tmp = UniGetContactSettingUtf(ccs->hContact, szModuleName, "KeyFingerprint", "");
+ if(strlen(tmp) < 2)
+ {
+ mir_free(tmp);
+ return CallService(MS_PROTO_CHAINSEND, w, l);
+ }
+ _tcscpy(cmd, _T("--batch --yes -e -a -r "));
+ TCHAR *tmp2 = mir_a2t(tmp);
+ mir_free(tmp);
+ _tcscat(cmd, tmp2);
+ mir_free(tmp2);
+ _tcscat(cmd, _T("\""));
+ tmp2 = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T(""));
+ path.append(tmp2);
+ _tcscat(cmd, tmp2);
+ mir_free(tmp2);
+ _tcscat(cmd, _T("\\exported_data"));
+ path.append(_T("\\exported_data"));
+ _tcscat(cmd, _T("\""));
+ {
+ wfstream f(path.c_str(), std::ios_base::in);
+ f<<str;
+ f.close();
+ }
+ pxExecute(cmd, "", &out, &code);
+ DeleteFile(path.c_str());
+ path.append(_T(".asc"));
+ wfstream f(path.c_str(), std::ios_base::out);
+ str.clear();
+ while(!f.eof())
+ {
+ TCHAR tmp[128];
+ f.getline(tmp, 128);
+ str.append(tmp);
+ }
+ mir_free((void**)ccs->lParam);
+ char *utf = mir_utf8encodeW(str.c_str()); //for later usage
+ ccs->hContact = utf;
+ }
- char *utf = mir_utf8encodeW(str.c_str()); //for later usage
- mir_free(utf);
+
}
return CallService(MS_PROTO_CHAINSEND, w, l);
|