diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2008-06-02 05:52:07 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2008-06-02 05:52:07 +0000 |
commit | 389f409a4b7c4243435ffdd11e39f225965a5a61 (patch) | |
tree | 336485ddede887b1f44037f68c25e812630b0cd7 | |
parent | bbdabe234691ad14c975661376e4e89c6650cdb8 (diff) |
store contacts properly on server side, so that status is reported
added code to store all old contacts to fix old server side contact lists
updated version.h
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@409 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | MySpace/proto.cpp | 5 | ||||
-rw-r--r-- | MySpace/server_con.cpp | 80 | ||||
-rw-r--r-- | MySpace/server_con.h | 3 | ||||
-rw-r--r-- | MySpace/version.h | 4 |
4 files changed, 68 insertions, 24 deletions
diff --git a/MySpace/proto.cpp b/MySpace/proto.cpp index 3fd3287..5d38d07 100644 --- a/MySpace/proto.cpp +++ b/MySpace/proto.cpp @@ -263,6 +263,9 @@ int AddToList(WPARAM wParam, LPARAM lParam) { hContact = CreateContact(mpsr->uid, mpsr->psr.nick, mpsr->psr.email, temp ? false : true);
} else {
if(!temp) {
+ AddBuddyOnServer(mpsr->uid);
+
+ /*
ClientNetMessage msg_add;
msg_add.add_string("addbuddy", "");
msg_add.add_int("sesskey", sesskey);
@@ -270,7 +273,7 @@ int AddToList(WPARAM wParam, LPARAM lParam) { msg_add.add_string("reason", "");
SendMessage(msg_add);
-
+ */
}
}
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp index 2b524e7..4c295c0 100644 --- a/MySpace/server_con.cpp +++ b/MySpace/server_con.cpp @@ -133,6 +133,58 @@ int LookupUID(int uid) { return ret;
}
+void AddAllContactsToServer() {
+ char *proto;
+ int uid;
+ HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ while ( hContact != NULL )
+ {
+ proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
+ if ( proto && !strcmp( MODULE, proto)) {
+ uid = DBGetContactSettingDword(hContact, MODULE, "UID", (DWORD)0);
+ AddBuddyOnServer(uid);
+ }
+ hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+}
+
+void AddBuddyOnServer(int uid) {
+ ClientNetMessage msg_add;
+ msg_add.add_string("addbuddy", "");
+ msg_add.add_int("sesskey", sesskey);
+ msg_add.add_int("newprofileid", uid);
+ msg_add.add_string("reason", "");
+
+ SendMessage(msg_add);
+
+ // update block list
+ ClientNetMessage msg_block;
+ msg_block.add_string("blocklist", "");
+ msg_block.add_int("sesskey", sesskey);
+
+ char idlist[1024];
+ mir_snprintf(idlist, 1024, "b-|%d|a+|%d", uid, uid);
+ msg_block.add_string("idlist", idlist);
+
+ SendMessage(msg_block);
+
+ // update server side list?
+ ClientNetMessage msg_srvlist;
+ msg_srvlist.add_int("persist", 1);
+ msg_srvlist.add_int("sesskey", sesskey);
+ msg_srvlist.add_int("cmd", 514);
+ msg_srvlist.add_int("dsn", 0);
+ msg_srvlist.add_int("uid", my_uid);
+ msg_srvlist.add_int("lid", 9);
+ msg_srvlist.add_int("rid", 31);
+
+ char body[1024];
+ mir_snprintf(body, 1024, "ContactID=%d", uid);
+ msg_srvlist.add_string("body", body);
+
+ SendMessage(msg_srvlist);
+}
+
HANDLE CreateContact(int uid, char *nick, char *email, bool add_buddy) {
HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
@@ -146,27 +198,7 @@ HANDLE CreateContact(int uid, char *nick, char *email, bool add_buddy) { }
- if(add_buddy) {
- ClientNetMessage msg_add;
- msg_add.add_string("addbuddy", "");
- msg_add.add_int("sesskey", sesskey);
- msg_add.add_int("newprofileid", uid);
- msg_add.add_string("reason", "");
-
- SendMessage(msg_add);
- }
-
- /*
- ClientNetMessage msg_block;
- msg_block.add_string("blocklist", "");
- msg_block.add_int("sesskey", sesskey);
-
- char idlist[1024];
- mir_snprintf(idlist, 1024, "b-|%d|a+|%d", mpsr->uid, mpsr->uid);
- msg_block.add_string("idlist", idlist);
-
- SendMessage(msg_block);
- */
+ if(add_buddy) AddBuddyOnServer(uid);
/*
// update contact details?
@@ -474,6 +506,12 @@ void __cdecl ServerThreadFunc(void*) { msg_setinfo.add_dict("info", ld);
SendMessage(msg_setinfo);
*/
+
+ // add all contacts to server (old versions didn't do it :| )
+ if(DBGetContactSettingByte(0, MODULE, "ContactsOnServer", 0) == 0) {
+ AddAllContactsToServer();
+ DBWriteContactSettingByte(0, MODULE, "ContactsOnServer", 1);
+ }
// start mail checking thread
mir_forkthread(CheckMailThreadFunc, 0);
diff --git a/MySpace/server_con.h b/MySpace/server_con.h index c81ce07..be73a6a 100644 --- a/MySpace/server_con.h +++ b/MySpace/server_con.h @@ -16,6 +16,9 @@ void SetServerStatusMessage(char *msg); HANDLE FindContact(int uid);
HANDLE CreateContact(int uid, char *nick, char *email, bool add_buddy);
int LookupUID(int uid);
+void AddBuddyOnServer(int uid);
+
+void AddAllContactsToServer();
void SendMessage(ClientNetMessage &msg);
void DownloadAvatar(HANDLE hContact, char *url);
diff --git a/MySpace/version.h b/MySpace/version.h index 87968ca..d6f3c11 100644 --- a/MySpace/version.h +++ b/MySpace/version.h @@ -4,8 +4,8 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
-#define __RELEASE_NUM 6
-#define __BUILD_NUM 3
+#define __RELEASE_NUM 7
+#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
|