summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-04 23:23:45 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-04 23:23:45 +0000
commit15855fa84a09fd1fd486d357c38db0f2bd181e74 (patch)
treec98d1ae74abca41c776522059343eda13a7e0a31 /src
parent819f8efabea6b0d7d971f9e6e4b21bbc18838874 (diff)
HistoryStats compiles ok now
git-svn-id: http://svn.miranda-ng.org/main/trunk@8399 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/metacontacts/meta_api.cpp69
-rw-r--r--src/modules/metacontacts/meta_services.cpp18
-rw-r--r--src/modules/metacontacts/meta_utils.cpp57
-rw-r--r--src/modules/metacontacts/metacontacts.h22
4 files changed, 74 insertions, 92 deletions
diff --git a/src/modules/metacontacts/meta_api.cpp b/src/modules/metacontacts/meta_api.cpp
index d7448d74ef..2cebf568be 100644
--- a/src/modules/metacontacts/meta_api.cpp
+++ b/src/modules/metacontacts/meta_api.cpp
@@ -28,7 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a handle to the default contact, or null on failure
-INT_PTR MetaAPI_GetDefault(WPARAM hMetaContact, LPARAM)
+
+static INT_PTR MetaAPI_GetDefault(WPARAM hMetaContact, LPARAM)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
if (cc == NULL)
@@ -44,7 +45,8 @@ INT_PTR MetaAPI_GetDefault(WPARAM hMetaContact, LPARAM)
//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a DWORD contact number, or -1 on failure
-INT_PTR MetaAPI_GetDefaultNum(WPARAM hMetaContact, LPARAM)
+
+static INT_PTR MetaAPI_GetDefaultNum(WPARAM hMetaContact, LPARAM)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
return (cc == NULL) ? -1 : cc->nDefault;
@@ -54,7 +56,8 @@ INT_PTR MetaAPI_GetDefaultNum(WPARAM hMetaContact, LPARAM)
//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a handle to the 'most online' contact
-INT_PTR MetaAPI_GetMostOnline(WPARAM hMetaContact, LPARAM)
+
+static INT_PTR MetaAPI_GetMostOnline(WPARAM hMetaContact, LPARAM)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
if (cc == NULL)
@@ -67,7 +70,8 @@ INT_PTR MetaAPI_GetMostOnline(WPARAM hMetaContact, LPARAM)
//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns a DWORD representing the number of subcontacts for the given metacontact
-INT_PTR MetaAPI_GetNumContacts(WPARAM hMetaContact, LPARAM)
+
+static INT_PTR MetaAPI_GetNumContacts(WPARAM hMetaContact, LPARAM)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
return (cc == NULL) ? -1 : cc->nSubs;
@@ -77,7 +81,8 @@ INT_PTR MetaAPI_GetNumContacts(WPARAM hMetaContact, LPARAM)
//wParam=(MCONTACT)hMetaContact
//lParam=(DWORD)contact number
//returns a handle to the specified subcontact
-INT_PTR MetaAPI_GetContact(WPARAM hMetaContact, LPARAM lParam)
+
+static INT_PTR MetaAPI_GetContact(WPARAM hMetaContact, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
return (cc == NULL) ? 0 : Meta_GetContactHandle(cc, lParam);
@@ -87,7 +92,8 @@ INT_PTR MetaAPI_GetContact(WPARAM hMetaContact, LPARAM lParam)
//wParam=(MCONTACT)hMetaContact
//lParam=(DWORD)contact number
//returns 0 on success
-INT_PTR MetaAPI_SetDefaultContactNum(WPARAM hMetaContact, LPARAM lParam)
+
+static INT_PTR MetaAPI_SetDefaultContactNum(WPARAM hMetaContact, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
if (cc == NULL)
@@ -106,7 +112,8 @@ INT_PTR MetaAPI_SetDefaultContactNum(WPARAM hMetaContact, LPARAM lParam)
//wParam=(MCONTACT)hMetaContact
//lParam=(MCONTACT)hSubcontact
//returns 0 on success
-INT_PTR MetaAPI_SetDefaultContact(WPARAM hMetaContact, LPARAM lParam)
+
+static INT_PTR MetaAPI_SetDefaultContact(WPARAM hMetaContact, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(lParam);
if (cc == NULL)
@@ -127,7 +134,8 @@ INT_PTR MetaAPI_SetDefaultContact(WPARAM hMetaContact, LPARAM lParam)
//wParam=(MCONTACT)hMetaContact
//lParam=(DWORD)contact number
//returns 0 on success
-INT_PTR MetaAPI_ForceSendContactNum(WPARAM hMetaContact, LPARAM lParam)
+
+static INT_PTR MetaAPI_ForceSendContactNum(WPARAM hMetaContact, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
if (cc == NULL)
@@ -147,7 +155,8 @@ INT_PTR MetaAPI_ForceSendContactNum(WPARAM hMetaContact, LPARAM lParam)
//wParam=(MCONTACT)hMetaContact
//lParam=(MCONTACT)hSubcontact
//returns 0 on success (will fail if 'force default' is in effect)
-INT_PTR MetaAPI_ForceSendContact(WPARAM hMetaContact, LPARAM lParam)
+
+static INT_PTR MetaAPI_ForceSendContact(WPARAM hMetaContact, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
if (cc == NULL)
@@ -169,6 +178,7 @@ INT_PTR MetaAPI_ForceSendContact(WPARAM hMetaContact, LPARAM lParam)
//wParam=(MCONTACT)hMetaContact
//lParam=0
//returns 0 on success (will fail if 'force default' is in effect)
+
INT_PTR MetaAPI_UnforceSendContact(WPARAM hMetaContact, LPARAM lParam)
{
if (db_get_b(hMetaContact, META_PROTO, "ForceDefault", 0))
@@ -180,13 +190,14 @@ INT_PTR MetaAPI_UnforceSendContact(WPARAM hMetaContact, LPARAM lParam)
return 0;
}
-
//'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=(MCONTACT)hMetaContact
-//lParam=0
-//returns 1(true) or 0(false) representing new state of 'force default'
+//
+// wParam=(MCONTACT)hMetaContact
+// lParam=0
+// returns 1(true) or 0(false) representing new state of 'force default'
+
INT_PTR MetaAPI_ForceDefault(WPARAM hMetaContact, LPARAM lParam)
{
// forward to menu function
@@ -200,6 +211,7 @@ INT_PTR MetaAPI_ForceDefault(WPARAM hMetaContact, LPARAM lParam)
// 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 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 hMetaContact, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
@@ -222,30 +234,49 @@ INT_PTR MetaAPI_GetForceState(WPARAM hMetaContact, LPARAM lParam)
return 0;
}
-// added 0.9.5.0 (22/3/05)
// wParam=(HANDLE)hContact
// lParam=0
// convert a given contact into a metacontact
-INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam)
+
+static INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam)
{
return Meta_Convert(wParam, lParam);
}
-// added 0.9.5.0 (22/3/05)
// wParam=(HANDLE)hContact
// lParam=(HANDLE)hMeta
// add an existing contact to a metacontact
-INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam)
+
+static INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam)
{
return Meta_Assign(wParam, lParam, FALSE);
}
-// added 0.9.5.0 (22/3/05)
// wParam=0
// lParam=(HANDLE)hContact
// remove a contact from a metacontact
-INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam)
+
+static 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);
}
+
+void CreateApiServices()
+{
+ CreateServiceFunction(MS_MC_GETDEFAULTCONTACT, MetaAPI_GetDefault);
+ CreateServiceFunction(MS_MC_GETDEFAULTCONTACTNUM, MetaAPI_GetDefaultNum);
+ CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
+ CreateServiceFunction(MS_MC_GETNUMCONTACTS, MetaAPI_GetNumContacts);
+ CreateServiceFunction(MS_MC_GETSUBCONTACT, MetaAPI_GetContact);
+ CreateServiceFunction(MS_MC_SETDEFAULTCONTACTNUM, MetaAPI_SetDefaultContactNum);
+ CreateServiceFunction(MS_MC_SETDEFAULTCONTACT, MetaAPI_SetDefaultContact);
+ CreateServiceFunction(MS_MC_FORCESENDCONTACTNUM, MetaAPI_ForceSendContactNum);
+ CreateServiceFunction(MS_MC_FORCESENDCONTACT, MetaAPI_ForceSendContact);
+ CreateServiceFunction(MS_MC_UNFORCESENDCONTACT, MetaAPI_UnforceSendContact);
+ CreateServiceFunction(MS_MC_GETFORCESTATE, MetaAPI_GetForceState);
+
+ CreateServiceFunction(MS_MC_CONVERTTOMETA, MetaAPI_ConvertToMeta);
+ CreateServiceFunction(MS_MC_ADDTOMETA, MetaAPI_AddToMeta);
+ CreateServiceFunction(MS_MC_REMOVEFROMMETA, MetaAPI_RemoveFromMeta);
+}
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index a12813f2ed..13c747b9cf 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -654,7 +654,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam)
// if the contact was forced, unforce it (which updates status)
if (db_get_dw(ccMeta->contactID, META_PROTO, "ForceSend", 0) == hContact)
- MetaAPI_UnforceSendContact((WPARAM)ccMeta->contactID, 0);
+ MetaAPI_UnforceSendContact(ccMeta->contactID, 0);
else {
// set status to that of most online contact
Meta_CopyContactNick(ccMeta, Meta_GetMostOnline(ccMeta));
@@ -1123,21 +1123,7 @@ void Meta_InitServices()
CreateProtoServiceFunction(META_FILTER, PSS_MESSAGE, MetaFilter_SendMessage);
// API services and events
- CreateServiceFunction(MS_MC_GETDEFAULTCONTACT, MetaAPI_GetDefault);
- CreateServiceFunction(MS_MC_GETDEFAULTCONTACTNUM, MetaAPI_GetDefaultNum);
- CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
- CreateServiceFunction(MS_MC_GETNUMCONTACTS, MetaAPI_GetNumContacts);
- CreateServiceFunction(MS_MC_GETSUBCONTACT, MetaAPI_GetContact);
- CreateServiceFunction(MS_MC_SETDEFAULTCONTACTNUM, MetaAPI_SetDefaultContactNum);
- CreateServiceFunction(MS_MC_SETDEFAULTCONTACT, MetaAPI_SetDefaultContact);
- CreateServiceFunction(MS_MC_FORCESENDCONTACTNUM, MetaAPI_ForceSendContactNum);
- CreateServiceFunction(MS_MC_FORCESENDCONTACT, MetaAPI_ForceSendContact);
- CreateServiceFunction(MS_MC_UNFORCESENDCONTACT, MetaAPI_UnforceSendContact);
- CreateServiceFunction(MS_MC_GETFORCESTATE, MetaAPI_GetForceState);
-
- CreateServiceFunction(MS_MC_CONVERTTOMETA, MetaAPI_ConvertToMeta);
- CreateServiceFunction(MS_MC_ADDTOMETA, MetaAPI_AddToMeta);
- CreateServiceFunction(MS_MC_REMOVEFROMMETA, MetaAPI_RemoveFromMeta);
+ CreateApiServices();
CreateServiceFunction("MetaContacts/OnOff", Meta_OnOff);
CreateServiceFunction("MetaContacts/CListMessageEvent", Meta_ClistMessageEventClicked);
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index 6bd8690232..bd5049f35d 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -210,7 +210,6 @@ int Meta_SetNick(char *szProto)
BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
{
char buffer[512], szId[40];
- WORD status;
MCONTACT most_online;
DBCachedContact *ccDest = CheckMeta(dest);
@@ -286,24 +285,18 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
db_set_ts(dest, META_PROTO, buffer, cli.pfnGetContactDisplayName(src, 0));
// Get the status
- if (!szProto)
- status = ID_STATUS_OFFLINE;
- else
- status = db_get_w(src, szProto, "Status", ID_STATUS_OFFLINE);
+ WORD status = (!szProto) ? ID_STATUS_OFFLINE : db_get_w(src, szProto, "Status", ID_STATUS_OFFLINE);
// write the status
- strcpy(buffer, "Status");
- strcat(buffer, szId);
+ strcpy(buffer, "Status"); strcat(buffer, szId);
db_set_w(dest, META_PROTO, buffer, status);
// write the handle
- strcpy(buffer, "Handle");
- strcat(buffer, szId);
+ strcpy(buffer, "Handle"); strcat(buffer, szId);
db_set_dw(dest, META_PROTO, buffer, src);
// write status string
- strcpy(buffer, "StatusString");
- strcat(buffer, szId);
+ strcpy(buffer, "StatusString"); strcat(buffer, szId);
TCHAR *szStatus = cli.pfnGetStatusModeDescription(status, 0);
db_set_ts(dest, META_PROTO, buffer, szStatus);
@@ -858,10 +851,8 @@ int Meta_SwapContacts(DBCachedContact *cc, DWORD contact_number1, DWORD contact_
BOOL ok1, ok2;
// swap the protocol
- strcpy(buff1, "Protocol");
- strcat(buff1, _itoa(contact_number1, buff12, 10));
- strcpy(buff2, "Protocol");
- strcat(buff2, _itoa(contact_number2, buff22, 10));
+ strcpy(buff1, "Protocol"); strcat(buff1, _itoa(contact_number1, buff12, 10));
+ strcpy(buff2, "Protocol"); strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(cc->contactID, META_PROTO, buff2, &dbv2);
if (ok1) {
@@ -874,10 +865,8 @@ int Meta_SwapContacts(DBCachedContact *cc, DWORD contact_number1, DWORD contact_
}
// swap the status
- strcpy(buff1, "Status");
- strcat(buff1, _itoa(contact_number1, buff12, 10));
- strcpy(buff2, "Status");
- strcat(buff2, _itoa(contact_number2, buff22, 10));
+ strcpy(buff1, "Status"); strcat(buff1, _itoa(contact_number1, buff12, 10));
+ strcpy(buff2, "Status"); strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff1, &dbv1);
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff2, &dbv2);
if (ok1) {
@@ -890,10 +879,8 @@ int Meta_SwapContacts(DBCachedContact *cc, DWORD contact_number1, DWORD contact_
}
// swap the status string
- strcpy(buff1, "StatusString");
- strcat(buff1, _itoa(contact_number1, buff12, 10));
- strcpy(buff2, "StatusString");
- strcat(buff2, _itoa(contact_number2, buff22, 10));
+ strcpy(buff1, "StatusString"); strcat(buff1, _itoa(contact_number1, buff12, 10));
+ strcpy(buff2, "StatusString"); strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(cc->contactID, META_PROTO, buff2, &dbv2);
if (ok1) {
@@ -906,10 +893,8 @@ int Meta_SwapContacts(DBCachedContact *cc, DWORD contact_number1, DWORD contact_
}
// swap the login
- strcpy(buff1, "Login");
- strcat(buff1, _itoa(contact_number1, buff12, 10));
- strcpy(buff2, "Login");
- strcat(buff2, _itoa(contact_number2, buff22, 10));
+ strcpy(buff1, "Login"); strcat(buff1, _itoa(contact_number1, buff12, 10));
+ strcpy(buff2, "Login"); strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(cc->contactID, META_PROTO, buff2, &dbv2);
if (ok1) {
@@ -924,10 +909,8 @@ int Meta_SwapContacts(DBCachedContact *cc, DWORD contact_number1, DWORD contact_
}
// swap the nick
- strcpy(buff1, "Nick");
- strcat(buff1, _itoa(contact_number1, buff12, 10));
- strcpy(buff2, "Nick");
- strcat(buff2, _itoa(contact_number2, buff22, 10));
+ strcpy(buff1, "Nick"); strcat(buff1, _itoa(contact_number1, buff12, 10));
+ strcpy(buff2, "Nick"); strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(cc->contactID, META_PROTO, buff2, &dbv2);
if (ok1) {
@@ -943,10 +926,8 @@ int Meta_SwapContacts(DBCachedContact *cc, DWORD contact_number1, DWORD contact_
else db_unset(cc->contactID, META_PROTO, buff1);
// swap the clist name
- strcpy(buff1, "CListName");
- strcat(buff1, _itoa(contact_number1, buff12, 10));
- strcpy(buff2, "CListName");
- strcat(buff2, _itoa(contact_number2, buff22, 10));
+ strcpy(buff1, "CListName"); strcat(buff1, _itoa(contact_number1, buff12, 10));
+ strcpy(buff2, "CListName"); strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(cc->contactID, META_PROTO, buff2, &dbv2);
if (ok1) {
@@ -962,10 +943,8 @@ int Meta_SwapContacts(DBCachedContact *cc, DWORD contact_number1, DWORD contact_
else db_unset(cc->contactID, META_PROTO, buff1);
// swap the handle
- strcpy(buff1, "Handle");
- strcat(buff1, _itoa(contact_number1, buff12, 10));
- strcpy(buff2, "Handle");
- strcat(buff2, _itoa(contact_number2, buff22, 10));
+ strcpy(buff1, "Handle"); strcat(buff1, _itoa(contact_number1, buff12, 10));
+ strcpy(buff2, "Handle"); strcat(buff2, _itoa(contact_number2, buff22, 10));
ok1 = !Mydb_get(cc->contactID, META_PROTO, buff1, &dbv1);
ok2 = !Mydb_get(cc->contactID, META_PROTO, buff2, &dbv2);
if (ok1) {
diff --git a/src/modules/metacontacts/metacontacts.h b/src/modules/metacontacts/metacontacts.h
index 7a22e9e351..a75efbd1a7 100644
--- a/src/modules/metacontacts/metacontacts.h
+++ b/src/modules/metacontacts/metacontacts.h
@@ -124,24 +124,10 @@ int GetDefaufaultPrio(int status);
int GetRealPriority(char *proto, int status);
// API function headers
-INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_GetProtoName(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam);
-INT_PTR MetaAPI_DisableHiddenGroup(WPARAM wParam, LPARAM lParam);
+void CreateApiServices();
+INT_PTR MetaAPI_GetForceState(WPARAM, LPARAM);
+INT_PTR MetaAPI_ForceDefault(WPARAM hMetaContact, LPARAM);
+INT_PTR MetaAPI_UnforceSendContact(WPARAM hMetaContact, LPARAM);
// extended db get/write setting functions, that handle unicode
INT_PTR Mydb_get(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);