From 1f9219eb0abc61710a0ed5ddf0b23877be08360d Mon Sep 17 00:00:00 2001 From: Piotr Piastucki Date: Mon, 19 Oct 2015 23:49:45 +0000 Subject: MSN: Periodically refresh OAuth so that connection doesn't timeout with error 922 after 24 hours. git-svn-id: http://svn.miranda-ng.org/main/trunk@15573 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn_threads.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'protocols/MSN/src/msn_threads.cpp') diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index e72575e1fb..8671f2032a 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -29,6 +29,7 @@ along with this program. If not, see . void __cdecl CMsnProto::msn_keepAliveThread(void*) { bool keepFlag = true; + time_t t; hKeepAliveThreadEvt = CreateEvent(NULL, FALSE, FALSE, NULL); @@ -58,6 +59,8 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) mStatusMsgTS = 0; ForkThread(&CMsnProto::msn_storeProfileThread, NULL); } + if (MyOptions.netId!=NETID_SKYPE && time(&t) >= authTokenExpiretime-3600) + ForkThread(&CMsnProto::msn_refreshOAuthThread, msnNsThread); break; case WAIT_OBJECT_0: @@ -80,6 +83,13 @@ void __cdecl CMsnProto::msn_loginThread(void*) MSN_FetchRecentMessages(); } +void __cdecl CMsnProto::msn_refreshOAuthThread(void *param) +{ + if (MSN_RefreshOAuthTokens() > 0) { + bIgnoreATH = true; + MSN_SendATH((ThreadData*)param); + } +} ///////////////////////////////////////////////////////////////////////////////////////// // MSN server thread - read and process commands from a server -- cgit v1.2.3