summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/main.cpp22
-rw-r--r--src/main.h1
-rw-r--r--src/net/loginhandler.cpp4
4 files changed, 23 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 930f6302..5fd80897 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-19 Yohann Ferreira <bertram@cegetel.net>
+
+ * src/main.h, src/main.cpp, src/net/loginhandler.cpp: Made mislogins
+ and misregistrations a little bit less annoying for the user.
+
2008-04-18 Yohann Ferreira <bertram@cegetel.net>
* src/gui/char_select.h, src/gui/char_select.cpp,
diff --git a/src/main.cpp b/src/main.cpp
index 4fc959cf..cc137752 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -502,6 +502,14 @@ namespace {
state = STATE_CHAR_SELECT;
}
} accountListener;
+
+ struct LoginListener : public gcn::ActionListener
+ {
+ void action(const gcn::ActionEvent &event)
+ {
+ state = STATE_LOGIN;
+ }
+ } loginListener;
}
// TODO Find some nice place for these functions
@@ -521,13 +529,6 @@ void accountLogin(LoginData *loginData)
// Clear the password, avoids auto login when returning to login
loginData->password = "";
- // Remove _M or _F from username after a login for registration purpose
- if (loginData->registerLogin)
- {
- loginData->username =
- loginData->username.substr(0, loginData->username.length() - 2);
- }
-
// TODO This is not the best place to save the config, but at least better
// than the login gui window
if (loginData->remember)
@@ -936,6 +937,13 @@ int main(int argc, char *argv[])
accountLogin(&loginData);
break;
+ case STATE_LOGIN_ERROR:
+ logger->log("State: LOGIN ERROR");
+ currentDialog = new OkDialog("Error ", errorMessage);
+ currentDialog->addActionListener(&loginListener);
+ currentDialog = NULL; // OkDialog deletes itself
+ break;
+
case STATE_SWITCH_ACCOUNTSERVER:
logger->log("State: SWITCH_ACCOUNTSERVER");
diff --git a/src/main.h b/src/main.h
index 12f5bf66..1cc5f892 100644
--- a/src/main.h
+++ b/src/main.h
@@ -75,6 +75,7 @@ enum {
STATE_LOADDATA,
STATE_LOGIN,
STATE_LOGIN_ATTEMPT,
+ STATE_LOGIN_ERROR,
STATE_REGISTER,
STATE_REGISTER_ATTEMPT,
STATE_ACCOUNTCHANGE_ERROR,
diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp
index 349684bf..39b2e194 100644
--- a/src/net/loginhandler.cpp
+++ b/src/net/loginhandler.cpp
@@ -72,7 +72,7 @@ void LoginHandler::handleMessage(MessageIn &msg)
errorMessage = "Unknown error";
break;
}
- state = STATE_ERROR;
+ state = STATE_LOGIN_ERROR;
}
}
break;
@@ -104,7 +104,7 @@ void LoginHandler::handleMessage(MessageIn &msg)
errorMessage = "Unknown error";
break;
}
- state = STATE_ERROR;
+ state = STATE_LOGIN_ERROR;
}
}
break;