diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/delphi/m_core.inc | 4 | ||||
-rw-r--r-- | include/delphi/m_db_int.inc | 56 | ||||
-rw-r--r-- | include/m_core.h | 3 | ||||
-rw-r--r-- | include/m_db_int.h | 59 |
4 files changed, 66 insertions, 56 deletions
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 79bbe29b3f..7ee88e52c0 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -53,6 +53,7 @@ const DBVTF_VARIABLELENGTH = $80; // ?
type
+ MCONTACT = DWORD;
HDBEVENT = THANDLE;
PDBVARIANT = ^TDBVARIANT;
TDBVARIANT = record
@@ -75,6 +76,9 @@ type end;
const
+ INVALID_CONTACT_ID = MCONTACT(-1);
+
+const
DBEF_FIRST = 1; // internally only, do not use
DBEF_SENT = 2; // if set, the event was sent by the user, otherwise it was received
DBEF_READ = 4; // event has been read by the user -- only needed for history
diff --git a/include/delphi/m_db_int.inc b/include/delphi/m_db_int.inc index 3b5dd22df1..106cc3bbfe 100644 --- a/include/delphi/m_db_int.inc +++ b/include/delphi/m_db_int.inc @@ -41,23 +41,25 @@ type PDBCachedContact = ^TDBCachedContact;
TDBCachedContact = record
- hContact:THANDLE;
- hNext :THANDLE;
- szProto :PAnsiChar;
- first :PDBCachedContactValue;
- last :PDBCachedContactValue;
+ contactID:MCONTACT;
+ dwDriverData:DWORD;
+ szProto:PAnsiChar;
+ first :PDBCachedContactValue;
+ last :PDBCachedContactValue;
end;
PMIDatabaseCache = ^MIDatabaseCache;
MIDatabaseCache = interface
- function AddContactToCache(hContact:THANDLE):PDBCachedContact; stdcall;
- function GetCachedContact(hContact:THANDLE):PDBCachedContact; stdcall;
- procedure FreeCachedContact(hContact:THANDLE); stdcall;
+ function AddContactToCache(contactID:MCONTACT):PDBCachedContact; stdcall;
+ function GetCachedContact(contactID:MCONTACT):PDBCachedContact; stdcall;
+ function GetFirstContact():PDBCachedContact; stdcall;
+ function GetNextContact(contactID:MCONTACT):PDBCachedContact; stdcall;
+ procedure FreeCachedContact(contactID:MCONTACT); 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(hContact:THANDLE; szSetting:pAnsiChar; bAllocate:int):PDBVARIANT; stdcall;
+ function GetCachedValuePtr(contactID:MCONTACT; szSetting:pAnsiChar; bAllocate:int):PDBVARIANT; stdcall;
end;
type
@@ -68,35 +70,35 @@ type SetCacheSafetyMode:procedure(val:bool); stdcall;
GetContactCount:function():long; stdcall;
- FindFirstContact:function(const szProto:PAnsiChar = NIL):THANDLE; stdcall;
- FindNextContact:function(hContact:THANDLE; const szProto:PAnsiChar = NIL):THANDLE; stdcall;
+ FindFirstContact:function(const szProto:PAnsiChar = NIL):MCONTACT; stdcall;
+ FindNextContact:function(contactID:MCONTACT; const szProto:PAnsiChar = NIL):MCONTACT; stdcall;
- DeleteContact:function(hContact:THANDLE):long; stdcall;
- AddContact:function():THANDLE; stdcall;
- IsDbContact:function(hContact:THANDLE):bool; stdcall;
+ DeleteContact:function(contactID:MCONTACT):long; stdcall;
+ AddContact:function():MCONTACT; stdcall;
+ IsDbContact:function(contactID:MCONTACT):bool; stdcall;
- GetEventCount:function(hContact:THANDLE):long; stdcall;
- AddEvent:function(hContact:THANDLE; dbe:PDBEVENTINFO):THANDLE; stdcall;
- DeleteEvent:function(hContact:THANDLE; hDbEvent:THANDLE):bool; stdcall;
+ GetEventCount:function(contactID:MCONTACT):long; stdcall;
+ AddEvent:function(contactID:MCONTACT; dbe:PDBEVENTINFO):THANDLE; stdcall;
+ DeleteEvent:function(contactID:MCONTACT; hDbEvent:THANDLE):bool; stdcall;
GetBlobSize:function(hDbEvent:THANDLE):long; stdcall;
GetEvent:function(hDbEvent:THANDLE; dbe:PDBEVENTINFO):bool; stdcall;
- MarkEventRead:function(hContact:THANDLE; hDbEvent:THANDLE):bool; stdcall;
+ MarkEventRead:function(contactID:MCONTACT; hDbEvent:THANDLE):bool; stdcall;
GetEventContact:function(hDbEvent:THANDLE):THANDLE; stdcall;
- FindFirstEvent:function(hContact:THANDLE):THANDLE; stdcall;
- FindFirstUnreadEvent:function(hContact:THANDLE):THANDLE; stdcall;
- FindLastEvent:function(hContact:THANDLE):THANDLE; stdcall;
+ FindFirstEvent:function(contactID:MCONTACT):THANDLE; stdcall;
+ FindFirstUnreadEvent:function(contactID:MCONTACT):THANDLE; stdcall;
+ FindLastEvent:function(contactID:MCONTACT):THANDLE; stdcall;
FindNextEvent:function(hDbEvent:THANDLE):THANDLE; stdcall;
FindPrevEvent:function(hDbEvent:THANDLE):THANDLE; stdcall;
EnumModuleNames:function(pFunc:TDBMODULEENUMPROC; pParam:pointer):bool; stdcall;
- GetContactSetting:function(hContact:THANDLE; szModule, szSetting:pAnsiChar; dbv:PDBVARIANT):bool; stdcall;
- GetContactSettingStr:function(hContact:THANDLE; szModule, szSetting:pAnsiChar; dbv:PDBVARIANT):bool; stdcall;
- GetContactSettingStatic:function(hContact:THANDLE; szModule, szSetting:pAnsiChar; dbv:PDBVARIANT):bool; stdcall;
+ GetContactSetting:function(contactID:MCONTACT; szModule, szSetting:pAnsiChar; dbv:PDBVARIANT):bool; stdcall;
+ GetContactSettingStr:function(contactID:MCONTACT; szModule, szSetting:pAnsiChar; dbv:PDBVARIANT):bool; stdcall;
+ GetContactSettingStatic:function(contactID:MCONTACT; szModule, szSetting:pAnsiChar; dbv:PDBVARIANT):bool; stdcall;
FreeVariant:function(dbv:PDBVARIANT):bool; stdcall;
- WriteContactSetting:function(hContact:THANDLE; dbcws:PDBCONTACTWRITESETTING):bool; stdcall;
- DeleteContactSetting:function(hContact:THANDLE; szModule, szSetting:pAnsiChar):bool; stdcall;
- EnumContactSettings:function(hContact:THANDLE; dbces:PDBCONTACTENUMSETTINGS):bool; stdcall;
+ WriteContactSetting:function(contactID:MCONTACT; dbcws:PDBCONTACTWRITESETTING):bool; stdcall;
+ DeleteContactSetting:function(contactID:MCONTACT; szModule, szSetting:pAnsiChar):bool; stdcall;
+ EnumContactSettings:function(contactID:MCONTACT; 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;
diff --git a/include/m_core.h b/include/m_core.h index b6ef9ffb1d..4f77e965a5 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -48,6 +48,9 @@ MIR_CORE_DLL(LPCTSTR) CmdLine_GetOption(LPCTSTR ptszParameter); ///////////////////////////////////////////////////////////////////////////////
// database functions
+typedef UINT32 MCONTACT;
+#define INVALID_CONTACT_ID (MCONTACT(-1))
+
// DBVARIANT: used by db/contact/getsetting and db/contact/writesetting
#define DBVT_DELETED 0 //this setting just got deleted, no other values are valid
#define DBVT_BYTE 1 //bVal and cVal are valid
diff --git a/include/m_db_int.h b/include/m_db_int.h index 8d7adfa9b6..81a6c3a433 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -33,36 +33,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct DBCachedGlobalValue
{
- char* name;
+ char *name;
DBVARIANT value;
};
struct DBCachedContactValue
{
- char* name;
+ char *name;
DBVARIANT value;
- DBCachedContactValue* next;
+ DBCachedContactValue *next;
};
struct DBCachedContact
{
- HANDLE hContact;
- HANDLE hNext;
- char *szProto;
- DBCachedContactValue* first;
- DBCachedContactValue* last;
+ MCONTACT contactID;
+ DWORD dwDriverData;
+ char *szProto;
+ DBCachedContactValue *first, *last;
};
interface MIDatabaseCache : public MZeroedObject
{
- STDMETHOD_(DBCachedContact*,AddContactToCache)(HANDLE hContact) PURE;
- STDMETHOD_(DBCachedContact*,GetCachedContact)(HANDLE hContact) PURE;
- STDMETHOD_(void,FreeCachedContact)(HANDLE hContact) PURE;
+ STDMETHOD_(DBCachedContact*,AddContactToCache)(MCONTACT contactID) PURE;
+ STDMETHOD_(DBCachedContact*, GetCachedContact)(MCONTACT contactID) PURE;
+ STDMETHOD_(DBCachedContact*, GetFirstContact)(void) PURE;
+ STDMETHOD_(DBCachedContact*, GetNextContact)(MCONTACT contactID) PURE;
+ STDMETHOD_(void, FreeCachedContact)(MCONTACT contactID) PURE;
STDMETHOD_(char*,InsertCachedSetting)(const char *szName, int) PURE;
STDMETHOD_(char*,GetCachedSetting)(const char *szModuleName, const char *szSettingName, int, int) PURE;
STDMETHOD_(void,SetCachedVariant)(DBVARIANT *s, DBVARIANT *d) PURE;
- STDMETHOD_(DBVARIANT*,GetCachedValuePtr)(HANDLE hContact, char *szSetting, int bAllocate) PURE;
+ STDMETHOD_(DBVARIANT*,GetCachedValuePtr)(MCONTACT contactID, char *szSetting, int bAllocate) PURE;
};
interface MIDatabase
@@ -72,35 +73,35 @@ interface MIDatabase STDMETHOD_(void,SetCacheSafetyMode)(BOOL) PURE;
STDMETHOD_(LONG,GetContactCount)(void) PURE;
- STDMETHOD_(HANDLE,FindFirstContact)(const char *szProto = NULL) PURE;
- STDMETHOD_(HANDLE,FindNextContact)(HANDLE hContact, const char *szProto = NULL) PURE;
+ STDMETHOD_(MCONTACT,FindFirstContact)(const char *szProto = NULL) PURE;
+ STDMETHOD_(MCONTACT, FindNextContact)(MCONTACT contactID, const char *szProto = NULL) PURE;
- STDMETHOD_(LONG,DeleteContact)(HANDLE hContact) PURE;
+ STDMETHOD_(LONG,DeleteContact)(MCONTACT contactID) PURE;
STDMETHOD_(HANDLE,AddContact)(void) PURE;
- STDMETHOD_(BOOL,IsDbContact)(HANDLE hContact) PURE;
+ STDMETHOD_(BOOL,IsDbContact)(MCONTACT contactID) PURE;
- STDMETHOD_(LONG,GetEventCount)(HANDLE hContact) PURE;
- STDMETHOD_(HANDLE,AddEvent)(HANDLE hContact, DBEVENTINFO *dbe) PURE;
- STDMETHOD_(BOOL,DeleteEvent)(HANDLE hContact, HANDLE hDbEvent) PURE;
+ STDMETHOD_(LONG,GetEventCount)(MCONTACT contactID) PURE;
+ STDMETHOD_(HANDLE,AddEvent)(MCONTACT contactID, DBEVENTINFO *dbe) PURE;
+ STDMETHOD_(BOOL,DeleteEvent)(MCONTACT contactID, HANDLE hDbEvent) PURE;
STDMETHOD_(LONG,GetBlobSize)(HANDLE hDbEvent) PURE;
STDMETHOD_(BOOL,GetEvent)(HANDLE hDbEvent, DBEVENTINFO *dbe) PURE;
- STDMETHOD_(BOOL,MarkEventRead)(HANDLE hContact, HANDLE hDbEvent) PURE;
+ STDMETHOD_(BOOL,MarkEventRead)(MCONTACT contactID, HANDLE hDbEvent) PURE;
STDMETHOD_(HANDLE,GetEventContact)(HANDLE hDbEvent) PURE;
- STDMETHOD_(HANDLE,FindFirstEvent)(HANDLE hContact) PURE;
- STDMETHOD_(HANDLE,FindFirstUnreadEvent)(HANDLE hContact) PURE;
- STDMETHOD_(HANDLE,FindLastEvent)(HANDLE hContact) PURE;
+ STDMETHOD_(HANDLE,FindFirstEvent)(MCONTACT contactID) PURE;
+ STDMETHOD_(HANDLE,FindFirstUnreadEvent)(MCONTACT contactID) PURE;
+ STDMETHOD_(HANDLE,FindLastEvent)(MCONTACT contactID) PURE;
STDMETHOD_(HANDLE,FindNextEvent)(HANDLE hDbEvent) PURE;
STDMETHOD_(HANDLE,FindPrevEvent)(HANDLE hDbEvent) PURE;
STDMETHOD_(BOOL,EnumModuleNames)(DBMODULEENUMPROC pFunc, void *pParam) PURE;
- STDMETHOD_(BOOL,GetContactSetting)(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) PURE;
- STDMETHOD_(BOOL,GetContactSettingStr)(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) PURE;
- STDMETHOD_(BOOL,GetContactSettingStatic)(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) PURE;
+ STDMETHOD_(BOOL,GetContactSetting)(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) PURE;
+ STDMETHOD_(BOOL,GetContactSettingStr)(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) PURE;
+ STDMETHOD_(BOOL,GetContactSettingStatic)(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv) PURE;
STDMETHOD_(BOOL,FreeVariant)(DBVARIANT *dbv) PURE;
- STDMETHOD_(BOOL,WriteContactSetting)(HANDLE hContact, DBCONTACTWRITESETTING *dbcws) PURE;
- STDMETHOD_(BOOL,DeleteContactSetting)(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting) PURE;
- STDMETHOD_(BOOL,EnumContactSettings)(HANDLE hContact, DBCONTACTENUMSETTINGS* dbces) PURE;
+ STDMETHOD_(BOOL,WriteContactSetting)(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws) PURE;
+ STDMETHOD_(BOOL,DeleteContactSetting)(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting) PURE;
+ STDMETHOD_(BOOL,EnumContactSettings)(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces) PURE;
STDMETHOD_(BOOL,SetSettingResident)(BOOL bIsResident, const char *pszSettingName) PURE;
STDMETHOD_(BOOL,EnumResidentSettings)(DBMODULEENUMPROC pFunc, void *pParam) PURE;
STDMETHOD_(BOOL,IsSettingEncrypted)(LPCSTR szModule, LPCSTR szSetting) PURE;
|