summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-01-07 05:39:02 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-01-07 05:39:02 +0800
commitbe4e0a83b16c0b27305c25bf4b8bbe12adab52f1 (patch)
tree622016aef1cf157e04a5376ecbe357e9f3761b76
parentc6e1aac9084a22e7c19eaf21a82570b265ff07c3 (diff)
downloadpttbbs-be4e0a83b16c0b27305c25bf4b8bbe12adab52f1.tar
pttbbs-be4e0a83b16c0b27305c25bf4b8bbe12adab52f1.tar.gz
pttbbs-be4e0a83b16c0b27305c25bf4b8bbe12adab52f1.tar.bz2
pttbbs-be4e0a83b16c0b27305c25bf4b8bbe12adab52f1.tar.lz
pttbbs-be4e0a83b16c0b27305c25bf4b8bbe12adab52f1.tar.xz
pttbbs-be4e0a83b16c0b27305c25bf4b8bbe12adab52f1.tar.zst
pttbbs-be4e0a83b16c0b27305c25bf4b8bbe12adab52f1.zip
1. fix a bug that files' stamp in the same board are not in order.
2. delete user's posts when the id is deleted git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3466 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h2
-rw-r--r--mbbsd/bbs.c23
-rw-r--r--mbbsd/user.c1
3 files changed, 21 insertions, 5 deletions
diff --git a/include/proto.h b/include/proto.h
index eb3b3628..28a4404f 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -60,7 +60,7 @@ int inc_badsale(const char *, int num);
//void set_assess(int uid, unsigned char num, int type);
/* bbs */
-void delete_allpost();
+void delete_allpost(char *userid);
int invalid_brdname(const char *brd);
void chomp(char *src);
int del_range(int ent, const fileheader_t *fhdr, const char *direct);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index e8d9fa02..20b2327e 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -75,7 +75,7 @@ anticrosspost(void)
mail_id(cuser.userid, "Cross-Post»@³æ",
"etc/crosspost.txt", "Pttĵ¹î³¡¶¤");
if ((now - cuser.firstlogin) / 86400 < 14)
- delete_allpost();
+ delete_allpost(cuser.userid);
kick_all(cuser.userid); // XXX: in2: wait for testing
u_exit("Cross Post");
exit(0);
@@ -592,16 +592,19 @@ deleteCrossPost(fileheader_t *fh, char *bname)
}
void
-delete_allpost()
+delete_allpost(char *userid)
{
fileheader_t fhdr;
int fd, i;
char bdir[MAXPATHLEN]="", file[MAXPATHLEN]="";
+
+ if(!userid) return;
+
setbdir(bdir, ALLPOST);
if( (fd = open(bdir, O_RDWR)) != -1)
{
for(i=0; read(fd, &fhdr, sizeof(fileheader_t)) >0; i++){
- if(strcmp(fhdr.owner, cuser.userid))
+ if(strcmp(fhdr.owner, userid))
continue;
deleteCrossPost(&fhdr, ALLPOST);
setbfile(file, ALLPOST, fhdr.filename);
@@ -939,7 +942,19 @@ do_general(int isbid)
append_record(genbuf,(void*) &bidinfo, sizeof(bidinfo));
postfile.filemode |= FILE_BID ;
}
- if (append_record(buf, &postfile, sizeof(postfile)) != -1) {
+ strcpy(genbuf, fpath);
+ setbpath(fpath, currboard);
+ stampfile(fpath, &postfile);
+ // Ptt: stamp file again to make it order
+ // fix the bug that search failure in getindex
+ //
+ if (append_record(buf, &postfile, sizeof(postfile)) == -1)
+ {
+ unlink(genbuf);
+ }
+ else
+ {
+ rename(genbuf, fpath);
setbtotal(currbid);
if( currmode & MODE_SELECT )
diff --git a/mbbsd/user.c b/mbbsd/user.c
index a43b1d7c..3a3c396f 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -24,6 +24,7 @@ kill_user(int num, const char *userid)
sethomepath(src, userid);
snprintf(dst, sizeof(dst), "tmp/%s", userid);
friend_delete_all(userid, FRIEND_ALOHA);
+ delete_allpost(userid);
if (dashd(src) && Rename(src, dst) == 0) {
snprintf(src, sizeof(src), "/bin/rm -fr home/%c/%s >/dev/null 2>&1", userid[0], userid);
system(src);