diff options
author | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-26 03:06:22 +0800 |
---|---|---|
committer | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-26 03:06:22 +0800 |
commit | acc243fc5d8cd196664f64ccf68c47351a60260a (patch) | |
tree | d1689efff77a3a93e0dfeee0549e437dbefcceed /mbbsd/mail.c | |
parent | 85d2b41177d66a43eb0a176c0a9c686569e9e460 (diff) | |
download | pttbbs-acc243fc5d8cd196664f64ccf68c47351a60260a.tar pttbbs-acc243fc5d8cd196664f64ccf68c47351a60260a.tar.gz pttbbs-acc243fc5d8cd196664f64ccf68c47351a60260a.tar.bz2 pttbbs-acc243fc5d8cd196664f64ccf68c47351a60260a.tar.lz pttbbs-acc243fc5d8cd196664f64ccf68c47351a60260a.tar.xz pttbbs-acc243fc5d8cd196664f64ccf68c47351a60260a.tar.zst pttbbs-acc243fc5d8cd196664f64ccf68c47351a60260a.zip |
1.debug select_read problem with "SR" in board name.
2.cache mailsum. get_sum_record is a bad function that cause a lot of IO
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2087 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r-- | mbbsd/mail.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 792dc976..015776e3 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -137,10 +137,15 @@ m_init() sethomedir(currmaildir, cuser.userid); } -int -chkmailbox() +void +touchmailusage() { - if (!HAVE_PERM(PERM_SYSOP) && !HAVE_PERM(PERM_MAILLIMIT)) { + mailkeep=0; +} + +void +setupmailusage() +{ // Ptt: get_sum_records is a bad function int max_keepmail = MAX_KEEPMAIL; if (HAS_PERM(PERM_SYSSUBOP) || HAS_PERM(PERM_SMG) || HAS_PERM(PERM_PRG) || HAS_PERM(PERM_ACTION) || HAS_PERM(PERM_PAINT)) { @@ -155,11 +160,18 @@ chkmailbox() mailsumlimit = 50; mailsumlimit += (cuser.exmailbox + ADD_EXMAILBOX) * 10; mailmaxkeep = max_keepmail + cuser.exmailbox; + mailkeep=get_num_records(currmaildir,sizeof(fileheader_t)); + mailsum =get_sum_records(currmaildir, sizeof(fileheader_t)); +} + +int +chkmailbox() +{ + if (!HAVE_PERM(PERM_SYSOP) && !HAVE_PERM(PERM_MAILLIMIT)) { + if(!mailkeep) setupmailusage(); m_init(); - if ((mailkeep = get_num_records(currmaildir, sizeof(fileheader_t))) > - mailmaxkeep || - (mailsum = get_sum_records(currmaildir, sizeof(fileheader_t))) > - mailsumlimit) { + if (mailkeep > mailmaxkeep || + mailsum > mailsumlimit) { bell(); bell(); vmsg("您保存信件數目或容量 %d 超出上限 %d, 請整理", @@ -829,6 +841,7 @@ mail_del(int ent, fileheader_t * fhdr, char *direct) if (getans(msg_del_ny) == 'y') { if (!delete_record(direct, sizeof(*fhdr), ent)) { + touchmailusage(); setdirpath(genbuf, direct, fhdr->filename); unlink(genbuf); return DIRCHANGED; |