pretty up new mail scan

This commit is contained in:
Andrew Pamment 2016-08-13 14:17:28 +10:00
parent bfabd9ead4
commit d9c97540d5
2 changed files with 37 additions and 5 deletions

View File

@ -1871,6 +1871,7 @@ void mail_scan(struct user_record *user) {
char c; char c;
int i; int i;
int j; int j;
int lines = 0;
s_printf("\r\nScan for new mail? (Y/N) : "); s_printf("\r\nScan for new mail? (Y/N) : ");
c = s_getc(); c = s_getc();
@ -1880,7 +1881,13 @@ void mail_scan(struct user_record *user) {
if (conf.mail_conferences[i]->sec_level > user->sec_level) { if (conf.mail_conferences[i]->sec_level > user->sec_level) {
continue; continue;
} }
s_printf("\r\n%d. %s\r\n", i, conf.mail_conferences[i]->name); s_printf("\r\n\e[1;32m%d. %s\e[0m\r\n", i, conf.mail_conferences[i]->name);
lines+=2;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_getc();
lines = 0;
}
for (j=0;j<conf.mail_conferences[i]->mail_area_count;j++) { for (j=0;j<conf.mail_conferences[i]->mail_area_count;j++) {
if (conf.mail_conferences[i]->mail_areas[j]->read_sec_level > user->sec_level) { if (conf.mail_conferences[i]->mail_areas[j]->read_sec_level > user->sec_level) {
continue; continue;
@ -1903,12 +1910,24 @@ void mail_scan(struct user_record *user) {
msghs = read_message_headers(i, j, user); msghs = read_message_headers(i, j, user);
if (msghs != NULL) { if (msghs != NULL) {
if (msghs->msg_count > 0) { if (msghs->msg_count > 0) {
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msg_count); s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msg_count);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_getc();
lines = 0;
}
} }
free_message_headers(msghs); free_message_headers(msghs);
} }
} else { } else {
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, jbh.ActiveMsgs); s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, jbh.ActiveMsgs);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_getc();
lines = 0;
}
} }
} else { } else {
if (jlr.HighReadMsg < (jbh.ActiveMsgs - 1)) { if (jlr.HighReadMsg < (jbh.ActiveMsgs - 1)) {
@ -1917,13 +1936,25 @@ void mail_scan(struct user_record *user) {
if (msghs != NULL) { if (msghs != NULL) {
if (msghs->msg_count > 0) { if (msghs->msg_count > 0) {
if (msghs->msgs[msghs->msg_count-1]->msg_no > jlr.HighReadMsg) { if (msghs->msgs[msghs->msg_count-1]->msg_no > jlr.HighReadMsg) {
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msgs[msghs->msg_count-1]->msg_no - jlr.HighReadMsg); s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msgs[msghs->msg_count-1]->msg_no - jlr.HighReadMsg);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_getc();
lines = 0;
}
} }
} }
free_message_headers(msghs); free_message_headers(msghs);
} }
} else { } else {
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, (jbh.ActiveMsgs - 1) - jlr.HighReadMsg); s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, (jbh.ActiveMsgs - 1) - jlr.HighReadMsg);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_getc();
lines = 0;
}
} }
} else { } else {
JAM_CloseMB(jb); JAM_CloseMB(jb);

1
main.c
View File

@ -656,6 +656,7 @@ void server(int port) {
ssh_pid = fork(); ssh_pid = fork();
if (ssh_pid == 0) { if (ssh_pid == 0) {
ssh_pid = -1;
serverssh(conf.ssh_port); serverssh(conf.ssh_port);
exit(0); exit(0);
} }