diff options
author | Piotr Piastucki <leech.miranda@gmail.com> | 2015-10-19 23:49:45 +0000 |
---|---|---|
committer | Piotr Piastucki <leech.miranda@gmail.com> | 2015-10-19 23:49:45 +0000 |
commit | 1f9219eb0abc61710a0ed5ddf0b23877be08360d (patch) | |
tree | f01701f493132a3fa0abbc20db581987456d9b69 /protocols/MSN/src/msn_threads.cpp | |
parent | 53fe38bb0e7f94a58c3e4edc21581fdd4c5b3e5e (diff) |
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
Diffstat (limited to 'protocols/MSN/src/msn_threads.cpp')
-rw-r--r-- | protocols/MSN/src/msn_threads.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>. 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
|