summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-09-06 09:29:22 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-09-06 09:29:22 +0300
commitfd25e8729b0b69ceca5c5bc407b4b4379496ac85 (patch)
treeee5e49a70beff2c5a1e32e87cbc6dedaac24cfdc /messages.cpp
parentbb56212c72bea28881c668b6da766c603a67a37d (diff)
modified: main.cpp
modified: messages.cpp
Diffstat (limited to 'messages.cpp')
-rw-r--r--messages.cpp19
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);
}