summaryrefslogtreecommitdiff
path: root/src/modules/metacontacts/meta_api.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-02 20:06:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-02 20:06:10 +0000
commite27f1addc43bdfeb896081ecca5e0b52e9e6179a (patch)
treecafb3b02fbf0f5c2b6085d82af212c05da60a2c7 /src/modules/metacontacts/meta_api.cpp
parent79939e2f78e89f4581cfbcc19818c756ece26ad6 (diff)
current mc state
git-svn-id: http://svn.miranda-ng.org/main/trunk@8362 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/metacontacts/meta_api.cpp')
-rw-r--r--src/modules/metacontacts/meta_api.cpp88
1 files changed, 45 insertions, 43 deletions
diff --git a/src/modules/metacontacts/meta_api.cpp b/src/modules/metacontacts/meta_api.cpp
index 701540deae..1d94f15be9 100644
--- a/src/modules/metacontacts/meta_api.cpp
+++ b/src/modules/metacontacts/meta_api.cpp
@@ -25,55 +25,61 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "metacontacts.h"
//gets the handle for the default contact
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a handle to the default contact, or null on failure
-INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam)
+{
DWORD default_contact_number = db_get_dw(wParam, META_PROTO, "Default", -1);
- if (default_contact_number != -1) {
+ if (default_contact_number != -1)
return (INT_PTR)Meta_GetContactHandle(wParam, default_contact_number);
- }
+
return 0;
}
//gets the contact number for the default contact
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a DWORD contact number, or -1 on failure
-INT_PTR MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam)
+{
return db_get_dw(wParam, META_PROTO, "Default", -1);
}
//gets the handle for the 'most online' contact
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a handle to the 'most online' contact
-INT_PTR MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam)
+{
return (INT_PTR)Meta_GetMostOnline(wParam);
}
//gets the number of subcontacts for a metacontact
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a DWORD representing the number of subcontacts for the given metacontact
-INT_PTR MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam)
+{
DWORD num_contacts = db_get_dw(wParam, META_PROTO, "NumContacts", -1);
return num_contacts;
}
//gets the handle of a subcontact, using the subcontact's number
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=(DWORD)contact number
//returns a handle to the specified subcontact
-INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam)
+{
return (INT_PTR)Meta_GetContactHandle(wParam, (DWORD)lParam);
}
//sets the default contact, using the subcontact's contact number
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=(DWORD)contact number
//returns 0 on success
-INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam)
+{
DWORD num_contacts = db_get_dw(wParam, META_PROTO, "NumContacts", -1);
if (num_contacts == -1)
return 1;
@@ -87,10 +93,11 @@ INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) {
}
//sets the default contact, using the subcontact's handle
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=(HANDLE)hSubcontact
//returns 0 on success
-INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam)
+{
MCONTACT hMeta = (MCONTACT)db_get_dw(lParam, META_PROTO, "Handle", 0);
DWORD contact_number = Meta_GetContactNumber(lParam);
if (contact_number == -1 || !hMeta || hMeta != wParam)
@@ -103,10 +110,11 @@ INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) {
}
//forces the metacontact to send using a specific subcontact, using the subcontact's contact number
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=(DWORD)contact number
//returns 0 on success
-INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam)
+{
MCONTACT hContact = Meta_GetContactHandle(wParam, (int)lParam);
MCONTACT hMeta = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0);
if (!hContact || !hMeta || hMeta != wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
@@ -119,10 +127,11 @@ INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) {
}
//forces the metacontact to send using a specific subcontact, using the subcontact's handle
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=(HANDLE)hSubcontact
//returns 0 on success (will fail if 'force default' is in effect)
-INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam)
+{
MCONTACT hContact = lParam;
MCONTACT hMeta = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0);
if (!hContact || !hMeta || hMeta != wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
@@ -135,10 +144,11 @@ INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) {
}
//'unforces' the metacontact to send using a specific subcontact
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns 0 on success (will fail if 'force default' is in effect)
-INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam)
+{
if (db_get_b(wParam, META_PROTO, "ForceDefault", 0))
return 1;
@@ -152,22 +162,24 @@ INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam) {
//'forces' or 'unforces' (i.e. toggles) the metacontact to send using it's default contact
// overrides 'force send' above, and will even force use of offline contacts
// will send ME_MC_FORCESEND event
-//wParam=(HANDLE)hMetaContact
+//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns 1(true) or 0(false) representing new state of 'force default'
-INT_PTR MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam)
+{
// forward to menu function
Meta_ForceDefault(wParam, lParam);
return db_get_b(wParam, META_PROTO, "ForceDefault", 0);
}
// method to get state of 'force' for a metacontact
-// wParam=(HANDLE)hMetaContact
+// wParam=(MCONTACT)hMetaContact
// lParam= (DWORD)&contact_number or NULL
// if lparam supplied, the contact_number of the contatct 'in force' will be copied to the address it points to,
-// or if none is in force, the value (DWORD)-1 will be copied
+// or if none is in force, the value INVALID_CONTACT_ID will be copied
// (v0.8.0.8+ returns 1 if 'force default' is true with *lParam == default contact number, else returns 0 with *lParam as above)
-INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam)
+{
MCONTACT hMeta = wParam;
if ( !hMeta) return 0;
@@ -191,7 +203,8 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) {
// wParam=(HANDLE)hContact
// lParam=0
// convert a given contact into a metacontact
-INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam)
+{
return Meta_Convert(wParam, lParam);
}
@@ -199,7 +212,8 @@ INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam) {
// wParam=(HANDLE)hContact
// lParam=(HANDLE)hMeta
// add an existing contact to a metacontact
-INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam)
+{
return Meta_Assign(wParam, lParam, FALSE);
}
@@ -207,20 +221,8 @@ INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam) {
// wParam=0
// lParam=(HANDLE)hContact
// remove a contact from a metacontact
-INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam) {
+INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam)
+{
// notice we switch args - to keep the API function consistent with the others
return Meta_Delete((WPARAM)lParam, (LPARAM)wParam);
}
-
-// added 0.9.13.2 (6/10/05)
-// wParam=(BOOL)disable
-// lParam=0
-// enable/disable the 'hidden group hack' - for clists that support subcontact hiding using 'IsSubcontact' setting
-// should be called once in your 'onmodulesloaded' event handler
-
-BOOL meta_group_hack_disabled = FALSE; // this global flag is used in utils 'SetGroup' function
-
-INT_PTR MetaAPI_DisableHiddenGroup(WPARAM wParam, LPARAM lParam) {
- meta_group_hack_disabled = (BOOL)wParam;
- return 0;
-}