From dc934629919bdcaea72c78e5291263914fb958ec Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 11 May 2009 20:05:46 +0000 Subject: svn merge -r113003:119136 svn+ssh://svn.lindenlab.com/svn/linden/branches/login-api/login-api-2 svn+ssh://svn.lindenlab.com/svn/linden/branches/login-api/login-api-3 --- indra/newview/lllogininstance.h | 95 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 indra/newview/lllogininstance.h (limited to 'indra/newview/lllogininstance.h') diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h new file mode 100644 index 0000000000..da70fec40e --- /dev/null +++ b/indra/newview/lllogininstance.h @@ -0,0 +1,95 @@ +/** + * @file lllogininstance.h + * @brief A host for the viewer's login connection. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLLOGININSTANCE_H +#define LL_LLLOGININSTANCE_H + +#include +class LLLogin; + +// This class hosts the login module and is used to +// negotiate user authentication attempts. +class LLLoginInstance : public LLSingleton +{ +public: + LLLoginInstance(); + ~LLLoginInstance(); + + void connect(const LLSD& credential); // Connect to the current grid choice. + void connect(const std::string& uri, const LLSD& credential); // Connect to the given uri. + void reconnect(); // reconnect using the current credentials. + void disconnect(); + + // Set whether this class will drive user interaction. + // If not, login failures like 'need tos agreement' will + // end the login attempt. + void setUserInteraction(bool state) { mUserInteraction = state; } + bool getUserInteraction() { return mUserInteraction; } + + // Whether to tell login to skip optional update request. + // False by default. + void setSkipOptionalUpdate(bool state) { mSkipOptionalUpdate = state; } + + bool authFailure() { return mAttemptComplete && mLoginState == "offline"; } + bool authSuccess() { return mAttemptComplete && mLoginState == "online"; } + + const std::string& getLoginState() { return mLoginState; } + LLSD getResponse(const std::string& key) { return getResponse()[key]; } + LLSD getResponse(); + + // Only valid when authSuccess == true. + const F64 getLastTransferRateBPS() { return mTransferRate; } + +private: + void constructAuthParams(const LLSD& credentials); + void updateApp(bool mandatory, const std::string& message); + bool updateDialogCallback(const LLSD& notification, const LLSD& response); + + bool handleLoginEvent(const LLSD& event); + bool handleLoginFailure(const LLSD& event); + bool handleLoginSuccess(const LLSD& event); + + void handleTOSResponse(bool v, const std::string& key); + + void attemptComplete() { mAttemptComplete = true; } // In the future an event? + + boost::scoped_ptr mLoginModule; + std::string mLoginState; + LLSD mRequestData; + LLSD mResponseData; + bool mUserInteraction; + bool mSkipOptionalUpdate; + bool mAttemptComplete; + F64 mTransferRate; +}; + +#endif -- cgit v1.2.3 From db7f15df68cda2850c3d8a7ffcc59fc136de6f95 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 22 Jul 2009 14:53:55 -0700 Subject: Adding LLLoginInstance unit test --- indra/newview/lllogininstance.h | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'indra/newview/lllogininstance.h') diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index da70fec40e..afe96acd1e 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -34,7 +34,9 @@ #define LL_LLLOGININSTANCE_H #include +#include class LLLogin; +class LLEventStream; // This class hosts the login module and is used to // negotiate user authentication attempts. @@ -49,16 +51,6 @@ public: void reconnect(); // reconnect using the current credentials. void disconnect(); - // Set whether this class will drive user interaction. - // If not, login failures like 'need tos agreement' will - // end the login attempt. - void setUserInteraction(bool state) { mUserInteraction = state; } - bool getUserInteraction() { return mUserInteraction; } - - // Whether to tell login to skip optional update request. - // False by default. - void setSkipOptionalUpdate(bool state) { mSkipOptionalUpdate = state; } - bool authFailure() { return mAttemptComplete && mLoginState == "offline"; } bool authSuccess() { return mAttemptComplete && mLoginState == "online"; } @@ -69,10 +61,25 @@ public: // Only valid when authSuccess == true. const F64 getLastTransferRateBPS() { return mTransferRate; } + // Set whether this class will drive user interaction. + // If not, login failures like 'need tos agreement' will + // end the login attempt. + void setUserInteraction(bool state) { mUserInteraction = state; } + bool getUserInteraction() { return mUserInteraction; } + + // Whether to tell login to skip optional update request. + // False by default. + void setSkipOptionalUpdate(bool state) { mSkipOptionalUpdate = state; } + void setSerialNumber(const std::string& sn) { mSerialNumber = sn; } + void setLastExecEvent(int lee) { mLastExecEvent = lee; } + + typedef boost::function UpdaterLauncherCallback; + void setUpdaterLauncher(const UpdaterLauncherCallback& ulc) { mUpdaterLauncher = ulc; } + private: void constructAuthParams(const LLSD& credentials); void updateApp(bool mandatory, const std::string& message); - bool updateDialogCallback(const LLSD& notification, const LLSD& response); + bool updateDialogCallback(const LLSD& event); bool handleLoginEvent(const LLSD& event); bool handleLoginFailure(const LLSD& event); @@ -90,6 +97,10 @@ private: bool mSkipOptionalUpdate; bool mAttemptComplete; F64 mTransferRate; + std::string mSerialNumber; + int mLastExecEvent; + UpdaterLauncherCallback mUpdaterLauncher; + boost::scoped_ptr mUpdateAppResponse; }; #endif -- cgit v1.2.3 From 9538328d5f7cf0f0be5dd77b8e27032e09104fff Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Fri, 24 Jul 2009 15:08:16 -0700 Subject: Adding LLLoginInstance unit test. - Added LLNotificationsInterface class. - Removed LLLoginInstance use of LLNotifications EventAPI --- indra/newview/lllogininstance.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/lllogininstance.h') diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index afe96acd1e..47d52a6184 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -37,6 +37,7 @@ #include class LLLogin; class LLEventStream; +class LLNotificationsInterface; // This class hosts the login module and is used to // negotiate user authentication attempts. @@ -73,13 +74,15 @@ public: void setSerialNumber(const std::string& sn) { mSerialNumber = sn; } void setLastExecEvent(int lee) { mLastExecEvent = lee; } + void setNotificationsInterface(LLNotificationsInterface* ni) { mNotifications = ni; } + typedef boost::function UpdaterLauncherCallback; void setUpdaterLauncher(const UpdaterLauncherCallback& ulc) { mUpdaterLauncher = ulc; } private: void constructAuthParams(const LLSD& credentials); void updateApp(bool mandatory, const std::string& message); - bool updateDialogCallback(const LLSD& event); + bool updateDialogCallback(const LLSD& notification, const LLSD& response); bool handleLoginEvent(const LLSD& event); bool handleLoginFailure(const LLSD& event); @@ -90,6 +93,8 @@ private: void attemptComplete() { mAttemptComplete = true; } // In the future an event? boost::scoped_ptr mLoginModule; + LLNotificationsInterface* mNotifications; + std::string mLoginState; LLSD mRequestData; LLSD mResponseData; -- cgit v1.2.3 From 8f4811f3fd7f252a5f5bc50ed11fecd8e42f3e68 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Tue, 11 Aug 2009 12:09:18 -0400 Subject: Better solution for fixing up the LLFloaterTOS callback after the last viewer-2.0.0-3 merge. LLFloaterTOS and LLLoginInstance now communicate through an event pump "lllogininstance_tos_callback". reviewed by Mani. --- indra/newview/lllogininstance.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lllogininstance.h') diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 47d52a6184..6a2ccf919e 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -88,7 +88,7 @@ private: bool handleLoginFailure(const LLSD& event); bool handleLoginSuccess(const LLSD& event); - void handleTOSResponse(bool v, const std::string& key); + bool handleTOSResponse(bool v, const std::string& key); void attemptComplete() { mAttemptComplete = true; } // In the future an event? -- cgit v1.2.3 From e3a4e3dc10a96b0822674cea262f41774e55a660 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 9 Oct 2009 19:42:59 -0400 Subject: DEV-40930: Added ["change"] key to login-module status events. Changed existing event calls to use state as "offline" or "online", with "change" indicating the reason for this status event. Changed disconnect() to send state "offline", change "disconnect" -- instead of replaying last auth failure. Changed unit tests accordingly. Changed LLLoginInstance::handleLoginEvent() to use LLEventDispatcher to route calls to handleLoginFailure() et al. Added LLEventDispatcher::get() to allow retrieving Callable by name and testing for empty(). --- indra/newview/lllogininstance.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/lllogininstance.h') diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 6a2ccf919e..19d7449bc1 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -33,6 +33,7 @@ #ifndef LL_LLLOGININSTANCE_H #define LL_LLLOGININSTANCE_H +#include "lleventdispatcher.h" #include #include class LLLogin; @@ -85,8 +86,9 @@ private: bool updateDialogCallback(const LLSD& notification, const LLSD& response); bool handleLoginEvent(const LLSD& event); - bool handleLoginFailure(const LLSD& event); - bool handleLoginSuccess(const LLSD& event); + void handleLoginFailure(const LLSD& event); + void handleLoginSuccess(const LLSD& event); + void handleDisconnect(const LLSD& event); bool handleTOSResponse(bool v, const std::string& key); @@ -106,6 +108,7 @@ private: int mLastExecEvent; UpdaterLauncherCallback mUpdaterLauncher; boost::scoped_ptr mUpdateAppResponse; + LLEventDispatcher mDispatcher; }; #endif -- cgit v1.2.3