diff options
author | George Hazan <ghazan@miranda.im> | 2018-09-23 17:27:04 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-09-23 17:27:12 +0300 |
commit | 95b66d773710bfdc4784ebac07bbb86868fdea8a (patch) | |
tree | ff053043d665086c1c97ebe331c42974eca52614 | |
parent | e5902c3524be5c1473563521c3e6e99acdf3ec3c (diff) |
db_event_edit - new stub for editing messages
-rw-r--r-- | include/m_database.h | 388 | ||||
-rw-r--r-- | include/m_db_int.h | 2 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 181110 -> 181506 bytes | |||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 322750 -> 322966 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 176374 -> 176780 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 323860 -> 324052 bytes | |||
-rw-r--r-- | plugins/Db3x_mmap/src/dbevents.cpp | 29 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.h | 1 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbevents.cpp | 7 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbintf.h | 1 | ||||
-rw-r--r-- | plugins/Dbx_sqlite/src/dbevents.cpp | 5 | ||||
-rw-r--r-- | plugins/Dbx_sqlite/src/dbintf.h | 1 | ||||
-rw-r--r-- | plugins/Import/src/dbrw/dbevents.cpp | 5 | ||||
-rw-r--r-- | plugins/Import/src/dbrw/dbintf.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/MDatabaseReadonly.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/db.cpp | 5 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 1 |
20 files changed, 234 insertions, 220 deletions
diff --git a/include/m_database.h b/include/m_database.h index 8edb101dff..3e911424de 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -1,26 +1,24 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org)
-Copyright (c) 2000-08 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// Miranda NG: the free IM client for Microsoft* Windows*
+//
+// Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org)
+// Copyright (c) 2000-08 Miranda ICQ/IM project,
+// all portions of this codebase are copyrighted to the people
+// listed in contributors.txt.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_DATABASE_H__
#define M_DATABASE_H__ 1
@@ -198,13 +196,11 @@ EXTERN_C MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv); /////////////////////////////////////////////////////////////////////////////////////////
// Database contacts
-/*
-Gets the handle of the first contact in the database. This handle can be used
-with loads of functions. It does not need to be closed.
-You can specify szProto to find only its contacts
-Returns a handle to the first contact in the db on success, or NULL if there
-are no contacts in the db.
-*/
+// Gets the handle of the first contact in the database. This handle can be used
+// with loads of functions. It does not need to be closed.
+// You can specify szProto to find only its contacts
+// Returns a handle to the first contact in the db on success, or NULL if there
+// are no contacts in the db.
#if defined(__cplusplus)
EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto = nullptr);
@@ -212,13 +208,11 @@ EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto = nullptr); EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto);
#endif
-/*
-Gets the handle of the next contact after hContact in the database. This handle
-can be used with loads of functions. It does not need to be closed.
-You can specify szProto to find only its contacts
-Returns a handle to the contact after hContact in the db on success or NULL if
-hContact was the last contact in the db or hContact was invalid.
-*/
+// Gets the handle of the next contact after hContact in the database. This handle
+// can be used with loads of functions. It does not need to be closed.
+// You can specify szProto to find only its contacts
+// Returns a handle to the contact after hContact in the db on success or NULL if
+// hContact was the last contact in the db or hContact was invalid.
#if defined(__cplusplus)
EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto = nullptr);
@@ -260,20 +254,18 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
// Database events
-/*
-Adds a new event to a contact's event list
-Returns a handle to the newly added event, or NULL on failure
-Triggers a db/event/added event just before it returns.
-Events are sorted chronologically as they are entered, so you cannot guarantee
-that the new hEvent is the last event in the chain, however if a new event is
-added that has a timestamp less than 90 seconds *before* the event that should
-be after it, it will be added afterwards, to allow for protocols that only
-store times to the nearest minute, and slight delays in transports.
-There are a few predefined eventTypes below for easier compatibility, but
-modules are free to define their own, beginning at 2000
-DBEVENTINFO.timestamp is in GMT, as returned by time(). There are services
-db/time/x below with useful stuff for dealing with it.
-*/
+// Adds a new event to a contact's event list
+// Returns a handle to the newly added event, or NULL on failure
+// Triggers a db/event/added event just before it returns.
+// Events are sorted chronologically as they are entered, so you cannot guarantee
+// that the new hEvent is the last event in the chain, however if a new event is
+// added that has a timestamp less than 90 seconds *before* the event that should
+// be after it, it will be added afterwards, to allow for protocols that only
+// store times to the nearest minute, and slight delays in transports.
+// There are a few predefined eventTypes below for easier compatibility, but
+// modules are free to define their own, beginning at 2000
+// DBEVENTINFO.timestamp is in GMT, as returned by time(). There are services
+// db/time/x below with useful stuff for dealing with it.
#define EVENTTYPE_MESSAGE 0
#define EVENTTYPE_URL 1
@@ -284,123 +276,99 @@ db/time/x below with useful stuff for dealing with it. EXTERN_C MIR_CORE_DLL(MEVENT) db_event_add(MCONTACT hContact, DBEVENTINFO *dbei);
-/*
-Gets the number of events in the chain belonging to a contact in the database.
-Returns the number of events in the chain owned by hContact or -1 if hContact
-is invalid. They can be retrieved using the db_event_first/last() services.
-*/
+// Gets the number of events in the chain belonging to a contact in the database.
+// Returns the number of events in the chain owned by hContact or -1 if hContact
+// is invalid. They can be retrieved using the db_event_first/last() services.
EXTERN_C MIR_CORE_DLL(int) db_event_count(MCONTACT hContact);
-/*
-Removes a single event from the database
-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
-*/
+// Removes a single event from the database
+// 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
EXTERN_C MIR_CORE_DLL(int) db_event_delete(MCONTACT hContact, MEVENT hDbEvent);
-/*
-Retrieves a handle to the first event in the chain for hContact
-Returns the handle, or NULL if hContact is invalid or has no events
-Events in a chain are sorted chronologically automatically
-*/
+// Edits an event in the database
+// Returns 0 on success, or nonzero on error
-EXTERN_C MIR_CORE_DLL(MEVENT) db_event_first(MCONTACT hContact);
+EXTERN_C MIR_CORE_DLL(int) db_event_edit(MCONTACT hContact, MEVENT hDbEvent, DBEVENTINFO *dbei);
-/*
-Retrieves a handle to the first unread event in the chain for hContact
-Returns the handle, or NULL if hContact is invalid or all its events have been
-read
+// Retrieves a handle to the first event in the chain for hContact
+// Returns the handle, or NULL if hContact is invalid or has no events
+// Events in a chain are sorted chronologically automatically
-Events in a chain are sorted chronologically automatically, but this does not
-necessarily mean that all events after the first unread are unread too. They
-should be checked individually with db_event_next() and db_event_get()
-This service is designed for startup, reloading all the events that remained
-unread from last time
-*/
+EXTERN_C MIR_CORE_DLL(MEVENT) db_event_first(MCONTACT hContact);
+
+// Retrieves a handle to the first unread event in the chain for hContact
+// Returns the handle, or NULL if hContact is invalid or all its events have been read
+//
+// Events in a chain are sorted chronologically automatically, but this does not
+// necessarily mean that all events after the first unread are unread too. They
+// should be checked individually with db_event_next() and db_event_get()
+// This service is designed for startup, reloading all the events that remained
+// unread from last time
EXTERN_C MIR_CORE_DLL(MEVENT) db_event_firstUnread(MCONTACT hContact);
-/*
-Retrieves all the information stored in hDbEvent
-hDbEvent should have been returned by db_event_add/first/last/next/prev()
-Returns 0 on success or nonzero if hDbEvent is invalid
-Don't forget to set dbe.cbSize, dbe.pBlob and dbe.cbBlob before calling this
-service
-The correct value dbe.cbBlob can be got using db/event/getblobsize
-If successful, all the fields of dbe are filled. dbe.cbBlob is set to the
-actual number of bytes retrieved and put in dbe.pBlob
-If dbe.cbBlob is too small, dbe.pBlob is filled up to the size of dbe.cbBlob
-and then dbe.cbBlob is set to the required size of data to go in dbe.pBlob
-On return, dbe.szModule is a pointer to the database module's own internal list
-of modules. Look but don't touch.
-*/
+// Retrieves all the information stored in hDbEvent
+// hDbEvent should have been returned by db_event_add/first/last/next/prev()
+// Returns 0 on success or nonzero if hDbEvent is invalid
+// Don't forget to set dbe.cbSize, dbe.pBlob and dbe.cbBlob before calling this function
+// The correct value dbe.cbBlob can be got using db_event_getBlobSize
+// If successful, all the fields of dbe are filled. dbe.cbBlob is set to the
+// actual number of bytes retrieved and put in dbe.pBlob
+// If dbe.cbBlob is too small, dbe.pBlob is filled up to the size of dbe.cbBlob
+// and then dbe.cbBlob is set to the required size of data to go in dbe.pBlob
+// On return, dbe.szModule is a pointer to the database module's own internal list
+// of modules. Look but don't touch.
EXTERN_C MIR_CORE_DLL(int) db_event_get(MEVENT hDbEvent, DBEVENTINFO *dbei);
-/*
-Retrieves the space in bytes required to store the blob in hDbEvent
-hDbEvent should have been returned by db_event_add/first/last/next/prev()
-Returns the space required in bytes, or -1 if hDbEvent is invalid
-*/
+// Retrieves the space in bytes required to store the blob in hDbEvent
+// hDbEvent should have been returned by db_event_add/first/last/next/prev()
+// Returns the space required in bytes, or -1 if hDbEvent is invalid
EXTERN_C MIR_CORE_DLL(int) db_event_getBlobSize(MEVENT hDbEvent);
-/*
-Retrieves a handle to the contact that owns hDbEvent.
-hDbEvent should have been returned by db_event_add/first/last/next/prev()
-NULL is a valid return value, meaning, as usual, the user.
-Returns INVALID_CONTACT_ID if hDbEvent is invalid, or the handle to the contact on success
-*/
+// Retrieves a handle to the contact that owns hDbEvent.
+// hDbEvent should have been returned by db_event_add/first/last/next/prev()
+// NULL is a valid return value, meaning, as usual, the user.
+// Returns INVALID_CONTACT_ID if hDbEvent is invalid, or the handle to the contact on success
EXTERN_C MIR_CORE_DLL(MCONTACT) db_event_getContact(MEVENT hDbEvent);
-/*
-Retrieves a handle to the last event in the chain for hContact
-Returns the handle, or NULL if hContact is invalid or has no events
-Events in a chain are sorted chronologically automatically
-*/
+// Retrieves a handle to the last event in the chain for hContact
+// Returns the handle, or NULL if hContact is invalid or has no events
+// Events in a chain are sorted chronologically automatically
EXTERN_C MIR_CORE_DLL(MEVENT) db_event_last(MCONTACT hContact);
-/*
-Changes the flags for an event to mark it as read.
-hDbEvent should have been returned by db_event_add/first/last/next/prev()
-Returns the entire flag DWORD for the event after the change, or -1 if hDbEvent
-is invalid.
-This is the one database write operation that does not trigger an event.
-Modules should not save flags states for any length of time.
-*/
+// Changes the flags for an event to mark it as read.
+// hDbEvent should have been returned by db_event_add/first/last/next/prev()
+// Returns the entire flag DWORD for the event after the change, or -1 if hDbEvent is invalid.
+// This is the one database write operation that does not trigger an event.
+// Modules should not save flags states for any length of time.
EXTERN_C MIR_CORE_DLL(int) db_event_markRead(MCONTACT hContact, MEVENT hDbEvent);
-/*
-Retrieves a handle to the next event in a chain after hDbEvent
-Returns the handle, or NULL if hDbEvent is invalid or is the last event
-Events in a chain are sorted chronologically automatically
-*/
+// Retrieves a handle to the next event in a chain after hDbEvent
+// Returns the handle, or NULL if hDbEvent is invalid or is the last event
+// Events in a chain are sorted chronologically automatically
EXTERN_C MIR_CORE_DLL(MEVENT) db_event_next(MCONTACT hContact, MEVENT hDbEvent);
-/*
-Retrieves a handle to the previous event in a chain before hDbEvent
-Returns the handle, or NULL if hDbEvent is invalid or is the first event
-Events in a chain are sorted chronologically automatically
-*/
+// Retrieves a handle to the previous event in a chain before hDbEvent
+// Returns the handle, or NULL if hDbEvent is invalid or is the first event
+// Events in a chain are sorted chronologically automatically
EXTERN_C MIR_CORE_DLL(MEVENT) db_event_prev(MCONTACT hContact, MEVENT hDbEvent);
-/*
-Retrieves a handle to the event identified by its module and unique identifier
-*/
+// Retrieves a handle to the event identified by its module and unique identifier
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
-*/
+// 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);
@@ -583,92 +551,96 @@ EXTERN_C MIR_APP_DLL(wchar_t*) DbEvent_GetString(DBEVENTINFO *dbei, const char * /////////////////////////////////////////////////////////////////////////////////////////
// Database events
-/* DB/Event/Added event
-Called when a new event has been added to the event chain for a contact
- wParam = (MCONTACT)hContact
- lParam = (LPARAM)(HANDLE)hDbEvent
-hDbEvent is a valid handle to the event. hContact is a valid handle to the
-contact to which hDbEvent refers.
-Since events are sorted chronologically, you cannot guarantee that hDbEvent is
-at any particular position in the chain.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// DB/Event/Added event
+// Called when a new event has been added to the event chain for a contact
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(HANDLE)hDbEvent
+// hDbEvent is a valid handle to the event. hContact is a valid handle to the
+// contact to which hDbEvent refers.
+// Since events are sorted chronologically, you cannot guarantee that hDbEvent is
+// at any particular position in the chain.
+
#define ME_DB_EVENT_ADDED "DB/Event/Added"
-/* DB/Event/FilterAdd (NOTE: Added during 0.3.3+ development!)
-Called **before** a new event is made of a DBEVENTINFO structure, this
-hook is not SAFE unless you know what you're doing with it, the arguments
-are passed as-is (with errors, pointer problems, if any) from any arguments
-passed to db_event_add.
-
-The point of this hook is to stop any unwanted database events, to stop
-an event being added, return 1, to allow the event to pass through return
-0.
- wParam = (MCONTACT)hContact
- lParam = (LPARAM)&DBEVENTINFO
-
-Any changed made to the said DBEVENTINFO are also passed along to the database,
-therefore it is possible to shape the data, however DO NOT DO THIS.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// DB/Event/FilterAdd (NOTE: Added during 0.3.3+ development!)
+// Called **before** a new event is made of a DBEVENTINFO structure, this
+// hook is not SAFE unless you know what you're doing with it, the arguments
+// are passed as-is (with errors, pointer problems, if any) from any arguments
+// passed to db_event_add.
+
+// The point of this hook is to stop any unwanted database events, to stop
+// an event being added, return 1, to allow the event to pass through return 0.
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)&DBEVENTINFO
+//
+// Any changed made to the said DBEVENTINFO are also passed along to the database,
+// therefore it is possible to shape the data, however DO NOT DO THIS.
+
#define ME_DB_EVENT_FILTER_ADD "DB/Event/FilterAdd"
-/* DB/Event/Marked/Read event
-Called when an event is marked read
-wParam = (MCONTACT)hContact
-lParam = (LPARAM)(HANDLE)hDbEvent
-hDbEvent is a valid handle to the event.
-hContact is a valid handle to the contact to which hDbEvent refers, and will
-remain valid.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// DB/Event/Marked/Read event
+// Called when an event is marked read
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(HANDLE)hDbEvent
+// hDbEvent is a valid handle to the event.
+// hContact is a valid handle to the contact to which hDbEvent refers, and will remain valid.
+
#define ME_DB_EVENT_MARKED_READ "DB/Event/Marked/Read"
-/* DB/Event/Deleted event
-Called when an event is about to be deleted from the event chain for a contact
- wParam = (MCONTACT)hContact
- lParam = (LPARAM)(HANDLE)hDbEvent
-hDbEvent is a valid handle to the event which is about to be deleted, but it
-won't be once your hook has returned.
-hContact is a valid handle to the contact to which hDbEvent refers, and will
-remain valid.
-Returning nonzero from your hook will not stop the deletion, but it will, as
-usual, stop other hooks from being called.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// DB/Event/Deleted event
+// Called when an event is about to be deleted from the event chain for a contact
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(HANDLE)hDbEvent
+// hDbEvent is a valid handle to the event which is about to be deleted, but it
+// won't be once your hook has returned.
+// hContact is a valid handle to the contact to which hDbEvent refers, and will
+// remain valid.
+// Returning nonzero from your hook will not stop the deletion, but it will, as
+// usual, stop other hooks from being called.
+
#define ME_DB_EVENT_DELETED "DB/Event/Deleted"
-/* DB/Contact/Added event
-Called when a new contact has been added to the database
- wParam = (MCONTACT)hContact
- lParam = 0
-hContact is a valid handle to the new contact.
-Contacts are initially created without any settings, so if you hook this event
-you will almost certainly also want to hook db/contact/settingchanged as well.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// DB/Contact/Added event
+// Called when a new contact has been added to the database
+// wParam = (MCONTACT)hContact
+// lParam = 0
+// hContact is a valid handle to the new contact.
+// Contacts are initially created without any settings, so if you hook this event
+// you will almost certainly also want to hook db/contact/settingchanged as well.
+
#define ME_DB_CONTACT_ADDED "DB/Contact/Added"
-/* DB/Contact/Deleted event
-Called when an contact is about to be deleted
- wParam = (MCONTACT)hContact
- lParam = 0
-hContact is a valid handle to the contact which is about to be deleted, but it
-won't be once your hook has returned.
-Returning nonzero from your hook will not stop the deletion, but it will, as
-usual, stop other hooks from being called.
-Deleting a contact invalidates all events in its chain.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// DB/Contact/Deleted event
+// Called when an contact is about to be deleted
+// wParam = (MCONTACT)hContact
+// lParam = 0
+// hContact is a valid handle to the contact which is about to be deleted, but it
+// won't be once your hook has returned.
+// Returning nonzero from your hook will not stop the deletion, but it will, as
+// usual, stop other hooks from being called.
+// Deleting a contact invalidates all events in its chain.
+
#define ME_DB_CONTACT_DELETED "DB/Contact/Deleted"
-/* DB/Contact/SettingChanged event
-Called when a contact has had one of its settings changed
- wParam = (MCONTACT)hContact
- lParam = (LPARAM)(DBCONTACTWRITESETTING*)&dbcws
-hContact is a valid handle to the contact that has changed.
-This event will be triggered many times rapidly when a whole bunch of values
-are set.
-Modules which hook this should be aware of this fact and quickly return if they
-are not interested in the value that has been changed.
-Careful not to get into infinite loops with this event.
-The structure dbcws is the same one as is passed to the original service, so
-don't change any of the members.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// DB/Contact/SettingChanged event
+// Called when a contact has had one of its settings changed
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(DBCONTACTWRITESETTING*)&dbcws
+// hContact is a valid handle to the contact that has changed.
+// This event will be triggered many times rapidly when a whole bunch of values are set.
+// Modules which hook this should be aware of this fact and quickly return if they
+// are not interested in the value that has been changed.
+// Careful not to get into infinite loops with this event.
+// The structure dbcws is the same one as is passed to the original service, so
+// don't change any of the members.
+
#define ME_DB_CONTACT_SETTINGCHANGED "DB/Contact/SettingChanged"
/////////////////////////////////////////////////////////////////////////////////////////
@@ -676,7 +648,7 @@ don't change any of the members. #ifndef DB_NOHELPERFUNCTIONS
-/* inlined range tolerate versions */
+///////////////////////////////////////////////////////////////////////////////////////// inlined range tolerate versions */
__inline BYTE DBGetContactSettingRangedByte(MCONTACT hContact, const char *szModule, const char *szSetting, BYTE errorValue, BYTE minValue, BYTE maxValue)
{
@@ -701,7 +673,7 @@ __inline DWORD DBGetContactSettingRangedDword(MCONTACT hContact, const char *szM /////////////////////////////////////////////////////////////////////////////////////////
// Helper to process the auth req body
-/* blob is: 0(DWORD), hContact(DWORD), nick(UTF8), firstName(UTF8), lastName(UTF8), email(UTF8), reason(UTF8) */
+///////////////////////////////////////////////////////////////////////////////////////// blob is: 0(DWORD), hContact(DWORD), nick(UTF8), firstName(UTF8), lastName(UTF8), email(UTF8), reason(UTF8) */
#pragma warning(disable : 4251)
diff --git a/include/m_db_int.h b/include/m_db_int.h index 3c07534ced..0c8fcff3fe 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -97,6 +97,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, EditEvent)(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) PURE;
STDMETHOD_(LONG, GetBlobSize)(MEVENT hDbEvent) PURE;
STDMETHOD_(BOOL, GetEvent)(MEVENT hDbEvent, DBEVENTINFO *dbe) PURE;
STDMETHOD_(BOOL, MarkEventRead)(MCONTACT contactID, MEVENT hDbEvent) PURE;
@@ -208,6 +209,7 @@ public: ////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT, DBEVENTINFO*) override;
STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT, MEVENT) override;
+ STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe);
STDMETHODIMP_(LONG) GetBlobSize(MEVENT) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT, MEVENT) override;
STDMETHODIMP_(MCONTACT) GetEventContact(MEVENT) override;
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 317438069d..260a657a22 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 ead783bb0f..1797cf3b93 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 280ac51e0e..0ce2622b7d 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 1c7b47d424..ae0cf50018 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 34a0ae2d3f..3f6d575329 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -23,14 +23,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-STDMETHODIMP_(LONG) CDb3Mmap::GetEventCount(MCONTACT contactID)
+LONG CDb3Mmap::GetEventCount(MCONTACT contactID)
{
mir_cslock lck(m_csDbAccess);
DBContact *dbc = (DBContact*)DBRead(GetContactOffset(contactID), nullptr);
return (dbc->signature != DBCONTACT_SIGNATURE) ? -1 : dbc->eventCount;
}
-STDMETHODIMP_(MEVENT) CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
+MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
{
if (dbei == nullptr) return 0;
if (dbei->timestamp == 0) return 0;
@@ -162,7 +162,7 @@ STDMETHODIMP_(MEVENT) CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) return (MEVENT)ofsNew;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
+BOOL CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
{
DBCachedContact *cc;
if (contactID) {
@@ -257,14 +257,19 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) return 0;
}
-STDMETHODIMP_(LONG) CDb3Mmap::GetBlobSize(MEVENT hDbEvent)
+BOOL CDb3Mmap::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe)
+{
+ return 1;
+}
+
+LONG CDb3Mmap::GetBlobSize(MEVENT hDbEvent)
{
mir_cslock lck(m_csDbAccess);
DBEvent *dbe = AdaptEvent((DWORD)hDbEvent, 0);
return (dbe->signature != DBEVENT_SIGNATURE) ? -1 : dbe->cbBlob;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
+BOOL CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
{
if (dbei == nullptr) return 1;
if (dbei->cbBlob > 0 && dbei->pBlob == nullptr) {
@@ -306,7 +311,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) return 0;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
+BOOL CDb3Mmap::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
{
DBCachedContact *cc;
if (contactID) {
@@ -356,14 +361,14 @@ STDMETHODIMP_(BOOL) CDb3Mmap::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) return ret;
}
-STDMETHODIMP_(MCONTACT) CDb3Mmap::GetEventContact(MEVENT hDbEvent)
+MCONTACT CDb3Mmap::GetEventContact(MEVENT hDbEvent)
{
mir_cslock lck(m_csDbAccess);
DBEvent *dbe = AdaptEvent((DWORD)hDbEvent, INVALID_CONTACT_ID);
return (dbe->signature != DBEVENT_SIGNATURE) ? INVALID_CONTACT_ID : dbe->contactID;
}
-STDMETHODIMP_(MEVENT) CDb3Mmap::FindFirstEvent(MCONTACT contactID)
+MEVENT CDb3Mmap::FindFirstEvent(MCONTACT contactID)
{
DBCachedContact *cc;
DWORD ofsContact = GetContactOffset(contactID, &cc);
@@ -392,7 +397,7 @@ STDMETHODIMP_(MEVENT) CDb3Mmap::FindFirstEvent(MCONTACT contactID) return 0;
}
-STDMETHODIMP_(MEVENT) CDb3Mmap::FindFirstUnreadEvent(MCONTACT contactID)
+MEVENT CDb3Mmap::FindFirstUnreadEvent(MCONTACT contactID)
{
DBCachedContact *cc;
DWORD ofsContact = GetContactOffset(contactID, &cc);
@@ -421,7 +426,7 @@ STDMETHODIMP_(MEVENT) CDb3Mmap::FindFirstUnreadEvent(MCONTACT contactID) return 0;
}
-STDMETHODIMP_(MEVENT) CDb3Mmap::FindLastEvent(MCONTACT contactID)
+MEVENT CDb3Mmap::FindLastEvent(MCONTACT contactID)
{
DBCachedContact *cc;
DWORD ofsContact = GetContactOffset(contactID, &cc);
@@ -450,7 +455,7 @@ STDMETHODIMP_(MEVENT) CDb3Mmap::FindLastEvent(MCONTACT contactID) return 0;
}
-STDMETHODIMP_(MEVENT) CDb3Mmap::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent)
+MEVENT CDb3Mmap::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent)
{
DBCachedContact *cc = (contactID) ? m_cache->GetCachedContact(contactID) : nullptr;
@@ -472,7 +477,7 @@ STDMETHODIMP_(MEVENT) CDb3Mmap::FindNextEvent(MCONTACT contactID, MEVENT hDbEven return 0;
}
-STDMETHODIMP_(MEVENT) CDb3Mmap::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent)
+MEVENT CDb3Mmap::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent)
{
DBCachedContact *cc = (contactID) ? m_cache->GetCachedContact(contactID) : nullptr;
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 8f5970ff99..c00c6d8321 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -220,6 +220,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) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override;
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index 27b9c1c52e..4485cf0dc0 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -230,6 +230,13 @@ BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) ///////////////////////////////////////////////////////////////////////////////
+BOOL CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe)
+{
+ return 1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
LONG CDbxMDBX::GetBlobSize(MEVENT hDbEvent)
{
txn_ptr_ro txn(m_txn_ro);
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h index f7986e2b5c..8f1b6ab24b 100644 --- a/plugins/Dbx_mdbx/src/dbintf.h +++ b/plugins/Dbx_mdbx/src/dbintf.h @@ -254,6 +254,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) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override;
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index d6af4ee98e..22324d96e1 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -135,6 +135,11 @@ BOOL CDbxSQLite::DeleteEvent(MCONTACT hContact, MEVENT hDbEvent) return 0; } +BOOL CDbxSQLite::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) +{ + return 1; // not supported +} + LONG CDbxSQLite::GetBlobSize(MEVENT hDbEvent) { if (hDbEvent == 0) diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h index 4ab30580a5..08e3e419f2 100644 --- a/plugins/Dbx_sqlite/src/dbintf.h +++ b/plugins/Dbx_sqlite/src/dbintf.h @@ -43,6 +43,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) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override; STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override; STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override; STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override; diff --git a/plugins/Import/src/dbrw/dbevents.cpp b/plugins/Import/src/dbrw/dbevents.cpp index 062cc79069..d6db3c1ae2 100644 --- a/plugins/Import/src/dbrw/dbevents.cpp +++ b/plugins/Import/src/dbrw/dbevents.cpp @@ -44,6 +44,11 @@ STDMETHODIMP_(BOOL) CDbxSQLite::DeleteEvent(MCONTACT, MEVENT) return FALSE; } +BOOL CDbxSQLite::EditEvent(MCONTACT, MEVENT, DBEVENTINFO*) +{ + return 1; +} + STDMETHODIMP_(LONG) CDbxSQLite::GetBlobSize(MEVENT hDbEvent) { mir_cslock lock(m_csDbAccess); diff --git a/plugins/Import/src/dbrw/dbintf.h b/plugins/Import/src/dbrw/dbintf.h index 692316c38f..eb23330477 100644 --- a/plugins/Import/src/dbrw/dbintf.h +++ b/plugins/Import/src/dbrw/dbintf.h @@ -135,6 +135,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) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override; STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override; STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override; STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override; diff --git a/src/mir_app/src/MDatabaseReadonly.cpp b/src/mir_app/src/MDatabaseReadonly.cpp index 4464715ae1..96226aa709 100644 --- a/src/mir_app/src/MDatabaseReadonly.cpp +++ b/src/mir_app/src/MDatabaseReadonly.cpp @@ -76,6 +76,11 @@ BOOL MDatabaseReadonly::DeleteEvent(MCONTACT, MEVENT) return 1; } +BOOL MDatabaseReadonly::EditEvent(MCONTACT, MEVENT, DBEVENTINFO*) +{ + return 1; +} + LONG MDatabaseReadonly::GetBlobSize(MEVENT) { return 0; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index b9f156f89f..2a4d43f391 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -652,3 +652,4 @@ Miranda_WaitOnHandleEx @663 ??_7MDatabaseReadonly@@6B@ @685 NONAME
?GetEventById@MDatabaseReadonly@@UAGIPBD0@Z @686 NONAME
?SetEventId@MDatabaseReadonly@@UAGHPBDI0@Z @687 NONAME
+?EditEvent@MDatabaseReadonly@@UAGHIIPAUDBEVENTINFO@@@Z @688 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 200a31a90c..fc9155d7cb 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -652,3 +652,4 @@ Miranda_WaitOnHandleEx @663 ??_7MDatabaseReadonly@@6B@ @685 NONAME
?GetEventById@MDatabaseReadonly@@UEAAIPEBD0@Z @686 NONAME
?SetEventId@MDatabaseReadonly@@UEAAHPEBDI0@Z @687 NONAME
+?EditEvent@MDatabaseReadonly@@UEAAHIIPEAUDBEVENTINFO@@@Z @688 NONAME
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 1fae803761..87eb0ed80c 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -361,6 +361,11 @@ MIR_CORE_DLL(int) db_event_delete(MCONTACT hContact, MEVENT hDbEvent) return (currDb == nullptr) ? 0 : currDb->DeleteEvent(hContact, hDbEvent);
}
+MIR_CORE_DLL(int) db_event_edit(MCONTACT hContact, MEVENT hDbEvent, DBEVENTINFO *dbei)
+{
+ return (currDb == nullptr) ? 0 : currDb->EditEvent(hContact, hDbEvent, dbei);
+}
+
MIR_CORE_DLL(MEVENT) db_event_first(MCONTACT hContact)
{
return (currDb == nullptr) ? 0 : currDb->FindFirstEvent(hContact);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 968b8f764f..1b50cfafc5 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1067,3 +1067,4 @@ CallObjectEventHook @1259 ?VerifyControls@CDlgBase@@AAE_NP8CCtrlBase@@AE_NXZ@Z @1265 NONAME
db_event_getById @1266
db_event_setId @1267
+db_event_edit @1268
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 17079509be..f43d9b35ed 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1067,3 +1067,4 @@ CallObjectEventHook @1259 ?VerifyControls@CDlgBase@@AEAA_NP8CCtrlBase@@EAA_NXZ@Z @1265 NONAME
db_event_getById @1266
db_event_setId @1267
+db_event_edit @1268
|