diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-07-14 00:49:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-07-14 00:49:40 +0300 |
commit | acd87806b767d70c0676c0f800e23a7ce4f623e0 (patch) | |
tree | 3929d2c0e19d4abe9db62943816a156e7472eb19 /src/pincodemanager.cpp | |
parent | a14077ce17133d7a7e12a747c067c07deca1c1f7 (diff) | |
download | manaplus-acd87806b767d70c0676c0f800e23a7ce4f623e0.tar.gz manaplus-acd87806b767d70c0676c0f800e23a7ce4f623e0.tar.bz2 manaplus-acd87806b767d70c0676c0f800e23a7ce4f623e0.tar.xz manaplus-acd87806b767d70c0676c0f800e23a7ce4f623e0.zip |
Add packet SMSG_CHAR_PINCODE_STATUS2 0x0ae9.
Diffstat (limited to 'src/pincodemanager.cpp')
-rw-r--r-- | src/pincodemanager.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/pincodemanager.cpp b/src/pincodemanager.cpp index 67b14f2bf..a97c813ef 100644 --- a/src/pincodemanager.cpp +++ b/src/pincodemanager.cpp @@ -46,7 +46,8 @@ PincodeManager::PincodeManager() : mSeed(0U), mAccountId(BeingId_zero), mDialog(nullptr), - mState(PincodeState::None) + mState(PincodeState::None), + mLockFlag(false) { } @@ -235,6 +236,14 @@ void PincodeManager::pinOk() client->focusWindow(); } +void PincodeManager::lockedPin() +{ + // +++ here can be handled locked account by pin code. + // but hercules for now not have this feature + mState = PincodeState::Ask; + updateState(); +} + void PincodeManager::wrongPin() { mState = PincodeState::Ask; @@ -254,3 +263,43 @@ bool PincodeManager::isBlocked() { return mState != PincodeState::None; } + +bool PincodeManager::processPincodeStatus(const uint16_t state) +{ + switch (state) + { + case 0: // pin ok + pincodeManager.pinOk(); + break; + case 1: // ask for pin + pincodeManager.setState(PincodeState::Ask); + break; + case 2: // create new pin + case 4: // create new pin? + { + pincodeManager.setState(PincodeState::Create); + break; + } + case 3: // pin must be changed + pincodeManager.setState(PincodeState::Change); + break; + case 8: // pincode was incorrect + case 5: // client show error? + if (mLockFlag) + pincodeManager.lockedPin(); + else + pincodeManager.wrongPin(); + return true; + case 6: // Unable to use your KSSN number + break; + case 7: // char select window shows a button + break; + default: + if (client) + client->updatePinState(); + return false; + } + if (client) + client->updatePinState(); + return true; +} |