diff options
Diffstat (limited to 'messages.cpp')
-rw-r--r-- | messages.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/messages.cpp b/messages.cpp index f4e9ad6..7cc59e2 100644 --- a/messages.cpp +++ b/messages.cpp @@ -35,7 +35,6 @@ 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); HANDLE hContact = ccs->hContact; if(isProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); @@ -317,8 +316,10 @@ int RecvMsgSvc(WPARAM w, LPARAM l) str.erase(str.find_last_of(_T("\n")), 1); if(!str.length()) { + 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"); + pre->szMessage = mir_strdup(str.c_str()); return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } else @@ -329,8 +330,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) str.insert(0, inopentag); str.append(inclosetag); } - char *utf = mir_utf8encodeW(str.c_str()); - pre->szMessage = utf; + pre->szMessage = mir_utf8encodeW(str.c_str()); return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } } @@ -344,8 +344,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) mir_free(tmp); mir_free((void**)pre->szMessage); str.insert(0, _T("Received unencrypted message:\n")); - char *utf = mir_utf8encodeW(str.c_str()); - pre->szMessage = utf; + pre->szMessage = mir_utf8encodeW(str.c_str()); return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } return CallService(MS_PROTO_CHAINRECV, w, l); @@ -360,7 +359,6 @@ 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); HANDLE hContact = ccs->hContact; if(isProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); @@ -481,14 +479,13 @@ int SendMsgSvc(WPARAM w, LPARAM l) HistoryLog(hContact, "Failed to encrypt message with GPG", EVENTTYPE_MESSAGE, DBEF_SENT); return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } - mir_free((void**)ccs->lParam); - char *utf = mir_u2a(str.c_str()); - ccs->lParam = (LPARAM)utf; +// mir_free((void**)ccs->lParam); + ccs->lParam = (LPARAM)mir_utf8encodeW(str.c_str()); if(bAppendTags) DBWriteContactSettingByte(hContact, szGPGModuleName, "MsgsForTagging", DBGetContactSettingByte(ccs->hContact, szGPGModuleName, "MsgsForTagging", 0) + 1); } } - ccs->wParam&=~PREF_UNICODE; +// ccs->wParam&=~PREF_UNICODE; //memory leak ? return CallService(MS_PROTO_CHAINSEND, w, l); } |