summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-22 20:06:17 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-22 20:06:17 +0800
commita0689bfa437cdec8d1872270b58c33647d57dfd8 (patch)
tree178180e94d82431a6ff3fec574acae2c59508851
parent952a4c62f07058da5e677ee3c3070f0e7a096f9e (diff)
downloadpttbbs-a0689bfa437cdec8d1872270b58c33647d57dfd8.tar
pttbbs-a0689bfa437cdec8d1872270b58c33647d57dfd8.tar.gz
pttbbs-a0689bfa437cdec8d1872270b58c33647d57dfd8.tar.bz2
pttbbs-a0689bfa437cdec8d1872270b58c33647d57dfd8.tar.lz
pttbbs-a0689bfa437cdec8d1872270b58c33647d57dfd8.tar.xz
pttbbs-a0689bfa437cdec8d1872270b58c33647d57dfd8.tar.zst
pttbbs-a0689bfa437cdec8d1872270b58c33647d57dfd8.zip
ticket#31, both implemented.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2937 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h1
-rw-r--r--mbbsd/bbs.c38
-rw-r--r--mbbsd/vote.c26
3 files changed, 60 insertions, 5 deletions
diff --git a/include/proto.h b/include/proto.h
index 311b15bb..95b29d17 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -718,6 +718,7 @@ int getDBCSstatus(unsigned char *s, int pos);
/* vote */
void b_suckinfile(FILE *fp, char *fname);
+void b_suckinfile_invis(FILE * fp, char *fname, const char *boardname);
int b_results(void);
int b_vote(void);
int b_vote_maintain(void);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 5159f921..95ae518f 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -4,6 +4,8 @@
#define WHEREAMI_LEVEL 16
static int recommend(int ent, fileheader_t * fhdr, const char *direct);
+static int do_add_recommend(const char *direct, fileheader_t *fhdr,
+ int ent, const char *buf, int type);
int mailalert(const char *userid);
#ifdef ASSESS
@@ -1017,7 +1019,7 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
#define UPDATE_USEREC (currmode |= MODE_DIRTY)
static int
-cross_post(int ent, const fileheader_t * fhdr, const char *direct)
+cross_post(int ent, fileheader_t * fhdr, const char *direct)
{
char xboard[20], fname[80], xfpath[80], xtitle[80];
char inputbuf[10], genbuf[200], genbuf2[4];
@@ -1123,11 +1125,37 @@ cross_post(int ent, const fileheader_t * fhdr, const char *direct)
write_header(xptr, save_title);
currboard = save_currboard;
- fprintf(xptr, "※ [本文轉錄自 %s 看板]\n\n", currboard);
+ if ((bp->brdattr & BRD_HIDE) && (bp->brdattr & BRD_POSTMASK))
+ {
+ /* invisible board */
+ fprintf(xptr, "※ [本文轉錄自某隱形看板]\n\n");
+ b_suckinfile_invis(xptr, fname, currboard);
+ } else {
+ /* public board */
+ fprintf(xptr, "※ [本文轉錄自 %s 看板]\n\n", currboard);
+ b_suckinfile(xptr, fname);
+ }
- b_suckinfile(xptr, fname);
addsignature(xptr, 0);
fclose(xptr);
+
+ /* add cp log */
+ {
+ char buf[MAXPATHLEN];
+ int maxlength = 51 +2 -14
+ - strlen(cuser.userid) - strlen(xboard);
+ struct tm *ptime = localtime4(&now);
+
+ snprintf(buf, sizeof(buf),
+ ANSI_COLOR(1;31) "→ " ANSI_COLOR(33) "%s"
+ ANSI_RESET ANSI_COLOR(32)
+ ":轉錄至看板「%s」" ANSI_RESET "%*s"
+ "%15s %02d/%02d\n",
+ cuser.userid, xboard, maxlength, "",
+ fromhost, ptime->tm_mon + 1, ptime->tm_mday);
+ do_add_recommend(direct, fhdr, ent, buf, 2);
+ }
+
/*
* Cross fs有問題 } else { unlink(xfpath); link(fname, xfpath); }
*/
@@ -2514,7 +2542,7 @@ change_hidden(int ent, const fileheader_t * fhdr, const char *direct)
bp = getbcache(currbid);
if (((bp->brdattr & BRD_HIDE) && (bp->brdattr & BRD_POSTMASK))) {
- if (getans("目前板在隱形狀態, 要解隱形嘛(y/N)?") != 'y')
+ if (getans("目前看板隱形中, 要解除嗎(y/N)?") != 'y')
return FULLUPDATE;
bp->brdattr &= ~BRD_HIDE;
bp->brdattr &= ~BRD_POSTMASK;
@@ -2522,7 +2550,7 @@ change_hidden(int ent, const fileheader_t * fhdr, const char *direct)
board_hidden_status = 0;
hbflreload(currbid);
} else {
- if (getans("目前板在現形狀態, 要隱形嘛(y/N)?") != 'y')
+ if (getans("要設定看板為隱形嗎(y/N)?") != 'y')
return FULLUPDATE;
bp->brdattr |= BRD_HIDE;
bp->brdattr |= BRD_POSTMASK;
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 0bc47449..f87ba9ac 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -129,6 +129,32 @@ b_suckinfile(FILE * fp, char *fname)
}
}
+void
+b_suckinfile_invis(FILE * fp, char *fname, const char *boardname)
+{
+ FILE *sfp;
+
+ if ((sfp = fopen(fname, "r"))) {
+ char inbuf[256];
+ if(fgets(inbuf, sizeof(inbuf), sfp))
+ {
+ /* first time, try if boardname revealed. */
+ char *post = strstr(inbuf, str_post1);
+ if(!post) post = strstr(inbuf, str_post2);
+ if(post) post = strstr(post, boardname);
+ if(post) {
+ /* found releaved stuff. */
+ while(*boardname++)
+ *post++ = '?';
+ }
+ fputs(inbuf, fp);
+ while (fgets(inbuf, sizeof(inbuf), sfp))
+ fputs(inbuf, fp);
+ }
+ fclose(sfp);
+ }
+}
+
static void
b_count(const char *buf, int counts[], short item_num, int *total)
{