From e2b98c75887cd08a278c2056ab8742b5108cf0ad Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 12 Aug 2010 22:43:02 +0300 Subject: something working ? --- messages.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 7a16dcd..ed3da04 100644 --- a/messages.cpp +++ b/messages.cpp @@ -64,21 +64,34 @@ int RecvMsgSvc(WPARAM w, LPARAM l) cmd += _T("--output \""); cmd += tmp2; cmd += _T("\\decrypted_data\""); - mir_free(tmp2); cmd += _T(" -d -a \""); cmd += path; cmd += _T("\""); pxExecute(&cmd, "", &out, &code); DeleteFile(path.c_str()); - cp866_to_cp1251(&out); + str.clear(); { - string::size_type p = out.find(">\"") +2; - TCHAR *tmp = mir_a2t (out.substr(p).c_str()); - if(_tcslen(tmp) > 0) + wstring path = tmp2; + mir_free(tmp2); + path += _T("\\decrypted_data"); + fstream f(path.c_str(), std::ios::in); + while(!f.eof()) { - mir_free((void**)ccs->lParam); - char *utf = mir_utf8encodeW(tmp); - ccs->lParam = (LPARAM)utf; + char tmp[256]; + f.getline(tmp, 256); + TCHAR *tmp2 = mir_a2t(tmp); + str.append(tmp2).append(_T("\n")); + mir_free(tmp); + } + f.close(); + DeleteFile(path.c_str()); + } + { + if(str.length() > 0) + { + mir_free((void**)pre->szMessage); + char *utf = mir_utf8encodeW(str.c_str()); + pre->szMessage = utf; return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } } -- cgit v1.2.3