Skip to content
Snippets Groups Projects
Commit 87f64b2d authored by Mark Palange (Mani)'s avatar Mark Palange (Mani)
Browse files

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.
parent ad6d0e3b
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -89,6 +89,7 @@ class LLLoginInstance : public LLSingleton<LLLoginInstance>
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 @@ class LLLoginInstance : public LLSingleton<LLLoginInstance>
std::string mSerialNumber;
int mLastExecEvent;
UpdaterLauncherCallback mUpdaterLauncher;
boost::scoped_ptr<LLEventStream> mUpdateAppResponse;
LLEventDispatcher mDispatcher;
};
......
......@@ -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;
}
......@@ -35,6 +35,7 @@
#include "llpanel.h"
#include "llframetimer.h"
#include "llevents.h"
class LLImageRaw;
class LLButton;
......@@ -75,7 +76,12 @@ class LLProgressView : public LLPanel
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
......@@ -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;
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment