From ad621c29997aff0bda961718de44f536d13213cf Mon Sep 17 00:00:00 2001 From: sje Date: Sat, 30 Jun 2007 15:48:03 +0000 Subject: implemented messaging! woohoo! git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@223 4f64403b-2f21-0410-a795-97e2b3489a10 --- MySpace/server_con.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'MySpace/server_con.cpp') 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 + #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)⪯ + 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; -- cgit v1.2.3