From 70a2ced9cf3ffcd53376b639fd27762526b22468 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sun, 10 Apr 2016 09:50:58 +1000 Subject: [PATCH] Mail listing bug fix --- README.md | 2 +- mail_menu.c | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9e91623..8a5e76c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you want to install Magicka BBS, follow these steps. 1. Ensure you have git, c compiler, sqlite-dev and gnu make 2. Clone the repo `git clone https://github.com/apamment/MagickaBBS` -2a. This is the master branch, it's recommended to check out the 0.1 branch +***This is the master branch, it's recommended to check out the 0.1 branch*** cd MagickaBBS/ git checkout 0.1 diff --git a/mail_menu.c b/mail_menu.c index 82dc04a..b608f0a 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -1372,6 +1372,8 @@ int mail_menu(int socket, struct user_record *user) { s_readstring(socket, buffer, 6); if (tolower(buffer[0]) == 'q') { + JAM_CloseMB(jb); + closed = 1; break; } else if (strlen(buffer) > 0) { z = atoi(buffer); @@ -1386,21 +1388,23 @@ int mail_menu(int socket, struct user_record *user) { } } - sprintf(buffer, "(#) Read Message # (ENTER) Quit\r\n"); - s_putstring(socket, buffer); - s_readstring(socket, buffer, 6); - if (strlen(buffer) > 0) { - z = atoi(buffer); - if (z >= 0 && z <= msghs->msg_count) { - JAM_CloseMB(jb); - closed = 1; - read_message(socket, user, msghs, z); + if (closed == 0) { + sprintf(buffer, "(#) Read Message # (ENTER) Quit\r\n"); + s_putstring(socket, buffer); + s_readstring(socket, buffer, 6); + if (strlen(buffer) > 0) { + z = atoi(buffer); + if (z >= 0 && z <= msghs->msg_count) { + JAM_CloseMB(jb); + closed = 1; + read_message(socket, user, msghs, z); + } } + + JAM_CloseMB(jb); } } - if (closed == 0) { - JAM_CloseMB(jb); - } + if (msghs != NULL) { free_message_headers(msghs); }