diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2013-04-20 19:35:45 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2013-04-20 19:35:45 +0000 |
commit | 2973e11eefbc41935fdac9b6040bd0d360510e05 (patch) | |
tree | 1fb57c589636c8e994beba1449ef7fe11d6ce4d8 /protocols/Skype/src/skype_database.cpp | |
parent | 5b48d799fc3ebbf8bb0e9010f12954db24c91a32 (diff) |
refactoring continued
git-svn-id: http://svn.miranda-ng.org/main/trunk@4490 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_database.cpp')
-rw-r--r-- | protocols/Skype/src/skype_database.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index b607c8e4b7..8b3088b484 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -63,12 +63,10 @@ void CSkypeProto::RaiseAuthRequestEvent( ::CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
}
-bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, const char* message, int flag)
+bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, const char* guid, int flag)
{
bool result = false;
- int length = ::strlen(message);
-
HANDLE hDbEvent = ::db_event_last(hContact);
while (hDbEvent)
{
@@ -86,8 +84,7 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, const char* me int sendFlag = dbei.flags & DBEF_SENT;
if (dbei.eventType == EVENTTYPE_MESSAGE && sendFlag == flag)
{
- char *dbMessage = (char *)dbei.pBlob;
- if (::strncmp(dbMessage, message, length) == 0 && dbei.timestamp == timestamp)
+ if (::memcmp(&dbei.pBlob[dbei.cbBlob - 32], guid, 32) == 0)
{
::mir_free(dbei.pBlob);
result = true;
@@ -105,17 +102,19 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, const char* me void CSkypeProto::RaiseMessageReceivedEvent(
HANDLE hContact,
DWORD timestamp,
+ const char *guid,
const wchar_t *message,
bool isNeedCheck)
{
- /*if (isNeedCheck)
- if (this->IsMessageInDB(hContact, timestamp, message))
- return;*/
+ if (isNeedCheck)
+ if (this->IsMessageInDB(hContact, timestamp, guid))
+ return;
PROTORECVEVENT recv;
- recv.flags = PREF_UNICODE;
+ recv.flags = PREF_UTF;
+ recv.lParam = (LPARAM)guid;
recv.timestamp = timestamp;
- recv.tszMessage = ::mir_wstrdup(message);
+ recv.szMessage = ::mir_utf8encodeW(message);
::ProtoChainRecvMsg(hContact, &recv);
}
@@ -123,10 +122,11 @@ void CSkypeProto::RaiseMessageReceivedEvent( void CSkypeProto::RaiseMessageSendedEvent(
HANDLE hContact,
DWORD timestamp,
+ const char *guid,
const wchar_t *message)
{
- /*if (this->IsMessageInDB(hContact, timestamp, message, DBEF_SENT))
- return;*/
+ if (this->IsMessageInDB(hContact, timestamp, guid, DBEF_SENT))
+ return;
char *msg = ::mir_utf8encodeW(message);
|