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_proto.h | 1 + protocols/Sametime/src/sametime_session.cpp | 27 +++++++++++++++++++++------ protocols/Sametime/src/version.h | 4 ++-- 3 files changed, 24 insertions(+), 8 deletions(-) (limited to 'protocols/Sametime') diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index 35082ecd23..7b51b77476 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -113,6 +113,7 @@ struct CSametimeProto : public PROTO void InitSessionMenu(); int LogIn(int status, HANDLE hNetlibUser); int LogOut(); + int OnLogInRedirect(char* newHost); int SetSessionStatus(int status); void UpdateSelfStatus(); int SetIdle(bool idle); 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; diff --git a/protocols/Sametime/src/version.h b/protocols/Sametime/src/version.h index 8e4ec7c6c6..eac0e4cf48 100644 --- a/protocols/Sametime/src/version.h +++ b/protocols/Sametime/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 7 #define __RELEASE_NUM 0 -#define __BUILD_NUM 0 +#define __BUILD_NUM 3 #include @@ -10,5 +10,5 @@ #define __DESCRIPTION "Implementation of instant messaging for the Lotus Sametime protocol." #define __AUTHOR "Scott Ellis, Szymon Tokarz" #define __AUTHOREMAIL "mail"/*antispam*/"@"/*antispam*/"scottellis.com.au, wsx22"/*antispam*/"@"/*antispam*/"o2.pl" -#define __COPYRIGHT "© 2005 Scott Ellis, 2014 wsx22" +#define __COPYRIGHT "© 2005 Scott Ellis, 2014-2016 wsx22" #define __AUTHORWEB "http://miranda-ng.org/p/Sametime/" -- cgit v1.2.3