diff options
38 files changed, 69 insertions, 69 deletions
diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index fee5eac3cb..35bb5118c1 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -81,7 +81,7 @@ hDbEvent should have been returned by db_event_add/first/last/next/prev() Returns 0 on success, or nonzero if hDbEvent was invalid
Triggers a db/event/deleted event just *before* the event is deleted
}
-function db_event_delete(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; external CoreDLL;
+function db_event_delete(hDbEvent:TMEVENT):int; stdcall; external CoreDLL;
{
Retrieves a handle to the first event in the chain for hContact
diff --git a/include/m_database.h b/include/m_database.h index b9275e15c3..094a0c57fa 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -290,7 +290,7 @@ EXTERN_C MIR_CORE_DLL(int) db_event_count(MCONTACT hContact); // Returns 0 on success, or nonzero if hDbEvent was invalid
// Triggers a db/event/deleted event just *before* the event is deleted
-EXTERN_C MIR_CORE_DLL(int) db_event_delete(MCONTACT hContact, MEVENT hDbEvent);
+EXTERN_C MIR_CORE_DLL(int) db_event_delete(MEVENT hDbEvent);
// Edits an event in the database
// Returns 0 on success, or nonzero on error
diff --git a/include/m_db_int.h b/include/m_db_int.h index 1c1320a35a..a2a13f3d12 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -96,7 +96,7 @@ interface MIR_APP_EXPORT MIDatabase STDMETHOD_(LONG, GetEventCount)(MCONTACT contactID) PURE;
STDMETHOD_(MEVENT, AddEvent)(MCONTACT contactID, DBEVENTINFO *dbe) PURE;
- STDMETHOD_(BOOL, DeleteEvent)(MCONTACT contactID, MEVENT hDbEvent) PURE;
+ STDMETHOD_(BOOL, DeleteEvent)(MEVENT hDbEvent) PURE;
STDMETHOD_(BOOL, EditEvent)(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) PURE;
STDMETHOD_(LONG, GetBlobSize)(MEVENT hDbEvent) PURE;
STDMETHOD_(BOOL, GetEvent)(MEVENT hDbEvent, DBEVENTINFO *dbe) PURE;
@@ -210,7 +210,7 @@ public: ////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT, DBEVENTINFO*) override;
- STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT, MEVENT) override;
+ STDMETHODIMP_(BOOL) DeleteEvent(MEVENT) override;
STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe);
STDMETHODIMP_(LONG) GetBlobSize(MEVENT) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT, MEVENT) override;
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 85b6572c5f..e7ae777699 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex 40864ec163..8ad1d65b46 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 7656fe6f57..64fea1de5c 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex 3c7ea2205a..f10a29be5f 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 8bbdb853d0..8e696d6cf6 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -225,7 +225,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA if (blDelete) {
if (le->hDbEvent)
- db_event_delete(hContact, le->hDbEvent);
+ db_event_delete(le->hDbEvent);
else
DeleteFile(le->filelink);
@@ -260,7 +260,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA DeleteFile(le->filename);
if (le->hDbEvent)
- db_event_delete(hContact, le->hDbEvent);
+ db_event_delete(le->hDbEvent);
else
DeleteFile(le->filelink);
diff --git a/plugins/BasicHistory/src/EventList.h b/plugins/BasicHistory/src/EventList.h index 52c70e64c1..3117807923 100644 --- a/plugins/BasicHistory/src/EventList.h +++ b/plugins/BasicHistory/src/EventList.h @@ -97,7 +97,7 @@ protected: void DeleteEvent(const EventIndex& ev)
{
if (!ev.isExternal)
- db_event_delete(m_hContact, ev.hEvent);
+ db_event_delete(ev.hEvent);
}
void RebuildGroup(int selected);
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 22053a663c..36ea44152a 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -394,7 +394,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) MEVENT hDbEvent = db_event_last(hContact);
while (hDbEvent != NULL) {
MEVENT hPrevEvent = db_event_prev(hContact, hDbEvent);
- hDbEvent = (db_event_delete(hContact, hDbEvent) == 0) ? hPrevEvent : NULL;
+ hDbEvent = (db_event_delete(hDbEvent) == 0) ? hPrevEvent : NULL;
}
db_set_safety_mode(TRUE);
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 22716614ee..ba17be694e 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -162,11 +162,16 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) return (MEVENT)ofsNew;
}
-BOOL CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
+BOOL CDb3Mmap::DeleteEvent(MEVENT hDbEvent)
{
+ mir_cslockfull lck(m_csDbAccess);
+ DBEvent dbe = *(DBEvent*)DBRead((DWORD)hDbEvent, nullptr);
+ if (dbe.signature != DBEVENT_SIGNATURE)
+ return 1;
+
DBCachedContact *cc;
- if (contactID) {
- if ((cc = m_cache->GetCachedContact(contactID)) == nullptr)
+ if (dbe.contactID) {
+ if ((cc = m_cache->GetCachedContact(dbe.contactID)) == nullptr)
return 2;
if (cc->IsSub())
if ((cc = m_cache->GetCachedContact(cc->parentID)) == nullptr)
@@ -174,18 +179,16 @@ BOOL CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) }
else cc = nullptr;
- mir_cslockfull lck(m_csDbAccess);
DWORD ofsContact = (cc) ? cc->dwOfsContact : m_dbHeader.ofsUser;
- DBContact dbc = *(DBContact*)DBRead(ofsContact, nullptr);
- DBEvent dbe = *(DBEvent*)DBRead((DWORD)hDbEvent, nullptr);
- if (dbc.signature != DBCONTACT_SIGNATURE || dbe.signature != DBEVENT_SIGNATURE)
+ DBContact dbc = *(DBContact *)DBRead(ofsContact, nullptr);
+ if (dbc.signature != DBCONTACT_SIGNATURE)
return 1;
lck.unlock();
log1("delete event @ %08x", hContact);
// call notifier while outside mutex
- NotifyEventHooks(g_hevEventDeleted, contactID, (LPARAM)hDbEvent);
+ NotifyEventHooks(g_hevEventDeleted, dbe.contactID, (LPARAM)hDbEvent);
// get back in
lck.lock();
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 26d3a4931b..bdbcbeac0c 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -219,7 +219,7 @@ public: STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
- STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) override;
+ STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp index 9ef07017f5..82afdf0727 100644 --- a/plugins/Dbx_mdbx/src/dbcontacts.cpp +++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp @@ -48,7 +48,7 @@ LONG CDbxMDBX::DeleteContact(MCONTACT contactID) OBJLIST<EventItem> events(50);
GatherContactHistory(contactID, events);
while (events.getCount()) {
- DeleteEvent(contactID, events[0].eventId);
+ DeleteEvent(events[0].eventId);
events.remove(0);
}
}
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index 776c2679eb..c720609e25 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -48,37 +48,38 @@ MEVENT CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) ///////////////////////////////////////////////////////////////////////////////
-BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
+BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent)
{
- DBCachedContact *cc = (contactID != 0) ? m_cache->GetCachedContact(contactID) : &m_ccDummy, *cc2;
- if (cc == nullptr || cc->dbc.dwEventCount == 0)
- return 1;
-
+ DBCachedContact *cc, *cc2;
DBEvent dbe;
{
txn_ptr_ro txn(m_txn_ro);
MDBX_val key = { &hDbEvent, sizeof(MEVENT) }, data;
if (mdbx_get(txn, m_dbEvents, &key, &data) != MDBX_SUCCESS)
return 1;
+
dbe = *(DBEvent*)data.iov_base;
+ cc = (dbe.dwContactID != 0) ? m_cache->GetCachedContact(dbe.dwContactID) : &m_ccDummy;
+ if (cc == nullptr || cc->dbc.dwEventCount == 0)
+ return 1;
}
if (!CheckEvent(cc, &dbe, cc2))
return 1;
{
txn_ptr trnlck(StartTran());
- DBEventSortingKey key2 = { contactID, hDbEvent, dbe.timestamp };
+ DBEventSortingKey key2 = { dbe.dwContactID, hDbEvent, dbe.timestamp };
MDBX_val key = { &key2, sizeof(key2) }, data;
if (mdbx_del(trnlck, m_dbEventsSort, &key, nullptr) != MDBX_SUCCESS)
return 1;
- if (contactID != 0) {
+ if (dbe.dwContactID != 0) {
cc->dbc.dwEventCount--;
if (cc->dbc.evFirstUnread == hDbEvent)
FindNextUnread(trnlck, cc, key2);
- MDBX_val keyc = { &contactID, sizeof(MCONTACT) };
+ MDBX_val keyc = { &dbe.dwContactID, sizeof(MCONTACT) };
data.iov_len = sizeof(DBContact); data.iov_base = &cc->dbc;
if (mdbx_put(trnlck, m_dbContacts, &keyc, &data, 0) != MDBX_SUCCESS)
return 1;
@@ -99,7 +100,7 @@ BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) if (mdbx_del(trnlck, m_dbEventsSort, &key, nullptr) != MDBX_SUCCESS)
return 1;
- key.iov_len = sizeof(MCONTACT); key.iov_base = &contactID;
+ key.iov_len = sizeof(MCONTACT); key.iov_base = &dbe.dwContactID;
cc2->dbc.dwEventCount--;
if (cc2->dbc.evFirstUnread == hDbEvent)
FindNextUnread(trnlck, cc2, key2);
@@ -120,7 +121,7 @@ BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) }
DBFlush();
- NotifyEventHooks(g_hevEventDeleted, contactID, hDbEvent);
+ NotifyEventHooks(g_hevEventDeleted, dbe.dwContactID, hDbEvent);
return 0;
}
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h index 53d598b406..4a089b8ef3 100644 --- a/plugins/Dbx_mdbx/src/dbintf.h +++ b/plugins/Dbx_mdbx/src/dbintf.h @@ -268,7 +268,7 @@ public: STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
- STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) override;
+ STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index 77aee3f4e4..ef6562f85a 100755 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -207,14 +207,13 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, DBEVENTINFO *dbei) return hDbEvent; } -BOOL CDbxSQLite::DeleteEvent(MCONTACT hContact, MEVENT hDbEvent) +BOOL CDbxSQLite::DeleteEvent(MEVENT hDbEvent) { if (hDbEvent == 0) return 1; - DBCachedContact *cc = (hContact) - ? m_cache->GetCachedContact(hContact) - : &m_system; + MEVENT hContact = GetEventContact(hDbEvent); + DBCachedContact *cc = (hContact) ? m_cache->GetCachedContact(hContact) : &m_system; if (cc == nullptr) return 1; @@ -236,13 +235,12 @@ BOOL CDbxSQLite::DeleteEvent(MCONTACT hContact, MEVENT hDbEvent) if (rc != SQLITE_DONE) return 1; - cc->DeleteEvent(hDbEvent); if (cc->IsSub() && (cc = m_cache->GetCachedContact(cc->parentID))) cc->DeleteEvent(hDbEvent); } - NotifyEventHooks(g_hevEventDeleted, hContact, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevEventDeleted, hContact, hDbEvent); return 0; } diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h index fdab9d8b4c..16a8db11dd 100755 --- a/plugins/Dbx_sqlite/src/dbintf.h +++ b/plugins/Dbx_sqlite/src/dbintf.h @@ -64,7 +64,7 @@ public: STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override; STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override; - STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) override; + STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override; STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override; STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override; STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override; diff --git a/plugins/HistoryPlusPlus/EmptyHistoryForm.pas b/plugins/HistoryPlusPlus/EmptyHistoryForm.pas index dc416180bb..08335d3d0b 100644 --- a/plugins/HistoryPlusPlus/EmptyHistoryForm.pas +++ b/plugins/HistoryPlusPlus/EmptyHistoryForm.pas @@ -209,7 +209,7 @@ begin while hDBEvent <> 0 do
begin
prevhDbEvent := db_event_prev(hContact,hDBEvent);
- if db_event_delete(hContact,hDBEvent) = 0 then
+ if db_event_delete(hDBEvent) = 0 then
hDBEvent := prevhDbEvent
else
hDBEvent := 0;
diff --git a/plugins/HistoryPlusPlus/GlobalSearch.pas b/plugins/HistoryPlusPlus/GlobalSearch.pas index 6cd4e103eb..2ae098591a 100644 --- a/plugins/HistoryPlusPlus/GlobalSearch.pas +++ b/plugins/HistoryPlusPlus/GlobalSearch.pas @@ -1105,7 +1105,7 @@ var begin
si := GetSearchItem(Index);
if (FormState = gsDelete) and (si.hDBEvent <> 0) then
- db_event_delete(si.Contact.Handle, si.hDBEvent);
+ db_event_delete(si.hDBEvent);
if FFiltered then
Index := FilterHistory[Index];
DeleteEventFromLists(Index);
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index ac3fb4589e..7df2cae662 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -1733,14 +1733,14 @@ begin if FormState = gsDelete then
begin // probably unnecessary considering prev check
hDBEvent := db_event_first(hContact);
- db_event_delete(hContact, hDBEvent);
+ db_event_delete(hDBEvent);
end;
end
else
begin
idx := GridIndexToHistory(Index);
if (FormState = gsDelete) and (History[idx] <> 0) then
- db_event_delete(hContact, History[idx]);
+ db_event_delete(History[idx]);
DeleteEventFromSessions(idx);
DeleteHistoryItem(idx);
end;
diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas index 2a2e78a474..0ecc0d3a67 100644 --- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas +++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas @@ -968,7 +968,7 @@ end; procedure TExternalGrid.GridItemDelete(Sender: TObject; Index: Integer);
begin
if (FGridState = gsDelete) and (Items[Index].hDBEvent <> 0) and (not Items[Index].Custom) then
- db_event_delete(Items[Index].hContact, Items[Index].hDBEvent);
+ db_event_delete(Items[Index].hDBEvent);
if Index <> High(Items) then
begin
Finalize(Items[Index]);
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 91c3478011..d74dbfeadc 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -179,7 +179,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke // find next event
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
if (doDelete)
- db_event_delete(hContact, hDBEvent);
+ db_event_delete(hDBEvent);
hDBEvent = hDBEventNext;
}
diff --git a/plugins/Import/src/dbrw/dbevents.cpp b/plugins/Import/src/dbrw/dbevents.cpp index 8fdac2a857..0b4611d51d 100644 --- a/plugins/Import/src/dbrw/dbevents.cpp +++ b/plugins/Import/src/dbrw/dbevents.cpp @@ -39,7 +39,7 @@ STDMETHODIMP_(MEVENT) CDbxSQLite::AddEvent(MCONTACT, DBEVENTINFO*) return 0; } -STDMETHODIMP_(BOOL) CDbxSQLite::DeleteEvent(MCONTACT, MEVENT) +STDMETHODIMP_(BOOL) CDbxSQLite::DeleteEvent(MEVENT) { return FALSE; } diff --git a/plugins/Import/src/dbrw/dbintf.h b/plugins/Import/src/dbrw/dbintf.h index 07b2a62a2b..6d62fd6fb6 100644 --- a/plugins/Import/src/dbrw/dbintf.h +++ b/plugins/Import/src/dbrw/dbintf.h @@ -133,7 +133,7 @@ public: STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override; STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override; - STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) override; + STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override; STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override; STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override; STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override; diff --git a/plugins/MirLua/src/Modules/m_database.cpp b/plugins/MirLua/src/Modules/m_database.cpp index c3df7db49e..d4f5a051be 100644 --- a/plugins/MirLua/src/Modules/m_database.cpp +++ b/plugins/MirLua/src/Modules/m_database.cpp @@ -341,10 +341,9 @@ static int db_AddEvent(lua_State *L) static int db_DeleteEvent(lua_State *L) { - MCONTACT hContact = luaL_optinteger(L, 1, 0); - MEVENT hDbEvent = luaL_checkinteger(L, 2); + MCONTACT hDbEvent = luaL_optinteger(L, 1, 0); - int res = db_event_delete(hContact, hDbEvent); + int res = db_event_delete(hDbEvent); lua_pushboolean(L, res == 0); return 1; diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index 3b66730d0b..c1a4a438d4 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -26,7 +26,7 @@ void CALLBACK DeleteTimerProc(HWND, UINT, UINT_PTR, DWORD) { if (difftime(time(0), current->timestamp) < 1) break; if (!db_event_get(current->hDbEvent, &info)) // && info.flags&DBEF_READ) { - db_event_delete(current->hContact, current->hDbEvent); + db_event_delete(current->hDbEvent); next = current->next; if (prev) prev->next = next; else if (DeleteEvents.first == current) DeleteEvents.first = next; diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 931f938336..5796e051e3 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -45,7 +45,7 @@ void RemoveLoggedEventsXStatus(MCONTACT hContact) auto T = eventListXStatus.rev_iter();
for (auto &it : T)
if (it->hContact == hContact) {
- db_event_delete(it->hContact, it->hDBEvent);
+ db_event_delete(it->hDBEvent);
mir_free(it);
eventListXStatus.remove(T.indexOf(&it));
}
@@ -56,7 +56,7 @@ void RemoveLoggedEventsStatus(MCONTACT hContact) auto T = eventListStatus.rev_iter();
for (auto &it : T)
if (it->hContact == hContact) {
- db_event_delete(it->hContact, it->hDBEvent);
+ db_event_delete(it->hDBEvent);
mir_free(it);
eventListStatus.remove(T.indexOf(&it));
}
@@ -67,7 +67,7 @@ void RemoveLoggedEventsSMsg(MCONTACT hContact) auto T = eventListSMsg.rev_iter();
for (auto &it : T)
if (it->hContact == hContact) {
- db_event_delete(it->hContact, it->hDBEvent);
+ db_event_delete(it->hDBEvent);
mir_free(it);
eventListSMsg.remove(T.indexOf(&it));
}
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index bc1a257072..21bdc3dec3 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -69,7 +69,7 @@ void RemoveReadEvents(MCONTACT hContact = 0) if (remove) {
if (g_plugin.getByte(node->hContact, DBSETTING_REMOVE)) // is history disabled for this contact?
- db_event_delete(node->hContact, node->hDBEvent);
+ db_event_delete(node->hDBEvent);
// remove list node anyway
if (event_list == node) event_list = node->next;
@@ -92,7 +92,7 @@ void RemoveAllEvents(MCONTACT hContact) MEVENT hDBEvent = db_event_first(hContact);
while(hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
- db_event_delete(hContact, hDBEvent);
+ db_event_delete(hDBEvent);
hDBEvent = hDBEventNext;
}
}
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index 6d2d4ab10c..4b274a6a9a 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -371,7 +371,7 @@ void RemoveUsers() MEVENT hDbEvent = db_event_first(0);
while (hDbEvent != NULL) {
- db_event_delete(0, hDbEvent);
+ db_event_delete(hDbEvent);
hDbEvent = db_event_first(0);
}
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 4b3d6cd040..ae3c4794a6 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -36,7 +36,7 @@ int OnDbEventAdded(WPARAM, LPARAM lParam) Contact_RemoveFromList(hcntct);
Contact_Hide(hcntct);
if (!g_sets.HistLog)
- db_event_delete(0, hDbEvent);
+ db_event_delete(hDbEvent);
return 1;
}
}
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 0c9f5e6dc6..43f569f7a3 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -518,7 +518,7 @@ void CDiscordProto::OnCommandMessageDelete(const JSONNode &pRoot) if (!msgid.IsEmpty()) { MEVENT hEvent = db_event_getById(m_szModuleName, msgid); if (hEvent) - db_event_delete(db_event_getContact(hEvent), hEvent); + db_event_delete(hEvent); } } diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index d1b0ccb1f0..ed39bd871e 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -866,7 +866,7 @@ void CVkProto::NewsClearHistory() DBEVENTINFO dbei = {};
db_event_get(hDBEvent, &dbei);
if (dbei.timestamp < tTime)
- db_event_delete(hContact, hDBEvent);
+ db_event_delete(hDBEvent);
hDBEvent = hDBEventNext;
}
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 7b5f171b7f..47283a5e18 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -41,7 +41,7 @@ INT_PTR __cdecl CVkProto::SvcGetAllServerHistoryForContact(WPARAM hContact, LPAR MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
- db_event_delete(hContact, hDBEvent);
+ db_event_delete(hDBEvent);
hDBEvent = hDBEventNext;
}
@@ -73,7 +73,7 @@ INT_PTR __cdecl CVkProto::SvcGetAllServerHistory(WPARAM, LPARAM) MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
- db_event_delete(hContact, hDBEvent);
+ db_event_delete(hDBEvent);
hDBEvent = hDBEventNext;
}
@@ -111,7 +111,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay) DBEVENTINFO dbei = {};
db_event_get(hDBEvent, &dbei);
if (dbei.timestamp > tTime && dbei.eventType != VK_USER_DEACTIVATE_ACTION)
- db_event_delete(hContact, hDBEvent);
+ db_event_delete(hDBEvent);
hDBEvent = hDBEventNext;
}
@@ -305,7 +305,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque MEVENT hDbEvent = db_event_getById(m_szModuleName, strcat(szMid, "_"));
if (hDbEvent)
- db_event_delete(hContact, hDbEvent);
+ db_event_delete(hDbEvent);
if (isRead && isOut && datetime > tLastReadMessageTime)
tLastReadMessageTime = datetime;
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 712a8c1027..05a9081153 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -229,15 +229,14 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE;
case IDC_DELETEHISTORY:
- MEVENT hDbevent;
{
int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if (index == LB_ERR)
break;
if (MessageBox(hwndDlg, TranslateT("Are you sure you want to delete this history item?"), TranslateT("Delete history"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- hDbevent = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
- db_event_delete(hContact, hDbevent);
+ MEVENT hDbevent = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
+ db_event_delete(hDbevent);
SendMessage(hwndDlg, DM_HREBUILD, 0, 0);
}
}
diff --git a/src/mir_app/src/MDatabaseReadonly.cpp b/src/mir_app/src/MDatabaseReadonly.cpp index 1776a9d1a4..51dfcbf3ec 100644 --- a/src/mir_app/src/MDatabaseReadonly.cpp +++ b/src/mir_app/src/MDatabaseReadonly.cpp @@ -71,7 +71,7 @@ MEVENT MDatabaseReadonly::AddEvent(MCONTACT, DBEVENTINFO*) return 0; } -BOOL MDatabaseReadonly::DeleteEvent(MCONTACT, MEVENT) +BOOL MDatabaseReadonly::DeleteEvent(MEVENT) { return 1; } diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index d4d62e5f0a..4a92f525a5 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -578,7 +578,7 @@ Miranda_WaitOnHandleEx @663 ?AddEvent@MDatabaseReadonly@@UAGIIPAUDBEVENTINFO@@@Z @666 NONAME
?DeleteContact@MDatabaseReadonly@@UAGJI@Z @667 NONAME
?DeleteContactSetting@MDatabaseReadonly@@UAGHIPBD0@Z @668 NONAME
-?DeleteEvent@MDatabaseReadonly@@UAGHII@Z @669 NONAME
+?DeleteEvent@MDatabaseReadonly@@UAGHI@Z @669 NONAME
?EnumContactSettings@MDatabaseReadonly@@UAGHIP6AHPBDPAX@Z01@Z @670 NONAME
?EnumModuleNames@MDatabaseReadonly@@UAGHP6AHPBDPAX@Z1@Z @671 NONAME
?FindFirstUnreadEvent@MDatabaseReadonly@@UAGII@Z @672 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index bd99493d60..447cc83c99 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -578,7 +578,7 @@ Miranda_WaitOnHandleEx @663 ?AddEvent@MDatabaseReadonly@@UEAAIIPEAUDBEVENTINFO@@@Z @666 NONAME
?DeleteContact@MDatabaseReadonly@@UEAAJI@Z @667 NONAME
?DeleteContactSetting@MDatabaseReadonly@@UEAAHIPEBD0@Z @668 NONAME
-?DeleteEvent@MDatabaseReadonly@@UEAAHII@Z @669 NONAME
+?DeleteEvent@MDatabaseReadonly@@UEAAHI@Z @669 NONAME
?EnumContactSettings@MDatabaseReadonly@@UEAAHIP6AHPEBDPEAX@Z01@Z @670 NONAME
?EnumModuleNames@MDatabaseReadonly@@UEAAHP6AHPEBDPEAX@Z1@Z @671 NONAME
?FindFirstUnreadEvent@MDatabaseReadonly@@UEAAII@Z @672 NONAME
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index d7a6355036..6a0f771945 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -371,9 +371,9 @@ MIR_CORE_DLL(int) db_event_count(MCONTACT hContact) return (currDb == nullptr) ? 0 : currDb->GetEventCount(hContact);
}
-MIR_CORE_DLL(int) db_event_delete(MCONTACT hContact, MEVENT hDbEvent)
+MIR_CORE_DLL(int) db_event_delete(MEVENT hDbEvent)
{
- return (currDb == nullptr) ? 0 : currDb->DeleteEvent(hContact, hDbEvent);
+ return (currDb == nullptr) ? 0 : currDb->DeleteEvent(hDbEvent);
}
MIR_CORE_DLL(int) db_event_edit(MCONTACT hContact, MEVENT hDbEvent, DBEVENTINFO *dbei)
|