From 2184116cbf00ea959282cc6172934c81c74cb252 Mon Sep 17 00:00:00 2001 From: sje Date: Fri, 20 Jul 2007 04:08:52 +0000 Subject: made subcontact priorities configurable git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@289 4f64403b-2f21-0410-a795-97e2b3489a10 --- metacontacts/meta_utils.c | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'metacontacts/meta_utils.c') diff --git a/metacontacts/meta_utils.c b/metacontacts/meta_utils.c index c368ebb..7d064e1 100644 --- a/metacontacts/meta_utils.c +++ b/metacontacts/meta_utils.c @@ -429,23 +429,6 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) return TRUE; } -/* -#define ID_STATUS_OFFLINE 40071 ->8 -#define ID_STATUS_ONLINE 40072 ->0 -#define ID_STATUS_AWAY 40073 ->4 -#define ID_STATUS_DND 40074 ->7 -#define ID_STATUS_NA 40075 ->6 -#define ID_STATUS_OCCUPIED 40076 ->5 -#define ID_STATUS_FREECHAT 40077 ->1 -#define ID_STATUS_INVISIBLE 40078 ->0 -#define ID_STATUS_ONTHEPHONE 40079 ->2 -#define ID_STATUS_OUTTOLUNCH 40080 ->3 - -* Treat AIM 'away' as NA, to prevent it from being the most online all the time - see code in GetMostOnline below - -*/ - -int status_order[10] = {8, 0, 4, 7, 6, 5, 1, 0, 2, 3}; /** * Convenience method - get most online contact supporting messaging @@ -467,7 +450,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca HANDLE most_online_contact = NULL, hContact; int i, status, default_contact_number, num_contacts; unsigned long caps = 0; - char *proto; + char *proto, *most_online_proto; // you can't get more online than having the default contact ONLINE - so check that first if((default_contact_number = DBGetContactSettingDword(hMeta,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) @@ -491,7 +474,6 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca // a subcontact is being temporarily 'forced' to do sending if((most_online_contact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0))) { - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online_contact, 0); caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0; if(proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM; if(proto && (caps & capability) == capability && capability != 0) // capability is 0 when we're working out status @@ -516,6 +498,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca } else most_online_status = ID_STATUS_OFFLINE; + most_online_proto = proto; // otherwise, check all the subcontacts for the one closest to the ONLINE state which supports the required capability for(i = 0; i < num_contacts; i++) { if(i == default_contact_number) // already checked that (i.e. initial value of most_online_contact and most_online_status are those of the default contact) @@ -533,24 +516,17 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE); - // see comment above function - AIM is disproportionatly the most online due to limited status modes - if((strcmp(proto, "AIM") == 0 - || strcmp(proto, "SAMETIME") == 0 - || strcmp(proto, "MYSPACE")) - && status == ID_STATUS_AWAY) - { - status = ID_STATUS_NA; - } - if(status == ID_STATUS_ONLINE) { most_online_contact = hContact; + most_online_proto = proto; return most_online_contact; } else if(status <= ID_STATUS_OFFLINE) // status below ID_STATUS_OFFLINE is a connecting status continue; else { - if(status_order[status - ID_STATUS_OFFLINE] < status_order[most_online_status - ID_STATUS_OFFLINE]) { + if(GetRealPriority(proto, status) < GetRealPriority(most_online_proto, most_online_status)) { most_online_status = status; most_online_contact = hContact; + most_online_proto = proto; } } } -- cgit v1.2.3