summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-05 17:32:59 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-05 17:32:59 +0800
commit9d3aa427007b823892fff7be25e393443a27133c (patch)
tree83be0cf6de7c4dc60d199ef45a3974afda91352d
parent9cbf93e41956fddeadf60c0d454da12ec8fc2487 (diff)
downloadpttbbs-9d3aa427007b823892fff7be25e393443a27133c.tar
pttbbs-9d3aa427007b823892fff7be25e393443a27133c.tar.gz
pttbbs-9d3aa427007b823892fff7be25e393443a27133c.tar.bz2
pttbbs-9d3aa427007b823892fff7be25e393443a27133c.tar.lz
pttbbs-9d3aa427007b823892fff7be25e393443a27133c.tar.xz
pttbbs-9d3aa427007b823892fff7be25e393443a27133c.tar.zst
pttbbs-9d3aa427007b823892fff7be25e393443a27133c.zip
- multi.money updates,
- experimental money listing mode - prevent unread black-hole mails git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2987 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/pttstruct.h13
-rw-r--r--mbbsd/bbs.c74
-rw-r--r--mbbsd/mail.c18
-rw-r--r--util/deluserfile.c2
4 files changed, 83 insertions, 24 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 7a64de40..8837f814 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -242,6 +242,7 @@ typedef struct fileheader_t {
char date[6]; /* [02/02] or space(5) */
char title[TTLEN + 1];
union {
+ /* TODO: MOVE money to outside multi!!!!!! */
int money;
int anon_uid;
/* different order to match alignment */
@@ -277,15 +278,15 @@ typedef struct fileheader_t {
#define FILE_READ 0x1 /* already read : mail only */
#define FILE_MARKED 0x2 /* opus: 0x8 */
#define FILE_DIGEST 0x4 /* digest */
-#define FILE_HOLD 0x8 /* unused */
#define FILE_BOTTOM 0x8 /* push_bottom */
#define FILE_SOLVED 0x10 /* problem solved, sysop/BM only */
-#define FILE_HIDE 0x20 /* hild */
-#define FILE_BID 0x20 /* for bid */
-#define FILE_BM 0x40 /* BM only */
-#define FILE_MULTI 0x100 /* multi send for mail */
-#define FILE_VOTE 0x40 /* for vote */
+#define FILE_HIDE 0x20 /* hide, in announce */
+#define FILE_BID 0x20 /* bid, in non-announce */
+#define FILE_BM 0x40 /* BM only, in announce */
+#define FILE_VOTE 0x40 /* for vote, in non-announce */
#define FILE_ANONYMOUS 0x80 /* anonymous file */
+/* TODO filemode is unsigned, IS THIS MULTI CORRECT? DANGEROUS!!! */
+#define FILE_MULTI 0x100 /* multi send for mail */
#define STRLEN 80 /* Length of most string data */
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 935de326..2a858089 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -14,6 +14,34 @@ static char * const badpost_reason[] = {
};
#endif
+/* TODO multi.money is a mess.
+ * who can verify and finish this?
+ */
+#if 0
+static inline int
+valid_money(fileheader_t *pfh)
+{
+ /* FILE_DIGEST, FILE_BOTTOM? not sure */
+ if (pfh->filemode & (FILE_ANONYMOUS | FILE_VOTE | FILE_BID))
+ return 0;
+ return 1;
+}
+#endif
+
+/* modes to invalid multi.money */
+#define INVALIDMONEY_MODES (FILE_ANONYMOUS | FILE_BOTTOM | FILE_DIGEST | FILE_BID)
+
+/* hack for listing modes */
+enum {
+ LISTMODE_DATE = 0,
+ LISTMODE_MONEY,
+} LISTMODES;
+static char *listmode_desc[] = {
+ "日 期",
+ "價 格",
+};
+static int currlistmode = LISTMODE_DATE;
+
void
anticrosspost(void)
{
@@ -196,8 +224,10 @@ readtitle(void)
brd_title = bp->title + 7;
showtitle(currBM, brd_title);
- prints("[←]離開 [→]閱\讀 [^P]發表文章 [b]備忘錄 [d]刪除 [z]精華區 "
- "[TAB]文摘 [h]elp\n" ANSI_COLOR(7) " 編號 日 期 作 者 文 章 標 題");
+ outs("[←]離開 [→]閱\讀 [^P]發表文章 [b]備忘錄 [d]刪除 [z]精華區 [TAB]文摘 [h]說明\n");
+ prints(ANSI_COLOR(7) " 編號 %s 作 者 文 章 標 題",
+ listmode_desc[currlistmode]);
+
#ifdef USE_COOLDOWN
if (bp->brdattr & BRD_COOLDOWN && !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)))
prints(" " ANSI_RESET);
@@ -272,20 +302,33 @@ readdoent(int num, fileheader_t * ent)
else
prints("%6d", num);
- prints(
+ prints(" %c\033[1;3%4.4s" ANSI_RESET, type, recom);
+
+ if(currlistmode == LISTMODE_MONEY)
+ {
+ if( currmode & MODE_SELECT ||
+ ent->filemode & INVALIDMONEY_MODES)
+ outs(" ---- ");
+ else
+ prints("%5d ", ent->multi.money);
+ }
+ else // LISTMODE_DATE
+ {
#ifdef COLORDATE
- " %c\033[1;3%4.4s" ANSI_COLOR(%d) "%-6s" ANSI_RESET ANSI_COLOR(%d) "%-13.12s",
+ prints(ANSI_COLOR(%d) "%-6s" ANSI_RESET,
+ (ent->date[3] + ent->date[4]) % 7 + 31, enc->date);
#else
- " %c\033[1;3%4.4s" ANSI_RESET "%-6s" ANSI_COLOR(%d) "%-13.12s",
+ prints("%-6s", ent->date);
#endif
- type, recom,
-#ifdef COLORDATE
- (ent->date[3] + ent->date[4]) % 7 + 31,
-#endif
- ent->date, isonline, ent->owner);
+ }
+
+ // print author
+ if(isonline) outs(ANSI_COLOR(1));
+ prints("%-13.12s", ent->owner);
+ if(isonline) outs(ANSI_RESET);
if (strncmp(currtitle, title, TTLEN))
- prints(ANSI_RESET "%s " ANSI_COLOR(1) "%.*s" ANSI_RESET "%s\n",
+ prints("%s " ANSI_COLOR(1) "%.*s" ANSI_RESET "%s\n",
mark, special ? 6 : 0, title, special ? title + 6 : title);
else
prints("\033[1;3%cm%s %s" ANSI_RESET "\n",
@@ -2226,7 +2269,14 @@ view_postmoney(int ent, const fileheader_t * fhdr, const char *direct)
vmsg("匿名管理編號: %d (同一人號碼會一樣)",
fhdr->multi.anon_uid + (int)currutmp->pid);
else
- vmsg("這一篇文章值 %d 銀", fhdr->multi.money);
+ if (vmsg("這一篇文章值 %d 銀", fhdr->multi.money) == 'Q')
+ {
+ /* enable money listing mode */
+ currlistmode = (currlistmode == LISTMODE_MONEY) ?
+ LISTMODE_DATE : LISTMODE_MONEY;
+ vmsg((currlistmode == LISTMODE_MONEY) ?
+ "[測試中功\能] 開啟文章價格列表模式" : "停止列出文章價格");
+ }
return FULLUPDATE;
}
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index ad6fa9df..aa553b42 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -606,6 +606,7 @@ multi_send(char *title)
strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner));
strlcpy(mymail.title, save_title, sizeof(mymail.title));
+ /* TODO is this really going to work!?!?!? */
mymail.filemode |= FILE_MULTI; /* multi-send flag */
sethomedir(genbuf, p->word);
if (append_record_forward(genbuf, &mymail, sizeof(mymail), p->word) == -1)
@@ -800,7 +801,7 @@ read_new_mail(void * voidfptr, void *optarg)
arg->mrd = 1;
delete_it = NA;
while (!done) {
- int more_result = more(fname, YEA);
+ int more_result = more(fname, YEA);
switch (more_result) {
case 999:
@@ -1009,16 +1010,23 @@ mail_read(int ent, fileheader_t * fhdr, const char *direct)
while (!done) {
int more_result = more(buf, YEA);
- if (more_result != -1) {
+ /* whether success or not, update flag.
+ * or users may bug about "black-hole" mails
+ * and blinking notification */
+ if( !(fhdr->filemode & FILE_READ))
+ {
fhdr->filemode |= FILE_READ;
- substitute_ref_record(direct, fhdr, ent);
+ substitute_ref_record(direct, fhdr, ent);
}
switch (more_result) {
+ case -1:
+ /* no such file */
+ clear();
+ vmsg("此封信無內容。");
+ return FULLUPDATE;
case 999:
mail_reply(ent, fhdr, direct);
return FULLUPDATE;
- case -1:
- return READ_SKIP;
case 0:
break;
default:
diff --git a/util/deluserfile.c b/util/deluserfile.c
index 2dcab42e..aa5aaa74 100644
--- a/util/deluserfile.c
+++ b/util/deluserfile.c
@@ -52,7 +52,7 @@ void del_file(char *userid)
fileheader_t mymail;
stampfile(buf, &mymail);
- mymail.filemode = FILE_READ|FILE_HOLD;
+ mymail.filemode = FILE_READ;
strcpy(mymail.owner, "[備.忘.錄]");
strcpy(mymail.title, "熱線記錄");
sprintf(buf1, BBSHOME "/home/%c/%s/writelog",