From 60ed886ccef201a29a4f3a40fe582e97329ed8de Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 4 Jul 2007 15:43:37 +0000 Subject: added idle support git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@250 4f64403b-2f21-0410-a795-97e2b3489a10 --- MySpace/proto.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'MySpace/proto.cpp') diff --git a/MySpace/proto.cpp b/MySpace/proto.cpp index 0cdf64d..989424a 100644 --- a/MySpace/proto.cpp +++ b/MySpace/proto.cpp @@ -338,6 +338,7 @@ bool FileExists(char *filename) { CloseHandle(hFile); return true; } + return false; } int GetAvatarInfo(WPARAM wParam,LPARAM lParam) { @@ -424,10 +425,19 @@ void RegisterProto() { CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); } +int IdleChanged(WPARAM wParam, LPARAM lParam) { + if(lParam & IDF_PRIVACY) return 0; + + if((lParam & IDF_ISIDLE) && status == ID_STATUS_ONLINE) { // mimic official client - doesn't go idle when away (or invisible?) + SetServerStatus(ID_STATUS_IDLE); + } + return 0; +} + #define NUM_FILTER_SERVICES 17 HANDLE hServices[NUM_FILTER_SERVICES]; -HANDLE hEventContactDeleted; +HANDLE hEventContactDeleted, hEventIdle; void CreateProtoServices() { // create our services int i = 0; @@ -456,9 +466,11 @@ void CreateProtoServices() { // remember to modify the NUM_FILTER_SERVICES #define above if you add more services! hEventContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); + hEventIdle = HookEvent(ME_IDLE_CHANGED, IdleChanged); } void DeinitProto() { + UnhookEvent(hEventIdle); UnhookEvent(hEventContactDeleted); for(int i = 0; i < NUM_FILTER_SERVICES; i++) DestroyServiceFunction(hServices[i]); -- cgit v1.2.3