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() --- include/delphi/m_database.inc | 3 ++- include/m_database.h | 12 ++++++------ libs/win32/mir_app.lib | Bin 276524 -> 276274 bytes libs/win64/mir_app.lib | Bin 275834 -> 275574 bytes plugins/BasicHistory/src/DatExport.cpp | 2 +- plugins/BasicHistory/src/EventList.cpp | 4 ++-- plugins/BasicHistory/src/Scheduler.cpp | 2 +- plugins/BuddyPounce/src/main.cpp | 2 +- plugins/CmdLine/src/mimcmd_handlers.cpp | 4 ++-- plugins/ContactsPlus/src/send.cpp | 2 +- plugins/Db3x_mmap/src/dbevents.cpp | 8 ++++---- plugins/DbChecker/src/worker.cpp | 4 ++-- plugins/Dbx_mdbx/src/dbevents.cpp | 10 +++++----- plugins/Dbx_sqlite/src/dbevents.cpp | 15 ++++++++------- plugins/FTPFileYM/src/job_upload.cpp | 2 +- plugins/HistoryStats/src/mirandacontact.cpp | 2 +- plugins/IEHistory/src/dlgHandlers.cpp | 6 +++--- plugins/IEHistory/src/utils.cpp | 6 +++--- plugins/Import/src/dbrw/dbevents.cpp | 2 +- plugins/Import/src/import.cpp | 2 +- plugins/Import/src/patterns.cpp | 2 +- plugins/Import/src/textjson.cpp | 2 +- plugins/MirFox/src/MirandaUtils.cpp | 2 +- plugins/MirLua/src/Modules/m_database.cpp | 8 ++++---- plugins/MirLua/src/Modules/m_message.cpp | 2 +- plugins/MirOTR/src/dbfilter.cpp | 6 +++--- plugins/MirandaG15/src/CAppletManager.cpp | 2 +- plugins/Msg_Export/src/utils.cpp | 2 +- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 2 +- plugins/NewStory/src/history.h | 1 + plugins/NewStory/src/history_array.cpp | 11 ++++++----- plugins/NewStory/src/history_array.h | 7 +++++-- plugins/NewStory/src/history_control.cpp | 16 ++++++++++++---- plugins/NewStory/src/history_control.h | 2 +- plugins/NewXstatusNotify/src/main.cpp | 4 ++-- plugins/NewXstatusNotify/src/xstatus.cpp | 2 +- plugins/New_GPG/src/messages.cpp | 2 +- plugins/New_GPG/src/utilities.cpp | 2 +- plugins/Nudge/src/main.cpp | 4 ++-- plugins/PasteIt/src/PasteIt.cpp | 2 +- plugins/Popup/src/popup_wnd2.cpp | 2 +- plugins/RecentContacts/src/RecentContacts.cpp | 2 +- plugins/Scriver/src/globals.cpp | 2 +- plugins/Scriver/src/msglog.cpp | 2 +- plugins/SecureIM/src/dbevent.cpp | 2 +- plugins/SendScreenshotPlus/src/CSend.cpp | 2 +- plugins/SimpleAR/src/Main.cpp | 2 +- plugins/Spamotron/src/spamotron.cpp | 2 +- plugins/Spamotron/src/utils.cpp | 4 ++-- plugins/StopSpamMod/src/utilities.cpp | 2 +- plugins/TabSRMM/src/globals.cpp | 7 ++++--- plugins/TabSRMM/src/msgoptions.cpp | 2 +- plugins/TabSRMM/src/sendlater.cpp | 2 +- plugins/TabSRMM/src/sendqueue.cpp | 9 +++++---- plugins/TipperYM/src/subst.cpp | 2 +- .../src/ex_import/classExImContactXML.cpp | 2 +- plugins/UserInfoEx/src/mir_db.cpp | 2 +- plugins/WinterSpeak/src/EventInformation.cpp | 2 +- plugins/YARelay/src/main.cpp | 2 +- protocols/CloudFile/src/utils.cpp | 4 ++-- .../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 ++---- src/core/stdmsg/src/cmdlist.cpp | 2 +- src/core/stduihist/src/history.cpp | 2 +- src/mir_app/src/addcontact.cpp | 2 +- src/mir_app/src/chat_svc.cpp | 5 ++--- src/mir_app/src/db_events.cpp | 16 ++++++++-------- src/mir_app/src/mir_app.def | 5 ++--- src/mir_app/src/mir_app64.def | 5 ++--- src/mir_app/src/proto_interface.cpp | 2 +- src/mir_app/src/protocols.cpp | 2 +- 96 files changed, 183 insertions(+), 174 deletions(-) diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index ab9e66984c..93baaf542e 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -42,7 +42,8 @@ type szModule : PAnsiChar; // module that 'owns' this event and controls the data format timestamp: dword; // timestamp in UNIX time flags : dword; // the DBEF_* flags above - eventType: word; // event type, such as message, can be module defined + eventType: dword; // event type, such as message, can be module defined + hContact : TMCONTACT; // contact to which this event belongs cbBlob : dword; // size in bytes of pBlob^ pBlob : PByte; // pointer to buffer containing the module defined event data szId : PAnsiChar; // server id of event diff --git a/include/m_database.h b/include/m_database.h index caf2546e42..7362c7ead9 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -188,9 +188,10 @@ struct DBEVENTINFO // unless you use the standard C library which is // signed and can only do until 2038. In GMT. uint32_t flags; // combination of DBEF_* flags - uint16_t eventType; // module-defined event type field + uint32_t eventType; // module-defined event type field + MCONTACT hContact; // contact to which this event belongs int cbBlob; // size of pBlob in bytes - uint8_t *pBlob; // pointer to buffer containing module-defined event data + char *pBlob; // pointer to buffer containing module-defined event data const char *szId; // server message id const char *szUserId; // user id (for group chats only) const char *szReplyId; // this message is a reply to a message with that server id @@ -747,15 +748,14 @@ namespace DB ptrA m_szNick, m_szFirstName, m_szLastName, m_szEmail, m_szReason; uint32_t m_size; - uint8_t* makeBlob(); + char* makeBlob(); public: explicit AUTH_BLOB(MCONTACT hContact, const char *nick, const char *fname, const char *lname, const char *id, const char *reason); - explicit AUTH_BLOB(uint8_t *blob); + explicit AUTH_BLOB(char *blob); ~AUTH_BLOB(); - __forceinline operator char*() { return (char*)makeBlob(); } - __forceinline operator uint8_t*() { return makeBlob(); } + __forceinline operator char*() { return makeBlob(); } __forceinline uint32_t size() const { return m_size; } diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 8665026b0c..f919926783 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 681b7b006a..1c2d8e4c3a 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index fd3718c334..9d11a75860 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -181,7 +181,7 @@ bool DatExport::GetEventList(std::vector& eventList) info.flags = messageHeader.flags; info.timestamp = messageHeader.timestamp; info.cbBlob = messageHeader.cbBlob; - info.pBlob = (uint8_t*)memBuf.c_str(); + info.pBlob = (char *)memBuf.c_str(); HistoryEventList::GetObjectDescription(&info, _str, MAXSELECTSTR); exMsg.message = _str; sortedEvents.insert(std::pair(messageHeader.timestamp, exMsg)); diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 9fbdecec16..031552102e 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -508,7 +508,7 @@ void HistoryEventList::MargeMessages(const std::vector dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, nullptr, 0, nullptr, nullptr); char* buf = new char[dbei.cbBlob]; dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, nullptr, nullptr); - dbei.pBlob = (uint8_t*)buf; + dbei.pBlob = buf; db_event_add(m_hContact, &dbei); delete[] buf; } @@ -524,7 +524,7 @@ bool HistoryEventList::GetEventData(const EventIndex& ev, EventData& data) if (!ev.isExternal) { uint32_t newBlobSize = db_event_getBlobSize(ev.hEvent); if (newBlobSize > m_oldBlobSize) { - m_dbei.pBlob = (uint8_t*)mir_realloc(m_dbei.pBlob, newBlobSize); + m_dbei.pBlob = (char *)mir_realloc(m_dbei.pBlob, newBlobSize); m_oldBlobSize = newBlobSize; } diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 6721f102f4..98202c2382 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -1285,7 +1285,7 @@ void DoError(const TaskOptions& to, const std::wstring _error) dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, nullptr, 0, nullptr, nullptr); char* buf = new char[dbei.cbBlob]; dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, error.c_str(), len, buf, dbei.cbBlob, nullptr, nullptr); - dbei.pBlob = (uint8_t*)buf; + dbei.pBlob = buf; db_event_add(NULL, &dbei); } diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 6afa153bfb..f6a8ea1c9c 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -51,7 +51,7 @@ int MsgAck(WPARAM, LPARAM lParam) dbei.szModule = (char*)ack->szModule; dbei.timestamp = time(0); dbei.cbBlob = (int)mir_strlen(pszUtf) + 1; - dbei.pBlob = (uint8_t*)(char*)pszUtf; + dbei.pBlob = pszUtf; db_event_add(ack->hContact, &dbei); } // check to reuse diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 5778aebb41..1410c7c29a 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -705,7 +705,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; - dbei.pBlob = (uint8_t*)szMessage.get(); + dbei.pBlob = szMessage.get(); dbei.cbBlob = (uint32_t)mir_strlen(szMessage) + 1; dbei.szModule = ack->szModule; dbei.timestamp = (uint32_t)time(0); @@ -1346,7 +1346,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re DBEVENTINFO dbEvent = {}; char message[4096]; - dbEvent.pBlob = (uint8_t*)message; + dbEvent.pBlob = message; DB::ECPTR pCursor(DB::Events(hContact)); while (MEVENT hEvent = pCursor.FetchNext()) { diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index 1dbb92ab0f..71cdbe893a 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -412,7 +412,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara maSend[i].mcaUIN = mir_utf8encodeW(ptrW(GetContactUID(ackData->aContacts[i]))); dbei.cbBlob += (uint32_t)strlennull(maSend[i].mcaUIN) + (uint32_t)strlennull((char*)maSend[i].mcaNick) + 2; } - dbei.pBlob = (uint8_t*)_alloca(dbei.cbBlob); + dbei.pBlob = (char *)_alloca(dbei.cbBlob); for (i = 0, pBlob = (char*)dbei.pBlob; i < ackData->nContacts; i++) { strcpynull(pBlob, (char*)maSend[i].mcaNick); pBlob += strlennull(pBlob) + 1; diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index d2a694bd53..0ed6daf0bc 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -64,12 +64,12 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei) dbe.flags = dbei->flags; dbe.wEventType = dbei->eventType; dbe.cbBlob = dbei->cbBlob; - uint8_t *pBlob = dbei->pBlob; + char *pBlob = dbei->pBlob; - mir_ptr pCryptBlob; + mir_ptr pCryptBlob; if (m_bEncrypted) { size_t len; - uint8_t *pResult = m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len); + char *pResult = (char*)m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len); if (pResult != nullptr) { pCryptBlob = pBlob = pResult; dbe.cbBlob = (uint32_t)len; @@ -296,7 +296,7 @@ BOOL CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) uint32_t cbBlob = dbe->cbBlob; size_t bytesToCopy = cbBlob; if (dbei->cbBlob == -1) - dbei->pBlob = (uint8_t*)mir_calloc(cbBlob + 2); + dbei->pBlob = (char *)mir_calloc(cbBlob + 2); else if (dbei->cbBlob < cbBlob) bytesToCopy = dbei->cbBlob; diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index 6839bdf35e..40de977360 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -56,7 +56,7 @@ static bool ConvertOldEvent(DBEVENTINFO &dbei) dbei.flags |= DBEF_UTF; dbei.cbBlob = (uint32_t)mir_strlen(utf8str); - dbei.pBlob = (uint8_t*)utf8str; + dbei.pBlob = utf8str; return true; } @@ -128,7 +128,7 @@ void __cdecl WorkerThread(DbToolOptions *opts) mir_free(dboldev.pBlob); dboldev = dbei; if (dboldev.cbBlob) { - dboldev.pBlob = (uint8_t *)mir_alloc(dboldev.cbBlob); + dboldev.pBlob = (char *)mir_alloc(dboldev.cbBlob); memcpy(dboldev.pBlob, dbei.pBlob, dboldev.cbBlob); } else dboldev.pBlob = nullptr; diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index 3cbb5e5e5a..b43a2eaa46 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -188,12 +188,12 @@ bool CDbxMDBX::EditEvent(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO * dbe.flags = dbei->flags; dbe.wEventType = dbei->eventType; dbe.cbBlob = dbei->cbBlob; - uint8_t *pBlob = dbei->pBlob; + char *pBlob = dbei->pBlob; - mir_ptr pCryptBlob; + mir_ptr pCryptBlob; if (m_bEncrypted) { size_t len; - uint8_t *pResult = m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len); + char *pResult = (char*)m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len); if (pResult != nullptr) { pCryptBlob = pBlob = pResult; dbe.cbBlob = (uint16_t)len; @@ -310,10 +310,10 @@ BOOL CDbxMDBX::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) dbei->flags = dbe->flags; dbei->eventType = dbe->wEventType; - uint32_t cbBlob = dbe->cbBlob; + int cbBlob = dbe->cbBlob; size_t bytesToCopy = cbBlob; if (dbei->cbBlob == -1) - dbei->pBlob = (uint8_t*)mir_calloc(cbBlob + 2); + dbei->pBlob = (char *)mir_calloc(cbBlob + 2); else if (dbei->cbBlob < cbBlob) bytesToCopy = dbei->cbBlob; diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index 6e6bb872b9..541a4d8ff4 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -123,10 +123,10 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei) } else szEventId = ""; - mir_ptr pCryptBlob; + mir_ptr pCryptBlob; if (m_bEncrypted) { size_t len; - uint8_t *pResult = m_crypto->encodeBuffer(tmp.pBlob, tmp.cbBlob, &len); + char *pResult = (char*)m_crypto->encodeBuffer(tmp.pBlob, tmp.cbBlob, &len); if (pResult != nullptr) { pCryptBlob = tmp.pBlob = pResult; tmp.cbBlob = (uint16_t)len; @@ -265,10 +265,10 @@ BOOL CDbxSQLite::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei) return 1; DBEVENTINFO tmp = *dbei; - mir_ptr pCryptBlob; + mir_ptr pCryptBlob; if (m_bEncrypted && tmp.pBlob) { size_t len; - uint8_t *pResult = m_crypto->encodeBuffer(tmp.pBlob, tmp.cbBlob, &len); + char *pResult = (char*)m_crypto->encodeBuffer(tmp.pBlob, tmp.cbBlob, &len); if (pResult != nullptr) { pCryptBlob = tmp.pBlob = pResult; tmp.cbBlob = (uint16_t)len; @@ -407,7 +407,7 @@ BOOL CDbxSQLite::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) } mir_cslock lock(m_csDbAccess); - sqlite3_stmt *stmt = InitQuery("SELECT module, timestamp, type, flags, server_id, user_id, reply_id, LENGTH(CAST(data AS BLOB)) AS l, data FROM events WHERE id = ? LIMIT 1;", qEvGet); + sqlite3_stmt *stmt = InitQuery("SELECT module, timestamp, type, flags, server_id, user_id, reply_id, LENGTH(CAST(data AS BLOB)) AS l, data, contact_id FROM events WHERE id = ? LIMIT 1;", qEvGet); sqlite3_bind_int64(stmt, 1, hDbEvent); int rc = sqlite3_step(stmt); logError(rc, __FILE__, __LINE__); @@ -424,7 +424,8 @@ BOOL CDbxSQLite::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) dbei->timestamp = sqlite3_column_int64(stmt, 1); dbei->eventType = sqlite3_column_int(stmt, 2); dbei->flags = sqlite3_column_int64(stmt, 3); - + dbei->hContact = sqlite3_column_int(stmt, 8); + p = (char *)sqlite3_column_text(stmt, 4); if (mir_strlen(p)) { mir_strncpy(g_szId, p, sizeof(g_szId)); @@ -449,7 +450,7 @@ BOOL CDbxSQLite::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) int32_t cbBlob = sqlite3_column_int64(stmt, 7); size_t bytesToCopy = cbBlob; if (dbei->cbBlob == -1) - dbei->pBlob = (uint8_t*)mir_calloc(cbBlob + 2); + dbei->pBlob = (char *)mir_calloc(cbBlob + 2); else if (dbei->cbBlob < cbBlob) bytesToCopy = dbei->cbBlob; diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index b1bc6de66f..6e4fbc29b3 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -90,7 +90,7 @@ void UploadJob::autoSend() dbei.szModule = szProto; dbei.timestamp = (uint32_t)time(0); dbei.cbBlob = (uint32_t)mir_strlen(m_szFileLink) + 1; - dbei.pBlob = (uint8_t*)m_szFileLink; + dbei.pBlob = m_szFileLink; db_event_add(m_hContact, &dbei); ProtoChainSend(m_hContact, PSS_MESSAGE, 0, (LPARAM)m_szFileLink); CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)m_hContact, 0); diff --git a/plugins/HistoryStats/src/mirandacontact.cpp b/plugins/HistoryStats/src/mirandacontact.cpp index 5e070fe315..f0e20dcc76 100644 --- a/plugins/HistoryStats/src/mirandacontact.cpp +++ b/plugins/HistoryStats/src/mirandacontact.cpp @@ -28,7 +28,7 @@ void MirandaContact::fetchSlot(int i) if (ei.dbe.cbBlob > ei.nAllocated) { ei.nAllocated = ei.dbe.cbBlob; - ei.dbe.pBlob = reinterpret_cast(realloc(ei.dbe.pBlob, ei.dbe.cbBlob + 1)); + ei.dbe.pBlob = reinterpret_cast(realloc(ei.dbe.pBlob, ei.dbe.cbBlob + 1)); } db_event_get(ci.hEvent, &ei.dbe); diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 6f1625b111..967444332f 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -132,7 +132,7 @@ void FillIEViewInfo(IEVIEWEVENTDATA *fillData, DBEVENTINFO dbInfo, uint8_t *blob fillData->bIsMe = (dbInfo.flags & DBEF_SENT); fillData->dwFlags = (dbInfo.flags & DBEF_SENT) ? IEEDF_SENT : 0; fillData->time = dbInfo.timestamp; - size_t len = mir_strlen((char *)blob) + 1; + int len = (int)mir_strlen((char *)blob) + 1; uint8_t *pos; fillData->szText.a = (char *)blob; @@ -164,7 +164,7 @@ uint32_t WINAPI WorkerThread(LPVOID lpvData) ieEvent.iType = IEE_LOG_MEM_EVENTS; ieEvent.eventData = ieData; DBEVENTINFO dbInfo = {}; - uint8_t *buffer = nullptr; + char *buffer = nullptr; int newSize, oldSize = 0; while (count < target) { cLoad = (count + LOAD_COUNT > target) ? target - count : LOAD_COUNT; @@ -173,7 +173,7 @@ uint32_t WINAPI WorkerThread(LPVOID lpvData) for (i = 0; i < cLoad; i++) { newSize = db_event_getBlobSize(dbEvent); if (newSize > oldSize) { - buffer = (uint8_t*)realloc(buffer, newSize); + buffer = (char*)realloc(buffer, newSize); dbInfo.pBlob = buffer; oldSize = newSize; } diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index c96baeff7c..c9e2e2a5a7 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -123,7 +123,7 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat int index = 0; MEVENT hEvent = hFirstEvent; - void *buffer = nullptr; + char *buffer = nullptr; bool found = false; int oldSize, newSize; oldSize = newSize = 0; @@ -132,10 +132,10 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat while ((!found) && (hEvent)) { newSize = db_event_getBlobSize(hEvent); if (newSize > oldSize) { - buffer = (wchar_t *)realloc(buffer, newSize); + buffer = (char *)realloc(buffer, newSize); oldSize = newSize; } - dbEvent.pBlob = (uint8_t*)buffer; + dbEvent.pBlob = buffer; dbEvent.cbBlob = newSize; if (db_event_get(hEvent, &dbEvent) == 0) { //successful switch (type) { diff --git a/plugins/Import/src/dbrw/dbevents.cpp b/plugins/Import/src/dbrw/dbevents.cpp index 95fc34eca3..1fbea90b86 100644 --- a/plugins/Import/src/dbrw/dbevents.cpp +++ b/plugins/Import/src/dbrw/dbevents.cpp @@ -88,7 +88,7 @@ STDMETHODIMP_(BOOL) CDbxSQLite::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) uint32_t cbBlob = sqlite3_column_int(stmt, 5); size_t bytesToCopy = cbBlob; if (dbei->cbBlob == -1) - dbei->pBlob = (uint8_t*)mir_calloc(cbBlob + 2); + dbei->pBlob = (char *)mir_calloc(cbBlob + 2); else if (dbei->cbBlob < cbBlob) bytesToCopy = dbei->cbBlob; diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index e743d13cc8..659189da72 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -888,7 +888,7 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int // Copy the event and import it DB::EventInfo dbei; dbei.cbBlob = srcDb->GetBlobSize(hEvent); - dbei.pBlob = (uint8_t*)mir_alloc(dbei.cbBlob+1); + dbei.pBlob = (char *)mir_alloc(dbei.cbBlob+1); bool bSkipThis = false; if (!srcDb->GetEvent(hEvent, &dbei)) { diff --git a/plugins/Import/src/patterns.cpp b/plugins/Import/src/patterns.cpp index 9dadce018c..3cb29d2ad1 100644 --- a/plugins/Import/src/patterns.cpp +++ b/plugins/Import/src/patterns.cpp @@ -567,7 +567,7 @@ public: dbei->timestamp = RLInteger(&pMsg[0x12]); dbei->timestamp -= TimeZone_ToLocal(dbei->timestamp) - dbei->timestamp; // deduct time zone offset from timestamp dbei->cbBlob = RLWord(&pMsg[m_iMsgHeaderSize - 2]); - dbei->pBlob = (uint8_t*)mir_alloc(dbei->cbBlob + 1); + dbei->pBlob = (char *)mir_alloc(dbei->cbBlob + 1); memcpy(dbei->pBlob, pMsg + m_iMsgHeaderSize, dbei->cbBlob); if (m_iFileVersion != 1) for (int i = 0; i < dbei->cbBlob; i++) { diff --git a/plugins/Import/src/textjson.cpp b/plugins/Import/src/textjson.cpp index 39b2768787..db0adcd73d 100644 --- a/plugins/Import/src/textjson.cpp +++ b/plugins/Import/src/textjson.cpp @@ -190,7 +190,7 @@ public: dbei->flags |= DBEF_UTF; dbei->cbBlob = (uint32_t)szBody.size() + offset; - dbei->pBlob = (uint8_t*)mir_calloc(dbei->cbBlob + 1); + dbei->pBlob = (char *)mir_calloc(dbei->cbBlob + 1); memcpy(dbei->pBlob + offset, szBody.c_str(), szBody.size()); dbei->pBlob[dbei->cbBlob] = 0; } diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index fa0fa3cc8d..83db70a709 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -297,7 +297,7 @@ void MirandaUtils::addMessageToDB(MCONTACT hContact, char* msgBuffer, std::size_ dbei.szModule = targetHandleSzProto; dbei.timestamp = (uint32_t)time(0); dbei.cbBlob = (uint32_t)bufSize; - dbei.pBlob = (uint8_t*)msgBuffer; + dbei.pBlob = msgBuffer; db_event_add(hContact, &dbei); } diff --git a/plugins/MirLua/src/Modules/m_database.cpp b/plugins/MirLua/src/Modules/m_database.cpp index 6ca2e20f28..e3f4922643 100644 --- a/plugins/MirLua/src/Modules/m_database.cpp +++ b/plugins/MirLua/src/Modules/m_database.cpp @@ -305,8 +305,8 @@ void MakeDbEvent(lua_State *L, DBEVENTINFO &dbei) switch (lua_type(L, -1)) { case LUA_TTABLE: dbei.cbBlob = (uint32_t)lua_rawlen(L, 4); - dbei.pBlob = (uint8_t*)mir_calloc(dbei.cbBlob); - for (uint32_t i = 0; i < dbei.cbBlob; i++) { + dbei.pBlob = (char *)mir_calloc(dbei.cbBlob); + for (int i = 0; i < dbei.cbBlob; i++) { lua_geti(L, 4, i + 1); dbei.pBlob[i] = lua_tointeger(L, -1); lua_pop(L, 1); @@ -316,7 +316,7 @@ void MakeDbEvent(lua_State *L, DBEVENTINFO &dbei) size_t nLen; const char *str = lua_tolstring(L, -1, &nLen); dbei.cbBlob = (uint32_t)nLen; - dbei.pBlob = (uint8_t*)mir_alloc(nLen); + dbei.pBlob = (char *)mir_alloc(nLen); memcpy(dbei.pBlob, str, nLen); break; } @@ -649,7 +649,7 @@ int MT::Get(lua_State *L, DBEVENTINFO *dbei) if (mir_strcmpi(key, "Blob") == 0) { lua_createtable(L, dbei->cbBlob, 0); - for (uint32_t i = 0; i < dbei->cbBlob; i++) { + for (int i = 0; i < dbei->cbBlob; i++) { lua_pushinteger(L, dbei->pBlob[i]); lua_rawseti(L, -2, i + 1); } diff --git a/plugins/MirLua/src/Modules/m_message.cpp b/plugins/MirLua/src/Modules/m_message.cpp index a9f026ec89..1425771a14 100644 --- a/plugins/MirLua/src/Modules/m_message.cpp +++ b/plugins/MirLua/src/Modules/m_message.cpp @@ -39,7 +39,7 @@ static int message_Send(lua_State *L) dbei.timestamp = time(0); dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(message); - dbei.pBlob = (uint8_t*)mir_strdup(message); + dbei.pBlob = mir_strdup(message); dbei.flags = DBEF_UTF | DBEF_SENT; db_event_add(hContact, &dbei); diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index d6420f1cea..2b8d1869c1 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -97,8 +97,8 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) buf.Append(msg + msgLen + 1, datalen); } - my_dbei.pBlob = (uint8_t*)buf.GetBuffer(); - my_dbei.cbBlob = (int)buf.GetLength(); + my_dbei.pBlob = buf.GetBuffer(); + my_dbei.cbBlob = buf.GetLength(); my_dbei.flags |= DBEF_OTR_PREFIXED; db_event_add(hContact, &my_dbei); @@ -115,7 +115,7 @@ int OnDatabaseEventAdded(WPARAM hContact, LPARAM lParam) DBEVENTINFO info = {}; info.cbBlob = len * 2; - info.pBlob = (uint8_t*)_alloca(info.cbBlob); + info.pBlob = (char *)_alloca(info.cbBlob); if (db_event_get(lParam, &info)) return 0; diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index c3d47bbb48..a4fcb5df39 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -655,7 +655,7 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob) return; dbei.cbBlob = pJob->iBufferSize; - dbei.pBlob = (uint8_t*)pJob->pcBuffer; + dbei.pBlob = pJob->pcBuffer; db_event_add(pJob->hContact, &dbei); } diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 859857159c..924d26fa58 100644 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -1001,7 +1001,7 @@ bool bExportEvent(MCONTACT hContact, MEVENT hDbEvent, HANDLE hFile, const wstrin DB::EventInfo dbei(hDbEvent); if (dbei) { if (db_mc_isMeta(hContact)) - hContact = db_event_getContact(hDbEvent); + hContact = dbei.hContact; // Write the event result = ExportDBEventInfo(hContact, hFile, sFilePath, dbei, bAppendOnly); diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 9a4b94b3bc..3fbf7fedaf 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -72,7 +72,7 @@ void __cdecl AutoreplyDelayThread(CAutoreplyData *ad) dbei.szModule = szProto; dbei.timestamp = time(0); dbei.cbBlob = ReplyLen; - dbei.pBlob = (uint8_t*)(char*)pszReply; + dbei.pBlob = pszReply; db_event_add(ad->hContact, &dbei); } diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h index f71bab9fed..7bcf223d7f 100644 --- a/plugins/NewStory/src/history.h +++ b/plugins/NewStory/src/history.h @@ -18,6 +18,7 @@ enum UM_ADDEVENTFILTER, UM_REMOVEEVENT, UM_EDITEVENT, + UM_MARKREAD, UM_SELECTED, diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 2c4ce4a936..9bc64a2f81 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -369,9 +369,9 @@ void ItemData::getFontColor(int &fontId, int &colorId) const } } -void ItemData::load(bool bFullLoad) +void ItemData::load(int flags) { - if (!bFullLoad && m_bLoaded) + if (!(flags & LOAD_ALWAYS) && m_bLoaded) return; if (!fetch()) @@ -381,7 +381,8 @@ void ItemData::load(bool bFullLoad) switch (dbe.eventType) { case EVENTTYPE_MESSAGE: - markRead(); + if (!(flags & LOAD_BACK)) + markRead(); __fallthrough; case EVENTTYPE_STATUSCHANGE: @@ -639,7 +640,7 @@ int HistoryArray::find(MEVENT hEvent) return -1; } -ItemData* HistoryArray::get(int id, bool bLoad) const +ItemData* HistoryArray::get(int id, bool bLoad, bool bBack) const { int pageNo = id / HIST_BLOCK_SIZE; if (pageNo >= pages.getCount()) @@ -647,7 +648,7 @@ ItemData* HistoryArray::get(int id, bool bLoad) const auto *p = &pages[pageNo].data[id % HIST_BLOCK_SIZE]; if (bLoad && !p->m_bLoaded) - p->load(); + p->load((bBack) ? LOAD_BACK : 0); return p; } diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index 1bbc623a13..00b312172d 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -10,6 +10,9 @@ enum CMStringW TplFormatString(int tpl, MCONTACT hContact, ItemData *item); +#define LOAD_ALWAYS 0x0001 +#define LOAD_BACK 0x0002 + struct ItemData { MCONTACT hContact; @@ -41,7 +44,7 @@ struct ItemData bool fetch(void); void fill(int tmpl); - void load(bool bFullLoad = false); + void load(int flags = 0); bool isLink(HWND, POINT pt, CMStringW *url = nullptr) const; bool isLinkChar(HWND, int idx) const; @@ -150,7 +153,7 @@ public: pages.insert(new ItemBlock()); } - ItemData* get(int id, bool bLoad = false) const; + ItemData* get(int id, bool bLoad = false, bool bBack = false) const; ItemData* insert(int idx); __forceinline int FindNext(int id, const Filter &filter) { return find(id, +1, filter); } diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index f56d5b4661..b2b83ebc44 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -120,7 +120,10 @@ static void __cdecl sttLoadItems(void *param) auto *pData = (NewstoryListData *)param; for (int i = pData->totalCount-1; i >= 0; i--) { - pData->LoadItem(i); + auto *pItem = pData->LoadItem(i, true); + if (pItem->dbe.eventType == EVENTTYPE_MESSAGE && !(pItem->dbe.flags & DBEF_SENT) && !pItem->dbe.markedRead()) + PostMessage(pData->m_hwnd, UM_MARKREAD, WPARAM(pItem), 0); + if ((i % 100) == 0) Sleep(50); } @@ -366,7 +369,7 @@ void NewstoryListData::EndEditItem(bool bAccept) ptrA szUtf(mir_utf8encodeW(pItem->wtext)); dbei.cbBlob = (int)mir_strlen(szUtf) + 1; - dbei.pBlob = (uint8_t *)szUtf.get(); + dbei.pBlob = szUtf.get(); db_event_edit(pItem->hEvent, &dbei); } @@ -552,13 +555,13 @@ void NewstoryListData::HitTotal(int yCurr, int yTotal) FixScrollPosition(); } -ItemData* NewstoryListData::LoadItem(int idx) +ItemData* NewstoryListData::LoadItem(int idx, bool bBack) { if (totalCount == 0) return nullptr; mir_cslock lck(m_csItems); - return (bSortAscending) ? items.get(idx, true) : items.get(totalCount - 1 - idx, true); + return (bSortAscending) ? items.get(idx, true, bBack) : items.get(totalCount - 1 - idx, true, bBack); } void NewstoryListData::OpenFolder() @@ -1105,6 +1108,11 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } break; + case UM_MARKREAD: + if (auto *pItem = (ItemData *)wParam) + pItem->markRead(); + break; + case WM_SIZE: data->OnResize(LOWORD(lParam), HIWORD(lParam)); break; diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index f18ee1793d..619d6f01ce 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -67,7 +67,7 @@ struct NewstoryListData : public MZeroedObject void HitTotal(int yCurr, int yTotal); void LineUp(); void LineDown(); - ItemData* LoadItem(int idx); + ItemData* LoadItem(int idx, bool bBack = false); void OpenFolder(); void PageUp(); void PageDown(); diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 70fba89f5f..1bd2e9f3f6 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -272,7 +272,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt) DBEVENTINFO dbei = {}; dbei.cbBlob = (uint32_t)mir_strlen(blob) + 1; - dbei.pBlob = (uint8_t*)blob; + dbei.pBlob = blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; dbei.timestamp = (uint32_t)time(0); @@ -355,7 +355,7 @@ int ContactStatusChanged(MCONTACT hContact, uint16_t oldStatus, uint16_t newStat DBEVENTINFO dbei = {}; dbei.cbBlob = (uint32_t)mir_strlen(blob) + 1; - dbei.pBlob = (uint8_t*)blob; + dbei.pBlob = blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; dbei.timestamp = (uint32_t)time(0); diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 9be1a1176e..21e0c90d5a 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -289,7 +289,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) DBEVENTINFO dbei = {}; dbei.cbBlob = (uint32_t)mir_strlen(blob) + 1; - dbei.pBlob = (uint8_t*)(char*)blob; + dbei.pBlob = blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; dbei.timestamp = (uint32_t)time(0); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index c71281696d..fd8e14d6d3 100644 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -761,7 +761,7 @@ int HookSendMsg(WPARAM w, LPARAM l) //mir_free(dbei->pBlob); str_event.insert(0, toUTF8(globals.wszOutopentag.c_str())); str_event.append(toUTF8(globals.wszOutclosetag.c_str())); - dbei->pBlob = (uint8_t*)mir_strdup(str_event.c_str()); + dbei->pBlob = mir_strdup(str_event.c_str()); dbei->cbBlob = (uint32_t)str_event.length() + 1; } diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index f33e7a65c5..8ff37f3b84 100644 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -476,7 +476,7 @@ void HistoryLog(MCONTACT hContact, const char *msg, uint32_t _time, uint32_t fla dbei.flags = DBEF_UTF | flags; dbei.timestamp = (_time) ? _time : (uint32_t)time(0); dbei.cbBlob = (uint32_t)mir_strlen(msg) + 1; - dbei.pBlob = (uint8_t*)msg; + dbei.pBlob = (char *)msg; db_event_add(hContact, &dbei); } diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 02f5d36cec..3ca4812eaf 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -288,7 +288,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact) dbei.timestamp = (uint32_t)time(0); dbei.eventType = 1; dbei.cbBlob = (uint32_t)mir_strlen(buff) + 1; - dbei.pBlob = (uint8_t*)buff; + dbei.pBlob = buff; db_event_add(hContact, &dbei); } @@ -302,7 +302,7 @@ void Nudge_ShowStatus(CNudgeElement *n, MCONTACT hContact, uint32_t timestamp) dbei.flags = DBEF_UTF; dbei.timestamp = timestamp; dbei.cbBlob = (uint32_t)mir_strlen(buff) + 1; - dbei.pBlob = (uint8_t*)buff; + dbei.pBlob = buff; db_event_add(hContact, &dbei); } diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index ca180f5c48..2ae89ff3f9 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -118,7 +118,7 @@ static void PasteIt(MCONTACT hContact, int mode) dbei.szModule = szProto; dbei.timestamp = (uint32_t)time(0); dbei.cbBlob = (uint32_t)mir_strlen(pasteToWeb->szFileLink) + 1; - dbei.pBlob = (uint8_t *)pasteToWeb->szFileLink; + dbei.pBlob = pasteToWeb->szFileLink; db_event_add(hContact, &dbei); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)pasteToWeb->szFileLink); } diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index bcf59cf35f..b6de298843 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -799,7 +799,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg) dbei.szModule = Proto_GetBaseAccountName(hContact); dbei.timestamp = time(0); dbei.cbBlob = (int)mir_strlen(msg) + 1; - dbei.pBlob = (uint8_t*)msg; + dbei.pBlob = msg; db_event_add(hContact, &dbei); } diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 0120c0b046..656434f9c2 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -368,7 +368,7 @@ INT_PTR OnMenuCommandShowList(WPARAM, LPARAM) cmultimap *contacts = new cmultimap; DBEVENTINFO dbe = {}; - uint8_t buf[1]; + char buf[1]; dbe.pBlob = buf; for (auto &curContact : Contacts()) { diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index a9b36e00e5..23bbc7af31 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -131,7 +131,7 @@ static int ackevent(WPARAM, LPARAM lParam) dbei.szModule = Proto_GetBaseAccountName(hContact); dbei.timestamp = time(0); dbei.cbBlob = (int)mir_strlen(item->sendBuffer) + 1; - dbei.pBlob = (uint8_t*)item->sendBuffer; + dbei.pBlob = item->sendBuffer; dbei.szId = (char *)pAck->lParam; MessageWindowEvent evt = { item->hSendId, hContact, &dbei }; diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index e61802a471..0f5867f734 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -380,7 +380,7 @@ public: return false; dbei.flags = DBEF_UTF | ((streamData->eventsToInsert < 2) ? DBEF_SENT : 0); - dbei.pBlob = (uint8_t *)TranslateU(szBuiltinEvents[streamData->eventsToInsert]); + dbei.pBlob = TranslateU(szBuiltinEvents[streamData->eventsToInsert]); dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob); } diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp index 0905da4a5f..66921acadc 100644 --- a/plugins/SecureIM/src/dbevent.cpp +++ b/plugins/SecureIM/src/dbevent.cpp @@ -8,6 +8,6 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText) dbei.timestamp = time(0); dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (int)mir_strlen(szText) + 1; - dbei.pBlob = (uint8_t*)szText; + dbei.pBlob = (char *)szText; db_event_add(0, &dbei); } diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 1591919edf..378bb0ac6c 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -326,7 +326,7 @@ void CSend::DB_EventAdd(uint16_t EventType) dbei.timestamp = time(0); dbei.flags |= DBEF_UTF; dbei.cbBlob = m_cbEventMsg; - dbei.pBlob = (uint8_t*)m_szEventMsg.GetString(); + dbei.pBlob = m_szEventMsg.GetBuffer(); db_event_add(m_hContact, &dbei); } diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 56f5765bb9..450ed5dfdd 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -209,7 +209,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) dbei.szModule = pszProto; dbei.timestamp = time(0); dbei.cbBlob = (int)mir_strlen(pszUtf) + 1; - dbei.pBlob = (uint8_t*)pszUtf; + dbei.pBlob = pszUtf; db_event_add(hContact, &dbei); mir_free(ptszTemp2); diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index 76ea50fbd8..40340c72a7 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -234,7 +234,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) szAuthEventModule = mir_u2a(AuthEventModule); dbei2.szModule = szAuthEventModule; dbei2.timestamp = dbei->timestamp; - dbei2.pBlob = _dbv.pbVal + sizeof(uint32_t); + dbei2.pBlob = (char*)_dbv.pbVal + sizeof(uint32_t); db_event_add(hContact, &dbei2); g_plugin.delSetting(hContact, "AuthEvent"); diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index c829b5f101..3c17ff7dbb 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -465,7 +465,7 @@ int LogToSystemHistory(char *message, char *origmessage) DBEVENTINFO dbei = {}; dbei.timestamp = time(&tm); dbei.szModule = MODULENAME; - dbei.pBlob = (uint8_t*)msg; + dbei.pBlob = msg; if (origmessage) dbei.cbBlob = (1 + mir_snprintf(msg, "%s: %s%s %s: %s", MODULENAME, message, DOT(message), Translate("Their message was"), origmessage)); else @@ -498,7 +498,7 @@ void MarkUnread(MCONTACT hContact) pos += mir_strlen((const char*)pos)+1; memcpy(&dbei.cbBlob, pos, sizeof(uint32_t)); pos += sizeof(uint32_t); - dbei.pBlob = (uint8_t*)malloc(dbei.cbBlob); + dbei.pBlob = (char *)malloc(dbei.cbBlob); memcpy(dbei.pBlob, pos, dbei.cbBlob); pos += dbei.cbBlob; db_event_add(hContact,&dbei); diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index b7aac4ddb4..95581f9b47 100644 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -262,7 +262,7 @@ void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags) Event.flags = flags | DBEF_UTF; Event.timestamp = (uint32_t)time(0); Event.cbBlob = (uint32_t)mir_strlen(data) + 1; - Event.pBlob = (uint8_t *)_strdup(data); + Event.pBlob = _strdup(data); db_event_add(hContact, &Event); } diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 8c11830517..feba7f7be9 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -504,12 +504,13 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) else text.Format(TranslateT("changed status from %s to %s."), szOldStatus, szNewStatus); + T2Utf szUtf(text); DB::EventInfo dbei; - dbei.pBlob = (uint8_t*)T2Utf(text).detach(); - dbei.cbBlob = (int)mir_strlen((char*)dbei.pBlob); + dbei.pBlob = szUtf; + dbei.cbBlob = (int)mir_strlen(szUtf); dbei.flags = DBEF_UTF | DBEF_READ; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.timestamp = time(0); - dbei.szModule = (char*)c->getProto(); + dbei.szModule = (char *)c->getProto(); dat->LogEvent(dbei); } diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 1cbdd9be21..825063a022 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -630,7 +630,7 @@ public: dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType; if (dbei.eventType == EVENTTYPE_ERRMSG) dbei.szModule = (char *)TranslateT("Sample error message"); - dbei.pBlob = (uint8_t *)szText.detach(); + dbei.pBlob = szText; dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob); dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0; dbei.flags |= (m_bRtl ? DBEF_RTL : 0); diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 110ec8ed24..7a870800ba 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -794,7 +794,7 @@ HANDLE SendLater::processAck(const ACKDATA *ack) dbei.szModule = Proto_GetBaseAccountName((p->hContact)); dbei.timestamp = time(0); dbei.cbBlob = (int)mir_strlen(p->sendBuffer) + 1; - dbei.pBlob = (uint8_t*)(p->sendBuffer); + dbei.pBlob = p->sendBuffer; db_event_add(p->hContact, &dbei); p->cleanDB(); diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 4a2f85e618..159b9dafc8 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -347,7 +347,7 @@ void SendQueue::logError(CMsgDialog *dat, int iSendJobIndex, const wchar_t *szEr DB::EventInfo dbei; dbei.eventType = EVENTTYPE_ERRMSG; if (iSendJobIndex >= 0) { - dbei.pBlob = (uint8_t *)m_jobs[iSendJobIndex].szSendBuffer; + dbei.pBlob = m_jobs[iSendJobIndex].szSendBuffer; iMsgLen = mir_strlen(m_jobs[iSendJobIndex].szSendBuffer) + 1; } else { @@ -473,7 +473,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) if (job.dwFlags & PREF_RTL) dbei.flags |= DBEF_RTL; - dbei.pBlob = (uint8_t*)job.szSendBuffer; + dbei.pBlob = job.szSendBuffer; dbei.szId = (char *)ack->lParam; MessageWindowEvent evt = { job.iSendId, job.hContact, &dbei }; @@ -545,13 +545,14 @@ int SendQueue::doSendLater(int iJobIndex, CMsgDialog *dat, MCONTACT hContact, bo else szNote = TranslateT("The send later feature is not available on this protocol."); + ptrA szUtf(mir_utf8encodeW(szNote)); DB::EventInfo dbei; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = Proto_GetBaseAccountName(dat->m_hContact); dbei.timestamp = time(0); - dbei.pBlob = (uint8_t*)mir_utf8encodeW(szNote); - dbei.cbBlob = (int)mir_strlen((char*)dbei.pBlob); + dbei.pBlob = szUtf; + dbei.cbBlob = (int)mir_strlen(szUtf); dat->LogEvent(dbei); if (dat->m_hDbEventFirst == 0) diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index cc9bac99a9..a7aafa717d 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -168,7 +168,7 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received) DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) { - dbei.pBlob = (uint8_t *)alloca(dbei.cbBlob); + dbei.pBlob = (char *)alloca(dbei.cbBlob); db_event_get(hDbEvent, &dbei); if (dbei.cbBlob == 0 || dbei.pBlob == nullptr) return nullptr; diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index 3e4cd100de..33faddebfe 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -923,7 +923,7 @@ int CExImContactXML::ImportEvent(LPCSTR pszModule, const TiXmlElement *xmlEvent) return ERROR_INVALID_VALUE; size_t baselen; - mir_ptr tmpVal((uint8_t*)mir_base64_decode(tmp, &baselen)); + mir_ptr tmpVal((char *)mir_base64_decode(tmp, &baselen)); if (tmpVal != NULL) { // event owning module dbei.pBlob = tmpVal; diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 176753d2cc..4ec519f6b1 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -508,7 +508,7 @@ bool GetInfoWithData(MEVENT hEvent, DBEVENTINFO *dbei) dbei->cbBlob = (size != -1) ? (uint32_t)size : 0; } if (dbei->cbBlob) { - dbei->pBlob = (uint8_t*) mir_alloc(dbei->cbBlob); + dbei->pBlob = (char *)mir_alloc(dbei->cbBlob); if (dbei->pBlob == nullptr) dbei->cbBlob = 0; } diff --git a/plugins/WinterSpeak/src/EventInformation.cpp b/plugins/WinterSpeak/src/EventInformation.cpp index becb758c95..749ca4ae5c 100644 --- a/plugins/WinterSpeak/src/EventInformation.cpp +++ b/plugins/WinterSpeak/src/EventInformation.cpp @@ -38,7 +38,7 @@ bool EventInformation::isValidEvent(MEVENT event) { return false; } - m_event_info.pBlob = new unsigned char[m_event_info.cbBlob]; + m_event_info.pBlob = new char[m_event_info.cbBlob]; // get the event info db_event_get(event, &m_event_info); diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 472f3e17d8..75ead98cc7 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -69,7 +69,7 @@ int ProtoAck(WPARAM,LPARAM lparam) dbei.flags = DBEF_SENT | DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(p->msgText) + 1; - dbei.pBlob = (uint8_t*)p->msgText; + dbei.pBlob = p->msgText; db_event_add(hForwardTo, &dbei); } 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); diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index 356d7ad6f0..78815ef42b 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -95,7 +95,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, LPARAM lParam) dbei.szModule = Proto_GetBaseAccountName(hContact); dbei.timestamp = time(0); dbei.cbBlob = (uint32_t)(mir_strlen(p->szMsg) + 1); - dbei.pBlob = (uint8_t*)p->szMsg; + dbei.pBlob = p->szMsg; dbei.szId = (char *)lParam; MessageWindowEvent evt = { id, hContact, &dbei }; diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 2e59abcf9e..c886b4f341 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP int newBlobSize = db_event_getBlobSize(hDbEvent); if (newBlobSize > oldBlobSize) { - dbei.pBlob = (uint8_t*)mir_realloc(dbei.pBlob, newBlobSize); + dbei.pBlob = (char *)mir_realloc(dbei.pBlob, newBlobSize); oldBlobSize = newBlobSize; } dbei.cbBlob = oldBlobSize; diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 4e1c822bec..ad55172acc 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -210,7 +210,7 @@ MIR_APP_DLL(void) Contact::AddByEvent(MEVENT hEvent, MWindow hwndParent) uint32_t dwData[2]; DBEVENTINFO dbei = {}; dbei.cbBlob = sizeof(dwData); - dbei.pBlob = (uint8_t*)&dwData; + dbei.pBlob = (char *)&dwData; db_event_get(hEvent, &dbei); if (dwData[0] != 0) m_szName.Format(L"%d", dwData[0]); diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index b7a759e3f0..aacc6d7eb3 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -847,9 +847,8 @@ static int OnEventAdded(WPARAM hContact, LPARAM hDbEvent) if (auto *pDlg = Srmm_FindDialog(hContact)) pDlg->EventAdded(hDbEvent, dbei); - MCONTACT hRealContact = db_event_getContact(hDbEvent); - if (hRealContact != hContact) - if (auto *pDlg = Srmm_FindDialog(hRealContact)) + if (dbei.hContact != hContact) + if (auto *pDlg = Srmm_FindDialog(dbei.hContact)) pDlg->EventAdded(hDbEvent, dbei); } } diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index cee5015c96..78d00685ef 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -375,7 +375,7 @@ void DB::FILE_BLOB::write(DB::EventInfo &dbei) std::string text = root.write(); dbei.cbBlob = (int)text.size() + 1; - dbei.pBlob = (uint8_t*)mir_realloc(dbei.pBlob, dbei.cbBlob); + dbei.pBlob = (char *)mir_realloc(dbei.pBlob, dbei.cbBlob); memcpy(dbei.pBlob, text.c_str(), dbei.cbBlob); } @@ -394,9 +394,9 @@ DB::AUTH_BLOB::AUTH_BLOB(MCONTACT hContact, LPCSTR nick, LPCSTR fname, LPCSTR ln m_size = uint32_t(sizeof(uint32_t) * 2 + 5 + mir_strlen(m_szNick) + mir_strlen(m_szFirstName) + mir_strlen(m_szLastName) + mir_strlen(m_szEmail) + mir_strlen(m_szReason)); } -DB::AUTH_BLOB::AUTH_BLOB(uint8_t *blob) +DB::AUTH_BLOB::AUTH_BLOB(char *blob) { - char *pCurBlob = (char *)blob; + char *pCurBlob = blob; m_dwUin = *(uint32_t*)pCurBlob; pCurBlob += sizeof(uint32_t); m_hContact = *(uint32_t*)pCurBlob; @@ -406,24 +406,24 @@ DB::AUTH_BLOB::AUTH_BLOB(uint8_t *blob) m_szLastName = mir_strdup(pCurBlob); pCurBlob += mir_strlen(pCurBlob) + 1; m_szEmail = mir_strdup(pCurBlob); pCurBlob += mir_strlen(pCurBlob) + 1; m_szReason = mir_strdup(pCurBlob); pCurBlob += mir_strlen(pCurBlob) + 1; - m_size = uint32_t(pCurBlob - (char *)blob); + m_size = uint32_t(pCurBlob - blob); } DB::AUTH_BLOB::~AUTH_BLOB() { } -uint8_t* DB::AUTH_BLOB::makeBlob() +char* DB::AUTH_BLOB::makeBlob() { - uint8_t *pBlob, *pCurBlob; - pCurBlob = pBlob = (uint8_t*)mir_alloc(m_size + 1); + char *pBlob, *pCurBlob; + pCurBlob = pBlob = (char *)mir_alloc(m_size + 1); *((uint32_t*)pCurBlob) = m_dwUin; pCurBlob += sizeof(uint32_t); *((uint32_t*)pCurBlob) = (uint32_t)m_hContact; pCurBlob += sizeof(uint32_t); - mir_snprintf((char*)pCurBlob, m_size - 8, "%s%c%s%c%s%c%s%c%s%c", + mir_snprintf(pCurBlob, m_size - 8, "%s%c%s%c%s%c%s%c%s%c", (m_szNick) ? m_szNick.get() : "", 0, (m_szFirstName) ? m_szFirstName.get() : "", 0, (m_szLastName) ? m_szLastName.get() : "", 0, diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index e2f035218c..83ab5e5a8f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -289,11 +289,10 @@ Netlib_DestroySecurityProvider @381 Netlib_InitSecurityProvider @382 Netlib_NtlmCreateResponse @383 ??0AUTH_BLOB@DB@@QAE@IPBD0000@Z @384 NONAME -??0AUTH_BLOB@DB@@QAE@PAE@Z @385 NONAME +??0AUTH_BLOB@DB@@QAE@PAD@Z @385 NONAME ??1AUTH_BLOB@DB@@QAE@XZ @386 NONAME ??4AUTH_BLOB@DB@@QAEAAV01@ABV01@@Z @387 NONAME ??BAUTH_BLOB@DB@@QAEPADXZ @388 NONAME -??BAUTH_BLOB@DB@@QAEPAEXZ @389 NONAME ?get_contact@AUTH_BLOB@DB@@QBEIXZ @390 NONAME ?get_email@AUTH_BLOB@DB@@QBEPBDXZ @391 NONAME ?get_firstName@AUTH_BLOB@DB@@QBEPBDXZ @392 NONAME @@ -301,7 +300,7 @@ Netlib_NtlmCreateResponse @383 ?get_nick@AUTH_BLOB@DB@@QBEPBDXZ @394 NONAME ?get_reason@AUTH_BLOB@DB@@QBEPBDXZ @395 NONAME ?get_uin@AUTH_BLOB@DB@@QBEIXZ @396 NONAME -?makeBlob@AUTH_BLOB@DB@@AAEPAEXZ @397 NONAME +?makeBlob@AUTH_BLOB@DB@@AAEPADXZ @1046 NONAME ?size@AUTH_BLOB@DB@@QBEIXZ @398 NONAME Chat_UnescapeTags @399 NONAME ProtoGetAvatarFormatByMimeType @400 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 6c39849c39..a768154279 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -289,11 +289,10 @@ Netlib_DestroySecurityProvider @381 Netlib_InitSecurityProvider @382 Netlib_NtlmCreateResponse @383 ??0AUTH_BLOB@DB@@QEAA@IPEBD0000@Z @384 NONAME -??0AUTH_BLOB@DB@@QEAA@PEAE@Z @385 NONAME +??0AUTH_BLOB@DB@@QEAA@PEAD@Z @385 NONAME ??1AUTH_BLOB@DB@@QEAA@XZ @386 NONAME ??4AUTH_BLOB@DB@@QEAAAEAV01@AEBV01@@Z @387 NONAME ??BAUTH_BLOB@DB@@QEAAPEADXZ @388 NONAME -??BAUTH_BLOB@DB@@QEAAPEAEXZ @389 NONAME ?get_contact@AUTH_BLOB@DB@@QEBAIXZ @390 NONAME ?get_email@AUTH_BLOB@DB@@QEBAPEBDXZ @391 NONAME ?get_firstName@AUTH_BLOB@DB@@QEBAPEBDXZ @392 NONAME @@ -301,7 +300,7 @@ Netlib_NtlmCreateResponse @383 ?get_nick@AUTH_BLOB@DB@@QEBAPEBDXZ @394 NONAME ?get_reason@AUTH_BLOB@DB@@QEBAPEBDXZ @395 NONAME ?get_uin@AUTH_BLOB@DB@@QEBAIXZ @396 NONAME -?makeBlob@AUTH_BLOB@DB@@AEAAPEAEXZ @397 NONAME +?makeBlob@AUTH_BLOB@DB@@AEAAPEADXZ @397 NONAME ?size@AUTH_BLOB@DB@@QEBAIXZ @398 NONAME Chat_UnescapeTags @399 NONAME ProtoGetAvatarFormatByMimeType @400 diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp index 3caf9971aa..3d783df392 100644 --- a/src/mir_app/src/proto_interface.cpp +++ b/src/mir_app/src/proto_interface.cpp @@ -220,7 +220,7 @@ MEVENT PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) dbei.timestamp = pre->timestamp; dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(pre->szMessage) + 1; - dbei.pBlob = (uint8_t*)pre->szMessage; + dbei.pBlob = pre->szMessage; dbei.szUserId = pre->szUserId; dbei.szReplyId = pre->szReplyId; diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index bafd0d0d04..5ce2306a5f 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -183,7 +183,7 @@ MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pcre dbei.flags = DBEF_UTF | pcre->flags & (PREF_CREATEREAD ? DBEF_READ : 0); dbei.eventType = EVENTTYPE_AUTHREQUEST; dbei.cbBlob = pcre->lParam; - dbei.pBlob = (uint8_t*)pcre->szMessage; + dbei.pBlob = pcre->szMessage; return db_event_add(0, &dbei); } -- cgit v1.2.3