diff options
author | Dennis Friis <peavey@inspircd.org> | 2009-05-25 05:23:40 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-25 23:18:53 +0200 |
commit | 2f096639243c5fdddc828771699937751f5ac13b (patch) | |
tree | d9cf9861cb493ab526a7dfa500da959d4d7caee4 /src/main.cpp | |
parent | a3c66a09efc7f3683f0c247f4a2c5035bff83651 (diff) | |
download | mana-2f096639243c5fdddc828771699937751f5ac13b.tar.gz mana-2f096639243c5fdddc828771699937751f5ac13b.tar.bz2 mana-2f096639243c5fdddc828771699937751f5ac13b.tar.xz mana-2f096639243c5fdddc828771699937751f5ac13b.zip |
Add athena netcode for changing account password.
(cherry picked from commit ef006ed117bb602a928d33dc0fe90075efd7393f)
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index d1fba313..ba6be23a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -710,7 +710,6 @@ struct ErrorListener : public gcn::ActionListener } } errorListener; -#ifdef TMWSERV_SUPPORT struct AccountListener : public gcn::ActionListener { void action(const gcn::ActionEvent &event) @@ -719,6 +718,7 @@ struct AccountListener : public gcn::ActionListener } } accountListener; +#ifdef TMWSERV_SUPPORT struct LoginListener : public gcn::ActionListener { void action(const gcn::ActionEvent &event) @@ -1343,8 +1343,16 @@ int main(int argc, char *argv[]) loadUpdates(); break; - // Those states don't cause a network disconnect + // Those states don't cause a network disconnect case STATE_LOADDATA: + case STATE_CHANGEPASSWORD_ATTEMPT: + case STATE_CHANGEPASSWORD: + case STATE_ACCOUNTCHANGE_ERROR: + break; + + case STATE_CHAR_SELECT: + if (state == STATE_CONNECTING) + network->disconnect(); break; case STATE_ACCOUNT: @@ -1539,6 +1547,30 @@ int main(int argc, char *argv[]) accountLogin(network, &loginData); break; + case STATE_CHANGEPASSWORD_ATTEMPT: + logger->log("State: CHANGE PASSWORD ATTEMPT"); + Net::getLoginHandler()->changePassword(loginData.username, + loginData.password, + loginData.newPassword); + break; + + case STATE_CHANGEPASSWORD: + logger->log("State: CHANGE PASSWORD"); + currentDialog = new OkDialog("Password change", + "Password changed successfully!"); + currentDialog->addActionListener(&accountListener); + currentDialog = NULL; // OkDialog deletes itself + loginData.password = loginData.newPassword; + loginData.newPassword = ""; + break; + + case STATE_ACCOUNTCHANGE_ERROR: + logger->log("State: ACCOUNT CHANGE ERROR"); + currentDialog = new OkDialog("Error ", errorMessage); + currentDialog->addActionListener(&accountListener); + currentDialog = NULL; // OkDialog deletes itself + break; + default: state = STATE_EXIT; break; |