summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MySpace/common.h1
-rw-r--r--MySpace/proto.cpp14
-rw-r--r--MySpace/server_con.cpp9
-rw-r--r--MySpace/version.h4
4 files changed, 24 insertions, 4 deletions
diff --git a/MySpace/common.h b/MySpace/common.h
index 0a9db69..138fa5c 100644
--- a/MySpace/common.h
+++ b/MySpace/common.h
@@ -46,6 +46,7 @@
#include <m_clist.h>
#include <m_utils.h>
#include <m_langpack.h>
+#include <m_idle.h>
#include <m_popup.h>
#include <m_updater.h>
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]);
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp
index 47624ba..03321da 100644
--- a/MySpace/server_con.cpp
+++ b/MySpace/server_con.cpp
@@ -58,6 +58,7 @@ int stat_mir_to_myspace(int mir_status) {
case ID_STATUS_INVISIBLE: return 0;
case ID_STATUS_AWAY: return 5;
case ID_STATUS_ONLINE: return 1;
+ case ID_STATUS_IDLE: return 2;
}
return 0;
}
@@ -66,6 +67,7 @@ int stat_myspace_to_mir(int myspace_status) {
switch(myspace_status) {
case 0: return ID_STATUS_OFFLINE;
case 1: return ID_STATUS_ONLINE;
+ case 2: return ID_STATUS_IDLE;
case 5: return ID_STATUS_AWAY;
}
return 0;
@@ -253,7 +255,12 @@ void try_login(NetMessage &msg, HANDLE connection) {
}
void ParseStatusMessage(HANDLE hContact, char *smsg) {
- DBWriteContactSettingWord(hContact, MODULE, "Status", stat_myspace_to_mir(smsg[3] - '0'));
+ int stat = stat_myspace_to_mir(smsg[3] - '0');
+ if(stat == ID_STATUS_IDLE) {
+ DBWriteContactSettingWord(hContact, MODULE, "IdleTS", (DWORD)time(0));
+ } else {
+ DBWriteContactSettingWord(hContact, MODULE, "Status", stat);
+ }
smsg += 8;
char *end = strstr(smsg, "|");
if(end) *end = 0;
diff --git a/MySpace/version.h b/MySpace/version.h
index 8dcc3b3..c0a90b5 100644
--- a/MySpace/version.h
+++ b/MySpace/version.h
@@ -4,8 +4,8 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 19
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 0
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM