summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author(no author) <(no author)@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-22 11:40:29 +0800
committer(no author) <(no author)@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-22 11:40:29 +0800
commitf22efb079e367e8430f5fdee444136c524b6d432 (patch)
tree5f168fd6fdc441ef243f6caed91e6f6371bc9ed9
parent1745fa28925b72f7d0e532230aeac5bc805f2db0 (diff)
downloadpttbbs-f22efb079e367e8430f5fdee444136c524b6d432.tar
pttbbs-f22efb079e367e8430f5fdee444136c524b6d432.tar.gz
pttbbs-f22efb079e367e8430f5fdee444136c524b6d432.tar.bz2
pttbbs-f22efb079e367e8430f5fdee444136c524b6d432.tar.lz
pttbbs-f22efb079e367e8430f5fdee444136c524b6d432.tar.xz
pttbbs-f22efb079e367e8430f5fdee444136c524b6d432.tar.zst
pttbbs-f22efb079e367e8430f5fdee444136c524b6d432.zip
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@1193 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/include/common.h1
-rw-r--r--pttbbs/include/pttstruct.h606
-rw-r--r--pttbbs/mbbsd/bbs.c91
3 files changed, 262 insertions, 436 deletions
diff --git a/pttbbs/include/common.h b/pttbbs/include/common.h
index 18d377c2..786f13df 100644
--- a/pttbbs/include/common.h
+++ b/pttbbs/include/common.h
@@ -8,6 +8,7 @@
#define FN_PASSWD BBSHOME "/.PASSWDS" /* User records */
#define FN_USSONG "ussong" /* 點歌統計 */
#define FN_POST_NOTE "post.note" /* po文章備忘錄 */
+#define FN_POST_BID "post.bid"
#define FN_APPLICATION "application"
#define FN_MONEY "etc/money"
#define FN_OVERRIDES "overrides"
diff --git a/pttbbs/include/pttstruct.h b/pttbbs/include/pttstruct.h
index 991b2154..786f13df 100644
--- a/pttbbs/include/pttstruct.h
+++ b/pttbbs/include/pttstruct.h
@@ -1,427 +1,189 @@
/* $Id$ */
-#ifndef INCLUDE_STRUCT_H
-#define INCLUDE_STRUCT_H
-
-/* 小雞的資料 */
-typedef struct chicken_t {
- char name[20];
- char type; /* 物種 */
- unsigned char tech[16]; /* 技能 */
- time_t birthday; /* 生日 */
- time_t lastvisit; /* 上次照顧時間 */
- int oo; /* 補品 */
- int food; /* 食物 */
- int medicine; /* 藥品 */
- int weight; /* 體重 */
- int clean; /* 乾淨 */
- int run; /* 敏捷度 */
- int attack; /* 攻擊力 */
- int book; /* 知識 */
- int happy; /* 快樂 */
- int satis; /* 滿意度 */
- int temperament; /* 氣質 */
- int tiredstrong; /* 疲勞度 */
- int sick; /* 病氣指數 */
- int hp; /* 血量 */
- int hp_max; /* 滿血量 */
- int mm; /* 法力 */
- int mm_max; /* 滿法力 */
- time_t cbirth; /* 實際計算用的生日 */
- int pad[2]; /* 留著以後用 */
-} chicken_t;
-
-#define IDLEN 12 /* Length of bid/uid */
-#define PASSLEN 14 /* Length of encrypted passwd field */
-#define REGLEN 38 /* Length of registration data */
-
-typedef struct userec_t {
- char userid[IDLEN + 1];
- char realname[20];
- char username[24];
- char passwd[PASSLEN];
- unsigned char uflag;
- unsigned int userlevel;
- unsigned short numlogins;
- unsigned short numposts;
- time_t firstlogin;
- time_t lastlogin;
- char lasthost[16];
- int money;
- char remoteuser[3]; /* 保留 目前沒用到的 */
- char proverb;
- char email[50];
- char address[50];
- char justify[REGLEN + 1];
- unsigned char month;
- unsigned char day;
- unsigned char year;
- unsigned char sex;
- unsigned char state;
- unsigned char pager;
- unsigned char invisible;
- unsigned int exmailbox;
- chicken_t mychicken;
- time_t lastsong;
- unsigned int loginview;
- unsigned char channel; /* 動態看板 */
- unsigned short vl_count; /* ViolateLaw counter */
- unsigned short five_win;
- unsigned short five_lose;
- unsigned short five_tie;
- unsigned short chc_win;
- unsigned short chc_lose;
- unsigned short chc_tie;
- int mobile;
- char mind[4];
- char ident[11];
- unsigned int uflag2;
- unsigned char signature;
- char pad[71];
-} userec_t;
-/* these are flags in userec_t.uflag */
-#define PAGER_FLAG 0x4 /* true if pager was OFF last session */
-#define CLOAK_FLAG 0x8 /* true if cloak was ON last session */
-#define FRIEND_FLAG 0x10 /* true if show friends only */
-#define BRDSORT_FLAG 0x20 /* true if the boards sorted alphabetical */
-#define MOVIE_FLAG 0x40 /* true if show movie */
-#define COLOR_FLAG 0x80 /* true if the color mode open */
-#define MIND_FLAG 0x100 /* true if mind search mode open <-Heat*/
-/* these are flags in userec_t.uflag2 */
-#define WATER_MASK 000003 /* water mask */
-#define WATER_ORIG 0x0
-#define WATER_NEW 0x1
-#define WATER_OFO 0x2
-#define WATERMODE(mode) ((cuser.uflag2 & WATER_MASK) == mode)
-#define FAVNOHILIGHT 0x10 /* false if hilight favorite */
-#define FAVNEW_FLAG 0x20 /* true if add new board into one's fav */
-#define FOREIGN 0x100 /* true if a foreign */
-#define LIVERIGHT 0x200 /* true if get "liveright" already */
-
-#define BTLEN 48 /* Length of board title */
-
-typedef struct boardheader_t {
- char brdname[IDLEN + 1]; /* bid */
- char title[BTLEN + 1];
- char BM[IDLEN * 3 + 3]; /* BMs' userid, token '/' */
- unsigned int brdattr; /* board的屬性 */
- char pad[3]; /* 沒用到的 */
- time_t bupdate; /* note update time */
- char pad2[3]; /* 沒用到的 */
- unsigned char bvote; /* Vote flags */
- time_t vtime; /* Vote close time */
- unsigned int level; /* 可以看此板的權限 */
- int unused; /* 還沒用到 */
- int gid; /* 看板所屬的類別 ID */
- void *next[2]; /* 在同一個gid下一個看板 動態產生*/
- void *firstchild[2]; /* 屬於這個看板的第一個子看板 */
- void *parent;
- int childcount; /* 有多少個child */
- int nuser; /* 多少人在這板 */
- char pad5[4]; /* original void *u */
- time_t endgamble;
- char pad3[84];
-} boardheader_t;
-
-#define BRD_NOZAP 000000001 /* 不可zap */
-#define BRD_NOCOUNT 000000002 /* 不列入統計 */
-#define BRD_NOTRAN 000000004 /* 不轉信 */
-#define BRD_GROUPBOARD 000000010 /* 群組板 */
-#define BRD_HIDE 000000020 /* 隱藏板 (看板好友才可看) */
-#define BRD_POSTMASK 000000040 /* 限制發表或閱讀 */
-#define BRD_ANONYMOUS 000000100 /* 匿名板 */
-#define BRD_DEFAULTANONYMOUS 000000200 /* 預設匿名板 */
-#define BRD_BAD 000000400 /* 違法改進中看板 */
-#define BRD_VOTEBOARD 000001000 /* 連署機看板 */
-#define BRD_WARNEL 000002000 /* 連署機看板 */
-#define BRD_TOP 000004000 /* 熱門看板群組 */
-#define BRD_NORECOMMEND 000010000 /* 不可推薦 */
-#define BRD_BLOG 000020000 /* BLOG */
-
-#define TTLEN 64 /* Length of title */
-#define FNLEN 33 /* Length of filename */
-
-#define FHR_REFERENCE (1<<31)
-
-typedef struct fileheader_t {
- char filename[FNLEN]; /* M.9876543210.A */
- char recommend; /* important level */
- char owner[IDLEN + 2]; /* uid[.] */
- char date[6]; /* [02/02] or space(5) */
- char title[TTLEN + 1];
- int money; /* rocker: if bit32 on ==> reference */
- unsigned char filemode; /* must be last field @ boards.c */
-} fileheader_t;
-
-#define FILE_LOCAL 0x1 /* local saved */
-#define FILE_READ 0x1 /* already read : mail only */
-#define FILE_MARKED 0x2 /* opus: 0x8 */
-#define FILE_DIGEST 0x4 /* digest */
-#define FILE_HOLD 0x8 /* holdmail for mail */
-#define FILE_SOLVED 0x10 /* problem solved, sysop only */
-#define FILE_HIDE 0x20 /* hild */
-#define FILE_BM 0x40 /* BM only */
-#define FILE_BOTH 0x80 /* both replay for mail and board */
-#define FILE_MULTI 0x100 /* multi send for mail */
-
-#define STRLEN 80 /* Length of most string data */
-
-
-/* uhash is a userid->uid hash table -- jochang */
-
-#define HASH_BITS 16
-
-union xitem_t {
- struct { /* bbs_item */
- char fdate[9]; /* [mm/dd/yy] */
- char editor[13]; /* user ID */
- char fname[31];
- } B;
- struct { /* gopher_item */
- char path[81];
- char server[48];
- int port;
- } G;
-};
-
-typedef struct {
- char title[63];
- union xitem_t X;
-} item_t;
-
-typedef struct {
- item_t *item[MAX_ITEMS];
- char mtitle[STRLEN];
- char *path;
- int num, page, now, level;
-} gmenu_t;
-
-#define FAVMAX 1024 /* Max boards of Myfavorite */
-#define FAVGMAX 32 /* Max groups of Myfavorite */
-#define FAVGSLEN 8 /* Max Length of Description String */
-
-typedef struct msgque_t {
- pid_t pid;
- char userid[IDLEN + 1];
- char last_call_in[80];
-} msgque_t;
-
-typedef struct userinfo_t {
- int uid; /* Used to find user name in passwd file */
- pid_t pid; /* kill() to notify user of talk request */
- int sockaddr; /* ... */
- int destuid; /* talk uses this to identify who called */
- int destuip; /* dest index in utmpshm->uinfo[] */
- unsigned char active; /* When allocated this field is true */
- unsigned char invisible; /* Used by cloaking function in Xyz menu */
- unsigned char sockactive; /* Used to coordinate talk requests */
- unsigned int userlevel;
- unsigned char mode; /* UL/DL, Talk Mode, Chat Mode, ... */
- unsigned char pager; /* pager toggle, YEA, or NA */
- unsigned char in_chat; /* for in_chat commands */
- unsigned char sig; /* signal type */
- char userid[IDLEN + 1];
- char chatid[11]; /* chat id, if in chat mode */
- char username[24];
- char from[27]; /* machine name the user called in from */
- int from_alias;
- char birth; /* 是否是生日 Ptt*/
- char tty[11]; /* tty port */
- int friend[MAX_FRIEND];
- int friend_online[MAX_FRIEND];/* point到線上好友 utmpshm的位置 */
- /* 好友比較的cache 前兩個bit是狀態 */
- int reject[MAX_REJECT];
- int idoffset; /* shm id上的 offset */
- int lock;
- int friendtotal; /* 好友比較的cache 大小 */
- unsigned char msgcount;
- msgque_t msgs[MAX_MSGS];
- time_t uptime;
- time_t lastact; /* 上次使用者動的時間 */
- unsigned int brc_id;
- unsigned char lockmode; /* 不准 multi_login 玩的東西 */
- char turn; /* for gomo */
- char mateid[IDLEN + 1]; /* for gomo */
- unsigned short int five_win;
- unsigned short int five_lose;
- unsigned short int five_tie;
- unsigned short int chc_win;
- unsigned short int chc_lose;
- unsigned short int chc_tie;
- char mailalert;
- char sex;
- char color;
- char mind[4];
-} userinfo_t;
-
-typedef struct water_t {
- pid_t pid;
- char userid[IDLEN + 1];
- int top, count;
- msgque_t msg[MAX_REVIEW];
- userinfo_t *uin; // Ptt:這可以取代alive
-} water_t;
-
-typedef struct {
- fileheader_t *header;
- char mtitle[STRLEN];
- char *path;
- int num, page, now, level;
-} menu_t;
-
-typedef struct onekey_t { /* Used to pass commands to the readmenu */
- int key;
- int (*fptr)();
-} onekey_t;
-
-#define ANSILINELEN (511) /* Maximum Screen width in chars */
-
-/* anti_crosspost */
-typedef struct crosspost_t {
- int checksum[4]; /* 0 -> 'X' cross post 1-3 -> 簡查文章行 */
- int times; /* 第幾次 */
-} crosspost_t;
-
-#define SORT_BY_ID 0
-#define SORT_BY_CLASS 1
-#define SORT_BY_STAT 1
-#define SORT_BY_IDLE 2
-#define SORT_BY_FROM 3
-#define SORT_BY_FIVE 4
-#define SORT_BY_SEX 5
-
-typedef struct keeploc_t {
- char *key;
- int top_ln;
- int crs_ln;
- struct keeploc_t *next;
-} keeploc_t;
-
-#define USHM_SIZE (MAX_ACTIVE + 4) /* why+4? */
-
-/* MAX_BMs is dirty hardcode 4 in mbbsd/cache.c:is_BM_cache() */
-#define MAX_BMs 4 /* for BMcache, 一個看板最多幾板主 */
-
-typedef struct {
- /* uhash */
- char userid[MAX_USERS][IDLEN + 1];
- int next_in_hash[MAX_USERS];
- int money[MAX_USERS];
- int hash_head[1 << HASH_BITS];
- int number; /* # of users total */
- int loaded; /* .PASSWD has been loaded? */
-
- /* utmpshm */
- userinfo_t uinfo[USHM_SIZE];
- userinfo_t *sorted[2][8][USHM_SIZE];
- /* 第一維double buffer 由currsorted指向目前使用的
- 第二維sort type */
- int currsorted;
- time_t UTMPuptime;
- int UTMPnumber;
- char UTMPneedsort;
- char UTMPbusystate;
-
- /* brdshm */
- int BMcache[MAX_BOARD][MAX_BMs];
- boardheader_t bcache[MAX_BOARD];
- boardheader_t *bsorted[2][MAX_BOARD]; /* 0: by name 1: by class */
- fileheader_t dircache[MAX_BOARD][DIRCACHESIZE];
- time_t busystate_b[MAX_BOARD];
- int total[MAX_BOARD];
- int hbfl[MAX_BOARD][MAX_FRIEND + 1];
- time_t lastposttime[MAX_BOARD];
- time_t Buptime;
- time_t Btouchtime;
- int Bnumber;
- int Bbusystate;
- time_t close_vote_time;
-
- /* pttcache */
- char notes[MAX_MOVIE][200*11];
- char today_is[20];
- int n_notes[MAX_MOVIE_SECTION]; /* 一節中有幾個 看板 */
- int next_refresh[MAX_MOVIE_SECTION]; /* 下一次要refresh的 看板 */
- int max_film;
- int max_history;
- time_t Puptime;
- time_t Ptouchtime;
- int Pbusystate;
-
- int GLOBALVAR[10]; /* mbbsd間的 global variable
- 用以做統計等資料 (非常態) */
-
- union {
- int v[256];
- struct {
- int dymaxactive; /* 動態設定最大人數上限 */
- int toomanyusers; /* 超過人數上限不給進的個數 */
- int noonlineuser; /* 站上使用者不高亮度顯示 */
-#ifdef OUTTA_TIMER
- time_t now;
+#ifndef INCLUDE_COMMON_H
+#define INCLUDE_COMMON_H
+
+#define STR_GUEST "guest"
+#define DEFAULT_BOARD str_sysop
+
+#define FN_PASSWD BBSHOME "/.PASSWDS" /* User records */
+#define FN_USSONG "ussong" /* 點歌統計 */
+#define FN_POST_NOTE "post.note" /* po文章備忘錄 */
+#define FN_POST_BID "post.bid"
+#define FN_APPLICATION "application"
+#define FN_MONEY "etc/money"
+#define FN_OVERRIDES "overrides"
+#define FN_REJECT "reject"
+#define FN_WATER "water"
+#define FN_CANVOTE "can_vote"
+#define FN_VISABLE "visable"
+#define FN_USIES "usies" /* BBS log */
+#define FN_BOARD ".BRD" /* board list */
+#define FN_USEBOARD "usboard" /* 看板統計 */
+#define FN_NOTE_ANS "note.ans"
+#define FN_TOPSONG "etc/topsong"
+#define FN_OVERRIDES "overrides"
+#define FN_TICKET "ticket"
+#define FN_TICKET_END "ticket.end"
+#define FN_TICKET_LOCK "ticket.end.lock"
+#define FN_TICKET_ITEMS "ticket.items"
+#define FN_TICKET_RECORD "ticket.data"
+#define FN_TICKET_USER "ticket.user"
+#define FN_TICKET_OUTCOME "ticket.outcome"
+#define FN_TICKET_BRDLIST "boardlist"
+
+#define MSG_DEL_CANCEL "取消刪除"
+#define MSG_SELECT_BOARD "\033[7m【 選擇看板 】\033[m\n" \
+ "請輸入看板名稱(按空白鍵自動搜尋):"
+#define MSG_CLOAKED "哈哈!我隱形了!看不到勒... :P"
+#define MSG_UNCLOAK "我要重現江湖了...."
+#define MSG_BIG_BOY "我是大帥哥! ^o^Y"
+#define MSG_BIG_GIRL "世紀大美女 *^-^*"
+#define MSG_LITTLE_BOY "我是底迪啦... =)"
+#define MSG_LITTLE_GIRL "最可愛的美眉! :>"
+#define MSG_MAN "麥當勞叔叔 (^O^)"
+#define MSG_WOMAN "叫我小阿姨!! /:>"
+#define MSG_PLANT "植物也有性別喔.."
+#define MSG_MIME "礦物總沒性別了吧"
+#define MSG_PASSWD "請輸入您的密碼: "
+#define MSG_POSTER "\033[34;46m 文章選讀 "\
+ "\033[31;47m (y)\033[30m回信 "\
+ "\033[31m(=[]<>)\033[30m相關主題 "\
+ "\033[31m(/?)\033[30m搜尋標題 "\
+ "\033[31m(aA)\033[30m搜尋作者 "\
+ "\033[31m(x)\033[30m轉錄 "\
+ "\033[31m(V)\033[30m投票 \033[m"
+#define MSG_SEPERATOR "\
+───────────────────────────────────────"
+
+#define MSG_CLOAKED "哈哈!我隱形了!看不到勒... :P"
+#define MSG_UNCLOAK "我要重現江湖了...."
+
+#define MSG_WORKING "處理中,請稍候..."
+
+#define MSG_CANCEL "取消。"
+#define MSG_USR_LEFT "User 已經離開了"
+#define MSG_NOBODY "目前無人上線"
+
+#define MSG_DEL_OK "刪除完畢"
+#define MSG_DEL_CANCEL "取消刪除"
+#define MSG_DEL_ERROR "刪除錯誤"
+#define MSG_DEL_NY "請確定刪除(Y/N)?[N] "
+
+#define MSG_FWD_OK "文章轉寄完成!"
+#define MSG_FWD_ERR1 "轉寄失誤: system error"
+#define MSG_FWD_ERR2 "轉寄失誤: address error"
+
+#define MSG_SURE_NY "請您確定(Y/N)?[N] "
+#define MSG_SURE_YN "請您確定(Y/N)?[Y] "
+
+#define MSG_BID "請輸入看板名稱:"
+#define MSG_UID "請輸入使用者代號:"
+#define MSG_PASSWD "請輸入您的密碼: "
+
+#define MSG_BIG_BOY "我是大帥哥! ^o^Y"
+#define MSG_BIG_GIRL "世紀大美女 *^-^*"
+#define MSG_LITTLE_BOY "我是底迪啦... =)"
+#define MSG_LITTLE_GIRL "最可愛的美眉! :>"
+#define MSG_MAN "麥當勞叔叔 (^O^)"
+#define MSG_WOMAN "叫我小阿姨!! /:>"
+#define MSG_PLANT "植物也有性別喔.."
+#define MSG_MIME "礦物總沒性別了吧"
+
+#define ERR_BOARD_OPEN ".BOARD 開啟錯誤"
+#define ERR_BOARD_UPDATE ".BOARD 更新有誤"
+#define ERR_PASSWD_OPEN ".PASSWDS 開啟錯誤"
+
+#define ERR_BID "你搞錯了啦!沒有這個板喔!"
+#define ERR_UID "這裡沒有這個人啦!"
+#define ERR_PASSWD "密碼不對喔!你有沒有冒用人家的名字啊?"
+#define ERR_FILENAME "檔名不合法!"
+#define MSG_MAILER \
+"\033[34;46m 鴻雁往返 \033[31;47m(R)\033[30m回信\033[31m(x)\033[30m轉達\
+\033[31m(y)\033[30m群組回信\033[31m(D)\033[30m刪除\
+\033[31m(c)\033[30m收入信件夾\033[31m(z)\033[30m信件夾 \033[31m[G]\033[30m繼續?\033[0m"
+#define MSG_SHORTULIST "\033[7m\
+使用者代號 目前狀態 │使用者代號 目前狀態 │使用者代號 目前狀態 \033[0m"
+
+
+#define STR_AUTHOR1 "作者:"
+#define STR_AUTHOR2 "發信人:"
+#define STR_POST1 "看板:"
+#define STR_POST2 "站內:"
+
+/* Flags to getdata input function */
+#define NOECHO 0
+#define DOECHO 1
+#define LCECHO 2
+
+#define YEA 1 /* Booleans (Yep, for true and false) */
+#define NA 0
+
+/* 好友關係 */
+#define IRH 1 /* I reject him. */
+#define HRM 2 /* He reject me. */
+#define IBH 4 /* I am board friend of him. */
+#define IFH 8 /* I am friend of him. */
+#define HFM 16 /* He is friend of me. */
+#define ST_FRIEND (IBH | IFH | HFM)
+#define ST_REJECT (IRH | HRM)
+
+/* 鍵盤設定 */
+#define KEY_TAB 9
+#define KEY_ESC 27
+#define KEY_UP 0x0101
+#define KEY_DOWN 0x0102
+#define KEY_RIGHT 0x0103
+#define KEY_LEFT 0x0104
+#define KEY_HOME 0x0201
+#define KEY_INS 0x0202
+#define KEY_DEL 0x0203
+#define KEY_END 0x0204
+#define KEY_PGUP 0x0205
+#define KEY_PGDN 0x0206
+
+#define QCAST int (*)(const void *, const void *)
+#define Ctrl(c) (c & 037)
+#define chartoupper(c) ((c >= 'a' && c <= 'z') ? c+'A'-'a' : c)
+
+#define LEN_AUTHOR1 5
+#define LEN_AUTHOR2 7
+
+/* ----------------------------------------------------- */
+/* 群組名單模式 Ptt */
+/* ----------------------------------------------------- */
+#define FRIEND_OVERRIDE 0
+#define FRIEND_REJECT 1
+#define FRIEND_ALOHA 2
+#define FRIEND_POST 3
+#define FRIEND_SPECIAL 4
+#define FRIEND_CANVOTE 5
+#define BOARD_WATER 6
+#define BOARD_VISABLE 7
+
+#define LOCK_THIS 1 // lock這線不能重複玩
+#define LOCK_MULTI 2 // lock所有線不能重複玩
+
+#define I_TIMEOUT (-2) /* Used for the getchar routine select call */
+#define I_OTHERDATA (-333) /* interface, (-3) will conflict with chinese */
+
+#define CHE_O(c) ((c) >> 3)
+#define CHE_P(c) ((c) & 7)
+#define RTL(x) (((x) - 3) >> 1)
+#define dim(x) (sizeof(x) / sizeof(x[0]))
+#define LTR(x) ((x) * 2 + 3)
+#define CHE(a, b) ((a) | ((b) << 3))
+
+#define MAX_MODES 127
+
+#ifndef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
- int nWelcomes;
- } e;
- } GV2;
-
- /* fromcache */
- char domain[MAX_FROM][50];
- char replace[MAX_FROM][50];
- int top;
- int max_user;
- time_t max_time;
- time_t Fuptime;
- time_t Ftouchtime;
- int Fbusystate;
-} SHM_t;
-
-typedef struct {
- unsigned char oldlen; /* previous line length */
- unsigned char len; /* current length of line */
- unsigned char mode; /* status of line, as far as update */
- unsigned char smod; /* start of modified data */
- unsigned char emod; /* end of modified data */
- unsigned char sso; /* start stand out */
- unsigned char eso; /* end stand out */
- unsigned char data[ANSILINELEN + 1];
-} screenline_t;
-
-typedef struct {
- int r, c;
-} rc_t;
-
-#define BRD_ROW 10
-#define BRD_COL 9
-
-typedef int board_t[BRD_ROW][BRD_COL];
-
-/* name.c 中運用的資料結構 */
-typedef struct word_t {
- char *word;
- struct word_t *next;
-} word_t;
-
-typedef struct commands_t {
- int (*cmdfunc)();
- int level;
- char *desc; /* next/key/description */
-} commands_t;
-
-typedef struct MailQueue {
- char filepath[FNLEN];
- char subject[STRLEN];
- time_t mailtime;
- char sender[IDLEN + 1];
- char username[24];
- char rcpt[50];
- int method;
- char *niamod;
-} MailQueue;
-enum {MQ_TEXT, MQ_UUENCODE, MQ_JUSTIFY};
+#define char_lower(c) ((c >= 'A' && c <= 'Z') ? c|32 : c)
-typedef struct
-{
- time_t chrono;
- int recno;
-} TagItem;
+#define STR_CURSOR "●"
+#define STR_UNCUR " "
#endif
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index 85c894a6..82051438 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -448,8 +448,9 @@ do_allpost(fileheader_t *postfile, const char *fpath, const char *owner)
}
static int
-do_general()
+do_general(int isbid)
{
+ bid_t bidinfo;
fileheader_t postfile;
char fpath[80], buf[80];
int aborted, defanony, ifuseanony;
@@ -489,21 +490,51 @@ do_general()
#endif
#endif
- setbfile(genbuf, currboard, FN_POST_NOTE);
+ if(!isbid)
+ setbfile(genbuf, currboard, FN_POST_NOTE);
+ else
+ setbfile(genbuf, currboard, FN_POST_BID);
if (more(genbuf, NA) == -1)
- more("etc/" FN_POST_NOTE, NA);
-
+ {
+ if(!isbid)
+ more("etc/" FN_POST_NOTE, NA);
+ else
+ more("etc/" FN_POST_BID, NA);
+ }
move(19, 0);
- prints("發表文章於【\033[33m %s\033[m 】 \033[32m%s\033[m 看板\n\n",
+ prints("%s於【\033[33m %s\033[m 】 \033[32m%s\033[m 看板\n",
+ isbid?"公開招標":"發表文章",
currboard, bp->title + 7);
-
+ if(isbid)
+ {
+ prints("設定結標日期:");
+ bidinfo.enddate = gettime(20, now+86400);
+ do
+ getdata_str(21,0,"底價:",buf, 8, LCECHO, "1");
+ while((bidinfo.enddate=postfile.money=atoi(buf))<=0);
+ do
+ getdata_str(21,0, "每標至少增加多少:",buf, 5, LCECHO, "1");
+ while((bidinfo.increment=atoi(buf))<=0);
+ getdata_str(22,0,
+ "付款方式: 1.Ptt幣 2.郵局或銀行轉帳 3.支票或電匯 4.郵局貨到付款 [1]:",
+ buf, 3, LCECHO,"1");
+ bidinfo.payby=(buf[0]-'1');
+ if(bidinfo.payby<0 ||bidinfo.payby>3)bidinfo.payby=0;
+ getdata_str(23,0, "運費(0:免運費或文中說明)[0]:", buf, 6, LCECHO, "0");
+ bidinfo.shipping = atoi(buf);
+ if(bidinfo.shipping<0) bidinfo.shipping=0;
+ postfile.filemode |= FILE_BID ;
+ move(20,0);
+ clrtobot();
+ }
if (quote_file[0])
do_reply_title(20, currtitle);
else {
- getdata(21, 0,
- "種類:1.問題 2.建議 3.討論 4.心得 5.閒聊 6.公告 7.情報 (1-7或不選)",
+ getdata(21, 0,
+ "種類:1.問題 2.建議 3.討論 4.心得 5.閒聊 6.公告 7.情報 (1-7或不選)",
save_title, 3, LCECHO);
+
local_article = save_title[0] - '1';
if (local_article >= 0 && local_article <= 6)
snprintf(save_title, sizeof(save_title),
@@ -556,13 +587,18 @@ do_general()
#endif
/* 錢 */
aborted = (aborted > MAX_POST_MONEY * 2) ? MAX_POST_MONEY : aborted / 2;
- postfile.money = aborted;
+ if(!isbid)
+ postfile.money = aborted;
strlcpy(postfile.owner, owner, sizeof(postfile.owner));
strlcpy(postfile.title, save_title, sizeof(postfile.title));
if (islocal) /* local save */
postfile.filemode = FILE_LOCAL;
setbdir(buf, currboard);
+ if(isbid)
+ {
+ append_record(buf, &postfile, sizeof(postfile));
+ }
if (append_record(buf, &postfile, sizeof(postfile)) != -1) {
setbtotal(currbid);
@@ -582,9 +618,14 @@ do_general()
aborted = (aborted > MAX_POST_MONEY) ? MAX_POST_MONEY : aborted;
#endif
if (strcmp(currboard, "Test") && !ifuseanony) {
- prints("這是您的第 %d 篇文章。 稿酬 %d 銀。",
- ++cuser.numposts, aborted);
- demoney(aborted);
+ prints("這是您的第 %d 篇文章。",++cuser.numposts);
+ if(!isbid)
+ {
+ prints(" 稿酬 %d 銀。",aborted);
+ demoney(aborted);
+ }
+ else
+ prints("招標文章沒有稿酬。");
passwd_update(usernum, &cuser); /* post 數 */
} else
outs("測試信件不列入紀錄,敬請包涵。");
@@ -634,7 +675,18 @@ do_post()
if (bp->brdattr & BRD_VOTEBOARD)
return do_voteboard();
else if (!(bp->brdattr & BRD_GROUPBOARD))
- return do_general();
+ return do_general(0);
+ touchdircache(currbid);
+ return 0;
+}
+
+int
+do_post_openbid()
+{
+ boardheader_t *bp;
+ bp = getbcache(currbid);
+ if (!bp->brdattr & BRD_VOTEBOARD)
+ return do_general(1);
touchdircache(currbid);
return 0;
}
@@ -1709,7 +1761,6 @@ static int
b_post_note()
{
char buf[200], yn[3];
-
if (currmode & MODE_BOARD) {
setbfile(buf, currboard, FN_POST_NOTE);
if (more(buf, NA) == -1)
@@ -1719,6 +1770,17 @@ b_post_note()
vedit(buf, NA, NULL);
else
unlink(buf);
+
+
+ setbfile(buf, currboard, FN_POST_BID);
+ if (more(buf, NA) == -1)
+ more("etc/" FN_POST_BID, NA);
+ getdata(b_lines - 2, 0, "是否要用自訂bid注意事項?", yn, sizeof(yn), LCECHO);
+ if (yn[0] == 'y')
+ vedit(buf, NA, NULL);
+ else
+ unlink(buf);
+
return FULLUPDATE;
}
return 0;
@@ -2073,6 +2135,7 @@ struct onekey_t read_comms[] = {
{'y', reply_post},
{'z', b_man},
{Ctrl('P'), do_post},
+ {Ctrl('O'), do_post_openbid},
{Ctrl('W'), whereami},
{'\0', NULL}
};