From 90f870c48a253b1cbb5157ae1d1c8549c5150faa Mon Sep 17 00:00:00 2001 From: "Gergely Polonkai (W00d5t0ck)" Date: Thu, 29 Mar 2012 18:42:18 +0200 Subject: [PATCH] Now increasing the player login fail count, and displaying it to logging in players if non-zero. Signed-off-by: Gergely Polonkai (W00d5t0ck) --- wmud/game-networking.c | 6 +++++- wmud/wmud-types.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wmud/game-networking.c b/wmud/game-networking.c index 6348f9d..b0f3832 100644 --- a/wmud/game-networking.c +++ b/wmud/game-networking.c @@ -201,7 +201,10 @@ wmud_client_callback(GSocket *client_socket, GIOCondition condition, wmudClient " successful.\r\n", TELNET_IAC, TELNET_WONT, TELNET_ECHO); 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; /* TODO: send MOTD */ /* TODO: send menu items */ @@ -215,6 +218,7 @@ wmud_client_callback(GSocket *client_socket, GIOCondition condition, wmudClient " name would you like to be called? ", TELNET_IAC, TELNET_WONT, TELNET_ECHO); client->state = WMUD_CLIENT_STATE_FRESH; + client->player->fail_count++; client->login_try_count++; if (client->login_try_count == 3) { diff --git a/wmud/wmud-types.h b/wmud/wmud-types.h index bb194d1..ea32533 100644 --- a/wmud/wmud-types.h +++ b/wmud/wmud-types.h @@ -79,6 +79,7 @@ typedef struct _wmudPlayer { gchar *player_name; gchar *cpassword; gchar *email; + gint fail_count; } wmudPlayer; /**