Now increasing the player login fail count, and displaying it to logging in players if non-zero.

Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely Polonkai (W00d5t0ck) 2012-03-29 18:42:18 +02:00
parent d92c9960ba
commit 90f870c48a
2 changed files with 6 additions and 1 deletions

View File

@ -201,7 +201,10 @@ wmud_client_callback(GSocket *client_socket, GIOCondition condition, wmudClient
" successful.\r\n", TELNET_IAC, " successful.\r\n", TELNET_IAC,
TELNET_WONT, TELNET_ECHO); TELNET_WONT, TELNET_ECHO);
client->authenticated = TRUE; client->authenticated = TRUE;
/* TODO: Send fail count if non-zero */ if (client->player->fail_count > 0)
{
wmud_client_send("There %s %d failed login attempt%s with your account since your last visit\r\n", (client->player->fail_count == 1) ? "was" : "were", client->player->fail_count, (client->player->fail_count > 1) ? "s" : "");
}
client->state = WMUD_CLIENT_STATE_MENU; client->state = WMUD_CLIENT_STATE_MENU;
/* TODO: send MOTD */ /* TODO: send MOTD */
/* TODO: send menu items */ /* TODO: send menu items */
@ -215,6 +218,7 @@ wmud_client_callback(GSocket *client_socket, GIOCondition condition, wmudClient
" name would you like to be called? ", " name would you like to be called? ",
TELNET_IAC, TELNET_WONT, TELNET_ECHO); TELNET_IAC, TELNET_WONT, TELNET_ECHO);
client->state = WMUD_CLIENT_STATE_FRESH; client->state = WMUD_CLIENT_STATE_FRESH;
client->player->fail_count++;
client->login_try_count++; client->login_try_count++;
if (client->login_try_count == 3) if (client->login_try_count == 3)
{ {

View File

@ -79,6 +79,7 @@ typedef struct _wmudPlayer {
gchar *player_name; gchar *player_name;
gchar *cpassword; gchar *cpassword;
gchar *email; gchar *email;
gint fail_count;
} wmudPlayer; } wmudPlayer;
/** /**