From ab3d423b1dc514e9db61c170ca14bab49e5280cb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jan 2024 23:34:30 +0300 Subject: major atavism, PROTORECVEVENT, died with its own set of constants --- protocols/SkypeWeb/src/skype_contacts.cpp | 11 +++++----- protocols/SkypeWeb/src/skype_messages.cpp | 36 ++++++++++++------------------- protocols/SkypeWeb/src/skype_proto.cpp | 18 ++++++---------- protocols/SkypeWeb/src/skype_proto.h | 4 ++-- 4 files changed, 27 insertions(+), 42 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 52b04369fd..c16ccaa97a 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -130,12 +130,11 @@ void CSkypeProto::LoadContactsAuth(MHttpResponse *response, AsyncHttpRequest*) DB::AUTH_BLOB blob(hContact, displayName.c_str(), nullptr, nullptr, skypeId.c_str(), reason.c_str()); - PROTORECVEVENT pre = {}; - pre.timestamp = time(0); - pre.lParam = blob.size(); - pre.szMessage = blob; - - ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); + DB::EventInfo dbei; + dbei.timestamp = time(0); + dbei.cbBlob = blob.size(); + dbei.pBlob = blob; + ProtoChainRecv(hContact, PSR_AUTH, 0, dbei); } } diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 99a84cb78d..ddb4af3433 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -134,12 +134,12 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) EditEvent(hDbEvent, wszContent, timestamp); else { T2Utf szMsg(wszContent); - PROTORECVEVENT recv = {}; - recv.timestamp = timestamp; - recv.szMessage = szMsg; - recv.lParam = nEmoteOffset; - recv.szMsgId = szMessageId; - ProtoChainRecvMsg(hContact, &recv); + DB::EventInfo dbei; + dbei.timestamp = timestamp; + dbei.pBlob = szMsg; + dbei.cbBlob = nEmoteOffset; + dbei.szId = szMessageId; + ProtoChainRecvMsg(hContact, dbei); } } } @@ -214,25 +214,17 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const } if (nCount) { - PROTORECVEVENT pre = {}; - pre.timestamp = (uint32_t)timestamp; - pre.szMessage = (char*)psr; - - uint8_t *b = (uint8_t*)mir_calloc(sizeof(uint32_t) + mir_strlen(szMessageId) + 1); - uint8_t *pCur = b; - *((PDWORD)pCur) = nCount; - pCur += sizeof(uint32_t); - - mir_strcpy((char*)pCur, szMessageId); - - pre.lParam = (LPARAM)b; - - ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre); - for (uint32_t i = 0; i < *((PDWORD)b); i++) { + DB::EventInfo dbei; + dbei.timestamp = (uint32_t)timestamp; + dbei.pBlob = (char*)psr; + dbei.cbBlob = nCount; + dbei.szId = szMessageId; + + ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&dbei); + for (int i = 0; i < nCount; i++) { mir_free(psr[i]->id.a); mir_free(psr[i]); } - mir_free(b); } mir_free(psr); } diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 17fd5b2426..3e77308bbf 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -201,9 +201,9 @@ int CSkypeProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) return 0; } -int CSkypeProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) +int CSkypeProto::AuthRecv(MCONTACT, DB::EventInfo &dbei) { - return Proto_AuthRecv(m_szModuleName, pre); + return Proto_AuthRecv(m_szModuleName, dbei); } int CSkypeProto::AuthRequest(MCONTACT hContact, const wchar_t *szMessage) @@ -273,18 +273,15 @@ int CSkypeProto::UserIsTyping(MCONTACT hContact, int type) return 0; } -int CSkypeProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) +int CSkypeProto::RecvContacts(MCONTACT hContact, DB::EventInfo &dbei) { - PROTOSEARCHRESULT **isrList = (PROTOSEARCHRESULT**)pre->szMessage; + PROTOSEARCHRESULT **isrList = (PROTOSEARCHRESULT**)dbei.pBlob; - int nCount = *((LPARAM*)pre->lParam); - char* szMessageId = ((char*)pre->lParam + sizeof(LPARAM)); - - //if (GetMessageFromDb(hContact, szMessageId, pre->timestamp)) return 0; + int nCount = dbei.cbBlob; uint32_t cbBlob = 0; for (int i = 0; i < nCount; i++) - cbBlob += int(/*mir_wstrlen(isrList[i]->nick.w)*/0 + 2 + mir_wstrlen(isrList[i]->id.w) + mir_strlen(szMessageId)); + cbBlob += int(/*mir_wstrlen(isrList[i]->nick.w)*/0 + 2 + mir_wstrlen(isrList[i]->id.w)); char *pBlob = (char *)mir_calloc(cbBlob); char *pCurBlob = pBlob; @@ -296,13 +293,10 @@ int CSkypeProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) pCurBlob += mir_strlen(pCurBlob) + 1; } - DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; - dbei.timestamp = pre->timestamp; dbei.eventType = EVENTTYPE_CONTACTS; dbei.cbBlob = cbBlob; dbei.pBlob = pBlob; - dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0; db_event_add(hContact, &dbei); mir_free(pBlob); diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 11d91a6aa0..b2772ddc8d 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -55,14 +55,14 @@ public: int AuthRequest(MCONTACT hContact, const wchar_t* szMessage) override; int Authorize(MEVENT hDbEvent) override; int AuthDeny(MEVENT hDbEvent, const wchar_t* szReason) override; - int AuthRecv(MCONTACT hContact, PROTORECVEVENT*) override; + int AuthRecv(MCONTACT hContact, DB::EventInfo &dbei) override; INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override; int GetInfo(MCONTACT hContact, int infoType) override; HANDLE SearchBasic(const wchar_t* id) override; int SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char* msg) override; int SetStatus(int iNewStatus) override; int UserIsTyping(MCONTACT hContact, int type) override; - int RecvContacts(MCONTACT hContact, PROTORECVEVENT*) override; + int RecvContacts(MCONTACT hContact, DB::EventInfo &dbei) override; HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override; HANDLE GetAwayMsg(MCONTACT hContact) override; int SetAwayMsg(int m_iStatus, const wchar_t *msg) override; -- cgit v1.2.3