summaryrefslogtreecommitdiff
path: root/MySpace/server_con.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MySpace/server_con.cpp')
-rw-r--r--MySpace/server_con.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp
index 41aad7d..47bfbcb 100644
--- a/MySpace/server_con.cpp
+++ b/MySpace/server_con.cpp
@@ -5,6 +5,8 @@
#include "options.h"
#include "nick_dialog.h"
+#include <ctime>
+
#define SERVER_READ_BUFFER_SIZE (1024 * 32)
/* TODO: obtain IPs of network interfaces from user's machine, instead of
@@ -190,7 +192,7 @@ void try_login(NetMessage &msg, HANDLE connection) {
reply.add_int("login2", 196610);
reply.add_string("username", email);
reply.add_data("response", ch_resp, ch_resp_size);
- reply.add_int("clientver", 673);
+ reply.add_int("clientver", CLIENT_VER);
reply.add_int("reconn", 0);
reply.add_int("status", 100);
reply.add_int("id", 1);
@@ -347,6 +349,28 @@ void __cdecl ServerThreadFunc(void*) {
DBWriteContactSettingWord(hContact, MODULE, "Status", stat_myspace_to_mir(smsg[3] - '0'));
}
}
+ } else if(msg.get_int("bm") == 1) { // instant message
+ int uid = msg.get_int("f");
+ if(uid) {
+ HANDLE hContact = FindContact(uid);
+ if(!hContact) {
+ hContact = CreateContact(uid, 0, 0);
+ }
+ char text[MAX_MESSAGE_SIZE];
+ if(msg.get_string("msg", text, MAX_MESSAGE_SIZE)) {
+ PROTORECVEVENT pre = {0};
+ pre.flags = PREF_UTF;
+ pre.szMessage = text;
+ pre.timestamp = (DWORD)time(0);
+
+ CCSDATA css = {0};
+ css.hContact = hContact;
+ css.lParam = (LPARAM)&pre;
+ css.szProtoService = PSR_MESSAGE;
+
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&css);
+ }
+ }
} else if(msg.exists(NMString("persistr"))) {
int cmd, dsn, lid, req;
cmd = msg.get_int("cmd") & 255;