summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-10-03 09:03:25 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-10-03 09:03:25 +0800
commitc099482dac7f90462952c17fd69a62ba8b70eac6 (patch)
tree2bb8b2c679e369e006075da7f994d5e05d5fd547
parentccd2ab32d1e192b474ca4ad620dd9292c1ac2648 (diff)
downloadpttbbs-c099482dac7f90462952c17fd69a62ba8b70eac6.tar
pttbbs-c099482dac7f90462952c17fd69a62ba8b70eac6.tar.gz
pttbbs-c099482dac7f90462952c17fd69a62ba8b70eac6.tar.bz2
pttbbs-c099482dac7f90462952c17fd69a62ba8b70eac6.tar.lz
pttbbs-c099482dac7f90462952c17fd69a62ba8b70eac6.tar.xz
pttbbs-c099482dac7f90462952c17fd69a62ba8b70eac6.tar.zst
pttbbs-c099482dac7f90462952c17fd69a62ba8b70eac6.zip
* make del/edit in digest work more like before
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4899 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h1
-rw-r--r--mbbsd/bbs.c15
2 files changed, 11 insertions, 5 deletions
diff --git a/include/proto.h b/include/proto.h
index 5acd4877..45466453 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -62,6 +62,7 @@ int cmpfowner(fileheader_t *fhdr);
int b_note_edit_bname(int bid);
int Read(void);
int CheckPostPerm(void);
+int CheckModifyPerm(void);
int CheckPostRestriction(int);
void anticrosspost(void);
int Select(void);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 52975051..5d2e2180 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -335,14 +335,19 @@ int IsFreeBoardName(const char *brdname)
int
CheckPostPerm(void)
{
+ if (currmode & MODE_DIGEST)
+ return 0;
+ return CheckModifyPerm();
+}
+
+int
+CheckModifyPerm(void)
+{
static time4_t last_chk_time = 0x0BAD0BB5; /* any magic number */
static int last_board_index = 0; /* for speed up */
int valid_index = 0;
boardheader_t *bp = NULL;
- if (currmode & MODE_DIGEST)
- return 0;
-
// check if my own permission is changed.
if (ISNEWPERM(currutmp))
{
@@ -1431,7 +1436,7 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
// reason 1: BM may alter post restrictions to this board
// reason 2: this account may be occupied by someone else.
if (!HasUserPerm(PERM_BASIC) || // including guests
- (!CheckPostPerm() && !(currmode & MODE_DIGEST)) || // XXX it's stupid to check digest mode here, but right now CheckPostPerm early returns for digest... NOTE this is buggy but since I don't want to manintain the useless digest...
+ !CheckPostPerm() || // edit needs post perm (cannot be changed in digest mode)
!CheckPostRestriction(currbid)
)
return DONOTHING;
@@ -2949,7 +2954,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
// reason 1: BM may alter post restrictions to this board
// reason 2: this account may be occupied by someone else.
if (!HasUserPerm(PERM_BASIC) || // including guests
- (!CheckPostPerm() && !(currmode & MODE_DIGEST)) || // XXX it's stupid to check digest mode here, but right now CheckPostPerm early returns for digest... NOTE this is buggy but since I don't want to manintain the useless digest...
+ !( (currmode & MODE_DIGEST) ? (currmode & MODE_BOARD) : CheckPostPerm() ) || // allow BM to delete posts in digest mode
!CheckPostRestriction(currbid)
)
return DONOTHING;