add a * next to areas that have new messages
This commit is contained in:
parent
251692d2c6
commit
2fcf6305c0
@ -26,3 +26,11 @@ 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"
|
||||
|
||||
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"
|
2
dist/magicka.strings
vendored
2
dist/magicka.strings
vendored
@ -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
|
||||
|
@ -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);
|
||||
|
@ -2756,9 +2756,17 @@ void choose_area() {
|
||||
s_printf(get_string(248));
|
||||
for (i=start;i<start+22 && i < list_tmp;i++) {
|
||||
if (i == selected) {
|
||||
s_printf(get_string(249), 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(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);
|
||||
}
|
||||
}
|
||||
@ -2804,8 +2820,16 @@ void choose_area() {
|
||||
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 (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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user