diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/delphi/m_database.inc | 206 | ||||
-rw-r--r-- | include/m_core.h | 233 | ||||
-rw-r--r-- | include/m_database.h | 230 | ||||
-rw-r--r-- | include/m_protoint.h | 2 |
4 files changed, 195 insertions, 476 deletions
diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index 4876451e3a..210f4dc914 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -59,32 +59,6 @@ type end;
const
- {
- wParam : Handle of a contact to get the setting for (see notes)
- lParam : pointer to a TDBCONTACTGETSETTING structure to be filled with setting
- this structure also has to be initalised (see notes)
- affect : Queries the database module for a setting from a contact.
- returns: 0 on success, non zero on failure (contact not found, setting doesn't exist)
- notes : TDBCONTACTGETSETTING must be filled with the module name that created
- /wrote the setting you want to get (e.g. your module name)
- and the actual setting to read with TDBCONTACTGETSETTING.szModule and
- TDBCONTACTGETSETTING.szSetting -- TDBCONTACTGETSETTING.pValue is
- a pointer to a TDBVARIANT with the returned setting, this maybe nil
- and MUST be freed after you're done with it with FreeVariant()
-
- There are helper functions for reading/writing/deleting common types to and
- from the database -- see DBGetContactSetting<type>
-
- the contact handle (hContact) can be returned by FindContact/AddContact
- }
- MS_DB_CONTACT_GETSETTING:PAnsiChar = 'DB/Contact/GetSetting';
-
- {
- DB/Contact/GetSettingString service 0.4.3+
- Same as DB/Contact/GetSetting, but also gets the required string type
- inside the dbcgs->type parameter
- }
- MS_DB_CONTACT_GETSETTING_STR:PAnsiChar = 'DB/Contact/GetSettingStr';
{
wParam : Handle for a contact to query a setting for
@@ -104,15 +78,6 @@ const MS_DB_CONTACT_GETSETTINGSTATIC:PAnsiChar = 'DB/Contact/GetSettingStatic';
{
- wParam : 0
- lParam : Pointer to a TDBVARIANT structure
- affect : Free's the passed DBVARIANT's dynamic memory (if any) see notes
- returns: 0 on success, non zero on failure
- notes : use the helper function FreeVariant()
- }
- MS_DB_CONTACT_FREEVARIANT:PAnsiChar = 'DB/Contact/FreeVariant';
-
- {
wParam : Handle to contact to write setting for
lParam : Pointer to TDBCONTACTWRITESETTING which must be initalised
affects: writes a setting under a contact -- TDBCONTACTWRITESETTING structure
@@ -124,19 +89,6 @@ const }
MS_DB_CONTACT_WRITESETTING:PAnsiChar = 'DB/Contact/WriteSetting';
- {
- wParam : hContact under which the setting should be deleted
- lParam : Pointer to a TDBCONTACTGETSETTING structure
- affects: Deletes the given setting for a contact, the TDBCONTACTGETSETTING.pValue
- field is ignored -- only .szModule and .szSetting are needed, see notes
- returns: 0 on success, non zero on failure
- notes : triggers 'DB/Contact/SettingChanged' BEFORE it deletes the given
- setting, when the service returns the TDBVARIANT structure .type_ is set
- to 0 and no fields are valid, there is a helper function for this
- service, see below.
- }
- MS_DB_CONTACT_DELETESETTING:PAnsiChar = 'DB/Contact/DeleteSetting';
-
{
wParam : Handle of a contact to enum settings for
lParam : Pointer to a TDBCONTACTENUMSETTINGS structure, must be initalised
@@ -183,25 +135,6 @@ const MS_DB_CONTACT_GETCOUNT:PAnsiChar = 'DB/Contact/GetCount';
{
- wParam : 0
- lParam : 0
- returns: Returns a handle to the first contact in the database,
- this handle does not need to be closed, if there are no users
- NULL(0) is returned.
- }
- MS_DB_CONTACT_FINDFIRST:PAnsiChar = 'DB/Contact/FindFirst';
-
- {
- wParam : Contact handle
- lParam : 0
- returns: Returns a handle to the next contact after the given contact in
- wParam, this handle does not neeed to be closed -- may return NULL(0)
- if the given contact in wParam was the last in the database, or the
- given contact was invalid
- }
- MS_DB_CONTACT_FINDNEXT:PAnsiChar = 'DB/Contact/FindNext';
-
- {
wParam : Handle of a contact to delete
lParam : 0
affect : the user by the given handle is deleted from the database, see notes
@@ -288,71 +221,6 @@ const }
MS_DB_EVENT_GETTYPE:PAnsiChar = 'DB/EventType/Get';
- {
- wParam : contact handle for events count is needed
- lParam : 0
- service: Gets the number of events in the chain belonging to a contact
- in the databasee.
- returns: the numbef of events owned by hContact or -1 if hContact
- is invalid, they can be found with the event/find* servicees
- }
- MS_DB_EVENT_GETCOUNT:PAnsiChar = 'DB/Event/GetCount';
-
- {
- wParam : contact handle to add an event for
- lParam : Pointer to TDBEVENTINFO initialised with data
- affect : Add's an event to the contact's event list, the TDBEVENTINFO
- structure should be filled with the event of message -- see notes
- returns: a handle to a DB event (HANDLE), or NULL on error
- notes : Triggers 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()
- }
-const
- MS_DB_EVENT_ADD:PAnsiChar = 'DB/Event/Add';
-
- {
- wParam : Handle to the contact
- lParam : HANDLE handle to delete
- affects: Removes a single event from the database for the given contact
- returns: 0 on success, nonzero on failure
- notes : Triggers DB/Event/Deleted just before the event *is* deleted
- }
- MS_DB_EVENT_DELETE:PAnsiChar = 'DB/Event/Delete';
-
- {
- wParam : Handle to DB event
- lParam : 0
- returns: Returns the space in bytes requried to store the blob in HANDLE
- given by HANDLE(wParam) -- or -1 on error
- }
- MS_DB_EVENT_GETBLOBSIZE:PAnsiChar = 'DB/Event/GetBlobSize';
-
- {
- wParam : Handle to a DB event
- lParam : Pointer to a TDBEVENTINFO structure which must be initialised
- affects: Returns all the information about an DB event handle to a TDBEVENTINFO
- structure which must be initalised, DBEI.cbSize, DBEI.pBlob and DBEI.cbSize
- before calling this service, the size can be assertained with
- GetBlobSize() service, see notes
- returns: Returns 0 on success, non zero on failure
- notes : 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.
- }
- MS_DB_EVENT_GET:PAnsiChar = 'DB/Event/Get';
-
{ DB/Event/GetText (0.7.0+)
Retrieves the event's text
wParam=0
@@ -395,80 +263,6 @@ const MS_DB_EVENT_GETSTRINGT:PAnsiChar = 'DB/Event/GetStringT';
- {
- wParam : HCONTACT
- lParam : HANDLE
- affect : Changes the flag for an event to mark it as read
- Returns: Returns the entire flag DWORD for the event after the change, or -1
- if HANDLE is invalid, see notes
- notes : This iss one of the database write operations that does not trigger
- an event, modules should not save flagss states for any length of time.
- }
- MS_DB_EVENT_MARKREAD:PAnsiChar = 'DB/Event/MarkRead';
-
- {
- wParam : HANDLE
- lParam : 0
- Affect : Returns a handle to a contact that owns the HANDLE,
- see notes
- Returns: Returns a handle if successful or HDBEEVENT(-1) on failure
- notes : This service is very slow, only use wheen you have no other choice
- at all.
- }
- MS_DB_EVENT_GETCONTACT:PAnsiChar = 'DB/Event/GetContact';
-
- {
- wParam : HCONTACT
- lParam : 0
- Affect : Retrieves a handlee to the first event in the chain
- for a HCONTACT
- returns: Returns a handle, or NULL(0) if HCONTACT is invalid or has
- no events, events in a chain are sorted chronologically automatically
- }
- MS_DB_EVENT_FINDFIRST:PAnsiChar = 'DB/Event/FindFirst';
-
- {
- wParam : HCONTACT
- lParam : 0
- Affect : Retrieves a handle to the first unreead event in a chain for a HCONTACT
- see notes
- Returns: Returns a HANDLE handle or NULL(0) if the HCONTACT is invalid
- or all it's events have beeen read.
- Notes : 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 event/findnext and event/get
- This service is designed for startup, reloading all the events that remained
- unread from last time
- }
- MS_DB_EVENT_FINDFIRSTUNREAD:PAnsiChar = 'DB/Event/FindFirstUnread';
-
- {
- wParam : HCONTACT
- lParam : 0;
- Affects: Retrieves a handle to the lasts event in the chain for a HCONTACT
- Returns: Returns a handle or NULL(0) if HCONTACT is invalid or has no events
- }
- MS_DB_EVENT_FINDLAST:PAnsiChar = 'DB/Event/FindLast';
-
- {
- wParam : HANDLE
- lParam : 0
- Affects: Retrieves a handle to the next event in a chain after HANDLE
- Returns: A handle to the next DB event or NULL(0) if HANDLE is invalid
- or the last event in the chain.
- }
- MS_DB_EVENT_FINDNEXT:PAnsiChar = 'DB/Event/FindNext';
-
- {
- wParam : HANDLE
- lParam : 0
- Affects: Retrieves a handle to the previous event in a chain before HANDLE
- Returns: A handle to the previous HANDLE or NULL(0) if HANDLE is invalid
- or is the first event in the chain
- }
- MS_DB_EVENT_FINDPREV:PAnsiChar = 'DB/Event/FindPrev';
-
//************************** Encryption ****************************
{
diff --git a/include/m_core.h b/include/m_core.h index 2b81f6e9bd..638666c0d7 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -107,28 +107,181 @@ typedef struct { } DBEVENTINFO;
MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv);
-MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting);
+
+/******************************************************************************
+ * 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(HANDLE) db_find_first(const char *szProto = NULL);
+#else
+ MIR_CORE_DLL(HANDLE) 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(HANDLE) db_find_first(const char *szProto = NULL);
- MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto = NULL);
+ MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto = NULL);
#else
- MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto);
- MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto);
+ MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto);
#endif
-MIR_CORE_DLL(HANDLE) db_event_add(HANDLE hContact, DBEVENTINFO *dbei);
-MIR_CORE_DLL(int) db_event_count(HANDLE hContact);
-MIR_CORE_DLL(int) db_event_delete(HANDLE hContact, HANDLE hDbEvent);
-MIR_CORE_DLL(HANDLE) db_event_first(HANDLE hContact);
-MIR_CORE_DLL(HANDLE) db_event_firstUnread(HANDLE hContact);
-MIR_CORE_DLL(int) db_event_get(HANDLE hDbEvent, DBEVENTINFO *dbei);
-MIR_CORE_DLL(int) db_event_getBlobSize(HANDLE hDbEvent);
-MIR_CORE_DLL(HANDLE) db_event_getContact(HANDLE hDbEvent);
-MIR_CORE_DLL(HANDLE) db_event_last(HANDLE hDbEvent);
-MIR_CORE_DLL(int) db_event_markRead(HANDLE hContact, HANDLE hDbEvent);
-MIR_CORE_DLL(HANDLE) db_event_next(HANDLE hDbEvent);
-MIR_CORE_DLL(HANDLE) db_event_prev(HANDLE hDbEvent);
+/******************************************************************************
+ * 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(HANDLE) db_event_add(HANDLE 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(HANDLE 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(HANDLE hContact, HANDLE 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(HANDLE) db_event_first(HANDLE 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(HANDLE) db_event_firstUnread(HANDLE 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(HANDLE 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(HANDLE 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 (HANDLE)(-1) if hDbEvent is invalid, or the handle to the contact on
+success
+This service is exceptionally slow. Use only when you have no other choice at
+all.
+*/
+
+MIR_CORE_DLL(HANDLE) db_event_getContact(HANDLE 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(HANDLE) db_event_last(HANDLE hDbEvent);
+
+/*
+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(HANDLE hContact, HANDLE 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(HANDLE) db_event_next(HANDLE 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(HANDLE) db_event_prev(HANDLE hDbEvent);
+
+/******************************************************************************
+ * DATABASE SETTINGS
+ */
MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue);
MIR_CORE_DLL(int) db_get_w(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue);
@@ -151,6 +304,8 @@ MIR_CORE_DLL(INT_PTR) db_set_ws(HANDLE hContact, const char *szModule, const cha MIR_CORE_DLL(INT_PTR) db_set_utf(HANDLE hContact, const char *szModule, const char *szSetting, const char *val);
MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, const char *szModule, const char *szSetting, void *val, unsigned len);
+MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting);
+
#if defined(__cplusplus)
MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable=TRUE);
#else
@@ -191,28 +346,28 @@ typedef INT_PTR (*MIRANDASERVICEOBJPARAM)(void*, WPARAM, LPARAM, LPARAM); #define CALLSERVICE_NOTFOUND ((int)0x80000000)
#endif
-MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name);
-MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent);
-MIR_CORE_DLL(int) SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook);
-MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam);
-MIR_CORE_DLL(int) NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
-MIR_CORE_DLL(int) NotifyFastHook(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
-
-MIR_CORE_DLL(HANDLE) HookEvent(const char* name, MIRANDAHOOK hookProc);
-MIR_CORE_DLL(HANDLE) HookEventParam(const char* name, MIRANDAHOOKPARAM hookProc, LPARAM lParam);
-MIR_CORE_DLL(HANDLE) HookEventObj(const char* name, MIRANDAHOOKOBJ hookProc, void* object);
-MIR_CORE_DLL(HANDLE) HookEventObjParam(const char* name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam);
-MIR_CORE_DLL(HANDLE) HookEventMessage(const char* name, HWND hwnd, UINT message);
-MIR_CORE_DLL(int) UnhookEvent(HANDLE hHook);
-MIR_CORE_DLL(void) KillObjectEventHooks(void* pObject);
-MIR_CORE_DLL(void) KillModuleEventHooks(HINSTANCE pModule);
-
-MIR_CORE_DLL(HANDLE) CreateServiceFunction(const char *name, MIRANDASERVICE serviceProc);
-MIR_CORE_DLL(HANDLE) CreateServiceFunctionParam(const char *name, MIRANDASERVICEPARAM serviceProc, LPARAM lParam);
-MIR_CORE_DLL(HANDLE) CreateServiceFunctionObj(const char *name, MIRANDASERVICEOBJ serviceProc, void* object);
-MIR_CORE_DLL(HANDLE) CreateServiceFunctionObjParam(const char *name, MIRANDASERVICEOBJPARAM serviceProc, void* object, LPARAM lParam);
-MIR_CORE_DLL(int) DestroyServiceFunction(HANDLE hService);
-MIR_CORE_DLL(int) ServiceExists(const char *name);
+MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name);
+MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent);
+MIR_CORE_DLL(int) SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook);
+MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam);
+MIR_CORE_DLL(int) NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
+MIR_CORE_DLL(int) NotifyFastHook(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
+
+MIR_CORE_DLL(HANDLE) HookEvent(const char* name, MIRANDAHOOK hookProc);
+MIR_CORE_DLL(HANDLE) HookEventParam(const char* name, MIRANDAHOOKPARAM hookProc, LPARAM lParam);
+MIR_CORE_DLL(HANDLE) HookEventObj(const char* name, MIRANDAHOOKOBJ hookProc, void* object);
+MIR_CORE_DLL(HANDLE) HookEventObjParam(const char* name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam);
+MIR_CORE_DLL(HANDLE) HookEventMessage(const char* name, HWND hwnd, UINT message);
+MIR_CORE_DLL(int) UnhookEvent(HANDLE hHook);
+MIR_CORE_DLL(void) KillObjectEventHooks(void* pObject);
+MIR_CORE_DLL(void) KillModuleEventHooks(HINSTANCE pModule);
+
+MIR_CORE_DLL(HANDLE) CreateServiceFunction(const char *name, MIRANDASERVICE serviceProc);
+MIR_CORE_DLL(HANDLE) CreateServiceFunctionParam(const char *name, MIRANDASERVICEPARAM serviceProc, LPARAM lParam);
+MIR_CORE_DLL(HANDLE) CreateServiceFunctionObj(const char *name, MIRANDASERVICEOBJ serviceProc, void* object);
+MIR_CORE_DLL(HANDLE) CreateServiceFunctionObjParam(const char *name, MIRANDASERVICEOBJPARAM serviceProc, void* object, LPARAM lParam);
+MIR_CORE_DLL(int) DestroyServiceFunction(HANDLE hService);
+MIR_CORE_DLL(int) ServiceExists(const char *name);
MIR_CORE_DLL(INT_PTR) CallService(const char *name, WPARAM wParam, LPARAM lParam);
MIR_CORE_DLL(INT_PTR) CallServiceSync(const char *name, WPARAM wParam, LPARAM lParam);
diff --git a/include/m_database.h b/include/m_database.h index a050bb2fb2..c5657b91b7 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -140,44 +140,12 @@ Implemented in the dbchecker plugins, thus it might not exist /************************* Contact ********************************/
-/* DB/Contact/GetSetting service
-Look up the value of a named setting for a specific contact in the database
- wParam = (WPARAM)(HANDLE)hContact
- lParam = (LPARAM)(DBCONTACTGETSETTING*)&dbcgs
-hContact should have been returned by find*contact or addcontact
-Caller is responsible for free()ing dbcgs.pValue->pszVal and pbVal if they are
-returned. This should be done with db/contact/freevariant if you have your own
-heap (like DLLs do).
-Note that DBCONTACTGETSETTING takes a pointer to a DBVARIANT, whereas
-DBCONTACTWRITESETTING contains a DBVARIANT.
-Returns 0 on success or nonzero if the setting name was not found or hContact
-was invalid
-Because this is such a common function there are some short helper function at
-the bottom of this header that use it.
-
-(Added during 0.3.3+ development!!)
-
-If a setting is queried under for contact and it is deleted it will
-not be returned as a successful attempt, prior to 0.3.3 a *deleted*
-setting would be successfully read (which was a bug because the pValue
-was often garbage and maybe not even NULL terminated)
-
-To test for existing but 'deleted' settings, the return value will
-be 2, and pValue->type == DBVT_DELETED, at this point pValue is undefined.
-*/
typedef struct {
const char *szModule; // pointer to name of the module that wrote the
// setting to get
const char *szSetting; // pointer to name of the setting to get
DBVARIANT *pValue; // pointer to variant to receive the value
} DBCONTACTGETSETTING;
-#define MS_DB_CONTACT_GETSETTING "DB/Contact/GetSetting"
-
-/* DB/Contact/GetSettingString service 0.4.3+
-Same as DB/Contact/GetSetting, but also gets the required string type inside
-the dbcgs->type parameter
-*/
-#define MS_DB_CONTACT_GETSETTING_STR "DB/Contact/GetSettingStr"
/* DB/Contact/GetSettingStatic service
Look up the value of a named setting for a specific contact in the database
@@ -206,24 +174,6 @@ was invalid. */
#define MS_DB_CONTACT_GETSETTINGSTATIC "DB/Contact/GetSettingStatic"
-/* DB/Contact/FreeVariant service
-Free the memory in a DBVARIANT that is allocated by a call to
-db/contact/getsetting
- wParam = 0
- lParam = (LPARAM)(DBVARIANT*)&dbv
-Returns 0 on success, nonzero otherwise
-This service is actually just a wrapper around a call to free() and a test to
-check that it is a string or a blob in the variant. It exists because DLLs have
-their own heap and cannot free the memory allocated in db/contact/getsetting.
-Thus it need not be called if you know the variant contains some form of int,
-and you will often see free() used instead in code written before I noticed
-this problem.
-Good style, of course, dictates that it should be present to match all calls to
-db/contact/getsetting, but that's not going to happen of course.
-There's a helper function for this at the bottom of this header too.
-*/
-#define MS_DB_CONTACT_FREEVARIANT "DB/Contact/FreeVariant"
-
/* DB/Contact/WriteSetting service
Change the value of, or create a new value with, a named setting for a specific
contact in the database to the given value
@@ -245,20 +195,6 @@ typedef struct { } DBCONTACTWRITESETTING;
#define MS_DB_CONTACT_WRITESETTING "DB/Contact/WriteSetting"
-/* DB/Contact/DeleteSetting service
-Removes a named setting for a specific contact from the database
- wParam = (WPARAM)(HANDLE)hContact
- lParam = (LPARAM)(DBCONTACTGETSETTING*)&dbcgs
-hContact should have been returned by find*contact or addcontact
-pValue from dbcgs is not used.
-Returns 0 on success or nonzero if the setting was not present or hContact was
-invalid
-Triggers a db/contact/settingchanged event before it deletes the setting. The
-'new value' of the setting is set to type = 0 and all the other fields are
-undefined.
-*/
-#define MS_DB_CONTACT_DELETESETTING "DB/Contact/DeleteSetting"
-
/* db/contact/enumsettings v0.1.0.1+
Lists all the settings a specific modules has stored in the database for a
specific contact.
@@ -290,25 +226,6 @@ and contact/findnext */
#define MS_DB_CONTACT_GETCOUNT "DB/Contact/GetCount"
-/* DB/Contact/FindFirst service
-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.
- wParam = lParam = 0
-Returns a handle to the first contact in the db on success, or NULL if there
-are no contacts in the db.
-*/
-#define MS_DB_CONTACT_FINDFIRST "DB/Contact/FindFirst"
-
-/* DB/Contact/FindNext service
-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.
- wParam = (WPARAM)(HANDLE)hContact
- lParam = 0
-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.
-*/
-#define MS_DB_CONTACT_FINDNEXT "DB/Contact/FindNext"
-
/* DB/Contact/Delete
Deletes the contact hContact from the database and all events and settings
associated with it.
@@ -376,7 +293,6 @@ typedef struct #define DETF_MSGWINDOW 2 // show event in message window
#define DETF_NONOTIFY 4 // block event notify (e.g. Popups)
-
#define MS_DB_EVENT_REGISTERTYPE "DB/EventType/Register"
/* DB/EventType/Get service (0.7+)
@@ -388,81 +304,10 @@ Returns DBEVENTTYPEDESCR* or NULL, if an event isn't found. #define MS_DB_EVENT_GETTYPE "DB/EventType/Get"
-/* DB/Event/GetCount service
-Gets the number of events in the chain belonging to a contact in the database.
- wParam = (WPARAM)(HANDLE)hContact
- lParam = 0
-Returns the number of events in the chain owned by hContact or -1 if hContact
-is invalid. They can be retrieved using the event/find* services.
-*/
-#define MS_DB_EVENT_GETCOUNT "DB/Event/GetCount"
-
-/* DB/Event/Add
-Adds a new event to a contact's event list
- wParam = (WPARAM)(HANDLE)hContact
- lParam = (LPARAM)(DBEVENTINFO*)&dbe
-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
-#define MS_DB_EVENT_ADD "DB/Event/Add"
-
__forceinline HANDLE DbGetAuthEventContact(DBEVENTINFO* dbei)
{ return (HANDLE)(*(DWORD*)&dbei->pBlob[sizeof(DWORD)]);
}
-/* DB/Event/Delete
-Removes a single event from the database
- wParam = (WPARAM)(HANDLE)hContact
- lParam = (LPARAM)(HANDLE)hDbEvent
-hDbEvent should have been returned by db/event/add or db/event/find*event
-Returns 0 on success, or nonzero if hDbEvent was invalid
-Triggers a db/event/deleted event just *before* the event is deleted
-*/
-#define MS_DB_EVENT_DELETE "DB/Event/Delete"
-
-/* DB/Event/GetBlobSize
-Retrieves the space in bytes required to store the blob in hDbEvent
- wParam = (WPARAM)(HANDLE)hDbEvent
- lParam = 0
-hDbEvent should have been returned by db/event/add or db/event/find*event
-Returns the space required in bytes, or -1 if hDbEvent is invalid
-*/
-#define MS_DB_EVENT_GETBLOBSIZE "DB/Event/GetBlobSize"
-
-/* DB/Event/Get
-Retrieves all the information stored in hDbEvent
- wParam = (WPARAM)(HANDLE)hDbEvent
- lParam = (LPARAM)(DBEVENTINFO*)&dbe
-hDbEvent should have been returned by db/event/add or db/event/find*event
-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.
-*/
-#define MS_DB_EVENT_GET "DB/Event/Get"
-
/* DB/Event/GetText (0.7.0+)
Retrieves the event's text
wParam = (WPARAM)0 (unused)
@@ -532,81 +377,6 @@ __forceinline TCHAR* DbGetEventStringT(DBEVENTINFO* dbei, const char* str) return (TCHAR*)CallService(MS_DB_EVENT_GETSTRINGT, (WPARAM)dbei, (LPARAM)str);
}
-/* DB/Event/MarkRead
-Changes the flags for an event to mark it as read.
- wParam = (WPARAM)(HANDLE)hContact
- lParam = (LPARAM)(HANDLE)hDbEvent
-hDbEvent should have been returned by db/event/add or db/event/find*event
-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.
-*/
-#define MS_DB_EVENT_MARKREAD "DB/Event/MarkRead"
-
-/* DB/Event/GetContact
-Retrieves a handle to the contact that owns hDbEvent.
- wParam = (WPARAM)(HANDLE)hDbEvent
- lParam = 0
-hDbEvent should have been returned by db/event/add or db/event/find*event
-NULL is a valid return value, meaning, as usual, the user.
-Returns (HANDLE)(-1) if hDbEvent is invalid, or the handle to the contact on
-success
-This service is exceptionally slow. Use only when you have no other choice at
-all.
-*/
-#define MS_DB_EVENT_GETCONTACT "DB/Event/GetContact"
-
-/* DB/Event/FindFirst
-Retrieves a handle to the first event in the chain for hContact
- wParam = (WPARAM)(HANDLE)hContact
- lParam = 0
-Returns the handle, or NULL if hContact is invalid or has no events
-Events in a chain are sorted chronologically automatically
-*/
-#define MS_DB_EVENT_FINDFIRST "DB/Event/FindFirst"
-
-/* DB/Event/FindFirstUnread
-Retrieves a handle to the first unread event in the chain for hContact
- wParam = (WPARAM)(HANDLE)hContact
- lParam = 0
-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 event/findnext and event/get
-This service is designed for startup, reloading all the events that remained
-unread from last time
-*/
-#define MS_DB_EVENT_FINDFIRSTUNREAD "DB/Event/FindFirstUnread"
-
-/* DB/Event/FindLast
-Retrieves a handle to the last event in the chain for hContact
- wParam = (WPARAM)(HANDLE)hContact
- lParam = 0
-Returns the handle, or NULL if hContact is invalid or has no events
-Events in a chain are sorted chronologically automatically
-*/
-#define MS_DB_EVENT_FINDLAST "DB/Event/FindLast"
-
-/* DB/Event/FindNext
-Retrieves a handle to the next event in a chain after hDbEvent
- wParam = (WPARAM)(HANDLE)hDbEvent
- lParam = 0
-Returns the handle, or NULL if hDbEvent is invalid or is the last event
-Events in a chain are sorted chronologically automatically
-*/
-#define MS_DB_EVENT_FINDNEXT "DB/Event/FindNext"
-
-/* DB/Event/FindPrev
-Retrieves a handle to the previous event in a chain before hDbEvent
- wParam = (WPARAM)(HANDLE)hDbEvent
- lParam = 0
-Returns the handle, or NULL if hDbEvent is invalid or is the first event
-Events in a chain are sorted chronologically automatically
-*/
-#define MS_DB_EVENT_FINDPREV "DB/Event/FindPrev"
-
/************************** Encryption ****************************/
/* DB/Crypt/EncodeString
diff --git a/include/m_protoint.h b/include/m_protoint.h index 0c457f03cc..9849bbe320 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -54,7 +54,7 @@ struct PROTO_INTERFACE : public MZeroedObject char* m_szModuleName;
HANDLE m_hProtoIcon;
- DWORD __forceinline ProtoBroadcastAck(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam)
+ INT_PTR __forceinline ProtoBroadcastAck(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam)
{
return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam);
}
|