diff --git a/STRINGS.CHANGES b/STRINGS.CHANGES index ef53413..7b4cff1 100644 --- a/STRINGS.CHANGES +++ b/STRINGS.CHANGES @@ -25,4 +25,12 @@ NEWSTRING: "\r\n\e[1;31mError creating URL!\e[0m\r\n" LINE 259 NEW OLDSTRING: (NONE) -NEWSTRING: "\e[1;33mSorry this BBS does not have the webserver enabled.\e[0m\r\n" \ No newline at end of file +NEWSTRING: "\e[1;33mSorry this BBS does not have the webserver enabled.\e[0m\r\n" + +LINE 260 NEW +OLDSTRING: (NONE) +NEWSTRING: "\e[%d;1H\e[1;30;40m[\e[1;34;44m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%s\e[K" + +LINE 261 NEW +OLDSTRING: (NONE) +NEWSTRING: "\e[%d;1H\e[1;30;40m[\e[1;34m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%s\e[K" \ No newline at end of file diff --git a/dist/magicka.strings b/dist/magicka.strings index 671b5bd..54970f5 100644 --- a/dist/magicka.strings +++ b/dist/magicka.strings @@ -257,3 +257,5 @@ File exists!\r\n \e[1;34mURL\e[1;30m: \e[1;37m%s\e[0m\r\n \r\n\e[1;31mError creating URL!\e[0m\r\n \e[1;33mSorry this BBS does not have the webserver enabled.\e[0m\r\n +\e[%d;1H\e[1;30;40m[\e[1;34;44m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%s\e[K +\e[%d;1H\e[1;30;40m[\e[1;34m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%s\e[K diff --git a/src/bbs.h b/src/bbs.h index 197290e..615716a 100644 --- a/src/bbs.h +++ b/src/bbs.h @@ -293,6 +293,7 @@ extern void msgbase_reset_pointers(int conference, int msgarea); extern void msgbase_reset_all_pointers(); extern void full_mail_scan(struct user_record *user); extern int read_new_msgs(struct user_record *user, struct msg_headers *msghs); +extern int new_messages(struct user_record *user, int conference, int area); extern void rundoor(struct user_record *user, char *cmd, int stdio, char *codepage); extern void runexternal(struct user_record *user, char *cmd, int stdio, char **argv, char *cwd, int raw, char *codepage); diff --git a/src/mail_menu.c b/src/mail_menu.c index 1fc5a0d..c01090a 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -2756,9 +2756,17 @@ void choose_area() { s_printf(get_string(248)); for (i=start;iindex, area_tmp[i]->area->name); + if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[i]->index)) { + s_printf(get_string(259), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name); + } else { + s_printf(get_string(249), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name); + } } else { - s_printf(get_string(250), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name); + if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[i]->index)) { + s_printf(get_string(260), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name); + } else { + s_printf(get_string(250), i - start + 2, area_tmp[i]->index, area_tmp[i]->area->name); + } } } s_printf("\e[%d;5H", selected - start + 2); @@ -2785,8 +2793,16 @@ void choose_area() { selected = list_tmp - 1; } else { if (!redraw) { - s_printf(get_string(250), selected - start + 1, area_tmp[selected - 1]->index, area_tmp[selected - 1]->area->name); - s_printf(get_string(249), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name); + if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected - 1]->index)) { + s_printf(get_string(260), selected - start + 1, area_tmp[selected - 1]->index, area_tmp[selected - 1]->area->name); + } else { + s_printf(get_string(250), selected - start + 1, area_tmp[selected - 1]->index, area_tmp[selected - 1]->area->name); + } + if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected]->index)) { + s_printf(get_string(259), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name); + } else { + s_printf(get_string(249), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name); + } s_printf("\e[%d;5H", selected - start + 2); } } @@ -2803,9 +2819,17 @@ void choose_area() { if (selected < 0) { selected = 0; } else { - if (!redraw) { - s_printf(get_string(249), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name); - s_printf(get_string(250), selected - start + 3, area_tmp[selected + 1]->index, area_tmp[selected + 1]->area->name); + if (!redraw) { + if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected]->index)) { + s_printf(get_string(259), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name); + } else { + s_printf(get_string(249), selected - start + 2, area_tmp[selected]->index, area_tmp[selected]->area->name); + } + if (new_messages(gUser, gUser->cur_mail_conf, area_tmp[selected + 1]->index)) { + s_printf(get_string(260), selected - start + 3, area_tmp[selected + 1]->index, area_tmp[selected + 1]->area->name); + } else { + s_printf(get_string(250), selected - start + 3, area_tmp[selected + 1]->index, area_tmp[selected + 1]->area->name); + } s_printf("\e[%d;5H", selected - start + 2); } } @@ -3233,3 +3257,55 @@ void msgbase_reset_all_pointers() { } } } + +int new_messages(struct user_record *user, int conference, int area) { + int count = 0; + s_JamBase *jb; + s_JamBaseHeader jbh; + s_JamLastRead jlr; + struct msg_headers *msghs; + + jb = open_jam_base(conf.mail_conferences[conference]->mail_areas[area]->path); + if (!jb) { + return 0; + } + if (JAM_ReadMBHeader(jb, &jbh) != 0) { + JAM_CloseMB(jb); + return 0; + } + if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) { + if (jbh.ActiveMsgs == 0) { + JAM_CloseMB(jb); + return 0; + } + if (conf.mail_conferences[conference]->mail_areas[area]->type == TYPE_NETMAIL_AREA) { + msghs = read_message_headers(conference, area, user); + if (msghs != NULL) { + if (msghs->msg_count > 0) { + count = msghs->msg_count; + } + free_message_headers(msghs); + } + } else { + count = jbh.ActiveMsgs; + } + } else { + if (jlr.HighReadMsg < jbh.ActiveMsgs) { + if (conf.mail_conferences[conference]->mail_areas[area]->type == TYPE_NETMAIL_AREA) { + msghs = read_message_headers(conference, area, user); + if (msghs != NULL) { + if (msghs->msg_count > 0) { + if (msghs->msgs[msghs->msg_count-1]->msg_h->MsgNum > jlr.HighReadMsg) { + count = msghs->msgs[msghs->msg_count-1]->msg_h->MsgNum - jlr.HighReadMsg; + } + } + free_message_headers(msghs); + } + } else { + count = jbh.ActiveMsgs - jlr.HighReadMsg; + } + } + } + JAM_CloseMB(jb); + return count; +} diff --git a/src/www_msgs.c b/src/www_msgs.c index 28de7bf..0581e87 100644 --- a/src/www_msgs.c +++ b/src/www_msgs.c @@ -13,58 +13,6 @@ extern char * aha(char *input); extern struct bbs_config conf; -static int new_messages(struct user_record *user, int conference, int area) { - int count = 0; - s_JamBase *jb; - s_JamBaseHeader jbh; - s_JamLastRead jlr; - struct msg_headers *msghs; - - jb = open_jam_base(conf.mail_conferences[conference]->mail_areas[area]->path); - if (!jb) { - return 0; - } - if (JAM_ReadMBHeader(jb, &jbh) != 0) { - JAM_CloseMB(jb); - return 0; - } - if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) { - if (jbh.ActiveMsgs == 0) { - JAM_CloseMB(jb); - return 0; - } - if (conf.mail_conferences[conference]->mail_areas[area]->type == TYPE_NETMAIL_AREA) { - msghs = read_message_headers(conference, area, user); - if (msghs != NULL) { - if (msghs->msg_count > 0) { - count = msghs->msg_count; - } - free_message_headers(msghs); - } - } else { - count = jbh.ActiveMsgs; - } - } else { - if (jlr.HighReadMsg < jbh.ActiveMsgs) { - if (conf.mail_conferences[conference]->mail_areas[area]->type == TYPE_NETMAIL_AREA) { - msghs = read_message_headers(conference, area, user); - if (msghs != NULL) { - if (msghs->msg_count > 0) { - if (msghs->msgs[msghs->msg_count-1]->msg_h->MsgNum > jlr.HighReadMsg) { - count = msghs->msgs[msghs->msg_count-1]->msg_h->MsgNum - jlr.HighReadMsg; - } - } - free_message_headers(msghs); - } - } else { - count = jbh.ActiveMsgs - jlr.HighReadMsg; - } - } - } - JAM_CloseMB(jb); - return count; -} - static char *www_sanitize(char *inp) { int i; char *result;