From 1b62cf169aa0a0bcfaf0e22d1088fe59e77b93f9 Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 30 Apr 2004 14:32:22 +0000 Subject: clean up getindex() and substitute record fix bug of OSONG git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1901 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mail.c | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) (limited to 'mbbsd/mail.c') diff --git a/mbbsd/mail.c b/mbbsd/mail.c index f4a53dfa..731f37cf 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -823,22 +823,19 @@ mail_del(int ent, fileheader_t * fhdr, char *direct) if (fhdr->filemode & FILE_MARKED) return DONOTHING; - getdata(1, 0, msg_del_ny, genbuf, 3, LCECHO); - if (genbuf[0] == 'y') { - strlcpy(currfile, fhdr->filename, sizeof(currfile)); + if (currmode & MODE_SELECT) { + vmsg("請先回到正常模式後再進行刪除..."); + return READ_REDRAW; + } + + if (getans(msg_del_ny) == 'y') { if (!delete_record(direct, sizeof(*fhdr), ent)) { setdirpath(genbuf, direct, fhdr->filename); unlink(genbuf); - if ((currmode & MODE_SELECT)) { - int index; - sethomedir(genbuf, cuser.userid); - index = getindex(genbuf, fhdr->filename); - delete_record(genbuf, sizeof(fileheader_t), index); - } return DIRCHANGED; } } - return TITLE_REDRAW; + return READ_REDRAW; } static int @@ -856,14 +853,7 @@ mail_read(int ent, fileheader_t * fhdr, char *direct) if (more_result != -1) { fhdr->filemode |= FILE_READ; - if ((currmode & MODE_SELECT)) { - int index; - - index = getindex(currmaildir, fhdr->filename); - substitute_record(currmaildir, fhdr, sizeof(*fhdr), index); - substitute_record(direct, fhdr, sizeof(*fhdr), ent); - } else - substitute_record(currmaildir, fhdr, sizeof(*fhdr), ent); + substitute_ref_record(direct, fhdr, ent); } switch (more_result) { case 999: @@ -900,14 +890,7 @@ mail_read(int ent, fileheader_t * fhdr, char *direct) mail_del(ent, fhdr, direct); else { fhdr->filemode |= FILE_READ; - if ((currmode & MODE_SELECT)) { - int index; - - index = getindex(currmaildir, fhdr->filename); - substitute_record(currmaildir, fhdr, sizeof(*fhdr), index); - substitute_record(direct, fhdr, sizeof(*fhdr), ent); - } else - substitute_record(currmaildir, fhdr, sizeof(*fhdr), ent); + substitute_ref_record(direct, fhdr, ent); } return FULLUPDATE; } @@ -999,14 +982,7 @@ mail_mark(int ent, fileheader_t * fhdr, char *direct) { fhdr->filemode ^= FILE_MARKED; - if ((currmode & MODE_SELECT)) { - int index; - - index = getindex(currmaildir, fhdr->filename); - substitute_record(currmaildir, fhdr, sizeof(*fhdr), index); - substitute_record(direct, fhdr, sizeof(*fhdr), ent); - } else - substitute_record(currmaildir, fhdr, sizeof(*fhdr), ent); + substitute_ref_record(direct, fhdr, ent); return PART_REDRAW; } -- cgit v1.2.3