From 39681c2aa83e33d46598f8aeecd10370b04cf364 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 10 Oct 2018 23:26:08 +0300 Subject: stupid schema with event handles sharing via CreateEventHook eliminated --- plugins/Db3x_mmap/src/dbcontacts.cpp | 4 ++-- plugins/Db3x_mmap/src/dbcrypt.cpp | 16 ++++++++-------- plugins/Db3x_mmap/src/dbevents.cpp | 10 +++++----- plugins/Db3x_mmap/src/dbintf.cpp | 19 ------------------- plugins/Db3x_mmap/src/dbintf.h | 2 -- plugins/Db3x_mmap/src/dbsettings.cpp | 8 ++++---- plugins/Dbx_mdbx/src/dbcontacts.cpp | 4 ++-- plugins/Dbx_mdbx/src/dbevents.cpp | 8 ++++---- plugins/Dbx_mdbx/src/dbintf.cpp | 28 +++++++--------------------- plugins/Dbx_mdbx/src/dbintf.h | 4 ---- plugins/Dbx_mdbx/src/dbsettings.cpp | 6 +++--- plugins/Dbx_sqlite/src/dbcontacts.cpp | 4 ++-- plugins/Dbx_sqlite/src/dbevents.cpp | 10 +++++----- plugins/Dbx_sqlite/src/dbintf.cpp | 17 ----------------- plugins/Dbx_sqlite/src/dbintf.h | 9 --------- plugins/Dbx_sqlite/src/dbsettings.cpp | 6 +++--- 16 files changed, 45 insertions(+), 110 deletions(-) (limited to 'plugins') diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index f7f913368d..d2433d2d46 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -55,7 +55,7 @@ STDMETHODIMP_(LONG) CDb3Mmap::DeleteContact(MCONTACT contactID) log0("del contact"); // call notifier while outside mutex - NotifyEventHooks(hContactDeletedEvent, contactID, 0); + NotifyEventHooks(g_hevEventDeleted, contactID, 0); // get back in lck.lock(); @@ -136,7 +136,7 @@ STDMETHODIMP_(MCONTACT) CDb3Mmap::AddContact() DBCachedContact *cc = m_cache->AddContactToCache(dbc.dwContactID); cc->dwOfsContact = ofsNew; - NotifyEventHooks(hContactAddedEvent, dbc.dwContactID, 0); + NotifyEventHooks(g_hevEventAdded, dbc.dwContactID, 0); return dbc.dwContactID; } diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 777baae06e..7324df3025 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -240,10 +240,10 @@ void CDb3Mmap::SetPassword(const wchar_t *ptszPassword) void CDb3Mmap::ToggleEncryption() { - HANDLE hSave1 = hSettingChangeEvent; hSettingChangeEvent = nullptr; - HANDLE hSave2 = hEventAddedEvent; hEventAddedEvent = nullptr; - HANDLE hSave3 = hEventDeletedEvent; hEventDeletedEvent = nullptr; - HANDLE hSave4 = hEventFilterAddedEvent; hEventFilterAddedEvent = nullptr; + HANDLE hSave1 = g_hevSettingChanged; g_hevSettingChanged = nullptr; + HANDLE hSave2 = g_hevEventAdded; g_hevEventAdded = nullptr; + HANDLE hSave3 = g_hevEventDeleted; g_hevEventDeleted = nullptr; + HANDLE hSave4 = g_hevEventFiltered; g_hevEventFiltered = nullptr; mir_cslock lck(m_csDbAccess); ToggleSettingsEncryption(0); @@ -261,10 +261,10 @@ void CDb3Mmap::ToggleEncryption() dbcws.value.bVal = m_bEncrypted; WriteContactSetting(0, &dbcws); - hSettingChangeEvent = hSave1; - hEventAddedEvent = hSave2; - hEventDeletedEvent = hSave3; - hEventFilterAddedEvent = hSave4; + g_hevSettingChanged = hSave1; + g_hevEventAdded = hSave2; + g_hevEventDeleted = hSave3; + g_hevEventFiltered = hSave4; } void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID) diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 3f6d575329..d781616e25 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -57,7 +57,7 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) } } - if (NotifyEventHooks(hEventFilterAddedEvent, contactNotifyID, (LPARAM)dbei)) + if (NotifyEventHooks(g_hevEventFiltered, contactNotifyID, (LPARAM)dbei)) return 0; dbe.timestamp = dbei->timestamp; @@ -157,7 +157,7 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) // Notify only in safe mode or on really new events if (neednotify) - NotifyEventHooks(hEventAddedEvent, contactNotifyID, (LPARAM)ofsNew); + NotifyEventHooks(g_hevEventAdded, contactNotifyID, (LPARAM)ofsNew); return (MEVENT)ofsNew; } @@ -185,7 +185,7 @@ BOOL CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) log1("delete event @ %08x", hContact); // call notifier while outside mutex - NotifyEventHooks(hEventDeletedEvent, contactID, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevEventDeleted, contactID, (LPARAM)hDbEvent); // get back in lck.lock(); @@ -257,7 +257,7 @@ BOOL CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) return 0; } -BOOL CDb3Mmap::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) +BOOL CDb3Mmap::EditEvent(MCONTACT, MEVENT, DBEVENTINFO*) { return 1; } @@ -357,7 +357,7 @@ BOOL CDb3Mmap::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) DBFlush(0); lck.unlock(); - NotifyEventHooks(hEventMarkedRead, contactID, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevMarkedRead, contactID, (LPARAM)hDbEvent); return ret; } diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index 7cb981591f..db74e4ffef 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -90,15 +90,6 @@ CDb3Mmap::~CDb3Mmap() if (m_hDbFile != INVALID_HANDLE_VALUE) CloseHandle(m_hDbFile); - DestroyHookableEvent(hContactDeletedEvent); - DestroyHookableEvent(hContactAddedEvent); - DestroyHookableEvent(hSettingChangeEvent); - DestroyHookableEvent(hEventMarkedRead); - - DestroyHookableEvent(hEventAddedEvent); - DestroyHookableEvent(hEventDeletedEvent); - DestroyHookableEvent(hEventFilterAddedEvent); - mir_free(m_tszProfileName); free(m_pNull); @@ -133,16 +124,6 @@ int CDb3Mmap::Load(bool bSkipInit) if (!m_bReadOnly) { if (m_dbHeader.version < DB_095_1_VERSION) return EGROKPRF_CANTREAD; - - // retrieve the event handles - hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED); - hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED); - hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); - hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ); - - hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED); - hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED); - hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD); } FillContacts(); diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index c00c6d8321..4dc7e6a8d2 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -280,7 +280,6 @@ public: protected: DWORD m_dwFileSize, m_dwMaxContactId; - HANDLE hSettingChangeEvent, hContactDeletedEvent, hContactAddedEvent, hEventMarkedRead; DWORD CreateNewSpace(int bytes); void DeleteSpace(DWORD ofs, int bytes); @@ -309,7 +308,6 @@ protected: HANDLE m_hModHeap; LIST m_lMods, m_lOfs; - HANDLE hEventAddedEvent, hEventDeletedEvent, hEventFilterAddedEvent; MCONTACT m_hLastCachedContact; ModuleName *m_lastmn; diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index 299fd1cefd..4db0770ff5 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -329,7 +329,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW if (bIsResident) { lck.unlock(); log2(" set resident as %s (%p)", printVariant(&dbcwWork.value), pCachedValue); - NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcwWork); + NotifyEventHooks(g_hevSettingChanged, contactID, (LPARAM)&dbcwWork); return 0; } } @@ -437,7 +437,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW DBFlush(1); lck.unlock(); // notify - NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcwNotif); + NotifyEventHooks(g_hevSettingChanged, contactID, (LPARAM)&dbcwNotif); return 0; } } @@ -537,7 +537,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW lck.unlock(); // notify - NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcwNotif); + NotifyEventHooks(g_hevSettingChanged, contactID, (LPARAM)&dbcwNotif); return 0; } @@ -627,7 +627,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteContactSetting(MCONTACT contactID, LPCSTR sz dbcws.szModule = szModule; dbcws.szSetting = szSetting; dbcws.value.type = DBVT_DELETED; - NotifyEventHooks(hSettingChangeEvent, saveContact, (LPARAM)&dbcws); + NotifyEventHooks(g_hevSettingChanged, saveContact, (LPARAM)&dbcws); return 0; } diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp index 4216d7da3e..1cda600b34 100644 --- a/plugins/Dbx_mdbx/src/dbcontacts.cpp +++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp @@ -41,7 +41,7 @@ LONG CDbxMDBX::DeleteContact(MCONTACT contactID) if (contactID == 0) // global contact cannot be removed return 1; - NotifyEventHooks(hContactDeletedEvent, contactID, 0); + NotifyEventHooks(g_hevEventDeleted, contactID, 0); { OBJLIST events(50); GatherContactHistory(contactID, events); @@ -102,7 +102,7 @@ MCONTACT CDbxMDBX::AddContact() DBFlush(); - NotifyEventHooks(hContactAddedEvent, dwContactId, 0); + NotifyEventHooks(g_hevEventAdded, dwContactId, 0); return dwContactId; } diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index 545cfd95ce..c62893e8d3 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -127,7 +127,7 @@ BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) } DBFlush(); - NotifyEventHooks(hEventDeletedEvent, contactID, hDbEvent); + NotifyEventHooks(g_hevEventDeleted, contactID, hDbEvent); return 0; } @@ -179,7 +179,7 @@ bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbei, else cc = &m_ccDummy; if (bNew && m_safetyMode) - if (NotifyEventHooks(hEventFilterAddedEvent, contactNotifyID, (LPARAM)dbei)) + if (NotifyEventHooks(g_hevEventFiltered, contactNotifyID, (LPARAM)dbei)) return false; dbe.timestamp = dbei->timestamp; @@ -251,7 +251,7 @@ bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbei, // Notify only in safe mode or on really new events if (m_safetyMode) - NotifyEventHooks(bNew ? hEventAddedEvent : hEventEditedEvent, contactNotifyID, hDbEvent); + NotifyEventHooks(bNew ? g_hevEventAdded : g_hevEventEdited, contactNotifyID, hDbEvent); return true; } @@ -379,7 +379,7 @@ BOOL CDbxMDBX::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) } DBFlush(); - NotifyEventHooks(hEventMarkedRead, contactID, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevMarkedRead, contactID, (LPARAM)hDbEvent); return wRetVal; } diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp index 56c092ff36..e2bb33d12c 100644 --- a/plugins/Dbx_mdbx/src/dbintf.cpp +++ b/plugins/Dbx_mdbx/src/dbintf.cpp @@ -57,14 +57,14 @@ CDbxMDBX::~CDbxMDBX() if (m_crypto) m_crypto->destroy(); - DestroyHookableEvent(hContactDeletedEvent); - DestroyHookableEvent(hContactAddedEvent); - DestroyHookableEvent(hSettingChangeEvent); - DestroyHookableEvent(hEventMarkedRead); + DestroyHookableEvent(g_hevEventDeleted); + DestroyHookableEvent(g_hevEventAdded); + DestroyHookableEvent(g_hevSettingChanged); + DestroyHookableEvent(g_hevMarkedRead); - DestroyHookableEvent(hEventAddedEvent); - DestroyHookableEvent(hEventDeletedEvent); - DestroyHookableEvent(hEventFilterAddedEvent); + DestroyHookableEvent(g_hevEventAdded); + DestroyHookableEvent(g_hevEventDeleted); + DestroyHookableEvent(g_hevEventFiltered); mir_free(m_tszProfileName); } @@ -133,20 +133,6 @@ int CDbxMDBX::Load() if (InitModules()) return EGROKPRF_DAMAGED; if (InitCrypt()) return EGROKPRF_DAMAGED; - // everything is ok, go on - if (!m_bReadOnly) { - // retrieve the event handles - hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED); - hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED); - hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); - hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ); - - hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED); - hEventEditedEvent = CreateHookableEvent(ME_DB_EVENT_EDITED); - hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED); - hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD); - } - FillContacts(); return EGROKPRF_NOERROR; diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h index c250d8cdec..2098412a68 100644 --- a/plugins/Dbx_mdbx/src/dbintf.h +++ b/plugins/Dbx_mdbx/src/dbintf.h @@ -167,8 +167,6 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject MDBX_dbi m_dbGlobal; DBHeader m_header; - HANDLE hSettingChangeEvent, hContactDeletedEvent, hContactAddedEvent, hEventMarkedRead; - HWND m_hwndTimer; // for flushing database DBCachedContact m_ccDummy; // dummy contact to serve a cache item for MCONTACT = 0 @@ -198,8 +196,6 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject MDBX_cursor *m_curEvents, *m_curEventsSort, *m_curEventIds; MEVENT m_dwMaxEventId; - HANDLE hEventAddedEvent, hEventEditedEvent, hEventDeletedEvent, hEventFilterAddedEvent; - void FindNextUnread(const txn_ptr &_txn, DBCachedContact *cc, DBEventSortingKey &key2); //////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Dbx_mdbx/src/dbsettings.cpp b/plugins/Dbx_mdbx/src/dbsettings.cpp index d327e50504..67ae9ceb8c 100644 --- a/plugins/Dbx_mdbx/src/dbsettings.cpp +++ b/plugins/Dbx_mdbx/src/dbsettings.cpp @@ -284,7 +284,7 @@ LBL_WriteString: } if (szCachedSettingName[-1] != 0) { lck.unlock(); - NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcwWork); + NotifyEventHooks(g_hevSettingChanged, contactID, (LPARAM)&dbcwWork); return 0; } } @@ -350,7 +350,7 @@ LBL_WriteString: lck.unlock(); DBFlush(); - NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcwNotif); + NotifyEventHooks(g_hevSettingChanged, contactID, (LPARAM)&dbcwNotif); return 0; } @@ -390,7 +390,7 @@ BOOL CDbxMDBX::DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR dbcws.szModule = szModule; dbcws.szSetting = szSetting; dbcws.value.type = DBVT_DELETED; - NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcws); + NotifyEventHooks(g_hevSettingChanged, contactID, (LPARAM)&dbcws); return 0; } diff --git a/plugins/Dbx_sqlite/src/dbcontacts.cpp b/plugins/Dbx_sqlite/src/dbcontacts.cpp index 882b04d30e..7800e8b09a 100644 --- a/plugins/Dbx_sqlite/src/dbcontacts.cpp +++ b/plugins/Dbx_sqlite/src/dbcontacts.cpp @@ -81,7 +81,7 @@ MCONTACT CDbxSQLite::AddContact() DBCachedContact *cc = m_cache->AddContactToCache(hContact); if (cc == nullptr) return INVALID_CONTACT_ID; - NotifyEventHooks(hContactAddedEvent, hContact); + NotifyEventHooks(g_hevEventAdded, hContact); return hContact; } @@ -104,7 +104,7 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact) } m_cache->FreeCachedContact(hContact); - NotifyEventHooks(hContactDeletedEvent, hContact); + NotifyEventHooks(g_hevEventDeleted, hContact); return 0; } diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index 0bdec1190f..0bde038173 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -115,7 +115,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, DBEVENTINFO *dbei) return 0; if (m_safetyMode) - if (NotifyEventHooks(hEventFilterAddedEvent, hNotifyContact, (LPARAM)dbei)) + if (NotifyEventHooks(g_hevEventFiltered, hNotifyContact, (LPARAM)dbei)) return 0; MEVENT hDbEvent = 0; @@ -174,7 +174,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, DBEVENTINFO *dbei) } if (m_safetyMode) - NotifyEventHooks(hEventAddedEvent, hNotifyContact, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevEventAdded, hNotifyContact, (LPARAM)hDbEvent); return hDbEvent; } @@ -207,7 +207,7 @@ BOOL CDbxSQLite::DeleteEvent(MCONTACT hContact, MEVENT hDbEvent) cc->first = cc->unread = cc->last = 0; } - NotifyEventHooks(hEventDeletedEvent, hContact, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevEventDeleted, hContact, (LPARAM)hDbEvent); return 0; } @@ -239,7 +239,7 @@ BOOL CDbxSQLite::EditEvent(MCONTACT hContact, MEVENT hDbEvent, DBEVENTINFO *dbei assert(rc == SQLITE_ROW || rc == SQLITE_DONE); if (rc == SQLITE_DONE) { cc->first = cc->unread = cc->last = 0; - NotifyEventHooks(hEventEditedEvent, hContact, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevEventEdited, hContact, (LPARAM)hDbEvent); } sqlite3_reset(stmt); return (rc != SQLITE_DONE); @@ -346,7 +346,7 @@ BOOL CDbxSQLite::MarkEventRead(MCONTACT hContact, MEVENT hDbEvent) cc->unread = 0; } - NotifyEventHooks(hEventMarkedRead, hContact, (LPARAM)hDbEvent); + NotifyEventHooks(g_hevMarkedRead, hContact, (LPARAM)hDbEvent); return flags; } diff --git a/plugins/Dbx_sqlite/src/dbintf.cpp b/plugins/Dbx_sqlite/src/dbintf.cpp index dc204d1b4e..35445fc017 100644 --- a/plugins/Dbx_sqlite/src/dbintf.cpp +++ b/plugins/Dbx_sqlite/src/dbintf.cpp @@ -4,27 +4,10 @@ CDbxSQLite::CDbxSQLite(sqlite3 *database) : m_db(database), m_safetyMode(true) { - hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED); - hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED); - hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED); - hEventEditedEvent = CreateHookableEvent(ME_DB_EVENT_EDITED); - hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED); - hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD); - hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ); - hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); } CDbxSQLite::~CDbxSQLite() { - DestroyHookableEvent(hContactAddedEvent); - DestroyHookableEvent(hContactDeletedEvent); - DestroyHookableEvent(hEventAddedEvent); - DestroyHookableEvent(hEventEditedEvent); - DestroyHookableEvent(hEventDeletedEvent); - DestroyHookableEvent(hEventFilterAddedEvent); - DestroyHookableEvent(hEventMarkedRead); - DestroyHookableEvent(hSettingChangeEvent); - UninitEvents(); UninitContacts(); UninitSettings(); diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h index 98c07991ce..85bf3106c5 100644 --- a/plugins/Dbx_sqlite/src/dbintf.h +++ b/plugins/Dbx_sqlite/src/dbintf.h @@ -19,15 +19,6 @@ struct CDbxSQLite : public MDatabaseCommon, public MZeroedObject private: sqlite3 *m_db; - HANDLE hContactAddedEvent; - HANDLE hContactDeletedEvent; - HANDLE hEventAddedEvent; - HANDLE hEventEditedEvent; - HANDLE hEventDeletedEvent; - HANDLE hEventFilterAddedEvent; - HANDLE hEventMarkedRead; - HANDLE hSettingChangeEvent; - DBCachedContact m_system; bool m_safetyMode; diff --git a/plugins/Dbx_sqlite/src/dbsettings.cpp b/plugins/Dbx_sqlite/src/dbsettings.cpp index 8008e451d8..964226ba9a 100644 --- a/plugins/Dbx_sqlite/src/dbsettings.cpp +++ b/plugins/Dbx_sqlite/src/dbsettings.cpp @@ -246,7 +246,7 @@ BOOL CDbxSQLite::WriteContactSetting(MCONTACT hContact, DBCONTACTWRITESETTING *d } if (isResident) { lock.unlock(); - NotifyEventHooks(hSettingChangeEvent, hContact, (LPARAM)&dbcwWork); + NotifyEventHooks(g_hevSettingChanged, hContact, (LPARAM)&dbcwWork); return 0; } } @@ -282,7 +282,7 @@ BOOL CDbxSQLite::WriteContactSetting(MCONTACT hContact, DBCONTACTWRITESETTING *d lock.unlock(); - NotifyEventHooks(hSettingChangeEvent, hContact, (LPARAM)&dbcwNotif); + NotifyEventHooks(g_hevSettingChanged, hContact, (LPARAM)&dbcwNotif); return 0; } @@ -324,7 +324,7 @@ BOOL CDbxSQLite::DeleteContactSetting(MCONTACT hContact, LPCSTR szModule, LPCSTR dbcws.szModule = szModule; dbcws.szSetting = szSetting; dbcws.value.type = DBVT_DELETED; - NotifyEventHooks(hSettingChangeEvent, hContact, (LPARAM)&dbcws); + NotifyEventHooks(g_hevSettingChanged, hContact, (LPARAM)&dbcws); return 0; } -- cgit v1.2.3