diff options
Diffstat (limited to 'include/m_core.h')
-rw-r--r-- | include/m_core.h | 285 |
1 files changed, 0 insertions, 285 deletions
diff --git a/include/m_core.h b/include/m_core.h index 9f5bf4cbdb..78b33606b2 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -61,292 +61,7 @@ typedef uint32_t MCONTACT; typedef uint32_t MEVENT;
-// 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
-#define DBVT_WORD 2 // wVal and sVal are valid
-#define DBVT_DWORD 4 // dVal and lVal are valid
-#define DBVT_ASCIIZ 255 // pszVal is valid
-#define DBVT_BLOB 254 // cpbVal and pbVal are valid
-#define DBVT_UTF8 253 // pszVal is valid
-#define DBVT_WCHAR 252 // pszVal is valid
-#if defined(_UNICODE)
- #define DBVT_TCHAR DBVT_WCHAR
-#else
- #define DBVT_TCHAR DBVT_ASCIIZ
-#endif
-#define DBVTF_VARIABLELENGTH 0x80
-
-typedef struct
-{
- BYTE type;
- union {
- BYTE bVal; char cVal;
- WORD wVal; short sVal;
- DWORD dVal; long lVal;
- struct {
- union {
- char *pszVal;
- TCHAR *ptszVal;
- wchar_t *pwszVal;
- };
- WORD cchVal; //only used for db/contact/getsettingstatic
- };
- struct {
- WORD cpbVal;
- BYTE *pbVal;
- };
- };
-} DBVARIANT;
-
-#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)
-
-typedef struct
-{
- int cbSize; // size of the structure in bytes
- char *szModule; // pointer to name of the module that 'owns' this
- // event, ie the one that is in control of the data format
- 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; // the omnipresent 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
-
-#if defined(__cplusplus)
- bool __forceinline markedRead() const
- { return (flags & (DBEF_SENT | DBEF_READ)) != 0;
- }
-#endif
-} DBEVENTINFO;
-
-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.
-*/
-
-#if defined(__cplusplus)
- MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto = NULL);
-#else
- 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.
-*/
-
-#if defined(__cplusplus)
- MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto = NULL);
-#else
- MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto);
-#endif
-
-/******************************************************************************
- * 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.
-*/
-
-#define EVENTTYPE_MESSAGE 0
-#define EVENTTYPE_URL 1
-#define EVENTTYPE_CONTACTS 2 //v0.1.2.2+
-#define EVENTTYPE_ADDED 1000 //v0.1.1.0+: these used to be module-
-#define EVENTTYPE_AUTHREQUEST 1001 //specific codes, hence the module-
-#define EVENTTYPE_FILE 1002 //specific limit has been raised to 2000
-
-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.
-*/
-
-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
-*/
-
-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
-*/
-
-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
-*/
-
-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.
-*/
-
-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
-*/
-
-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
-*/
-
-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
-*/
-
-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.
-*/
-
-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
-*/
-
-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
-*/
-
-MIR_CORE_DLL(MEVENT) db_event_prev(MCONTACT hContact, MEVENT hDbEvent);
-
-/******************************************************************************
- * DATABASE SETTINGS
- */
-
-MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
-MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue);
-MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue);
-MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue);
-MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
-MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
-
-MIR_CORE_DLL(int) db_get_static(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
-MIR_CORE_DLL(int) db_get_static_utf(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
-MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, wchar_t *pDest, int cbDest);
-
-#if defined(__cplusplus)
- MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType=DBVT_ASCIIZ);
-#else
- MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType);
-#endif
-
-MIR_CORE_DLL(INT_PTR) db_set(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
-MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, BYTE val);
-MIR_CORE_DLL(INT_PTR) db_set_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, WORD val);
-MIR_CORE_DLL(INT_PTR) db_set_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD val);
-MIR_CORE_DLL(INT_PTR) db_set_s(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val);
-MIR_CORE_DLL(INT_PTR) db_set_ws(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCWSTR val);
-MIR_CORE_DLL(INT_PTR) db_set_utf(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val);
-MIR_CORE_DLL(INT_PTR) db_set_blob(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, void *val, unsigned len);
-
-MIR_CORE_DLL(INT_PTR) db_unset(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
-
-#if defined(__cplusplus)
- MIR_CORE_DLL(BOOL) db_set_resident(LPCSTR szModule, const char *szService, BOOL bEnable=TRUE);
-#else
- MIR_CORE_DLL(BOOL) db_set_resident(LPCSTR szModule, const char *szService, BOOL bEnable);
-#endif
-
-#define db_get_ws(a,b,c,d) db_get_s(a,b,c,d,DBVT_WCHAR)
-#define db_get_utf(a,b,c,d) db_get_s(a,b,c,d,DBVT_UTF8)
-#ifdef _UNICODE
- #define db_get_ts(a,b,c,d) db_get_s(a,b,c,d,DBVT_WCHAR)
- #define db_get_tsa db_get_wsa
- #define db_set_ts db_set_ws
- #define db_get_tstatic db_get_wstatic
-#else
- #define db_get_ts(a,b,c,d) db_get_s(a,b,c,d,DBVT_ASCIIZ)
- #define db_get_tsa db_get_sa
- #define db_set_ts db_set_s
- #define db_get_tstatic db_get_static
-#endif
///////////////////////////////////////////////////////////////////////////////
// events, hooks & services
|