From 436e303e24e5046d6cc52ac3da51a0b51adbef36 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 15 Jun 2020 18:35:21 +0300 Subject: simpler way of applying server ids to messages --- include/delphi/m_database.inc | 11 ++++++----- include/m_database.h | 34 ++++++++++++++++------------------ include/m_db_int.h | 2 -- 3 files changed, 22 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index 35bb5118c1..65c3ba5f31 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -40,11 +40,12 @@ type PDBEVENTINFO = ^TDBEVENTINFO; TDBEVENTINFO = record szModule : PAnsiChar; // module that 'owns' this event and controls the data format - timestamp: dword; // timestamp in UNIX time - flags : dword; // the DBEF_* flags above - eventType: word; // event type, such as message, can be module defined - cbBlob : dword; // size in bytes of pBlob^ - pBlob : PByte; // pointer to buffer containing the module defined event data + timestamp: dword; // timestamp in UNIX time + flags : dword; // the DBEF_* flags above + eventType: word; // event type, such as message, can be module defined + cbBlob : dword; // size in bytes of pBlob^ + pBlob : PByte; // pointer to buffer containing the module defined event data + szId : PAnsiChar; // unique server id end; (****************************************************************************** diff --git a/include/m_database.h b/include/m_database.h index c3d030ccb9..c0df1392e7 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -160,23 +160,25 @@ struct DBVARIANT }; }; -#define DBEF_TEMPORARY 1 // disable notifications about temporary database events -#define DBEF_SENT 2 // this event was sent by the user. If not set this event was received. -#define DBEF_READ 4 // event has been read by the user. It does not need to be processed any more except for history. -#define DBEF_RTL 8 // event contains the right-to-left aligned text -#define DBEF_UTF 16 // event contains a text in utf-8 -#define DBEF_ENCRYPTED 32 // event is encrypted (never reported outside a driver) +#define DBEF_TEMPORARY 0x0001 // disable notifications about temporary database events +#define DBEF_SENT 0x0002 // this event was sent by the user. If not set this event was received. +#define DBEF_READ 0x0004 // event has been read by the user. It does not need to be processed any more except for history. +#define DBEF_RTL 0x0008 // event contains the right-to-left aligned text +#define DBEF_UTF 0x0010 // event contains a text in utf-8 +#define DBEF_ENCRYPTED 0x0020 // event is encrypted (never reported outside a driver) +#define DBEF_HAS_ID 0x0040 // event has unique server id struct DBEVENTINFO { - char *szModule; // pointer to name of the module that 'owns' this event - DWORD timestamp; // seconds since 00:00, 01/01/1970. Gives us times until 2106 - // unless you use the standard C library which is - // signed and can only do until 2038. In GMT. - DWORD flags; // combination of DBEF_* flags - WORD eventType; // module-defined event type field - DWORD cbBlob; // size of pBlob in bytes - PBYTE pBlob; // pointer to buffer containing module-defined event data + const char *szModule; // pointer to name of the module that 'owns' this event + DWORD timestamp; // seconds since 00:00, 01/01/1970. Gives us times until 2106 + // unless you use the standard C library which is + // signed and can only do until 2038. In GMT. + DWORD flags; // combination of DBEF_* flags + WORD eventType; // module-defined event type field + DWORD cbBlob; // size of pBlob in bytes + PBYTE pBlob; // pointer to buffer containing module-defined event data + const char *szId; // server id bool __forceinline markedRead() const { return (flags & (DBEF_SENT | DBEF_READ)) != 0; @@ -357,10 +359,6 @@ EXTERN_C MIR_CORE_DLL(MEVENT) db_event_prev(MCONTACT hContact, MEVENT hDbEvent); EXTERN_C MIR_CORE_DLL(MEVENT) db_event_getById(const char *szModule, const char *szId); -// Sets an identifier for an event identified by its module and handle - -EXTERN_C MIR_CORE_DLL(MEVENT) db_event_setId(const char *szModule, MEVENT hDbEvent, const char *szId); - ///////////////////////////////////////////////////////////////////////////////////////// // Database settings diff --git a/include/m_db_int.h b/include/m_db_int.h index d6ca63d206..775c066b5a 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -132,7 +132,6 @@ interface MIR_APP_EXPORT MIDatabase STDMETHOD_(BOOL, Backup)(LPCWSTR) PURE; STDMETHOD_(MEVENT, GetEventById)(LPCSTR szModule, LPCSTR szId) PURE; - STDMETHOD_(BOOL, SetEventId)(LPCSTR szModule, MEVENT, LPCSTR szId) PURE; STDMETHOD_(DB::EventCursor*, EventCursor)(MCONTACT hContact, MEVENT hDbEvent) PURE; STDMETHOD_(DB::EventCursor*, EventCursorRev)(MCONTACT hContact, MEVENT hDbEvent) PURE; @@ -236,7 +235,6 @@ public: //////////////////////////////////////////////////////////////////////////////////////// STDMETHODIMP_(MEVENT) GetEventById(LPCSTR szModule, LPCSTR szId) override; - STDMETHODIMP_(BOOL) SetEventId(LPCSTR szModule, MEVENT, LPCSTR szId) override; }; ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3