From 197cf5ca922d695811fcd8ba790efa2528696971 Mon Sep 17 00:00:00 2001 From: Szymon Tokarz Date: Fri, 15 Jan 2016 15:23:41 +0000 Subject: Sametime Protocol: - improve login redirect session status support, force login to current server if no new host parameter in redirect message (like in https://developer.pidgin.im/ticket/7563 ) - new database protocol parameter "ForceLogin", if set to 1 - force login to Sametime server after any login redirect message git-svn-id: http://svn.miranda-ng.org/main/trunk@16094 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Sametime/src/sametime_session.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'protocols/Sametime/src/sametime_session.cpp') diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index a0e6eb8bdf..37bff64a3c 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -113,14 +113,10 @@ void __cdecl SessionStateChange(mwSession* session, mwSessionState state, gpoint break; case mwSession_STOPPED: - break; + case mwSession_LOGIN_REDIR: - proto->debugLog(_T("SessionStateChange() mwSession_LOGIN_REDIR info=[%s]"), _A2T((char*)info)); - //options.server_name = str((char*)info); - mir_strcpy(proto->options.server_name, (char*)info); - proto->LogOut(); - proto->LogIn(proto->login_status, proto->m_hNetlibUser); + proto->OnLogInRedirect((char*)info); break; case mwSession_LOGIN_CONT: @@ -521,6 +517,25 @@ int CSametimeProto::LogOut() return 0; } +int CSametimeProto::OnLogInRedirect(char* newHost) +{ + debugLog(_T("OnLogInRedirect() mwSession_LOGIN_REDIR newHost=[%s]"), _A2T(newHost)); + + if (!newHost || !mir_strcmp(newHost, options.server_name) || db_get_b(0, m_szModuleName, "ForceLogin", 0) == 1) { + debugLog(_T("OnLogInRedirect() forceLogin")); + mwSession_forceLogin(session); + return 0; + } + + debugLog(_T("OnLogInRedirect() redirect")); + mir_strcpy(options.server_name, newHost); + LogOut(); + Sleep(50); //wait for SessionThread end + LogIn(login_status, m_hNetlibUser); + return 0; + +} + void CSametimeProto::InitAwayMsg() { AwayMessages.szOnline = 0; -- cgit v1.2.3