diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2011-02-01 03:48:36 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2011-02-01 03:48:36 +0300 |
commit | 1bfecda76700e3ed89a1e381789a77ab26e262a8 (patch) | |
tree | 5aa4b40d4f7014ca53ac276c19d43dc148a5313d | |
parent | 86da56a08b722b906f5e660ab965a995a3ba1ff4 (diff) |
metacontacts fixes
-rw-r--r-- | messages.cpp | 35 | ||||
-rw-r--r-- | new_gpg.rc | 37 |
2 files changed, 35 insertions, 37 deletions
diff --git a/messages.cpp b/messages.cpp index 36434ea..952d9e5 100644 --- a/messages.cpp +++ b/messages.cpp @@ -520,7 +520,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) { if(metaIsSubcontact(hContact)) { - HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, DBEF_UTF); + HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, DBEF_UTF| DBEF_READ); HistoryLog(metaGetContact(hContact), msg, EVENTTYPE_MESSAGE, DBEF_UTF); mir_free(msg); return 1; @@ -551,7 +551,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) hcontact_data[ccs->hContact].msgs_to_ignore.push_back((char*)ccs->lParam); return CallService(MS_PROTO_CHAINSEND, w, l); } - if(!isContactHaveKey(hContact) && bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && isGPGConfigured()) //TODO: add all mesages to list, and send after key exchange done, encrypted + if(!isContactHaveKey(hContact) && bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && isGPGConfigured()) { void send_encrypted_msgs_thread(HANDLE hContact); LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); @@ -611,11 +611,17 @@ int SendMsgSvc(WPARAM w, LPARAM l) { //encrypt data here wstring str; + bool isansi = false; if(!metaIsSubcontact(hContact)) str = toUTF16(msg); else {//workaround ... - wchar_t *tmp = mir_a2t(msg); + wchar_t *tmp = mir_utf8decodeW(msg); + if(!tmp) + { + tmp = mir_a2t(msg); + isansi = true; + } str.append(tmp); mir_free(tmp); } @@ -702,7 +708,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) } if(out.find("usage: ") != string::npos) { - MessageBox(0, _T("Something wrong, gpg does not understand us, aborting encrypting."), _T("Warning"), MB_OK); + MessageBox(0, _T("Something wrong, gpg does not understand us, aborting encryption."), _T("Warning"), MB_OK); DeleteFile(path.c_str()); return CallService(MS_PROTO_CHAINSEND, w, l); } @@ -732,15 +738,22 @@ int SendMsgSvc(WPARAM w, LPARAM l) { //dirty hack to avoid metacontacts problem ..., this also broke filters chain string str_event = (char*)ccs->lParam; if(bAppendTags) - { + { //utf8 tag will cause problems here str_event.insert(0, toUTF8(outopentag)); str_event.append(toUTF8(outclosetag)); } - HistoryLog(hContact, (char*)str_event.c_str(), EVENTTYPE_MESSAGE, DBEF_SENT | DBEF_UTF); - HistoryLog(metaGetContact(hContact), (char*)str_event.c_str(), EVENTTYPE_MESSAGE, DBEF_SENT |DBEF_UTF); - hcontact_data[hContact].msgs_to_ignore.push_back(toUTF8(toUTF16((char*)ccs->lParam))); - hcontact_data[metaGetContact(hContact)].msgs_to_ignore.push_back(toUTF8(toUTF16((char*)ccs->lParam))); //hmm, twice ? metacontacts !! %) - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UNICODE, (LPARAM)str.c_str()); + DWORD flags = 0, flags2 = 0; + if(!isansi) //message from metacontact itself, yet another metacontacts workaround... + flags |= DBEF_UTF; + else + flags2 |= DBEF_READ; + HistoryLog(hContact, (char*)str_event.c_str(), EVENTTYPE_MESSAGE, DBEF_SENT | flags2 | flags); + HistoryLog(metaGetContact(hContact), (char*)str_event.c_str(), EVENTTYPE_MESSAGE, DBEF_SENT | flags); + hcontact_data[hContact].msgs_to_ignore.push_back(msg); + if(isansi) + hcontact_data[hContact].msgs_to_ignore.push_back(msg); + hcontact_data[metaGetContact(hContact)].msgs_to_ignore.push_back(msg); + CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)toUTF8(str).c_str()); return returnNoError(hContact); } if(bAppendTags) @@ -758,7 +771,7 @@ int HookSendMsg(WPARAM w, LPARAM l) DBEVENTINFO * dbei = (DBEVENTINFO*)l; if((dbei->eventType == EVENTTYPE_MESSAGE) && (dbei->flags & DBEF_SENT)) { - if(strstr((char*)dbei->pBlob, "-----BEGIN PGP MESSAGE-----") || strstr((char*)dbei->pBlob, "-----PGP KEY RESPONSE-----") || strstr((char*)dbei->pBlob, "-----PGP KEY REQUEST-----") || strstr((char*)dbei->pBlob, "-----PGP KEY RESPONSE-----")) //grrrr! + if(strstr((char*)dbei->pBlob, "-----BEGIN PGP MESSAGE-----") || strstr((char*)dbei->pBlob, "-----PGP KEY RESPONSE-----") || strstr((char*)dbei->pBlob, "-----PGP KEY REQUEST-----") || strstr((char*)dbei->pBlob, "-----PGP KEY RESPONSE-----")) //our service data, can be double added by metacontacts e.t.c. return 1; HANDLE hContact = NULL; if(!hcontact_data[(HANDLE)w].msgs_to_ignore.empty()) @@ -13,11 +13,13 @@ #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Russian (Russia) resources
+// русский resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
+#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -175,7 +177,7 @@ END //
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_LOAD_PUBLIC_KEY, DIALOG
BEGIN
@@ -261,7 +263,7 @@ IDI_UNSECURED ICON "icons\\unsecured.ico" //
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,0,9
+ FILEVERSION 0,0,0,10
PRODUCTVERSION 0,9,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
@@ -278,7 +280,7 @@ BEGIN BLOCK "041904b0"
BEGIN
VALUE "FileDescription", "new_gpg"
- VALUE "FileVersion", "0.0.0.9"
+ VALUE "FileVersion", "0.0.0.10"
VALUE "InternalName", "new_gpg"
VALUE "LegalCopyright", "Copyright (C) 2010 sss"
VALUE "OriginalFilename", "new_gpg"
@@ -292,16 +294,18 @@ BEGIN END
END
-#endif // Russian (Russia) resources
+#endif // русский resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
+// английский (США) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
+#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -357,26 +361,7 @@ BEGIN RTEXT "Close:",IDC_STATIC,127,49,23,8
END
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_OPT_GPG, DIALOG
- BEGIN
- END
-
- IDD_OPT_GPG_BIN, DIALOG
- BEGIN
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // English (United States) resources
+#endif // английский (США) resources
/////////////////////////////////////////////////////////////////////////////
|