From 7bdb598e26e7e98788933af43090d34027166969 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Sep 2016 18:01:49 +0000 Subject: second major wipeout of database services & structures: - DBCONTACTENUMSETTINGS removed; - all helpers moved to mir_core.dll git-svn-id: http://svn.miranda-ng.org/main/trunk@17296 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_api.pas | 1 - include/delphi/m_database.inc | 225 +++++++++-------------------------- include/delphi/m_db_int.inc | 264 ------------------------------------------ 3 files changed, 53 insertions(+), 437 deletions(-) delete mode 100644 include/delphi/m_db_int.inc (limited to 'include/delphi') diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas index e7a5a82b91..c20865c82c 100644 --- a/include/delphi/m_api.pas +++ b/include/delphi/m_api.pas @@ -201,7 +201,6 @@ var {$include m_contacts.inc} {$include m_crypto.inc} {$include m_database.inc} - {$include m_db_int.inc} {$include m_descbutton.inc} {$include m_email.inc} {$include m_extraicons.inc} diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index b11c097a1e..8dd608b9c4 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -67,8 +67,7 @@ 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. } -function db_event_add(hContact:TMCONTACT; dbei:PDBEVENTINFO):TMEVENT; stdcall; - external CoreDLL name 'db_event_add'; +function db_event_add(hContact:TMCONTACT; dbei:PDBEVENTINFO):TMEVENT; stdcall; external CoreDLL; { Gets the number of events in the chain belonging to a contact in the database. @@ -76,8 +75,7 @@ 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. Returns 0 for Subcontacts (use db_event_last to recognize empty history) } -function db_event_count(hContact:TMCONTACT):int; stdcall; - external CoreDLL name 'db_event_count'; +function db_event_count(hContact:TMCONTACT):int; stdcall; external CoreDLL; { Removes a single event from the database @@ -85,16 +83,14 @@ 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 name 'db_event_delete'; +function db_event_delete(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; external CoreDLL; { 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 } -function db_event_first(hContact:TMCONTACT):TMEVENT; stdcall; - external CoreDLL name 'db_event_first'; +function db_event_first(hContact:TMCONTACT):TMEVENT; stdcall; external CoreDLL; { Retrieves a handle to the first unread event in the chain for hContact @@ -107,8 +103,7 @@ 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 } -function db_event_firstUnread(hContact:TMCONTACT):TMEVENT; stdcall; - external CoreDLL name 'db_event_firstUnread'; +function db_event_firstUnread(hContact:TMCONTACT):TMEVENT; stdcall; external CoreDLL; { Retrieves all the information stored in hDbEvent @@ -124,16 +119,14 @@ 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. } -function db_event_get(hDbEvent:TMEVENT; dbei:PDBEVENTINFO):int; stdcall; - external CoreDLL name 'db_event_get'; +function db_event_get(hDbEvent:TMEVENT; dbei:PDBEVENTINFO):int; stdcall; external CoreDLL; { 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 } -function db_event_getBlobSize(hDbEvent:TMEVENT):int; stdcall; - external CoreDLL name 'db_event_getBlobSize'; +function db_event_getBlobSize(hDbEvent:TMEVENT):int; stdcall; external CoreDLL; { Retrieves a handle to the contact that owns hDbEvent. @@ -144,16 +137,14 @@ success This service is exceptionally slow. Use only when you have no other choice at all. } -function db_event_getContact(hDbEvent:TMEVENT):TMCONTACT; stdcall; - external CoreDLL name 'db_event_getContact'; +function db_event_getContact(hDbEvent:TMEVENT):TMCONTACT; stdcall; external CoreDLL; { 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 } -function db_event_last(hContact:TMCONTACT):TMEVENT; stdcall; - external CoreDLL name 'db_event_last'; +function db_event_last(hContact:TMCONTACT):TMEVENT; stdcall; external CoreDLL; { Changes the flags for an event to mark it as read. @@ -163,27 +154,23 @@ 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. } -function db_event_markRead(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; - external CoreDLL name 'db_event_markRead'; +function db_event_markRead(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; external CoreDLL; { 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 } -function db_event_next(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; - external CoreDLL name 'db_event_next'; +function db_event_next(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; external CoreDLL; { 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 } -function db_event_prev(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; - external CoreDLL name 'db_event_prev'; +function db_event_prev(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; external CoreDLL; -function db_free(dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_free'; +function db_free(dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL; (****************************************************************************** * DATABASE CONTACTS @@ -196,8 +183,7 @@ 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. } -function db_find_first(const szModule:PAnsiChar=nil):TMCONTACT; stdcall; - external CoreDLL name 'db_find_first'; +function db_find_first(const szModule:PAnsiChar=nil):TMCONTACT; stdcall; external CoreDLL; { Gets the handle of the next contact after hContact in the database. This handle @@ -206,57 +192,45 @@ 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. } -function db_find_next(hContact:TMCONTACT; const szModule:PAnsiChar=nil):TMCONTACT; stdcall; - external CoreDLL name 'db_find_next'; +function db_find_next(hContact:TMCONTACT; const szModule:PAnsiChar=nil):TMCONTACT; stdcall; external CoreDLL; (****************************************************************************** * DATABASE SETTINGS *) -function db_get(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_get'; -function db_get_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; - external CoreDLL name 'db_get_b'; -function db_get_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; - external CoreDLL name 'db_get_w'; -function db_get_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:dword):dword; stdcall; - external CoreDLL name 'db_get_dw'; -function db_get_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; - external CoreDLL name 'db_get_s'; -function db_get_sa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PAnsiChar; stdcall; - external CoreDLL name 'db_get_sa'; -function db_get_wsa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PWideChar; stdcall; - external CoreDLL name 'db_get_wsa'; - -function db_get_static(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; - external CoreDLL name 'db_get_static'; -function db_get_static_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; - external CoreDLL name 'db_get_static_utf'; -function db_get_wstatic(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PWideChar; destLen:int):int; stdcall; - external CoreDLL name 'db_get_wstatic'; - -function db_set(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_set'; -function db_set_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:byte):int_ptr; stdcall; - external CoreDLL name 'db_set_b'; -function db_set_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:word):int_ptr; stdcall; - external CoreDLL name 'db_set_w'; -function db_set_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:dword):int_ptr; stdcall; - external CoreDLL name 'db_set_dw'; -function db_set_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_set_s'; -function db_set_ws(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PWideChar):int_ptr; stdcall; - external CoreDLL name 'db_set_ws'; -function db_set_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_set_utf'; -function db_set_blob(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:pointer; len:uint):int_ptr; stdcall; - external CoreDLL name 'db_set_blob'; - -function db_unset(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_unset'; - -function db_set_resident(const szModule:PAnsiChar; const szSetting:PAnsiChar; bEnable:int):int; stdcall; - external CoreDLL name 'db_set_resident'; +function db_get(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL; +function db_get_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; external CoreDLL; +function db_get_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; external CoreDLL; +function db_get_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:dword):dword; stdcall; external CoreDLL; +function db_get_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; external CoreDLL; +function db_get_sa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PAnsiChar; stdcall; external CoreDLL; +function db_get_wsa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PWideChar; stdcall; external CoreDLL; + +function db_get_static(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; external CoreDLL; +function db_get_static_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; external CoreDLL; +function db_get_wstatic(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PWideChar; destLen:int):int; stdcall; external CoreDLL; + +function db_set(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL; +function db_set_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:byte):int_ptr; stdcall; external CoreDLL; +function db_set_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:word):int_ptr; stdcall; external CoreDLL; +function db_set_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:dword):int_ptr; stdcall; external CoreDLL; +function db_set_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; external CoreDLL; +function db_set_ws(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PWideChar):int_ptr; stdcall; external CoreDLL; +function db_set_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; external CoreDLL; +function db_set_blob(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:pointer; len:uint):int_ptr; stdcall; external CoreDLL; + +function db_unset(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):int_ptr; stdcall; external CoreDLL; + +function db_set_resident(const szModule:PAnsiChar; const szSetting:PAnsiChar; bEnable:int):int; stdcall; external CoreDLL; + +/////////////////////////////////////////////////////////////////////////////// + +function db_add_contact() : TMCONTACT; stdcall; external CoreDLL; +function db_delete_contact(hContact:TMCONTACT) : int; stdcall; external CoreDLL; + +function db_is_contact(hContact:TMCONTACT) : int; stdcall; external CoreDLL; + +function db_get_contact_count() : int; stdcall; external CoreDLL; /////////////////////////////////////////////////////////////////////////////// @@ -299,62 +273,7 @@ type type TDBSETTINGENUMPROC = function(const szSetting: PAnsiChar; lParam: LPARAM): int; cdecl; - PDBCONTACTENUMSETTINGS = ^TDBCONTACTENUMSETTINGS; - TDBCONTACTENUMSETTINGS = record - pfnEnumProc: TDBSETTINGENUMPROC; // function pointer to call to start the - // enum via MS_DB_CONTACT_ENUMSETTINGS - lParam : LPARAM; // passed to the above function - szModule : PAnsiChar; // name of the module to get settings for - ofsSettings: dword; // not used by us - end; - -const - MS_DB_CONTACT_ENUMSETTINGS:PAnsiChar = 'DB/Contact/EnumSettings'; - - { - wParam : 0 - lParam : 0 - affect : none - returns: Returns the number of contacts in the database for the loaded profile - not including the profile user, see notes. - notes : the contacts in the database can be read with FindFirst/FindNext - } - MS_DB_CONTACT_GETCOUNT:PAnsiChar = 'DB/Contact/GetCount'; - - { - wParam : Handle of a contact to delete - lParam : 0 - affect : the user by the given handle is deleted from the database, see notes - returns: Returns 0 on success or nonzero if the handle was invalid - notes : this triggers DB/Contact/Deleted BEFORE it actually deletes the contact - all events are also deleted -- other modules may end up with invalid - handles because of this, which they should be prepared for. - } - MS_DB_CONTACT_DELETE:PAnsiChar = 'DB/Contact/Delete'; - - { - wParam : 0 - lParam : 0 - affects: creates a new contact in the database, they have no settings, - settings must be added with MS_DB_CONTACT_WRITESETTING or - database helper functions for writing, see notes - returns: A handle to a new contact or NULL(0) on failure. - notes : triggers the ME_DB_CONTACT_ADDED event just before the service returns - } - MS_DB_CONTACT_ADD:PAnsiChar = 'DB/Contact/Add'; - - - { - wParam : (HANDLE) hContact - lParam : 0 - affects: Checks the given handle within the database for valid information, for - a proper internal header. - returns: Returns 1 if the contact handle is valid, 0 if it is not - notes : Due to the nature of multiple threading a contact handle can be deleted - soon after this service has returned a handle as valid, however it will never point - to another contact. - } - MS_DB_CONTACT_IS:PAnsiChar = 'DB/Contact/Is'; +function db_enum_settings(hContact:TMCONTACT; pFunc:TDBSETTINGENUMPROC; szModule:PAnsiChar; param:pointer) : int; stdcall; external CoreDll; //************************** Event ********************************* @@ -398,51 +317,13 @@ function DbEvent_GetTextW(dbei:PDBEVENTINFO; codepage:int) : PWideChar; stdcall; function DbEvent_GetIcon(dbei:PDBEVENTINFO; flags:int) : HICON; stdcall; external AppDll; -//*************************** Random ******************************* - - { - wParam : newSetting (BOOLEAN) - lParam : 0 - Affect : Miranda's database is normally protected against corruption by - aggressively flushing data to the disk on writes, if you're doing - alot of writes e.g. an import plugin, it can sometimes be desirable - to switch this feature off to speed up the process, if you do switch - it off, you must remember that crashes are far more likely to be - catastrophic, so switch it back on at the earliest possible opportunity. - if you're doing a lot of setting writes, the flush is already delayed - so you need not use this service for that purpose, see notes. - Returns: Always returns 0 (successful) - notes : This is set to true initally - } -const - MS_DB_SETSAFETYMODE:PAnsiChar = 'DB/SetSafetyMode'; - //*************************** Modules ****************************** - { - wParam : (caller defined data) will be passed to lParam of the call back - lParam : function pointer to TDBMODULEENUMPROC - Affects: Enumerates the names of all modules that have stored or - requested information from the database, - the modules are returned in no real order -- - Writing to the database while module names are being enumerated will cause - unpredictable results in the enumeration, but the write will work. - - the enumeration will stop if the callback returns a non zero value. - - Returns: the last return value from the enumeration call back. - Notes : This service is only useful for debugging or EnumSettings - version: The service registered to enumerate all modules that have touched - the database module uses wParam as the lParam cookie value and the lParam - value given here is the function pointer -- this is not safe - to use before v0.1.2.1 because I don't know if this was done in v0.1.2.1- - } -type - TDBMODULEENUMPROC = function(const szModule: PAnsiChar; ofsModuleName: dword; lParam: LPARAM): int; cdecl; -const - MS_DB_MODULES_ENUM:PAnsiChar = 'DB/Modules/Enum'; +function db_delete_module(hContact:TMCONTACT; szModuleName:PAnsiChar) : int; stdcall; external CoreDll; + +//************************** RANDOM ******************************** -function DbModule_Delete(hContact:TMCONTACT; szModuleName:PAnsiChar) : int; stdcall; external AppDll; +function db_set_safety_mode(bMode:int) : int; stdcall; external CoreDll; //************************** EVENTS ******************************** diff --git a/include/delphi/m_db_int.inc b/include/delphi/m_db_int.inc deleted file mode 100644 index 9511534cae..0000000000 --- a/include/delphi/m_db_int.inc +++ /dev/null @@ -1,264 +0,0 @@ -{ - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright 2012 Miranda NG 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_DB_INT} -{$DEFINE M_DB_INT} - -/////////////////////////////////////////////////////////////////////////////// -// basic database interface -type - TDBCachedGlobalValue = record - name : PAnsiChar; - value:TDBVARIANT; - end; -type - PDBCachedContactValue = ^TDBCachedContactValue; - TDBCachedContactValue = record - name:PAnsiChar; - value:TDBVARIANT; - next: PDBCachedContactValue; - end; - - PDBCachedContact = ^TDBCachedContact; - TDBCachedContact = record - contactID:TMCONTACT; - szProto:PAnsiChar; - first :PDBCachedContactValue; - last :PDBCachedContactValue; - // metacontacts - nSubs:int; // == -1 -> not a metacontact - pSubs:PMCONTACT; - parentID:TMCONTACT; // == 0 -> not a subcontact - nDefault:int // default sub number - end; - - PMIDatabaseCache = ^MIDatabaseCache; - MIDatabaseCache = interface - function AddContactToCache(contactID:TMCONTACT):PDBCachedContact; stdcall; - function GetCachedContact(contactID:TMCONTACT):PDBCachedContact; stdcall; - function GetFirstContact():PDBCachedContact; stdcall; - function GetNextContact(contactID:TMCONTACT):PDBCachedContact; stdcall; - procedure FreeCachedContact(contactID:TMCONTACT); stdcall; - - function InsertCachedSetting(szName:PAnsiChar; param:int):PAnsiChar; stdcall; - function GetCachedSetting(szModuleName:PAnsiChar; szSettingName:PAnsiChar; param1:int; param2:int):PAnsiChar; stdcall; - procedure SetCachedVariant(s:PDBVARIANT; d:PDBVARIANT); stdcall; - function GetCachedValuePtr(contactID:TMCONTACT; szSetting:PAnsiChar; bAllocate:int):PDBVARIANT; stdcall; - end; - -type - PMIDatabase = ^TMIDatabase; - TMIDatabase = record - m_cache: PMIDatabaseCache; - - IsRelational:function():long; stdcall; - SetCacheSafetyMode:procedure(val:bool); stdcall; - - GetContactCount:function():long; stdcall; - FindFirstContact:function(const szProto:PAnsiChar = NIL):TMCONTACT; stdcall; - FindNextContact:function(contactID:TMCONTACT; const szProto:PAnsiChar = NIL):TMCONTACT; stdcall; - - DeleteContact:function(contactID:TMCONTACT):long; stdcall; - AddContact:function():TMCONTACT; stdcall; - IsDbContact:function(contactID:TMCONTACT):bool; stdcall; - GetContactSize:function():long; stdcall; - - GetEventCount:function(contactID:TMCONTACT):long; stdcall; - AddEvent:function(contactID:TMCONTACT; dbe:PDBEVENTINFO):TMEVENT; stdcall; - DeleteEvent:function(contactID:TMCONTACT; hDbEvent:TMEVENT):bool; stdcall; - GetBlobSize:function(hDbEvent:TMEVENT):long; stdcall; - GetEvent:function(hDbEvent:TMEVENT; dbe:PDBEVENTINFO):bool; stdcall; - MarkEventRead:function(contactID:TMCONTACT; hDbEvent:TMEVENT):bool; stdcall; - GetEventContact:function(hDbEvent:TMEVENT):TMCONTACT; stdcall; - FindFirstEvent:function(contactID:TMCONTACT):TMEVENT; stdcall; - FindFirstUnreadEvent:function(contactID:TMCONTACT):TMEVENT; stdcall; - FindLastEvent:function(contactID:TMCONTACT):TMEVENT; stdcall; - FindNextEvent:function(contactID:TMCONTACT;hDbEvent:TMEVENT):TMEVENT; stdcall; - FindPrevEvent:function(contactID:TMCONTACT;hDbEvent:TMEVENT):TMEVENT; stdcall; - - EnumModuleNames:function(pFunc:TDBMODULEENUMPROC; pParam:pointer):bool; stdcall; - - GetContactSetting:function(contactID:TMCONTACT; szModule, szSetting:PAnsiChar; dbv:PDBVARIANT):bool; stdcall; - GetContactSettingStr:function(contactID:TMCONTACT; szModule, szSetting:PAnsiChar; dbv:PDBVARIANT):bool; stdcall; - GetContactSettingStatic:function(contactID:TMCONTACT; szModule, szSetting:PAnsiChar; dbv:PDBVARIANT):bool; stdcall; - FreeVariant:function(dbv:PDBVARIANT):bool; stdcall; - WriteContactSetting:function(contactID:TMCONTACT; dbcws:PDBCONTACTWRITESETTING):bool; stdcall; - DeleteContactSetting:function(contactID:TMCONTACT; szModule, szSetting:PAnsiChar):bool; stdcall; - EnumContactSettings:function(contactID:TMCONTACT; dbces:PDBCONTACTENUMSETTINGS):bool; stdcall; - SetSettingResident:function(bIsResident:bool; const pszSettingName:PAnsiChar):bool; stdcall; - EnumResidentSettings:function(pFunc:TDBMODULEENUMPROC; pParam:pointer):bool; stdcall; - IsSettingEncrypted:function(szModule:PAnsiChar; szSetting:PAnsiChar):bool; stdcall; - - MetaDetouchSub:function(contact:PDBCachedContact; nSub:int):bool; stdcall; - MetaSetDefault:function(contact:PDBCachedContact):bool; stdcall; - MetaMergeHistory:function(ccMeta:PDBCachedContact; ccSub:PDBCachedContact):bool; stdcall; - MetaSplitHistory:function(ccMeta:PDBCachedContact; ccSub:PDBCachedContact):bool; stdcall; - end; - -/////////////////////////////////////////////////////////////////////////////// -// basic database checker interface - -const - STATUS_MESSAGE = 0; - STATUS_WARNING = 1; - STATUS_ERROR = 2; - STATUS_FATAL = 3; - STATUS_SUCCESS = 4; - -type - pDBCHeckCallback = ^tDBCHeckCallback; - tDBCHeckCallback = record - cbSize:int; - spaceProcessed, - spaceUsed: dword; - hOutFile:THANDLE; - bCheckOnly, - bBackup, - bAggressive, - bEraseHistory, - bMarkRead, - bConvertUtf:int; - pfnAddLogMessage: procedure(_type:int; const szFormat:PWideChar{;...}); cdecl; - end; - -type - PMIDatabaseChecker = ^MIDatabaseChecker; - MIDatabaseChecker = interface - function Start(callback:PDBCHeckCallback):bool;stdcall; - function CheckDb(phase:int; firstTime:int):bool; stdcall; - procedure Destroy(); stdcall; - end; - -/////////////////////////////////////////////////////////////////////////////// -// Each database plugin should register itself using this structure - - -{ - Codes for DATABASELINK functions -} -const -// grokHeader() error codes - EGROKPRF_NOERROR = 0; - EGROKPRF_CANTREAD = 1; // can't open the profile for reading - EGROKPRF_UNKHEADER = 2; // header not supported, not a supported profile - EGROKPRF_VERNEWER = 3; // header correct, version in profile newer than reader/writer - EGROKPRF_DAMAGED = 4; // header/version fine, other internal data missing, damaged. - EGROKPRF_OBSOLETE = 5; // obsolete database version detected, requiring conversion - -// makeDatabase() error codes - EMKPRF_CREATEFAILED = 1; // for some reason CreateFile() didnt like something - -type - PDATABASELINK = ^TDATABASELINK; - TDATABASELINK = record - cbSize : int; - szShortName:PAnsiChar; // uniqie short database name - szFullName:TChar; // in English, auto-translated by the core - { - profile: pointer to a string which contains full path + name - Affect: The database plugin should create the profile, the filepath will not exist at - the time of this call, profile will be C:\..\.dat - Returns: 0 on success, non zero on failure - error contains extended error information, see EMKPRF_ - } - makeDatabase : function (const profile:TChar):int; cdecl; - { - profile: [in] a null terminated string to file path of selected profile - error: [in/out] pointer to an int to set with error if any - Affect: Ask the database plugin if it supports the given profile, if it does it will - return 0, if it doesnt return 1, with the error set in error -- EGROKPRF_ can be valid error - condition, most common error would be [EGROKPRF_UNKHEADER] - Note: Just because 1 is returned, doesnt mean the profile is not supported, the profile might be damaged - etc. - Returns: 0 on success, non zero on failure - } - grokHeader : function (const profile:TChar):int; cdecl; - { - Affect: Tell the database to create all services/hooks that a 3.xx legacy database might support into link, - which is a DATABASELINK structure - Returns: 0 on success, nonzero on failure - } - Load : function (const profile:TChar; bReadOnly:bool):PMIDatabase; cdecl; - { - Affect: The database plugin should shutdown, unloading things from the core and freeing internal structures - Returns: 0 on success, nonzero on failure - Note: Unload() might be called even if Load() was never called, wasLoaded is set to 1 if Load() was ever called. - } - Unload : function (db:PMIDatabase):int; cdecl; - { - Returns a pointer to the database checker or NULL if a database doesn't support checking - When you don't need this object aanymore, call its Destroy() method - } - CheckDB : function (const profile:PWideChar; error:pint):PMIDatabaseChecker;cdecl; - end; - -/////////////////////////////////////////////////////////////////////////////// -// cache access functions - -function db_get_contact(hContact:TMCONTACT):PDBCachedContact; stdcall; - external CoreDLL name 'db_get_contact'; - -/////////////////////////////////////////////////////////////////////////////// -// Database list's services - -const -{ - MS_DB_REGISTER_PLUGIN : registers a database plugin - wParam : 0 (unused) - lParam : DATABASELINK* = database link description -} - MS_DB_REGISTER_PLUGIN:PAnsiChar = 'DB/RegisterPlugin'; - -{ - MS_DB_FIND_PLUGIN : looks for a database plugin suitable to open this file - wParam : 0 (unused) - lParam : const TCHAR* = name of the database file - returns DATABASELINK* of the required plugin or NULL on error -} - MS_DB_FIND_PLUGIN:PAnsiChar = 'DB/FindPlugin'; - -{ - MS_DB_GET_CURRENT : returns the database pointer for the current profile - wParam : 0 (unused) - lParam : 0 (unused) - returns MIDatabase* of the current profile or NULL on error -} - MS_DB_GET_CURRENT:PAnsiChar = 'DB/GetCurrentDb'; - -{ - MS_DB_INIT_INSTANCE : initializes a database instance - wParam : 0 (unused) - lParam : MIDatabase* = pointer to a database instance - returns 0 -} - MS_DB_INIT_INSTANCE:PAnsiChar = 'DB/InitDbInstance'; - - -{ - MS_DB_DESTROY_INSTANCE : destroys a database instance - wParam : 0 (unused) - lParam : MIDatabase* = pointer to a database instance - returns 0 -} - MS_DB_DESTROY_INSTANCE:PAnsiChar = 'DB/DestroyDbInstance'; - -{$ENDIF} -- cgit v1.2.3