diff options
author | George Hazan <ghazan@miranda.im> | 2018-10-10 23:26:08 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-10-10 23:26:08 +0300 |
commit | 39681c2aa83e33d46598f8aeecd10370b04cf364 (patch) | |
tree | ee9ef3cb681b97f5d9f8e046add17b8356e9d7ad /plugins/Dbx_mdbx/src | |
parent | 802cbbae257dca16957d9b7e028be1d0d468e097 (diff) |
stupid schema with event handles sharing via CreateEventHook eliminated
Diffstat (limited to 'plugins/Dbx_mdbx/src')
-rw-r--r-- | plugins/Dbx_mdbx/src/dbcontacts.cpp | 4 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbevents.cpp | 8 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbintf.cpp | 28 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbintf.h | 4 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbsettings.cpp | 6 |
5 files changed, 16 insertions, 34 deletions
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<EventItem> 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;
}
|