This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
magicka/mail_menu.c
2016-03-22 13:07:42 +10:00

45 lines
925 B
C

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "bbs.h"
extern struct bbs_config conf;
int mail_menu(int socket, struct user_record *user) {
int doquit = 0;
int domail = 0;
char c;
char prompt[128];
while (!domail) {
s_displayansi(socket, "mailmenu");
sprintf(prompt, "\r\nConf: (%d) %s\r\nArea: (%d) %s\r\nTL: %dm :> ", user->cur_mail_conf, conf.mail_conferences[user->cur_mail_conf]->name, user->cur_mail_area, conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->name, user->timeleft);
s_putstring(socket, prompt);
c = s_getc(socket);
switch(tolower(c)) {
case 'q':
{
domail = 1;
}
break;
case 'g':
{
s_putstring(socket, "\r\nAre you sure you want to log off? (Y/N)");
c = s_getc(socket);
if (tolower(c) == 'y') {
domail = 1;
doquit = 1;
}
}
break;
}
}
return doquit;
}