From 01a664406e36abb810364237fda24e204265d7b4 Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 11 Jul 2007 04:24:28 +0000 Subject: fix reaction to global status modes git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@276 4f64403b-2f21-0410-a795-97e2b3489a10 --- MySpace/server_con.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'MySpace/server_con.cpp') diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp index 5f140b2..b540b3a 100644 --- a/MySpace/server_con.cpp +++ b/MySpace/server_con.cpp @@ -57,8 +57,9 @@ bool WriteData(char *fn, int fn_size, char *data, int data_size) { int stat_mir_to_myspace(int mir_status) { switch(mir_status) { case ID_STATUS_INVISIBLE: return 0; - case ID_STATUS_AWAY: return 5; case ID_STATUS_ONLINE: return 1; + case ID_STATUS_AWAY: return 5; + case ID_STATUS_IDLE: return 2; } return 0; @@ -71,7 +72,27 @@ int stat_myspace_to_mir(int myspace_status) { case 2: return ID_STATUS_IDLE; case 5: return ID_STATUS_AWAY; } - return 0; + return ID_STATUS_OFFLINE; +} + +// translate request to change to mode into actual mode +int stat_mir_to_mir(int mir_status) { + switch(mir_status) { + case ID_STATUS_INVISIBLE: return ID_STATUS_INVISIBLE; + case ID_STATUS_ONLINE: return ID_STATUS_ONLINE; + case ID_STATUS_AWAY: return ID_STATUS_AWAY; + + case ID_STATUS_DND: return ID_STATUS_AWAY; + case ID_STATUS_NA: return ID_STATUS_AWAY; + case ID_STATUS_OCCUPIED: return ID_STATUS_AWAY; + case ID_STATUS_ONTHEPHONE: return ID_STATUS_AWAY; + case ID_STATUS_OUTTOLUNCH: return ID_STATUS_AWAY; + + case ID_STATUS_FREECHAT: return ID_STATUS_ONLINE; + + case ID_STATUS_IDLE: return ID_STATUS_IDLE; + } + return ID_STATUS_OFFLINE; } HANDLE FindContact(int uid) { @@ -477,7 +498,7 @@ void __cdecl ServerThreadFunc(void*) { PipedStringList l = msg.get_list("msg"); int old_status = DBGetContactSettingWord(hContact, MODULE, "Status", ID_STATUS_OFFLINE), new_status = ParseStatusMessage(hContact, l); - if(status != ID_STATUS_INVISIBLE && old_status != new_status && new_status != ID_STATUS_OFFLINE) { + if(status != ID_STATUS_INVISIBLE && old_status == ID_STATUS_OFFLINE && new_status != ID_STATUS_OFFLINE) { ClientNetMessage msg; msg.add_int("bm", 200); msg.add_int("sesskey", sesskey); @@ -788,6 +809,7 @@ void SetServerStatus(int st) { if(st == ID_STATUS_OFFLINE) { StopThread(); } else { + st = stat_mir_to_mir(st); if(myspace_server_running && sesskey) { // set status ClientNetMessage msg_status; -- cgit v1.2.3