diff options
Diffstat (limited to 'plugins')
55 files changed, 111 insertions, 95 deletions
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<IImport::ExternalMessage>& 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<uint32_t, IImport::ExternalMessage>(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<IImport::ExternalMessage> 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<uint8_t> pCryptBlob;
+ mir_ptr<char> 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<uint8_t> pCryptBlob;
+ mir_ptr<char> 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<uint8_t> pCryptBlob;
+ mir_ptr<char> 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<uint8_t> pCryptBlob;
+ mir_ptr<char> 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<uint8_t*>(realloc(ei.dbe.pBlob, ei.dbe.cbBlob + 1));
+ ei.dbe.pBlob = reinterpret_cast<char *>(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<DBEVENTINFO>::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<uint8_t> tmpVal((uint8_t*)mir_base64_decode(tmp, &baselen));
+ mir_ptr<char > 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);
}
|