improvement on netmail message scan
This commit is contained in:
parent
fe197a13c3
commit
10ad4711ee
68
mail_menu.c
68
mail_menu.c
@ -1865,7 +1865,7 @@ void mail_scan(struct user_record *user) {
|
||||
s_JamBase *jb;
|
||||
s_JamBaseHeader jbh;
|
||||
s_JamLastRead jlr;
|
||||
|
||||
struct msg_headers *msghs;
|
||||
char c;
|
||||
int i;
|
||||
int j;
|
||||
@ -1882,30 +1882,48 @@ void mail_scan(struct user_record *user) {
|
||||
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) {
|
||||
continue;
|
||||
}
|
||||
jb = open_jam_base(conf.mail_conferences[i]->mail_areas[j]->path);
|
||||
if (!jb) {
|
||||
dolog("Unable to open message base");
|
||||
continue;
|
||||
}
|
||||
if (JAM_ReadMBHeader(jb, &jbh) != 0) {
|
||||
JAM_CloseMB(jb);
|
||||
continue;
|
||||
}
|
||||
if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) {
|
||||
if (jbh.ActiveMsgs == 0) {
|
||||
JAM_CloseMB(jb);
|
||||
continue;
|
||||
}
|
||||
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, jbh.ActiveMsgs);
|
||||
} else {
|
||||
if (jlr.HighReadMsg < (jbh.ActiveMsgs - 1)) {
|
||||
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, (jbh.ActiveMsgs - 1) - jlr.HighReadMsg);
|
||||
} else {
|
||||
JAM_CloseMB(jb);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
jb = open_jam_base(conf.mail_conferences[i]->mail_areas[j]->path);
|
||||
if (!jb) {
|
||||
dolog("Unable to open message base");
|
||||
continue;
|
||||
}
|
||||
if (JAM_ReadMBHeader(jb, &jbh) != 0) {
|
||||
JAM_CloseMB(jb);
|
||||
continue;
|
||||
}
|
||||
if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) {
|
||||
if (jbh.ActiveMsgs == 0) {
|
||||
JAM_CloseMB(jb);
|
||||
continue;
|
||||
}
|
||||
if (conf.mail_conferences[i]->mail_areas[j]->type == TYPE_NETMAIL_AREA) {
|
||||
msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user);
|
||||
if (msghs != NULL) {
|
||||
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msg_count);
|
||||
free_message_headers(msghs);
|
||||
}
|
||||
} else {
|
||||
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, jbh.ActiveMsgs);
|
||||
}
|
||||
} else {
|
||||
if (jlr.HighReadMsg < (jbh.ActiveMsgs - 1)) {
|
||||
if (conf.mail_conferences[i]->mail_areas[j]->type == TYPE_NETMAIL_AREA) {
|
||||
msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user);
|
||||
if (msghs != NULL) {
|
||||
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);
|
||||
}
|
||||
free_message_headers(msghs);
|
||||
}
|
||||
} else {
|
||||
s_printf(" --> %d. %s (%d new)\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, (jbh.ActiveMsgs - 1) - jlr.HighReadMsg);
|
||||
}
|
||||
} else {
|
||||
JAM_CloseMB(jb);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
JAM_CloseMB(jb);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user