summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorDennis Friis <peavey@inspircd.org>2009-05-25 05:23:40 +0200
committerDennis Friis <peavey@inspircd.org>2009-05-25 05:28:03 +0200
commitef006ed117bb602a928d33dc0fe90075efd7393f (patch)
treed82e8b7a1aedc7999c232d08bd12d0c50a343f9a /src/main.cpp
parent050103b8d2e3eb23e7aea188a1a269feb7c181ab (diff)
downloadmana-ef006ed117bb602a928d33dc0fe90075efd7393f.tar.gz
mana-ef006ed117bb602a928d33dc0fe90075efd7393f.tar.bz2
mana-ef006ed117bb602a928d33dc0fe90075efd7393f.tar.xz
mana-ef006ed117bb602a928d33dc0fe90075efd7393f.zip
Add athena netcode for changing account password.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 92fdf2f2..2bf9820e 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;