summaryrefslogtreecommitdiff
path: root/indra/newview/lllogininstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lllogininstance.cpp')
-rw-r--r--indra/newview/lllogininstance.cpp145
1 files changed, 86 insertions, 59 deletions
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 229703bb39..54459342a7 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -31,6 +31,7 @@
// llcommon
#include "llevents.h"
#include "stringize.h"
+#include "llsdserialize.h"
// llmessage (!)
#include "llfiltersd2xmlrpc.h" // for xml_escape_string()
@@ -47,12 +48,10 @@
#include "llstartup.h"
#include "llfloaterreg.h"
#include "llnotifications.h"
+#include "llnotificationsutil.h"
#include "llwindow.h"
#include "llviewerwindow.h"
#include "llprogressview.h"
-#if LL_LINUX
-#include "lltrans.h"
-#endif
#include "llsecapi.h"
#include "llstartup.h"
#include "llmachineid.h"
@@ -250,63 +249,90 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event)
void LLLoginInstance::handleLoginFailure(const LLSD& event)
{
-
-
- // Login has failed.
- // Figure out why and respond...
- LLSD response = event["data"];
- std::string reason_response = response["reason"].asString();
- std::string message_response = response["message"].asString();
- // For the cases of critical message or TOS agreement,
- // start the TOS dialog. The dialog response will be handled
- // by the LLLoginInstance::handleTOSResponse() callback.
- // The callback intiates the login attempt next step, either
- // to reconnect or to end the attempt in failure.
- if(reason_response == "tos")
- {
- LL_INFOS() << "LLLoginInstance::handleLoginFailure ToS" << LL_ENDL;
-
- LLSD data(LLSD::emptyMap());
- data["message"] = message_response;
- data["reply_pump"] = TOS_REPLY_PUMP;
- if (gViewerWindow)
- gViewerWindow->setShowProgress(FALSE);
- LLFloaterReg::showInstance("message_tos", data);
- LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
- .listen(TOS_LISTENER_NAME,
- boost::bind(&LLLoginInstance::handleTOSResponse,
- this, _1, "agree_to_tos"));
- }
- else if(reason_response == "critical")
- {
- LL_INFOS() << "LLLoginInstance::handleLoginFailure Crit" << LL_ENDL;
+ // Login has failed.
+ // Figure out why and respond...
+ LLSD response = event["data"];
+ std::string reason_response = response["reason"].asString();
+ std::string message_response = response["message"].asString();
+ // For the cases of critical message or TOS agreement,
+ // start the TOS dialog. The dialog response will be handled
+ // by the LLLoginInstance::handleTOSResponse() callback.
+ // The callback intiates the login attempt next step, either
+ // to reconnect or to end the attempt in failure.
+ if(reason_response == "tos")
+ {
+ LL_INFOS() << "LLLoginInstance::handleLoginFailure ToS" << LL_ENDL;
+
+ LLSD data(LLSD::emptyMap());
+ data["message"] = message_response;
+ data["reply_pump"] = TOS_REPLY_PUMP;
+ if (gViewerWindow)
+ gViewerWindow->setShowProgress(FALSE);
+ LLFloaterReg::showInstance("message_tos", data);
+ LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
+ .listen(TOS_LISTENER_NAME,
+ boost::bind(&LLLoginInstance::handleTOSResponse,
+ this, _1, "agree_to_tos"));
+ }
+ else if(reason_response == "critical")
+ {
+ LL_INFOS() << "LLLoginInstance::handleLoginFailure Crit" << LL_ENDL;
+
+ LLSD data(LLSD::emptyMap());
+ data["message"] = message_response;
+ data["reply_pump"] = TOS_REPLY_PUMP;
+ if(response.has("error_code"))
+ {
+ data["error_code"] = response["error_code"];
+ }
+ if(response.has("certificate"))
+ {
+ data["certificate"] = response["certificate"];
+ }
+
+ if (gViewerWindow)
+ gViewerWindow->setShowProgress(FALSE);
+
+ LLFloaterReg::showInstance("message_critical", data);
+ LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
+ .listen(TOS_LISTENER_NAME,
+ boost::bind(&LLLoginInstance::handleTOSResponse,
+ this, _1, "read_critical"));
+ }
+ else if(reason_response == "update")
+ {
+ // This shouldn't happen - the viewer manager should have forced an update;
+ // possibly the user ran the viewer directly and bypassed the update check
+ std::string required_version = response["message_args"]["VERSION"];
+ LL_WARNS() << "Login failed because an update to version " << required_version << " is required." << LL_ENDL;
+
+ if (gViewerWindow)
+ gViewerWindow->setShowProgress(FALSE);
+
+ LLSD data(LLSD::emptyMap());
+ data["VERSION"] = required_version;
+ LLNotificationsUtil::add("RequiredUpdate", data, LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2));
+ }
+ else if(reason_response == "key")
+ {
+ // this is a password problem or other restriction
+ // an appropriate message has already been displayed
+ attemptComplete();
+ }
+ else
+ {
+ LL_WARNS() << "Login failed for an unknown reason: " << LLSDOStreamer<LLSDNotationFormatter>(response) << LL_ENDL;
+
+ if (gViewerWindow)
+ gViewerWindow->setShowProgress(FALSE);
+
+ LLNotificationsUtil::add("LoginFailedUnknown", LLSD::emptyMap(), LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2));
+ }
+}
- LLSD data(LLSD::emptyMap());
- data["message"] = message_response;
- data["reply_pump"] = TOS_REPLY_PUMP;
- if(response.has("error_code"))
- {
- data["error_code"] = response["error_code"];
- }
- if(response.has("certificate"))
- {
- data["certificate"] = response["certificate"];
- }
-
- if (gViewerWindow)
- gViewerWindow->setShowProgress(FALSE);
-
- LLFloaterReg::showInstance("message_critical", data);
- LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
- .listen(TOS_LISTENER_NAME,
- boost::bind(&LLLoginInstance::handleTOSResponse,
- this, _1, "read_critical"));
- }
- else
- {
- LL_INFOS() << "LLLoginInstance::handleLoginFailure attemptComplete" << LL_ENDL;
- attemptComplete();
- }
+void LLLoginInstance::handleLoginDisallowed(const LLSD& notification, const LLSD& response)
+{
+ attemptComplete();
}
void LLLoginInstance::handleLoginSuccess(const LLSD& event)
@@ -363,6 +389,7 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key)
return true;
}
+
std::string construct_start_string()
{
std::string start;