diff options
Diffstat (limited to 'meta2/api.cpp')
-rw-r--r-- | meta2/api.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/meta2/api.cpp b/meta2/api.cpp index 73f5adc..467a1e8 100644 --- a/meta2/api.cpp +++ b/meta2/api.cpp @@ -52,6 +52,29 @@ int MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam) { return (int)Meta_GetMostOnline((HANDLE)wParam);
}
+//gets the handle for the 'active' messaging contact (the one new messages will be sent to,
+//taking into account temporary conversation settings and 'force state' below)
+//wParam=(HANDLE)hMetaContact
+//lParam=0
+//returns a handle to the 'most online' contact
+//added with meta2 (2007/10/4)
+int MetaAPI_GetActiveContact(WPARAM wParam, LPARAM lParam) {
+ HANDLE hMeta = (HANDLE)wParam, hActive = 0;
+ if(DBGetContactSettingByte(hMeta, MODULE, "ForceDefault", 0))
+ hActive = (HANDLE)MetaAPI_GetDefault((WPARAM)hMeta, 0);
+ if(!hActive) {
+ if((hActive = (HANDLE)DBGetContactSettingDword(hMeta, MODULE, "ForceSend", 0)) == 0) {
+ if((hActive = (HANDLE)DBGetContactSettingDword(hMeta, MODULE, "TempDefault", 0)) == 0) {
+ hActive = Meta_GetMostOnline(hMeta);
+ if(ContactStatus(hActive, ContactProto(hActive)) == ID_STATUS_OFFLINE) {
+ hActive = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_IMSENDOFFLINE);
+ }
+ }
+ }
+ }
+ return (int)hActive;
+}
+
//gets the number of subcontacts for a metacontact
//wParam=(HANDLE)hMetaContact
//lParam=0
@@ -275,7 +298,7 @@ int ModulesLoadedAPI(WPARAM wParam, LPARAM lParam) { return 0;
}
-#define NUM_API_SERVICES 17
+#define NUM_API_SERVICES 18
HANDLE hServicesAPI[NUM_API_SERVICES] = {0};
HANDLE hEventModulesLoadedAPI = 0;
void InitAPI() {
@@ -284,6 +307,7 @@ void InitAPI() { hServicesAPI[i++] = CreateServiceFunction(MS_MC_GETDEFAULTCONTACT, MetaAPI_GetDefault);
hServicesAPI[i++] = CreateServiceFunction(MS_MC_GETDEFAULTCONTACTNUM, MetaAPI_GetDefaultNum);
hServicesAPI[i++] = CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
+ hServicesAPI[i++] = CreateServiceFunction(MS_MC_GETACTIVECONTACT, MetaAPI_GetActiveContact);
hServicesAPI[i++] = CreateServiceFunction(MS_MC_GETNUMCONTACTS, MetaAPI_GetNumContacts);
hServicesAPI[i++] = CreateServiceFunction(MS_MC_GETSUBCONTACT, MetaAPI_GetContact);
hServicesAPI[i++] = CreateServiceFunction(MS_MC_SETDEFAULTCONTACTNUM, MetaAPI_SetDefaultContactNum);
|