From e96132b4d5344d2d58d247906bcaefccfb9d5253 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 20 Dec 2023 13:34:45 +0300 Subject: DBEVENTINFO::hContact to be returned inside an event, no need to call db_event_getContact() just after db_event_get() --- protocols/CloudFile/src/utils.cpp | 4 ++-- protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp | 2 +- protocols/Discord/src/server.cpp | 2 +- protocols/Discord/src/voice.cpp | 4 ++-- protocols/EmLanProto/src/mlan.cpp | 2 +- protocols/Gadu-Gadu/src/core.cpp | 2 +- protocols/GmailNotifier/src/notify.cpp | 2 +- protocols/ICQ-WIM/src/menus.cpp | 4 ++-- protocols/ICQ-WIM/src/proto.cpp | 8 +++----- protocols/ICQ-WIM/src/server.cpp | 2 +- protocols/ICQCorp/src/services.cpp | 2 +- protocols/IRCG/src/commandmonitor.cpp | 2 +- protocols/JabberG/src/jabber_archive.cpp | 2 +- protocols/JabberG/src/jabber_misc.cpp | 2 +- protocols/JabberG/src/jabber_omemo.cpp | 2 +- protocols/JabberG/src/jabber_thread.cpp | 2 +- protocols/NewsAggregator/Src/CheckFeed.cpp | 4 ++-- protocols/SkypeWeb/src/skype_contacts.cpp | 2 +- protocols/SkypeWeb/src/skype_db.cpp | 4 ++-- protocols/SkypeWeb/src/skype_proto.cpp | 11 +++++------ protocols/Steam/src/steam_contacts.cpp | 2 +- protocols/Telegram/src/server.cpp | 6 +++--- protocols/Tox/src/tox_contacts.cpp | 2 +- protocols/Tox/src/tox_messages.cpp | 2 +- protocols/Tox/src/tox_proto.h | 2 +- protocols/Tox/src/tox_utils.cpp | 4 ++-- protocols/VKontakte/src/misc.cpp | 6 +++--- protocols/VKontakte/src/vk_messages.cpp | 6 ++---- 28 files changed, 45 insertions(+), 50 deletions(-) (limited to 'protocols') diff --git a/protocols/CloudFile/src/utils.cpp b/protocols/CloudFile/src/utils.cpp index 73e22ef7c0..d241918c2f 100644 --- a/protocols/CloudFile/src/utils.cpp +++ b/protocols/CloudFile/src/utils.cpp @@ -23,7 +23,7 @@ void ShowNotification(const wchar_t *message, int flags, MCONTACT hContact) ShowNotification(_A2W(MODULENAME), message, flags, hContact); } -MEVENT AddEventToDb(MCONTACT hContact, uint16_t type, uint32_t flags, uint32_t cbBlob, uint8_t *pBlob) +MEVENT AddEventToDb(MCONTACT hContact, uint16_t type, uint32_t flags, uint32_t cbBlob, char *pBlob) { DBEVENTINFO dbei = {}; dbei.szModule = MODULENAME; @@ -74,7 +74,7 @@ void SendToContact(MCONTACT hContact, const wchar_t *data) char *message = mir_utf8encodeW(data); if (ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message) != ACKRESULT_FAILED) - AddEventToDb(hContact, EVENTTYPE_MESSAGE, DBEF_UTF | DBEF_SENT, (uint32_t)mir_strlen(message), (uint8_t*)message); + AddEventToDb(hContact, EVENTTYPE_MESSAGE, DBEF_UTF | DBEF_SENT, (uint32_t)mir_strlen(message), message); } void PasteToInputArea(MCONTACT hContact, const wchar_t *data) diff --git a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp index 37a82f7afe..989ae7bd37 100644 --- a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp +++ b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp @@ -379,7 +379,7 @@ void log_to_history(const ICurrencyRatesProvider *pProvider, MCONTACT hContact, dbei.flags = DBEF_READ | DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (int)::mir_strlen(psz) + 1; - dbei.pBlob = (uint8_t *)(char *)psz; + dbei.pBlob = psz; db_event_add(hContact, &dbei); } diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index 94f41aa5ed..096da0968d 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -116,7 +116,7 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest ProcessChatUser(pUser, _atoi64(szUserId), pNode); } - dbei.pBlob = buf.data(); + dbei.pBlob = (char *)buf.data(); dbei.cbBlob = (uint32_t)buf.length(); bool bSucceeded = false; diff --git a/protocols/Discord/src/voice.cpp b/protocols/Discord/src/voice.cpp index 5d1ccf1ea7..48e5290c23 100644 --- a/protocols/Discord/src/voice.cpp +++ b/protocols/Discord/src/voice.cpp @@ -42,7 +42,7 @@ void CDiscordProto::OnCommandCallCreated(const JSONNode &pRoot) dbei.timestamp = pCall->startTime; dbei.eventType = EVENT_INCOMING_CALL; dbei.cbBlob = uint32_t(mir_strlen(szMessage) + 1); - dbei.pBlob = (uint8_t *)szMessage; + dbei.pBlob = szMessage; dbei.flags = DBEF_UTF; db_event_add(pUser->hContact, &dbei); } @@ -76,7 +76,7 @@ void CDiscordProto::OnCommandCallDeleted(const JSONNode &pRoot) dbei.timestamp = currTime; dbei.eventType = EVENT_CALL_FINISHED; dbei.cbBlob = uint32_t(szMessage.GetLength() + 1); - dbei.pBlob = (uint8_t *)szMessage.c_str(); + dbei.pBlob = szMessage.GetBuffer(); dbei.flags = DBEF_UTF; db_event_add(pUser->hContact, &dbei); } diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 535a42a7aa..a1c764d125 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -329,7 +329,7 @@ void CMLan::RecvMessageUrl(CCSDATA *ccs) dbei.timestamp = pre->timestamp; dbei.flags = DBEF_UTF + ((pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0); dbei.cbBlob = (uint32_t)mir_strlen(szMessage) + 1; - dbei.pBlob = (uint8_t*)szMessage.get(); + dbei.pBlob = szMessage.get(); db_event_add(ccs->hContact, &dbei); } diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 93432deea9..b7c506df0b 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -897,7 +897,7 @@ retry: dbei.flags = DBEF_SENT | DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(e->event.multilogon_msg.message) + 1; - dbei.pBlob = (uint8_t*)e->event.multilogon_msg.message; + dbei.pBlob = e->event.multilogon_msg.message; db_event_add(getcontact(e->event.multilogon_msg.sender, 1, 0, nullptr), &dbei); } break; diff --git a/protocols/GmailNotifier/src/notify.cpp b/protocols/GmailNotifier/src/notify.cpp index 5b797c221a..cd4ed69fb9 100644 --- a/protocols/GmailNotifier/src/notify.cpp +++ b/protocols/GmailNotifier/src/notify.cpp @@ -150,7 +150,7 @@ void NotifyUser(Account *curAcc) resultLink *prst = curAcc->results.next; for (int i = 0; i < newMails; i++) { dbei.cbBlob = (uint32_t)mir_strlen(prst->content) + 1; - dbei.pBlob = (uint8_t*)prst->content; + dbei.pBlob = prst->content; db_event_add(curAcc->hContact, &dbei); prst = prst->next; } diff --git a/protocols/ICQ-WIM/src/menus.cpp b/protocols/ICQ-WIM/src/menus.cpp index 4cb75fe7b0..b78b308f43 100644 --- a/protocols/ICQ-WIM/src/menus.cpp +++ b/protocols/ICQ-WIM/src/menus.cpp @@ -47,13 +47,13 @@ INT_PTR CIcqProto::SvcExecMenu(WPARAM iCommand, LPARAM pHandle) IcqFileInfo *pFileInfo = nullptr; CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_UTF8))); - if (CheckFile(db_event_getContact(hEvent), wszText, pFileInfo)) { + if (CheckFile(dbei.hContact, wszText, pFileInfo)) { if (!pFileInfo || pFileInfo->bIsSticker) { // sticker is a simple text message prcoessed by SmileyAdd T2Utf szBody(wszText); mir_free(dbei.pBlob); dbei.cbBlob = (int)mir_strlen(szBody.get()); - dbei.pBlob = (uint8_t*)szBody.detach(); + dbei.pBlob = szBody.detach(); } else { // create the offline file event diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 30bc7ab707..277ecb6501 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -241,8 +241,7 @@ void __cdecl CIcqProto::OfflineFileThread(void *pParam) CMStringW wszUrl; if (fileText2url(blob.getUrl(), &wszUrl)) { - MCONTACT hContact = db_event_getContact(ofd->hDbEvent); - if (auto *pFileInfo = RetrieveFileInfo(hContact, wszUrl)) { + if (auto *pFileInfo = RetrieveFileInfo(dbei.hContact, wszUrl)) { if (!ofd->bCopy) { auto *pReq = new AsyncHttpRequest(CONN_NONE, REQUEST_GET, pFileInfo->szUrl, &CIcqProto::OnFileRecv); pReq->pUserInfo = ofd; @@ -561,10 +560,9 @@ int CIcqProto::SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *pszSrc DB::EventInfo dbei(hReplyEvent); if (dbei) { JSONNode replyTo; - MCONTACT replyContact = db_event_getContact(hReplyEvent); - CMStringA replyId(GetUserId(replyContact)); + CMStringA replyId(GetUserId(dbei.hContact)); replyTo << CHAR_PARAM("mediaType", "quote") << CHAR_PARAM("sn", replyId) << INT_PARAM("time", dbei.timestamp) - << CHAR_PARAM("msgId", dbei.szId) << WCHAR_PARAM("friendly", Clist_GetContactDisplayName(replyContact, 0)) + << CHAR_PARAM("msgId", dbei.szId) << WCHAR_PARAM("friendly", Clist_GetContactDisplayName(dbei.hContact, 0)) << WCHAR_PARAM("text", ptrW(DbEvent_GetTextW(&dbei, CP_UTF8))); parts.push_back(replyTo); } diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index a44c753bec..0b4213c09d 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -653,7 +653,7 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo if (bCreateRead) dbei.flags |= DBEF_READ; dbei.cbBlob = (int)mir_strlen(szUtf); - dbei.pBlob = (BYTE*)szUtf.get(); + dbei.pBlob = szUtf.get(); dbei.szId = szMsgId; if (isChatRoom(hContact)) dbei.szUserId = szSender; diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index 799c6172f6..253dfb3e42 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -202,7 +202,7 @@ static INT_PTR icqRecvMessage(WPARAM, LPARAM lParam) dbei.flags |= DBEF_READ; dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(szMsg) + 1; - dbei.pBlob = (uint8_t*)szMsg.get(); + dbei.pBlob = szMsg.get(); db_event_add(ccs->hContact, &dbei); return 0; } diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index daccc47cb9..5e8fff44fb 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -228,7 +228,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg) dbei.eventType = EVENTTYPE_MESSAGE; dbei.timestamp = (uint32_t)time(0); dbei.flags = DBEF_SENT | DBEF_UTF; - dbei.pBlob = (uint8_t*)mir_utf8encodeW(S); + dbei.pBlob = mir_utf8encodeW(S); dbei.cbBlob = (uint32_t)mir_strlen((char*)dbei.pBlob) + 1; db_event_add(hContact, &dbei); mir_free(dbei.pBlob); diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index b60f98ac97..976fb536c5 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -125,7 +125,7 @@ void CJabberProto::OnIqResultGetCollection(const TiXmlElement *iqNode, CJabberIq dbei.szModule = m_szModuleName; dbei.cbBlob = (uint32_t)mir_strlen(tszBody) + 1; dbei.flags = DBEF_READ + DBEF_UTF + from; - dbei.pBlob = (uint8_t*)tszBody; + dbei.pBlob = (char *)tszBody; dbei.timestamp = tmStart + atol(tszSecs); if (!DB::IsDuplicateEvent(hContact, dbei)) db_event_add(hContact, &dbei); diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 68f83280bf..d1f4992125 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -122,7 +122,7 @@ bool CJabberProto::AddDbPresenceEvent(MCONTACT hContact, uint8_t btEventType) } DBEVENTINFO dbei = {}; - dbei.pBlob = &btEventType; + dbei.pBlob = (char *)&btEventType; dbei.cbBlob = sizeof(btEventType); dbei.eventType = EVENTTYPE_JABBER_PRESENCE; dbei.flags = DBEF_READ; diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index d1f921f9b4..d2498a3da7 100644 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -1373,7 +1373,7 @@ bool CJabberProto::OmemoHandleMessage(const TiXmlElement *node, const char *jid, std::string text = root.write(); dbei.cbBlob = (int)text.size() + 1; - dbei.pBlob = (uint8_t *)text.c_str(); + dbei.pBlob = (char *)text.c_str(); db_event_add(hContact, &dbei); } else { diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 2efe644ed3..cc5f6d887b 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1245,7 +1245,7 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) // chatstates gone event if (hContact && XmlGetChildByTag(node, "gone", "xmlns", JABBER_FEAT_CHATSTATES) && m_bLogChatstates) { - uint8_t bEventType = JABBER_DB_EVENT_CHATSTATES_GONE; // gone event + char bEventType = JABBER_DB_EVENT_CHATSTATES_GONE; // gone event DBEVENTINFO dbei = {}; dbei.pBlob = &bEventType; dbei.cbBlob = 1; diff --git a/protocols/NewsAggregator/Src/CheckFeed.cpp b/protocols/NewsAggregator/Src/CheckFeed.cpp index a8af908e0d..60502647cc 100644 --- a/protocols/NewsAggregator/Src/CheckFeed.cpp +++ b/protocols/NewsAggregator/Src/CheckFeed.cpp @@ -160,13 +160,13 @@ static void XmlToMsg(MCONTACT hContact, CMStringW &title, CMStringW &link, CMStr bool MesExist = false; T2Utf pszTemp(message); int cbMemoLen = 10000, cbOrigLen = (uint32_t)mir_strlen(pszTemp); - uint8_t *pbBuffer = (uint8_t*)mir_alloc(cbMemoLen); + char *pbBuffer = (char *)mir_alloc(cbMemoLen); DB::ECPTR pCursor(DB::EventsRev(hContact)); while (MEVENT hDbEvent = pCursor.FetchNext()) { olddbei.cbBlob = db_event_getBlobSize(hDbEvent); if (olddbei.cbBlob > cbMemoLen) - pbBuffer = (uint8_t*)mir_realloc(pbBuffer, (size_t)(cbMemoLen = olddbei.cbBlob)); + pbBuffer = (char *)mir_realloc(pbBuffer, (size_t)(cbMemoLen = olddbei.cbBlob)); olddbei.pBlob = pbBuffer; db_event_get(hDbEvent, &olddbei); diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index ee2254ff27..c249c6e281 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -44,7 +44,7 @@ MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent) uint32_t body[3]; DBEVENTINFO dbei = {}; dbei.cbBlob = sizeof(uint32_t) * 2; - dbei.pBlob = (uint8_t*)&body; + dbei.pBlob = (char *)&body; if (db_event_get(hEvent, &dbei)) return INVALID_CONTACT_ID; diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 89235f6e4b..6f932e3910 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -49,7 +49,7 @@ MEVENT CSkypeProto::AddDbEvent(uint16_t type, MCONTACT hContact, uint32_t timest dbei.timestamp = timestamp; dbei.eventType = type; dbei.cbBlob = (uint32_t)mir_strlen(szMsg) + 1; - dbei.pBlob = (uint8_t *)szMsg; + dbei.pBlob = szMsg; dbei.flags = flags; dbei.szId = msgId; return db_event_add(hContact, &dbei); @@ -93,7 +93,7 @@ void CSkypeProto::EditEvent(MEVENT hEvent, const CMStringW &szContent, time_t ed std::string newMsg = jMsg.write().c_str(); dbei.cbBlob = int(newMsg.size() + 1); - dbei.pBlob = (uint8_t*)newMsg.c_str(); + dbei.pBlob = (char *)newMsg.c_str(); db_event_edit(hEvent, &dbei, true); } diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 35b500a0a7..59ad914aaa 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -286,15 +286,14 @@ int CSkypeProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) 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)); - uint8_t *pBlob = (uint8_t*)mir_calloc(cbBlob); - uint8_t *pCurBlob = pBlob; + char *pBlob = (char *)mir_calloc(cbBlob); + char *pCurBlob = pBlob; for (int i = 0; i < nCount; i++) { - //mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.w)); - pCurBlob += mir_strlen((PCHAR)pCurBlob) + 1; + pCurBlob += mir_strlen(pCurBlob) + 1; - mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.w)); - pCurBlob += mir_strlen((char*)pCurBlob) + 1; + mir_strcpy(pCurBlob, _T2A(isrList[i]->id.w)); + pCurBlob += mir_strlen(pCurBlob) + 1; } DBEVENTINFO dbei = {}; diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index a007840c3b..9ed0746a48 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -48,7 +48,7 @@ MCONTACT CSteamProto::GetContactFromAuthEvent(MEVENT hEvent) uint32_t body[3]; DBEVENTINFO dbei = {}; dbei.cbBlob = sizeof(uint32_t) * 2; - dbei.pBlob = (uint8_t*)& body; + dbei.pBlob = (char *)&body; if (db_event_get(hEvent, &dbei)) return INVALID_CONTACT_ID; diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 51d427c531..59b4328df3 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -415,7 +415,7 @@ void CTelegramProto::OnGetHistory(td::ClientManager::Response &response, void *p dbei.szModule = m_szModuleName; dbei.timestamp = pMsg->date_; dbei.cbBlob = szBody.GetLength(); - dbei.pBlob = (uint8_t*)szBody.c_str(); + dbei.pBlob = szBody.GetBuffer(); dbei.szId = szMsgId; dbei.flags = DBEF_READ | DBEF_UTF; if (pMsg->is_outgoing_) @@ -779,7 +779,7 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage) DB::EventInfo dbei(hOldEvent); mir_free(dbei.pBlob); dbei.cbBlob = szText.GetLength(); - dbei.pBlob = (uint8_t *)szText.Detach(); + dbei.pBlob = szText.GetBuffer(); dbei.timestamp = pMessage->date_; if (pMessage->is_outgoing_) dbei.flags |= DBEF_SENT; @@ -837,7 +837,7 @@ void CTelegramProto::ProcessMessageContent(TD::updateMessageContent *pObj) return; dbei.cbBlob = szText.GetLength(); - dbei.pBlob = (uint8_t *)szText.c_str(); + dbei.pBlob = szText.GetBuffer(); db_event_edit(hDbEvent, &dbei, true); } diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 7349f9ebe5..fffe9633ef 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -17,7 +17,7 @@ MCONTACT CToxProto::GetContactFromAuthEvent(MEVENT hEvent) uint32_t body[3]; DBEVENTINFO dbei = {}; dbei.cbBlob = sizeof(uint32_t) * 2; - dbei.pBlob = (uint8_t*)&body; + dbei.pBlob = (char *)&body; if (db_event_get(hEvent, &dbei)) return INVALID_CONTACT_ID; diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 77fe39b493..3cf6054f9e 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -151,7 +151,7 @@ int CToxProto::OnPreCreateMessage(WPARAM, LPARAM lParam) return 0; evt->dbei->cbBlob = evt->dbei->cbBlob - 4; - uint8_t *action = (uint8_t*)mir_alloc(evt->dbei->cbBlob); + char *action = (char *)mir_alloc(evt->dbei->cbBlob); memcpy(action, &evt->dbei->pBlob[4], evt->dbei->cbBlob); mir_free(evt->dbei->pBlob); evt->dbei->pBlob = action; diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 4109c00ecb..0c9f98f1b2 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -248,7 +248,7 @@ private: static bool IsFileExists(const wchar_t* path); - MEVENT AddEventToDb(MCONTACT hContact, uint16_t type, uint32_t timestamp, uint32_t flags, uint8_t *pBlob, size_t cbBlob); + MEVENT AddEventToDb(MCONTACT hContact, uint16_t type, uint32_t timestamp, uint32_t flags, char *pBlob, size_t cbBlob); }; struct CMPlugin : public ACCPROTOPLUGIN diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index b4840ddf97..7b7c39bfa8 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -126,10 +126,10 @@ bool CToxProto::IsFileExists(const wchar_t* path) return _waccess(path, 0) == 0; } -MEVENT CToxProto::AddEventToDb(MCONTACT hContact, uint16_t type, uint32_t timestamp, uint32_t flags, uint8_t *pBlob, size_t cbBlob) +MEVENT CToxProto::AddEventToDb(MCONTACT hContact, uint16_t type, uint32_t timestamp, uint32_t flags, char *pBlob, size_t cbBlob) { DBEVENTINFO dbei = {}; - dbei.szModule = this->m_szModuleName; + dbei.szModule = m_szModuleName; dbei.timestamp = timestamp; dbei.eventType = type; dbei.cbBlob = (uint32_t)cbBlob; diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index eed2b096c8..977e215386 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -717,10 +717,10 @@ MCONTACT CVkProto::MContactFromDbEvent(MEVENT hDbEvent) if (!hDbEvent || !IsOnline()) return INVALID_CONTACT_ID; - uint32_t body[2]; + char body[2]; DBEVENTINFO dbei = {}; dbei.cbBlob = sizeof(uint32_t) * 2; - dbei.pBlob = (uint8_t*)&body; + dbei.pBlob = body; if (db_event_get(hDbEvent, &dbei)) return INVALID_CONTACT_ID; @@ -1839,7 +1839,7 @@ void CVkProto::AddVkDeactivateEvent(MCONTACT hContact, CMStringW& wszType) dbei.eventType = VK_USER_DEACTIVATE_ACTION; ptrA pszDescription(mir_utf8encode(vkDeactivateEvent[iDEIdx].szDescription)); dbei.cbBlob = (uint32_t)mir_strlen(pszDescription) + 1; - dbei.pBlob = (uint8_t*)mir_strdup(pszDescription); + dbei.pBlob = mir_strdup(pszDescription); dbei.flags = DBEF_UTF | ( ( m_vkOptions.bShowVkDeactivateEvents diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 0a2f28db83..3549a77a8b 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -57,10 +57,8 @@ int CVkProto::ForwardMsg(MCONTACT hContact, std::vector& vForvardEvents, if (!dbei || dbei.eventType != EVENTTYPE_MESSAGE) continue; - MCONTACT hForwardContact = db_event_getContact(mEvnt); - - if (!Proto_IsProtoOnContact(hForwardContact, m_szModuleName)) { - CMStringW wszContactName = (dbei.flags & DBEF_SENT) ? getWStringA(0, "Nick", TranslateT("Me")) : Clist_GetContactDisplayName(hForwardContact); + if (!Proto_IsProtoOnContact(dbei.hContact, m_szModuleName)) { + CMStringW wszContactName = (dbei.flags & DBEF_SENT) ? getWStringA(0, "Nick", TranslateT("Me")) : Clist_GetContactDisplayName(dbei.hContact); wchar_t ttime[64]; time_t tTimestamp(dbei.timestamp); -- cgit v1.2.3