From 326fdfc6425dd89b32e94c111d68a0384b8765a3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 May 2013 19:13:36 +0000 Subject: hangup fix git-svn-id: http://svn.miranda-ng.org/main/trunk@4626 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_database.cpp | 18 ++---------------- protocols/Skype/src/skype_messages.cpp | 19 ++++++++++++------- protocols/Skype/src/skype_proto.cpp | 16 +++++----------- protocols/Skype/src/skype_proto.h | 17 ++++++++--------- 4 files changed, 27 insertions(+), 43 deletions(-) (limited to 'protocols/Skype') diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index 67853c73b3..2aca8bd1f3 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -84,21 +84,7 @@ void CSkypeProto::RaiseAuthRequestEvent(DWORD timestamp, CContact::Ref contact) this->AddDBEvent(hContact, EVENTTYPE_AUTHREQUEST, time(NULL), PREF_UTF, cbBlob, pBlob); } -void CSkypeProto::RaiseMessageReceivedEvent(HANDLE hContact, DWORD timestamp, SEBinary &guid, const char *message, bool isUnreaded) -{ - if ( !isUnreaded) - if (this->IsMessageInDB(hContact, timestamp, guid)) - return; - - PROTORECVEVENT recv; - recv.flags = PREF_UTF; - recv.lParam = (LPARAM)&guid; - recv.timestamp = timestamp; - recv.szMessage = ::mir_strdup(message); - ::ProtoChainRecvMsg(hContact, &recv); -} - -void CSkypeProto::RaiseMessageSentEvent(HANDLE hContact, DWORD timestamp, SEBinary &guid, const char *message, bool isUnreaded) +void CSkypeProto::RaiseMessageSentEvent(HANDLE hContact, DWORD timestamp, SEBinary &guid, const char *message, bool isUnread) { if (this->IsMessageInDB(hContact, timestamp, guid, DBEF_SENT)) return; @@ -113,7 +99,7 @@ void CSkypeProto::RaiseMessageSentEvent(HANDLE hContact, DWORD timestamp, SEBina ::memcpy((char *)&msg[msgLen], guid.data(), guidLen); DWORD flags = DBEF_UTF | DBEF_SENT; - if ( !isUnreaded) + if ( !isUnread) flags |= DBEF_READ; this->AddDBEvent( diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp index 64b29939e1..ced5ab8647 100644 --- a/protocols/Skype/src/skype_messages.cpp +++ b/protocols/Skype/src/skype_messages.cpp @@ -59,13 +59,18 @@ void CSkypeProto::OnMessageReceived(CConversation::Ref &conversation, CMessage:: SEBinary guid; message->GetPropGuid(guid); - - this->RaiseMessageReceivedEvent( - hContact, - timestamp, - guid, - text, - status == CMessage::UNCONSUMED_NORMAL); + ReadMessageParam param = { guid, messageType }; + + if (status != CMessage::UNCONSUMED_NORMAL) + if (this->IsMessageInDB(hContact, timestamp, guid)) + return; + + PROTORECVEVENT recv; + recv.flags = PREF_UTF; + recv.lParam = (LPARAM)¶m; + recv.timestamp = timestamp; + recv.szMessage = ::mir_strdup(text); + ::ProtoChainRecvMsg(hContact, &recv); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index ec39286302..eec50e2e38 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -285,26 +285,20 @@ int __cdecl CSkypeProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) this->Log(L"Incoming message"); ::db_unset(hContact, "CList", "Hidden"); - SEBinary *guid = (SEBinary*)pre->lParam; + ReadMessageParam *param = (ReadMessageParam*)pre->lParam; char *message = (char *)pre->szMessage; size_t msgLen = ::strlen(message) + 1; - message = (char *)::mir_realloc(message, msgLen + guid->size()); - ::memcpy((char *)&message[msgLen], guid->data(), guid->size()); - - CMessage::Ref skype_message; - g_skype->GetMessageByGuid(*guid, skype_message); - - CMessage::TYPE messageType; - skype_message->GetPropType(messageType); + message = (char *)::mir_realloc(message, msgLen + param->guid.size()); + ::memcpy((char *)&message[msgLen], param->guid.data(), param->guid.size()); return (INT_PTR)this->AddDBEvent( hContact, - messageType == CMessage::POSTED_TEXT ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_EMOTE, + param->msgType == CMessage::POSTED_TEXT ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_EMOTE, pre->timestamp, DBEF_UTF | ((pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0), - DWORD(msgLen + guid->size()), + DWORD(msgLen + param->guid.size()), (PBYTE)message); } diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 9487e6b35e..0ae55044c2 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -20,6 +20,12 @@ struct _tag_iconList HANDLE Handle; }; +struct ReadMessageParam +{ + SEBinary& guid; + CMessage::TYPE msgType; +}; + struct InviteChatParam { wchar_t *id; @@ -409,18 +415,12 @@ protected: bool IsMessageInDB(HANDLE hContact, DWORD timestamp, SEBinary &guid, int flag = 0); HANDLE AddDBEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags = 0, DWORD cbBlob = 0, PBYTE pBlob = 0); - void RaiseMessageReceivedEvent( - HANDLE hContact, - DWORD timestamp, - SEBinary &guid, - const char *message, - bool isUnreaded = true); void RaiseMessageSentEvent( HANDLE hContact, DWORD timestamp, SEBinary &guid, const char *message, - bool isUnreaded = true); + bool isUnread = true); void RaiseAuthRequestEvent( DWORD timestamp, CContact::Ref contact); @@ -435,5 +435,4 @@ protected: static INT_PTR CALLBACK PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK ContactSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -}; \ No newline at end of file +}; -- cgit v1.2.3