diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-03 16:07:55 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-03 16:07:55 +0000 |
commit | a55a751a710ebf51c0e6923e992505ad90789052 (patch) | |
tree | ac0c93d617d82ee81294b895893f4480a5a4752f /meta2/api.cpp | |
parent | c80b88f4ca41d1ccf11e308113862c5a11847385 (diff) |
added 'get active messaging contact' service to api
honour 'force' states, remember contact we're chatting with until window closed
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@346 4f64403b-2f21-0410-a795-97e2b3489a10
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);
|