From 8677ac8db6aa7528fdb84bf3cd8a996a3f45e254 Mon Sep 17 00:00:00 2001 From: Piotr Piastucki Date: Sat, 16 May 2015 12:09:28 +0000 Subject: - Cache authContactToken after refresh in MSN_GetPassportAuth as this token expires already after 8 hours whereas other tokens like login persist 24h - Fixed groupchat invite - Fork Contact list Refresh on connect into background thread so that login is faster. git-svn-id: http://svn.miranda-ng.org/main/trunk@13615 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn_auth.cpp | 1 + protocols/MSN/src/msn_chat.cpp | 2 +- protocols/MSN/src/msn_commands.cpp | 7 ++++--- protocols/MSN/src/msn_contact.cpp | 10 +++++++++- protocols/MSN/src/msn_proto.h | 1 + protocols/MSN/src/msn_threads.cpp | 6 ++++++ 6 files changed, 22 insertions(+), 5 deletions(-) (limited to 'protocols/MSN') diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 27174c1232..764fad3891 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -229,6 +229,7 @@ int CMsnProto::MSN_GetPassportAuth(void) } else if (strcmp(addr, "contacts.msn.com") == 0 && toks) { replaceStr(authContactToken, ezxml_txt(toks)); + setString("authContactToken", authContactToken); } else if (strcmp(addr, "messengersecure.live.com") == 0 && toks) { replaceStr(oimSendToken, ezxml_txt(toks)); diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index a4e8c12145..3c0488dfde 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -346,7 +346,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto char szContact[MSN_MAX_EMAIL_LEN]; sprintf(szContact, "%d:%s", msc->netId, msc->email); - str.insertn(msc->email); + str.insertn(szContact); } } } diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 9a9e2e7958..568aa898c1 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -1197,8 +1197,8 @@ LBL_InvalidCommand: isConnectSuccess = true; MSN_SetServerStatus(m_iStatus); MSN_EnableMenuItems(true); - MSN_RefreshContactList(); - MSN_FetchRecentMessages(); + // Fork refreshing and populating contact list to the background + ForkThread(&CMsnProto::msn_loginThread, NULL); } } break; @@ -1415,7 +1415,8 @@ LBL_InvalidCommand: bSentBND = false; ForkThread(&CMsnProto::msn_keepAliveThread, NULL); - ForkThread(&CMsnProto::MSNConnDetectThread, NULL); + /* FIXME: Currently disables, as P2P maybe not working anymore in MSNP24? */ + //ForkThread(&CMsnProto::MSNConnDetectThread, NULL); } break; case ' RVC': //********* CVR: MSNP8 diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index e2ce150fca..9d2371ce3a 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -106,6 +106,7 @@ void CMsnProto::MSN_SetContactDb(MCONTACT hContact, const char *szEmail) void CMsnProto::AddDelUserContList(const char* email, const int list, const int netId, const bool del) { +/* char buf[512]; size_t sz; @@ -125,6 +126,7 @@ void CMsnProto::AddDelUserContList(const char* email, const int list, const int } msnNsThread->sendPacket(del ? "RML" : "ADL", "%d\r\n%s", sz, buf); } +*/ if (del) Lists_Remove(list, email); @@ -252,21 +254,27 @@ bool CMsnProto::MSN_RefreshContactList(void) if (GetMyNetID() != NETID_SKYPE) { + // Get your own profile info if (!MSN_SharingFindMembership()) return false; if (m_iDesiredStatus == ID_STATUS_OFFLINE) return false; + // Get "classic" MSN contacts if (!MSN_ABFind("ABFindContactsPaged", NULL)) return false; - MSN_ABRefreshClist(); + + // Get Skype contacts on linked profiles + if (!MSN_ABRefreshClist()) return false; if (m_iDesiredStatus == ID_STATUS_OFFLINE) return false; + // Remove contacts not on server etc. MSN_CleanupLists(); if (m_iDesiredStatus == ID_STATUS_OFFLINE) return false; msnLoggedIn = true; + // Populate Contact list on MSN network to get status updates of contacts MSN_CreateContList(); //MSN_StoreGetProfile(); } diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index adbbab1a57..645b43a90d 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -264,6 +264,7 @@ struct CMsnProto : public PROTO // MSN thread functions void __cdecl msn_keepAliveThread(void* arg); + void __cdecl msn_loginThread(void* arg); void __cdecl MSNServerThread(void* arg); void __cdecl MsnFileAckThread(void* arg); diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 0eee4578c4..5fa82e973b 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -70,6 +70,12 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) debugLogA("Closing keep-alive thread"); } +void __cdecl CMsnProto::msn_loginThread(void*) +{ + MSN_RefreshContactList(); + MSN_FetchRecentMessages(); +} + ///////////////////////////////////////////////////////////////////////////////////////// // MSN server thread - read and process commands from a server -- cgit v1.2.3