diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-30 15:48:03 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-30 15:48:03 +0000 |
commit | ad621c29997aff0bda961718de44f536d13213cf (patch) | |
tree | 12f46c43d1fdd3b5204b199ff24eb3d2bcda9b57 /MySpace/server_con.cpp | |
parent | d7c18eb91b752af0a617feb08151ba6ec73b7332 (diff) |
implemented messaging! woohoo!
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@223 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'MySpace/server_con.cpp')
-rw-r--r-- | MySpace/server_con.cpp | 26 |
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)⪯
+ 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;
|