diff options
author | Mark Palange (Mani) <palange@lindenlab.com> | 2009-12-21 13:48:46 -0800 |
---|---|---|
committer | Mark Palange (Mani) <palange@lindenlab.com> | 2009-12-21 13:48:46 -0800 |
commit | 87f64b2d8deeeb415bf765268d35b0c0af76b61d (patch) | |
tree | efa9934bb7afbc65292c37185651b8b7f362d593 | |
parent | ad6d0e3bb766c737b1e9bbd9d006391cc8bcc085 (diff) |
EXT-3550 Fixed messages from login.cgi not being displayed.
Handling message from "indeterminate" state - feeding them to the llprogressview.
Handling showing error message from incomplete login.
-rw-r--r-- | indra/newview/lllogininstance.cpp | 41 | ||||
-rw-r--r-- | indra/newview/lllogininstance.h | 2 | ||||
-rw-r--r-- | indra/newview/llprogressview.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llprogressview.h | 6 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 12 | ||||
-rw-r--r-- | indra/viewer_components/login/lllogin.cpp | 11 |
6 files changed, 70 insertions, 29 deletions
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 2dc9f255d7..24c72c65ce 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -76,6 +76,7 @@ LLLoginInstance::LLLoginInstance() : mDispatcher.add("fail.login", boost::bind(&LLLoginInstance::handleLoginFailure, this, _1)); mDispatcher.add("connect", boost::bind(&LLLoginInstance::handleLoginSuccess, this, _1)); mDispatcher.add("disconnect", boost::bind(&LLLoginInstance::handleDisconnect, this, _1)); + mDispatcher.add("indeterminate", boost::bind(&LLLoginInstance::handleIndeterminate, this, _1)); } LLLoginInstance::~LLLoginInstance() @@ -204,6 +205,8 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event) mTransferRate = event["transfer_rate"].asReal(); } + + // Call the method registered in constructor, if any, for more specific // handling LLEventDispatcher::Callable method(mDispatcher.get(event["change"])); @@ -295,6 +298,22 @@ void LLLoginInstance::handleDisconnect(const LLSD& event) // placeholder } +void LLLoginInstance::handleIndeterminate(const LLSD& event) +{ + // The indeterminate response means that the server + // gave the viewer a new url and params to try. + // The login module handles the retry, but it gives us the + // server response so that we may show + // the user some status. + LLSD message = event.get("data").get("message"); + if(message.isDefined()) + { + LLSD progress_update; + progress_update["desc"] = message; + LLEventPumps::getInstance()->obtain("LLProgressView").post(progress_update); + } +} + bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) { if(accepted) @@ -374,28 +393,6 @@ void LLLoginInstance::updateApp(bool mandatory, const std::string& auth_msg) mNotifications->add(notification_name, args, payload, boost::bind(&LLLoginInstance::updateDialogCallback, this, _1, _2)); } - - /* *NOTE:Mani Experiment with Event API interface. - if(!mUpdateAppResponse) - { - bool make_unique = true; - mUpdateAppResponse.reset(new LLEventStream("logininstance_updateapp", make_unique)); - mUpdateAppResponse->listen("diaupdateDialogCallback", - boost::bind(&LLLoginInstance::updateDialogCallback, - this, _1 - ) - ); - } - - LLSD event; - event["op"] = "requestAdd"; - event["name"] = notification_name; - event["substitutions"] = args; - event["payload"] = payload; - event["reply"] = mUpdateAppResponse->getName(); - - LLEventPumps::getInstance()->obtain("LLNotifications").post(event); - */ } bool LLLoginInstance::updateDialogCallback(const LLSD& notification, const LLSD& response) diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 19d7449bc1..c8704eddb4 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -89,6 +89,7 @@ private: void handleLoginFailure(const LLSD& event); void handleLoginSuccess(const LLSD& event); void handleDisconnect(const LLSD& event); + void handleIndeterminate(const LLSD& event); bool handleTOSResponse(bool v, const std::string& key); @@ -107,7 +108,6 @@ private: std::string mSerialNumber; int mLastExecEvent; UpdaterLauncherCallback mUpdaterLauncher; - boost::scoped_ptr<LLEventStream> mUpdateAppResponse; LLEventDispatcher mDispatcher; }; diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 5f6b210767..f723d9f240 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -72,10 +72,12 @@ const S32 ANIMATION_FRAMES = 1; //13; LLProgressView::LLProgressView(const LLRect &rect) : LLPanel(), mPercentDone( 0.f ), - mMouseDownInActiveArea( false ) + mMouseDownInActiveArea( false ), + mUpdateEvents("LLProgressView") { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_progress.xml"); reshape(rect.getWidth(), rect.getHeight()); + mUpdateEvents.listen("self", boost::bind(&LLProgressView::handleUpdate, this, _1)); } BOOL LLProgressView::postBuild() @@ -260,3 +262,26 @@ void LLProgressView::onClickMessage(void* data) } } } + +bool LLProgressView::handleUpdate(const LLSD& event_data) +{ + LLSD message = event_data.get("message"); + LLSD desc = event_data.get("desc"); + LLSD percent = event_data.get("percent"); + + if(message.isUndefined()) + { + setMessage(message.asString()); + } + + if(desc.isDefined()) + { + setText(desc.asString()); + } + + if(percent.isDefined()) + { + setPercent(percent.asReal()); + } + return false; +} diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index 865646c85d..6853674d88 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -35,6 +35,7 @@ #include "llpanel.h" #include "llframetimer.h" +#include "llevents.h" class LLImageRaw; class LLButton; @@ -75,7 +76,12 @@ protected: LLRect mOutlineRect; bool mMouseDownInActiveArea; + // The LLEventStream mUpdateEvents depends upon this class being a singleton + // to avoid pump name conflicts. static LLProgressView* sInstance; + LLEventStream mUpdateEvents; + + bool handleUpdate(const LLSD& event_data); }; #endif // LL_LLPROGRESSVIEW_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 539673ab9e..fdf8fa171d 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1170,12 +1170,16 @@ bool idle_startup() } else { - // Still waiting for response. - // *TODO:Mani - Actually check for login progress. // If we get here we have gotten past the potential stall // in curl, so take "may appear frozen" out of progress bar. JC - auth_desc = LLTrans::getString("LoginInProgressNoFrozen"); - set_startup_status(progress, auth_desc, auth_message); + // *NOTE:Mani - Actual responses handled by LLLoginInstance::handleLoginEvent() + static bool has_set_unfrozen_msg = false; + if(!has_set_unfrozen_msg) + { + auth_desc = LLTrans::getString("LoginInProgressNoFrozen"); + set_startup_status(progress, auth_desc, auth_message); + has_set_unfrozen_msg = true; + } } return FALSE; diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 018f691672..364088ab31 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -235,6 +235,8 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential break; } + sendProgressEvent("offline", "indeterminate", mAuthResponse["responses"]); + // Here the login service at the current URI is redirecting us // to some other URI ("indeterminate" -- why not "redirect"?). // The response should contain another uri to try, with its @@ -276,7 +278,14 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential // Here we got through all the rewrittenURIs without succeeding. Tell // caller this didn't work out so well. Of course, the only failure data // we can reasonably show are from the last of the rewrittenURIs. - sendProgressEvent("offline", "fail.login", mAuthResponse["responses"]); + + // *NOTE: The response from LLXMLRPCListener's Poller::poll method returns an + // llsd with no "responses" node. To make the output from an incomplete login symmetrical + // to success, add a data/message and data/reason fields. + LLSD error_response; + error_response["reason"] = mAuthResponse["status"]; + error_response["message"] = mAuthResponse["error"]; + sendProgressEvent("offline", "fail.login", error_response); } void LLLogin::Impl::disconnect() |