Documentation ¶
Index ¶
- Constants
- Variables
- func InitConfig() (err error)
- func SetBBSHOME(bbshome string) string
- func SetBBSHomePath(filename string) string
- func SetIsTest()
- func UnsetIsTest()
- func ValidUSHMEntry(x UtmpID) bool
- type Address_t
- type Aid
- type AidInStore
- type Aidc
- type Aidu
- type AllowRejectEmail
- type AllowRejectEmailOp
- type ArticleSummaryRaw
- type BM_t
- type BSortBy
- type Bid
- type BidInStore
- type BoardDetailRaw
- type BoardHeaderRaw
- type BoardID_t
- type BoardStat
- type BoardStatAttr
- type BoardSummaryRaw
- type BoardTitle_t
- type BrdAttr
- type Career_t
- type ChatID_t
- type ChessCode
- type CommentType
- type Date_t
- type EditFlag
- type EmailDBOp
- type Email_t
- type FileHeaderRaw
- func (f *FileHeaderRaw) AnonUID() (anonUID int32)
- func (f *FileHeaderRaw) IsDeleted() bool
- func (f *FileHeaderRaw) Money() (money int32)
- func (f *FileHeaderRaw) SetAnonUID(uid UID) (err error)
- func (f *FileHeaderRaw) SetMoney(money int32) (err error)
- func (f *FileHeaderRaw) VoteLimitBadpost() uint8
- func (f *FileHeaderRaw) VoteLimitLogins() uint8
- func (f *FileHeaderRaw) VoteLimitPosts() uint8
- func (f *FileHeaderRaw) VoteLimitRegTime() uint8
- func (f *FileHeaderRaw) VoteLimits() *VoteLimits
- type FileMode
- type FileRefer
- type Filename_t
- func (f *Filename_t) Basename() string
- func (f *Filename_t) CreateTime() (types.Time4, error)
- func (f *Filename_t) DeletedName() string
- func (f *Filename_t) Eq(f2 *Filename_t) bool
- func (f *Filename_t) IsDeleted() bool
- func (f *Filename_t) Postfix() []byte
- func (f *Filename_t) String() string
- func (f *Filename_t) ToAidu() Aidu
- func (f *Filename_t) Type() RecordType
- type FriendOnline
- type FriendStat
- type FriendType
- type From_t
- type IPv4_t
- type MQType
- type MailQueue
- type MsgMode
- type MsgQueueRaw
- type Nickname_t
- type Owner_t
- type PERM
- type PERM2
- type PagerMode
- type Passwd_t
- type Phone_t
- type RCPT_t
- type RealName_t
- type RecordType
- type RegMailDBReq
- type RegMailDBReqHeader
- type Reg_t
- type RestrictReason
- type ServiceMode
- type SortByCategory
- type SortIdx
- type SortIdxInStore
- type StampType
- type Stat
- type StateMode
- type SubjectType
- type Subject_t
- type Title_t
- type UFlag
- type UID
- type UIDInStore
- type UserID_t
- type UserInfoRaw
- type UserOpMode
- type Userec2Raw
- type UserecRaw
- type UtmpID
- type VerifyDBMessage
- type VerifyDBStatus
- type VerifyDBVMethod
- type VoteLimits
- type WaterBall
- type WithMe_t
Constants ¶
const ( // These are special config variables requiring to be const. // copy to ptttype/00-config-production.go to setup production config. // // type struct requires const. MAX_USERS = 50 /* 最高註冊人數 */ MAX_ACTIVE = 31 /* 最多同時上站人數 */ MAX_BOARD = 100 /* 最大開板個數 */ ////////// //config.h ////////// HASH_BITS = 16 /* userid->uid hashing bits */ MAX_FRIEND = 100 /* 載入 cache 之最多朋友數目 */ MAX_REJECT = 32 /* 載入 cache 之最多壞人數目 */ MAX_MSGS = 10 /* 水球(熱訊)忍耐上限 */ MAX_ADBANNER = 100 /* 最多動態看板數 */ HOTBOARDCACHE = 10 /* 熱門看板快取 */ MAX_FROM = 30 /* 最多故鄉數 */ MAX_REVIEW = 7 /* 最多水球回顧 */ NUMVIEWFILE = 14 /* 進站畫面最多數 */ MAX_ADBANNER_SECTION = 10 /* 最多動態看板類別 */ MAX_ADBANNER_HEIGHT = 11 /* 最大動態看板內容高度 */ MAXPATHLEN = 256 PATHLEN = 256 )
const ( BOARD_HEADER_RAW_SZ = unsafe.Sizeof(EMPTY_BOARD_HEADER_RAW) BOARD_HEADER_BRDNAME_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.Brdname) BOARD_HEADER_TITLE_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.Title) BOARD_HEADER_BRD_ATTR_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.BrdAttr) BOARD_HEADER_NEXT_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.Next) BOARD_HEADER_FIRST_CHILD_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.FirstChild) BOARD_HEADER_PARENT_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.Parent) BOARD_HEADER_CHILD_COUNT_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.ChildCount) BOARD_HEADER_BM_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.BM) BOARD_HEADER_NUSER_OFFSET = unsafe.Offsetof(EMPTY_BOARD_HEADER_RAW.NUser) )
const ( ////////// // common.h ////////// STR_GUEST = "guest" // guest account STR_REGNEW = "new" // 用來建新帳號的名稱 STR_RECOVER = "/recover" // recover function // BBS Configuration Files FN_CONF_EDITABLE = "etc/editable" // 站務可編輯的系統檔案列表 FN_CONF_RESERVED_ID = "etc/reserved.id" // 保留系統用無法註冊的 ID FN_CONF_BINDPORTS = "etc/bindports.conf" // 預設要提供連線服務的 port 列表 // BBS Data File Names FN_CHICKEN = "chicken" FN_USSONG = "ussong" /* 點歌統計 */ FN_POST_NOTE = "post.note" /* po文章備忘錄 */ FN_POST_BID = "post.bid" FN_MONEY = "etc/money" FN_OVERRIDES = "overrides" FN_REJECT = "reject" FN_WATER = "water" // 舊水桶 FN_BANNED = "banned" // 新水桶 FN_BANNED_HISTORY = "banned.history" // 新水桶之歷史記錄 FN_BADPOST_HISTORY = "badpost.history" // 劣文歷史記錄 FN_CANVOTE = "can_vote" FN_VISIBLE = "visable" //nolint // 不知道是誰拼錯的,將錯就錯吧... // variable corrected in go. FN_ALOHAED = "alohaed" // 上站要通知我的名單 (編輯用) FN_ALOHA = "aloha" // 我上站要通知的名單 (自動產生) FN_USIES = "usies" /* BBS log */ FN_DIR = ".DIR" FN_DIR_BOTTOM = ".DIR.bottom" // FN_BOARD = ".BRD" /* board list */ (var) FN_USEBOARD = "usboard" /* 看板統計 */ FN_TOPSONG = "etc/topsong" FN_TICKET = "ticket" FN_TICKET_END = "ticket.end" FN_TICKET_LOCK = "ticket.end.lock" FN_TICKET_ITEMS = "ticket.items" FN_TICKET_RECORD = "ticket.data" FN_TICKET_USER = "ticket.user" FN_TICKET_OUTCOME = "ticket.outcome" FN_TICKET_BRDLIST = "boardlist" FN_BRDLISTHELP = "etc/boardlist.help" FN_BOARDHELP = "etc/board.help" FN_MAIL_ACCOUNT_SYSOP = "etc/mail_account_sysop" // 帳號站長信箱列表 FN_MAIL_ACCOUNT_SYSOP_DESC = "etc/mail_account_sysop_desc" // 帳號站長信箱說明 FN_USERMEMO = "memo.txt" // 使用者個人記事本 FN_BADLOGIN = "logins.bad" // in BBSHOME & user directory FN_RECENTLOGIN = "logins.recent" // in user directory FN_FORWARD = ".forward" /* auto forward */ FN_RECENTPAY = "money.recent" // 自訂刪除文章時出現的標題與檔案 FN_EDITHISTORY = ".history" MSG_CLOAKED = "已進入隱形模式(不列於使用者名單上)" MSG_UNCLOAK = "已離開隱形模式(公開於使用者名單上)" MSG_WORKING = "處理中,請稍候..." MSG_CANCEL = "取消。" MSG_USR_LEFT = "使用者已經離開了" MSG_NOBODY = "目前無人上線" MSG_DEL_OK = "刪除完畢" MSG_DEL_CANCEL = "取消刪除" MSG_DEL_ERROR = "刪除錯誤" MSG_DEL_NY = "請確定刪除(Y/N)?[N] " MSG_FWD_OK = "文章轉寄完成!" MSG_FWD_ERR1 = "轉寄錯誤: 系統錯誤 system error" MSG_FWD_ERR2 = "轉寄錯誤: 位址錯誤 address error" MSG_SURE_NY = "請您確定(Y/N)?[N] " MSG_SURE_YN = "請您確定(Y/N)?[Y] " MSG_BID = "請輸入看板名稱: " MSG_UID = "請輸入使用者代號: " MSG_PASSWD = "請輸入您的密碼: " //nolint MSG_BIG_BOY = "我是大帥哥! ^o^Y" MSG_BIG_GIRL = "世紀大美女 *^-^*" MSG_LITTLE_BOY = "我是底迪啦... =)" MSG_LITTLE_GIRL = "最可愛的美眉! :>" MSG_MAN = "麥當勞叔叔 (^O^)" MSG_WOMAN = "叫我小阿姨!! /:>" MSG_PLANT = "植物也有性別喔.." MSG_MIME = "礦物總沒性別了吧" ERR_BOARD_OPEN = ".BOARD 開啟錯誤" ERR_BOARD_UPDATE = ".BOARD 更新有誤" ERR_PASSWD_OPEN = ".PASSWDS 開啟錯誤" //nolint ERR_BID = "你搞錯了啦!沒有這個板喔!" ERR_UID = "這裡沒有這個人啦!" ERR_PASSWD = "密碼不對喔!請檢查帳號及密碼大小寫有無輸入錯誤。" //nolint ERR_FILENAME = "檔名不正確!" TN_ANNOUNCE = "[公告]" STR_AUTHOR1 = "作者:" STR_AUTHOR2 = "發信人:" STR_POST1 = "看板:" STR_POST2 = "站內:" STR_LOGINDAYS = "登入次數" STR_LOGINDAYS_QTY = "次" /* AIDS */ AID_DISPLAYNAME = "文章代碼(AID)" /* QUERY_ARTICLE_URL */ URL_DISPLAYNAME = "文章網址" MSG_SEPARATOR = "───────────────────────────────────────" /* Flags to getdata input function */ NOECHO = 0 DOECHO = 1 LCECHO = 2 NUMECHO = 4 GCARRY = 8 // (from M3) do not empty input buffer. PASSECHO = 0x10 YEA = true /* Booleans (Yep, for true and false) */ NA = false EQUSTR = 0 /* for strcmp */ LEN_AUTHOR1 = 5 LEN_AUTHOR2 = 7 /* the title of article will be truncate to PROPER_TITLE_LEN */ PROPER_TITLE_LEN = 42 /* ----------------------------------------------------- */ /* 水球模式 邊界定義 */ /* ----------------------------------------------------- */ WB_OFO_USER_TOP = 7 WB_OFO_USER_BOTTOM = 11 WB_OFO_USER_NUM = WB_OFO_USER_BOTTOM - WB_OFO_USER_TOP + 1 WB_OFO_USER_LEFT = 28 WB_OFO_MSG_TOP = 15 WB_OFO_MSG_BOTTOM = 22 WB_OFO_MSG_LEFT = 4 )
const ( LOCK_THIS = 1 // lock這線不能重複玩 LOCK_MULTI = 2 // lock所有線不能重複玩 MAX_MODES = 127 MAX_RECOMMENDS = 100 STR_CURSOR = ">" STR_CURSOR2 = "●" STR_UNCUR = " " STR_UNCUR2 = " " NOTREPLYING = -1 REPLYING = 0 RECVINREPLYING = 1 )
const ( EDIT_ABORTED = -1 /* ----------------------------------------------------- */ /* 聊天室常數 (xchatd) */ /* ----------------------------------------------------- */ EXIT_LOGOUT = 0 EXIT_LOSTCONN = -1 EXIT_CLIERROR = -2 EXIT_TIMEDOUT = -3 EXIT_KICK = -4 CHAT_LOGIN_OK = "OK" CHAT_LOGIN_EXISTS = "EX" CHAT_LOGIN_INVALID = "IN" CHAT_LOGIN_BOGUS = "BG" /* ----------------------------------------------------- */ /* Grayout Levels */ /* ----------------------------------------------------- */ GRAYOUT_COLORBOLD = -2 GRAYOUT_BOLD = -1 GRAYOUT_DARK = 0 GRAYOUT_NORM = 1 GRAYOUT_COLORNORM = 2 /* Typeahead */ TYPEAHEAD_NONE = -1 TYPEAHEAD_STDIN = 0 /* ----------------------------------------------------- */ /* Constants */ /* ----------------------------------------------------- */ DAY_SECONDS = 86400 MONTH_SECONDS = DAY_SECONDS * 30 MILLISECONDS = 1000 // milliseconds of one second )
const ( /* 好友關係 */ FRIEND_STAT_IRH = 1 /* I reject him. */ FRIEND_STAT_HRM = 2 /* He reject me. */ FRIEND_STAT_IBH = 4 /* I am board friend of him. */ FRIEND_STAT_IFH = 8 /* I friend him (He is one of my friends). */ FRIEND_STAT_HFM = 16 /* He friends me (I am one of his friends). */ FRIEND_STAT_FRIEND = FRIEND_STAT_IBH | FRIEND_STAT_IFH | FRIEND_STAT_HFM FRIEND_STAT_REJECT = FRIEND_STAT_IRH | FRIEND_STAT_HRM )
const ( ////////// //pttstruct.h // //SHMSIZE is computed in cache/shm.go NewSHM ////////// IDLEN = 12 /* Length of bid/uid */ IPV4LEN = 15 /* a.b.c.d form */ PASS_INPUT_LEN = 8 /* Length of valid input password length. For DES, set to 8. */ PASSLEN = 14 /* Length of encrypted passwd field */ REGLEN = 38 /* Length of registration data */ REALNAMESZ = 20 /* Size of real-name field */ NICKNAMESZ = 24 /* SIze of nick-name field */ EMAILSZ = 50 /* Size of email field */ ADDRESSSZ = 50 /* Size of address field */ CAREERSZ = 40 /* Size of career field */ PHONESZ = 20 /* Size of phone field */ USERNAMESZ = 24 /* Size of Username in MailQueue */ RCPTSZ = 50 /* Size of RCPT in MailQueue */ PASSWD_VERSION = 4194 BTLEN = 48 /* Length of board title */ TTLEN = 64 /* Length of title */ FNLEN = 28 /* Length of filename */ // Prefix of str_reply and str_forward usually needs longer. // In artitlcle list, the normal length is (80-34)=46. DISP_TTLEN = 46 STRLEN = 80 /* Length of most string data */ FAVMAX = 1024 /* Max boards of Myfavorite */ FAVGMAX = 32 /* Max groups of Myfavorite */ FAVGSLEN = 8 /* Max Length of Description String */ ONEKEY_SIZE = int('~') ANSILINELEN = 511 /* Maximum Screen width in chars */ /* USHM_SIZE 比 MAX_ACTIVE 大是為了防止檢查人數上限時, 又同時衝進來 * 會造成找 shm 空位的無窮迴圈. * 又, 因 USHM 中用 hash, 空間稍大時效率較好. */ USHM_SIZE = MAX_ACTIVE * 41 / 40 MAX_BMs = 4 TODAYISSZ = 20 )
const ( // mbbsd/register.c line: 415 CLEAN_USER_EXPIRE_RANGE_MIN = 365 * 12 * 60 // 180 days. // mbbsd/user.c line: 42 DIR_TMP = "tmp" DIR_HOME = "home" DIR_BOARD = "boards" )
const ( USER_ID_SZ = unsafe.Sizeof(EMPTY_USER_ID) BOARD_ID_SZ = unsafe.Sizeof(EMPTY_BOARD_ID) BOARD_TITLE_SZ = unsafe.Sizeof(EMPTY_BOARD_TITLE) UID_IN_STORE_SZ = unsafe.Sizeof(UIDInStore(0)) UTMP_ID_SZ = unsafe.Sizeof(UtmpID(0)) UID_SZ = unsafe.Sizeof(UID(0)) BID_IN_STORE_SZ = unsafe.Sizeof(BidInStore(0)) BID_SZ = unsafe.Sizeof(Bid(0)) EMAIL_SZ = unsafe.Sizeof(EMPTY_EMAIL) BM_SZ = unsafe.Sizeof(EMPTY_BM) AIDC_SZ = unsafe.Sizeof(EMPTY_AIDC) )
const ( USER_INFO_RAW_SZ = unsafe.Sizeof(EMPTY_USER_INFO_RAW) USER_INFO_USER_ID_OFFSET = unsafe.Offsetof(EMPTY_USER_INFO_RAW.UserID) USER_INFO_PID_OFFSET = unsafe.Offsetof(EMPTY_USER_INFO_RAW.Pid) USER_INFO_MODE_OFFSET = unsafe.Offsetof(EMPTY_USER_INFO_RAW.Mode) USER_INFO_MODE_SZ = unsafe.Sizeof(EMPTY_USER_INFO_RAW.Mode) )
const BRD_ATTR_SZ = unsafe.Sizeof(BrdAttr(0))
const DEFAULT_USEREC2_RAW_SZ = 128
const FILENAME_OFFSET_POSTFIX = 15
const FILE_HEADER_RAW_SZ = unsafe.Sizeof(EMPTY_FILE_HEADER_RAW)
const (
FN_PASSWD2 = ".PASSWD2" // passwd2 in per-user directories.
)
const (
FN_POST = ".post"
)
const MSG_QUEUE_RAW_SZ = unsafe.Sizeof(MsgQueueRaw{})
Require updating SHM_VERSION if MSG_QUEUE_RAW_SZ is changed.
const (
// https://github.com/ptt/pttbbs/blob/master/mbbsd/bbs.c#L15
NEWIDPOST_LIMIT_DAYS = 14
)
const (
NUMPERMS = 32
)
const N_USEREC2_PAD_TAIL = DEFAULT_USEREC2_RAW_SZ - types.INT32_SZ - PERM2_SZ - types.TIME4_SZ
const (
PASSWD2_VERSION = 1
)
const (
PERM2_SZ = unsafe.Sizeof(PERM2(0))
)
const (
// https://github.com/ptt/pttbbs/blob/master/mbbsd/bbs.c#L1396
POSTSAMPLE = "postsample"
)
const REG_MAILDB_REQ_SZ = unsafe.Sizeof(RegMailDBReq{})
const USEREC2_RAW_SZ = unsafe.Sizeof(USEREC2_RAW)
const USEREC_RAW_SZ = unsafe.Sizeof(USEREC_RAW)
const USER_OP_MODE_SZ = unsafe.Sizeof(UserOpMode(0))
const ( // mbbsd/board.c line: 1477 USE_REAL_DESC_FOR_HIDDEN_BOARD_IN_MYFAV = false )
Variables ¶
var ( SERVICE_MODE = DEV ////////// // make.conf ////////// BBSHOME = "/home/bbs" /* BBS home-dir. MUST-NOT set this directly. use SetBBSHOME() */ ////////// // pttbbs.conf ////////// /* 定義 BBS 站名位址 */ BBSNAME = "新批踢踢" /* 中文站名 */ BBSNAME_BIG5 = []byte{0xb7, 0x73, 0xa7, 0xe5, 0xbd, 0xf0, 0xbd, 0xf0} BBSENAME = "PTT2" /* 英文站名 */ MYHOSTNAME = "ptt2.cc" /* 網路位址 */ MYIP = "127.0.0.1" /* IP位址 */ /* 定義是否查詢文章的 web 版 URL,及 URL 用的 hostname/prefix */ QUERY_ARTICLE_URL = true /* 是否提供查詢文章 URL */ URL_PREFIX = "http://localhost/bbs" /* URL prefix */ /* 安全紀錄 */ BN_SECURITY_s = "Security" BN_SECURITY = ToBoardID([]byte(BN_SECURITY_s)) /* 動態看板的家 */ BN_NOTE_s = "Note" BN_NOTE = ToBoardID([]byte(BN_NOTE_s)) /* 紀錄 */ BN_RECORD_s = "Record" BN_RECORD = ToBoardID([]byte(BN_RECORD_s)) /* SYSOP 板 */ BN_SYSOP_s = "SYSOP" BN_SYSOP = ToBoardID([]byte(BN_SYSOP_s)) /* 測試板 */ BN_TEST_s = "Test" BN_TEST = ToBoardID([]byte(BN_TEST_s)) /* 發生錯誤時建議的回報板名為此板 */ BN_BUGREPORT_s = BBSMNAME + "Bug" BN_BUGREPORT = ToBoardID([]byte(BN_BUGREPORT_s)) /* 法律訴訟的板 */ BN_LAW_s = BBSMNAME + "Law" BN_LAW = ToBoardID([]byte(BN_LAW_s)) /* 新手板(會自動進我的最愛) */ BN_NEWBIE_s = BBSMNAME + "NewHand" BN_NEWBIE = ToBoardID([]byte(BN_NEWBIE_s)) /* 找看板(會自動進我的最愛) */ BN_ASKBOARD_s = "AskBoard" BN_ASKBOARD = ToBoardID([]byte(BN_ASKBOARD_s)) /* 外國板 */ BN_FOREIGN_s = BBSMNAME + "Foreign" BN_FOREIGN = ToBoardID([]byte(BN_FOREIGN_s)) /* 若定義, 提供美工特別用板 */ BN_ARTDSN_s = "Artdsn" BN_ARTDSN = ToBoardID([]byte(BN_ARTDSN_s)) /* 若定義,該板發文不受行限或是可上傳 */ BN_BBSMOVIE_s = "BBSmovie" BN_BBSMOVIE = ToBoardID([]byte(BN_BBSMOVIE_s)) // /* 若定義,則.... */ BN_WHOAMI_s = "WhoAmI" BN_WHOAMI = ToBoardID([]byte(BN_WHOAMI_s)) /* 若定義, 則全站所有五子棋/象棋棋譜都會紀錄在此板 */ IS_BN_FIVECHESS_LOG_INFERRED = true BN_FIVECHESS_LOG_s = BBSMNAME + "Five" BN_FIVECHESS_LOG = ToBoardID([]byte(BN_FIVECHESS_LOG_s)) IS_BN_CCHESS_LOG_INFERRED = true BN_CCHESS_LOG_s = BBSMNAME + "CChess" BN_CCHESS_LOG = ToBoardID([]byte(BN_CCHESS_LOG_s)) /* 若定義,則動態看板會動態檢查爭議性字眼 */ BN_NOTE_AGGCHKDIR = "<點歌> 動態看板" /* 若定義則啟用修文自動合併系統 */ EDITPOST_SMARTMERGE = true /* 可以設定多重進站畫面 */ MULTI_WELCOME_LOGIN = false /* 若定義, 則所有編輯文章最下方都會加入編輯來源. 否則只有 SYSOP板會加入來源 */ ALL_REEDIT_LOG = false /* 板主可以按大寫 H切換隱形與否 */ BMCHS = false /* 水球整理, 看板備份等等外部程式 */ OUTJOBSPOOL = true /* 若定義, 則不能舉辦賭盤 */ NO_GAMBLE = false /* 可動態透過 GLOBALVAR[9]調整使用者上限 */ DYMAX_ACTIVE = true /* 程式每天最多可以跑多久 (in seconds) 因為有的時候會出現跑不停的 process */ CPULIMIT_PER_DAY = 30 /* 若定義, 若程式失敗, 會等待 86400 秒以讓 gdb來 attach */ DEBUGSLEEP = true /* 若定義, 在轉寄位址輸入錯誤時會有讓使用者回報訊息的提示 */ /* 這個選項存在的原因是因為有部份使用者信誓旦旦說他們沒打錯但看不出程式錯誤 */ DEBUG_FWDADDRERR = false /* 若定義, 則可在外部 (shmctl cmsignal) 要求將 mbbsd將 zapbuf 釋放掉. 會使用非正規的記憶體要求函式. (目前只在 FreeBSD上測試過) !!請注意!! 除非您確切知道這個能能在做什麼並且有須要, 否則請不要打開這個功能!! */ CRITICAL_MEMORY = false /* 對於 port 23的, 會預先 fork 幾隻出來. 如此在系統負荷高的時候, 仍可有好的上站率 */ PRE_FORK = 10 /* 若定義, 則開啟 Big5 轉 UTF-8 的功能 */ CONVERT = true /* 若定義, 則在文章列表的時候不同日期會標上不同顏色 */ COLORDATE = false /* DBCS 相關設定 */ /* DBCS Aware: 讓游標不會跑到 DBCS trailing bytes 上 */ DBCSAWARE = true /* 若定義,guest 帳號預設不顯示一字雙色 */ GUEST_DEFAULT_DBCS_NOINTRESC = false /* 使用新式的 pmore (piaip's more) 代替舊式 bug 抓不完的 more 或是簡易的 minimore */ USE_PMORE = false /* 使用 rfork()取代 fork() . 目前只在 FreeBSD上有效 */ USE_RFORK = false /* 使用 HUGETLB shared memory . 目前只在 Linux 上有效 */ USE_HUGETLB = false /* 在某些平台之下, shared-memory規定需要為一定的 aligned size, 如在 linux x86_64 下使用 HUGETLB 時需為 4MB aligned, 而在 linux ia64 下使用 HUGETLB時需為 256MB aligned. 單位為 bytes */ SHMALIGNEDSIZE = 1048576 * 1 // 4MB for x86_64, 1MB for development /* 讓過於熱門或被鬧的版冷靜, SHM 會變大一些些 */ USE_COOLDOWN = true /* 若定義, 則在刪除看板文章的時候, 僅會在 .DIR 中標明, 並不會將該資料 從 .DIR 中拿掉. 可以避免多項問題 (尤其是熱門看板一堆推薦及編輯時) 須配合使用 (尚未完成) */ SAFE_ARTICLE_DELETE = true /* 若定義, 則在傳送水球的時候, 不會直接 kill 該程序. 理論上可以減少大 量的系統負和 */ NOKILLWATERBALL = true /* 若定義, 則 SYSOP帳號並不會自動加上站長權限. 在第一次啟動時, 您並不能定義 (否則就拿不到站長權了) . 而在設定完成後, 若您站長帳號並不叫做 SYSOP, 則可透過 NO_SYSOP_ACCOUNT 關閉該帳號, 以避免安全問題發生. */ NO_SYSOP_ACCOUNT = false /* 開啟小天使小主人功能 */ PLAY_ANGEL = false /* 若定義, 則使用舊式推文 */ OLDRECOMMEND = false /* 若定義, 則 guest 可推文,格式變為 IP+日期 */ GUESTRECOMMEND = false /* 定義幾秒內算快速推文 */ FASTRECMD_LIMIT = 90 /* 若定義, 可設定轉錄自動在原文留下記錄 */ USE_AUTOCPLOG = true /* 若定義, 新板設定自動開記錄,不過 USE_AUTOCPLOG 還是要開才有用 */ DEFAULT_AUTOCPLOG = true /* 如果 time_t 是 8 bytes的話 (如 X86_64) */ TIMET64 = true /* 使用 utmpd, 在外部運算好友資料, 如果您確定這個在做什麼才開啟 */ UTMPD = false UTMPD_ADDR = "192.168.0.1:5120" /* 在 cacheserver 上面擋掉狂上下站的使用者 */ NOFLOODING = false /* 使用 daemon/fromd, 使用外部daemon紀錄上站故鄉名稱 */ FROMD = false /* 若定義, 則不允許註冊 guest */ NO_GUEST_ACCOUNT_REG = false /* 限制一個email能註冊的帳號數量 (要使用請在make的時候加 WITH_EMAILDB) */ EMAILDB_LIMIT = 5 USE_REG_CAPTCHA = false USE_POST_CAPTCHA_FOR_NOREG = false USE_VOTE_CAPTCHA = false USE_REMOTE_CAPTCHA = false CAPTCHA_INSERT_SERVER_ADDR = "127.0.0.1:80" IS_CAPTCHA_INSERT_HOST_INFERRED = true CAPTCHA_INSERT_HOST = CAPTCHA_INSERT_SERVER_ADDR CAPTCHA_INSERT_URI = "/captcha/insert" CAPTCHA_INSERT_SECRET = "" CAPTCHA_URL_PREFIX = "http://localhost/captcha" CAPTCHA_CODE_LENGTH = 32 REQUIRE_SECURE_CONN_TO_REGISTER = false REQUIRE_VERIFY_EMAIL_AT_REGISTER = false /* 前進站畫面 */ //INSCREEN = "前進站畫面" INSCREEN = "" ////////// // config.h ////////// BBSPROGPOSTFIX = "bin/mbbsd" /* 主程式 */ BBSPROG = BBSHOME + string(os.PathSeparator) + BBSPROGPOSTFIX BAN_FILE = "BAN" /* 關站通告檔 */ LOAD_FILE = "/proc/loadavg" /* for Linux */ /* 系統名(郵件用),建議別超過 3 個字元。 詳見 sample/pttbbs.conf */ BBSMNAME = "Ptt" /* 系統名(選單用),建議剛好 4 個字元。 詳見 sample/pttbbs.conf */ BBSMNAME2 = "Ptt" /* 錢幣名,建議剛好 3 個字元。 詳見 sample/pttbbs.conf */ IS_MONEYNAME_INFFERRED = true MONEYNAME = BBSMNAME + "幣" /* AID 顯示的站台名稱。 若 IP 太長請另行定義。 */ IS_AID_HOSTNAME_INFERRED = true AID_HOSTNAME = MYHOSTNAME TITLE_COLOR = ansi.ANSIColor("0;1;37;46") /* 主畫面上方標題列 */ HLP_CATEGORY_COLOR = ansi.ANSIColor("0;1;32") /* 說明表格內分類項 */ HLP_DESCRIPTION_COLOR = ansi.ANSIColor("0") /* 說明表格內說明項 */ HLP_KEYLIST_COLOR = ansi.ANSIColor("0;1;36") /* 說明表格內按鍵項 */ BBSUSER = "bbs" BBSUID = 9999 BBSGID = 99 TAR_PATH = "tar" MUTT_PATH = "mutt" DEFAULT_FOLDER_CREATE_PERM = os.FileMode(0o755) DEFAULT_FILE_CREATE_PERM = os.FileMode(0o644) SHM_KEY = types.Key_t(1228) PASSWDSEM_KEY = 2010 /* semaphore key */ /* 若定義, 用一個奇怪的數字來檢查我的最愛和看板列表是否錯誤 */ MEM_CHECK = 0x98761234 RELAY_SERVER_IP = "127.0.0.1" XCHATD_ADDR = ":3838" BN_ID_PROBLEM_s = "SYSOP" BN_ID_PROBLEM = ToBoardID([]byte(BN_ID_PROBLEM_s)) BN_DELETED_s = "deleted" BN_DELETED = ToBoardID([]byte(BN_DELETED_s)) BN_JUNK_s = "junk" BN_JUNK = ToBoardID([]byte(BN_JUNK_s)) BN_POLICELOG_s = "PoliceLog" BN_POLICELOG = ToBoardID([]byte(BN_POLICELOG_s)) BN_UNANONYMOUS_s = "UnAnonymous" BN_UNANONYMOUS = ToBoardID([]byte(BN_UNANONYMOUS_s)) BN_NEWIDPOST_s = "NEWIDPOST" BN_NEWIDPOST = ToBoardID([]byte(BN_NEWIDPOST_s)) BN_ALLPOST_s = "ALLPOST" BN_ALLPOST = ToBoardID([]byte(BN_ALLPOST_s)) BN_ALLHIDPOST_s = "ALLHIDPOST" BN_ALLHIDPOST = ToBoardID([]byte(BN_ALLHIDPOST_s)) MAX_GUEST = 100 /* 最多 guest 上站人數 */ MAX_CPULOAD = 70 /* CPU 最高load */ DEBUGSLEEP_SECONDS = 3600 /* debug 等待時間 */ OVERLOADBLOCKFDS = 0 /* 超載後會保留這麼多個 fd */ MAX_SWAPUSED = 0.7 /* SWAP最高使用率 */ TARQUEUE_TIME_STR = "深夜" // 看板備份時間訊息 (應與 contab 一致) RECYCLE_BIN_NAME = "資源回收筒" // "垃圾桶" RECYCLE_BIN_OWNER = "[" + RECYCLE_BIN_NAME + "]" TIME_CAPSULE_NAME = "Magical Index" // "Time Capsule" MAX_POST_MONEY = 100 /* 發表文章稿費的上限 */ MAX_CHICKEN_MONEY = 100 /* 養雞場獲利上限 */ MAX_GUEST_LIFE = 3 * 24 * 60 * 60 /* 最長未認證使用者保留時間(秒) */ MAX_EDIT_LINE = 2048 /* 文章最長編輯長度 */ MAX_EDIT_LINE_LARGE = 32000 // 大檔最長編輯長度 MAX_LIFE = 120 * 24 * 60 * 60 /* 最長使用者保留時間(秒) */ KEEP_DAYS_REGGED = 120 /* 已註冊使用者保留多久 */ KEEP_DAYS_UNREGGED = 15 /* 未註冊使用者保留多久 */ THREAD_SEARCH_RANGE = 500 /* 系列文章搜尋上限 */ /* 定義是否使用外籍使用者註冊 及外國人最長居留時間,之後需向站方申請永久居留權 */ FOREIGN_REG = false FOREIGN_REG_DAY = 30 /* 外籍使用者試用日期上限 */ FORCE_PROCESS_REGISTER_FORM = 0 /* 定義看板好友名單將會在幾秒鐘後失效強迫重載 */ HBFLexpire = 432000 MAX_EXKEEPMAIL = 1000 /* 最多信箱加大多少封 */ /* 在轉信時附上的時區. 若在台灣, 中國大陸等地, 用預設的即可. */ INNTIMEZONE = "+0800 (CST)" ADD_EXMAILBOX = 0 /* 贈送信箱 */ BADPOST_CLEAR_DURATION = 180 // 消劣文時間限制 BADPOST_MIN_CLEAR_DURATION = 3 // 劣文首消時間限制 MAX_CROSSNUM = 9 /* 最多crosspost次數 */ MAX_QUERYLINES = 16 /* 顯示 Query/Plan 訊息最大行數 */ MAX_LOGIN_INFO = 128 /* 最多上線通知人數 */ MAX_POST_INFO = 32 /* 最多新文章通知人數 */ MAX_NAMELIST = 128 /* 最多其他特別名單人數 */ MAX_NOTE = 20 /* 最多保留幾篇留言? */ MAX_SIGLINES = 6 /* 簽名檔引入最大行數 */ LOGINATTEMPTS = 3 /* 最大進站失誤次數 */ MAX_KEEPMAIL = 200 /* 一般 user 最多保留幾封 MAIL? */ MAX_KEEPMAIL_SOFTLIMIT = 2500 /* 除 admin 外,無法寄給此人 */ MAX_KEEPMAIL_HARDLIMIT = 20000 /* 信箱數量的上限,超過就不給寄信 */ BADCIDCHARS = " *" /* Chat Room 中禁用於 nick 的字元 */ MAX_ROOM = 16 /* 聊天室最多有幾間包廂? */ MAXTAGS = 255 /* t(tag) 的最大數量 */ WRAPMARGIN = 511 /* 編輯器 wrap 長度 */ LOG_CONF_KEYWORD = false // 記錄搜尋的關鍵字 LOG_CONF_INTERNETMAIL = false // 記錄 internet outgoing mail LOG_CONF_PUSH = false // 記錄推文 LOG_CONF_EDIT_CALENDAR = false // 記錄編輯行事曆 LOG_CONF_POST = false // 記錄發文 LOG_CONF_CRAWLER = false // 記錄 crawlers LOG_CONF_CROSSPOST = false // 記錄轉錄 LOG_CONF_BAD_REG_CODE = false // 記錄打錯的註冊碼 LOG_CONF_VALIDATE_REG = false // 記錄審核註冊單 LOG_CONF_MASS_DELETE = false // 記錄大量刪除檔案 LOG_CONF_OSONG_VERBOSE = false // 詳細點播記錄 LOG_CONF_EDIT_TITLE = false // 編輯標題記錄 // 若想停用下列參數請在 pttbbs.conf 定義 NO_XXX (ex, NO_LOGINASNEW) LOGINASNEW = true /* 採用上站申請帳號制度 */ DOTIMEOUT = true /* 處理閒置時間 */ INTERNET_EMAIL = true /* 支援 InterNet Email 功能(含 Forward) */ SHOWUID = true /* 站長可看見使用者 UID */ SHOWBOARD = true /* 站長可看見使用者看板 */ SHOWPID = true /* 站長可看見使用者 PID */ HAVE_ANONYMOUS = true /* 提供 Anonymous 板 */ HAVE_ORIGIN = true /* 顯示 author 來自何處 */ USE_BSMTP = true /* 使用opus的BSMTP 寄收信? */ REJECT_FLOOD_POST = true /* 防止BlahBlah式灌水 */ IDLE_TIMEOUT = 43200 /* 一般情況之 timeout (12hr) */ SHOW_IDLE_TIME = true /* 顯示閒置時間 */ ////////// // common.h ////////// SZ_RECENTLOGIN = 16000 // size of max recent log before rotation SZ_RECENTPAY = 16000 // https://github.com/ptt/pttbbs/blob/master/include/common.h#L68 // pttbbs commit: 6bdd36898bde207683a441cdffe2981e95de5b20 // // FN_SAFEDEL_PREFIX_LEN is used in strncmp. we don' need this in go. USE_EDIT_HISTORY = true FN_SAFEDEL = ".d" FN_SAFEDEL_PREFIX_LEN = 2 // must match FN_SAFEDEL FN_SAFEDEL_b = []byte(FN_SAFEDEL) STR_SAFEDEL_TITLE = "(本文已被刪除)" SAFE_ARTICLE_DELETE_NUSER = 2 )
var ( ////////// // proto.h ////////// USE_COMMENTD = false USE_EMAILDB = false USE_REGCHECKD = false USE_VERIFYDB = false )
var ( IS_NEW_SHM = true // whether to create new shm (use only with ShmInit) IS_UTMP = true // whether to do with utmp HAVE_USERAGREEMENT_POSTFIX = "etc/UserAgreement" HAVE_USERAGREEMENT = BBSHOME + string(os.PathSeparator) + HAVE_USERAGREEMENT_POSTFIX HAVE_USERAGREEMENT_VERSION_POSTFIX = "etc/UserAgreementVersion" HAVE_USERAGREEMENT_VERSION = BBSHOME + string(os.PathSeparator) + HAVE_USERAGREEMENT_VERSION_POSTFIX HAVE_USERAGREEMENT_ACCEPTABLE_POSTFIX = "etc/UserAgreementAcceptable" HAVE_USERAGREEMENT_ACCEPTABLE = BBSHOME + string(os.PathSeparator) + HAVE_USERAGREEMENT_ACCEPTABLE_POSTFIX )
var ( // https://github.com/ptt/pttbbs/blob/master/mbbsd/cal.c#L23 ASSESS = true // https://github.com/ptt/pttbbs/blob/master/mbbsd/bbs.c#L608 ALLOW_FREE_TN_ANNOUNCE = false // https://github.com/ptt/pttbbs/blob/master/common/bbs/string.c#L67 USE_LEGACY_FORWARD = false // https://github.com/ptt/pttbbs/blob/master/mbbsd/bbs.c#L1202 USE_LIVE_ALLPOST = false // https://github.com/ptt/pttbbs/blob/master/mbbsd/bbs.c#L402 USE_AID_URL = false // https://github.com/ptt/pttbbs/blob/master/mbbsd/cache.c#L189 USE_NEW_BAN_SYSTEM = true )
var ( USEREC_EMAIL_IS_CONTACT = true ALLOW_REGISTER_WITH_ONLY_CONTACT_EMAIL = true REQUIRE_CONTACT_EMAIL_TO_CHANGE_PASSWORD = true )
var ( // https://github.com/ptt/pttbbs/blob/master/mbbsd/edit.c#L45 POST_MONEY_RATIO = 0.5 USE_POST_ENTROPY = true ENTROPY_RATIO = 0.25 ENTROPY_MAX = int(float64(MAX_POST_MONEY) * ENTROPY_RATIO) // https://github.com/ptt/pttbbs/blob/master/mbbsd/bbs.c#L1451 USE_HIDDEN_BOARD_NOCREDIT = true // https://github.com/ptt/pttbbs/blob/master/mbbsd/bbs.c#L1898 USE_SYSOP_EDIT = true )
var ( BRD_SYMBOL_GROUP = []byte{0xa3, 0x55} BRD_SYMBOL_BOARD = []byte{0xa1, 0xb7} )
var ( USER_ID_GUEST = [IDLEN + 1]byte{'g', 'u', 'e', 's', 't'} // guest account USER_ID_REGNEW = [IDLEN + 1]byte{'n', 'e', 'w'} // 用來建新帳號的名稱 FN_CONF_BANIP_POSTFIX = "etc/banip.conf" // 禁止連線的 IP 列表 FN_CONF_BANIP = BBSHOME + string(os.PathSeparator) + FN_CONF_BANIP_POSTFIX FN_PASSWD_POSTFIX = ".PASSWDS" /* User records */ FN_PASSWD = BBSHOME + string(os.PathSeparator) + FN_PASSWD_POSTFIX FN_BOARD_POSTFIX = ".BRD" /* board list */ FN_BOARD = BBSHOME + string(os.PathSeparator) + FN_BOARD_POSTFIX MSG_SELECT_BOARD = ansi.ANSIColor("7") + "【 選擇看板 】" + ansi.ANSIReset() + "\n" + "請輸入看板名稱(按空白鍵自動搜尋): " )
var ( TN_ANNOUNCE_BIG5 = []byte{'[', 0xa4, 0xbd, 0xa7, 0x69, ']'} //[公告] STR_AUTHOR1_BIG5 = []byte{0xa7, 0x40, 0xaa, 0xcc, 0x3a} // 作者: STR_AUTHOR2_BIG5 = []byte{0xb5, 0x6f, 0xab, 0x48, 0xa4, 0x48, 0x3a} // 發信人: STR_POST1_BIG5 = []byte{0xac, 0xdd, 0xaa, 0x4f, 0x3a} // 看板: STR_POST2_BIG5 = []byte{0xaf, 0xb8, 0xa4, 0xba, 0x3a} // 站內: STR_TITLE_BIG5 = []byte{0xbc, 0xd0, 0xc3, 0x44, 0x3a} // 標題: STR_TIME_BIG5 = []byte{0xae, 0xc9, 0xb6, 0xa1, 0x3a} // 時間: STR_BBS_BIG5 = []byte{0xa1, 0xb0, 0x20, 0xb5, 0x6f, 0xab, 0x48, 0xaf, 0xb8, 0x3a} //※ 發信站: STR_FORWARDER_BIG5 = []byte{0xa1, 0xb0, 0x20, 0xc2, 0xe0, 0xbf, 0xfd, 0xaa, 0xcc, 0x3a} //※ 轉錄者: STR_FROM_BIG5 = []byte{0xa8, 0xd3, 0xa6, 0xdb, 0x3a} // 來自: STR_URL_DISPLAYNAME_BIG5 = []byte{0xa1, 0xb0, 0x20, 0xa4, 0xe5, 0xb3, 0xb9, 0xba, 0xf4, 0xa7, 0x7d, 0x3a} //※ 文章網址: STR_EDIT_BIG5 = []byte("\xa1\xb0 \xbds\xbf\xe8:") //※ 編輯: )
var ( // mbbsd/register.c line: 381 FN_FRESH_POSTFIX = ".fresh" FN_FRESH = BBSHOME + string(os.PathSeparator) + FN_FRESH_POSTFIX )
var ( ALLOW_EMAIL_LIST []*AllowRejectEmail REJECT_EMAIL_LIST []*AllowRejectEmail ALLOW_EMAIL_LIST_UPDATE_TS types.Time4 REJECT_EMAIL_LIST_UPDATE_TS types.Time4 // https://github.com/ptt/pttbbs/blob/master/mbbsd/register.c#L958 FN_ALLOW_EMAIL_LIST_POSTFIX = "etc/whitemail" FN_REJECT_EMAIL_LIST_POSTFIX = "etc/banemail" FN_ALLOW_EMAIL_LIST = BBSHOME + string(os.PathSeparator) + FN_ALLOW_EMAIL_LIST_POSTFIX FN_REJECT_EMAIL_LIST = BBSHOME + string(os.PathSeparator) + FN_REJECT_EMAIL_LIST_POSTFIX )
var ( // https://github.com/ptt/pttbbs/blob/master/mbbsd/fav.c#L1202 FN_DEFAULT_FAVS_POSTFIX = "etc/myfav_defaults" FN_DEFAULT_FAVS = BBSHOME + string(os.PathSeparator) + FN_DEFAULT_FAVS_POSTFIX )
var ( STR_SPACE = " \t\n\r" BYTES_SPACE = []byte(STR_SPACE) )
var ( ANONYMOUS_ID = &UserID_t{'A', 'n', 'o', 'n', 'y', 'm', 'o', 'u', 's', '.'} ANONYMOUS_ID_BYTES = types.CstrToBytes(ANONYMOUS_ID[:]) ANONYMOUS_NICKNAME = []byte{0xb2, 0x71, 0xb2, 0x71, 0xa7, 0xda, 0xac, 0x4f, 0xbd, 0xd6, 0x20, 0x3f, 0x20, 0x5e, 0x6f, 0x5e} // 猜猜我是誰 ? ^o^ ANONYMOUS_HOST = []byte{0xb0, 0xce, 0xa6, 0x57, 0xa4, 0xd1, 0xa8, 0xcf, 0xaa, 0xba, 0xae, 0x61} // 匿名天使的家 )
var ( PATTERN_ANSI_MOVECMD = []byte("ABCDfjHJRu") PATTERN_ANSI_CODE = []byte("0123456789;,[") )
var ( ErrUserIDAlreadyExists = errors.New("user id already exists") ErrBoardIDAlreadyExists = errors.New("board id already exists") ErrInvalidUserID = errors.New("invalid user id") ErrInvalidBoardID = errors.New("invalid board id") ErrInvalidFilename = errors.New("invalid filename") ErrInvalidBid = errors.New("invalid bid") ErrInvalidAid = errors.New("invalid aid") ErrInvalidIdx = errors.New("invalid idx") ErrInvalidType = errors.New("invalid type") ErrInvalidAllowRejectEmailOp = errors.New("invalid allow-reject-email op") )
var ( EMPTY_USER_ID = UserID_t{} EMPTY_BOARD_ID = BoardID_t{} EMPTY_BOARD_TITLE = BoardTitle_t{} EMPTY_EMAIL = Email_t{} EMPTY_BM = BM_t{} EMPTY_AIDC = Aidc{} )
var ( STR_REPLY = []byte("Re:") STR_FORWARD = []byte("Fw:") STR_LEGACY_FORWARD = []byte{0x5b, 0xc2, 0xe0, 0xbf, 0xfd, 0x5d} STR_SYSOP = []byte("SYSOP") ARTICLE_CLASS_REPLY = []byte("R:") ARTICLE_CLASS_FORWARD = []byte{0xc2, 0xe0} STR_DOTS = []byte{0xa1, 0x4b} )
var ALOHA_MSG = []byte{
0x3c, 0x3c, 0xa4, 0x57, 0xaf, 0xb8, 0xb3, 0x71,
0xaa, 0xbe, 0x3e, 0x3e, 0x20, 0x2d, 0x2d, 0x20,
0xa7, 0xda, 0xb1, 0x71, 0xa4, 0x73, 0xa4, 0xa4,
0xa8, 0xd3, 0xa1, 0xe3,
}
var DEFAULT_BOARD = STR_SYSOP
var EMPTY_BOARD_HEADER_RAW = BoardHeaderRaw{}
var EMPTY_FILE_HEADER_RAW = FileHeaderRaw{}
var EMPTY_USER_INFO_RAW = UserInfoRaw{}
Require updating SHM_VERSION if USER_INFO_RAW_SZ is changed.
var FriendFile = []string{ FN_OVERRIDES, FN_REJECT, FN_ALOHAED, "", "", FN_CANVOTE, FN_WATER, FN_VISIBLE, }
var MQTypeString = []string{
"text",
"uuencode",
"mq-justify",
}
var N_SCREEN_BUFFER = 100 // to determine whether we should provide bottom.
ptt/article_list.go
var ReservedUserIDs []types.Cstr
var USEREC2_RAW = Userec2Raw{}
var USEREC_RAW = UserecRaw{}
Functions ¶
func InitConfig ¶
func InitConfig() (err error)
func SetBBSHOME ¶
SetBBSHOME
This is to safely set BBSHOME Public to be used in the tests of other modules.
Params
bbshome: new bbshome
Return
string: original bbshome
func SetBBSHomePath ¶ added in v0.8.3
func UnsetIsTest ¶ added in v0.8.3
func UnsetIsTest()
func ValidUSHMEntry ¶
Types ¶
type Address_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type Aid ¶ added in v0.3.0
type Aid int32
func (Aid) ToAidInStore ¶ added in v0.3.0
func (a Aid) ToAidInStore() AidInStore
type AidInStore ¶ added in v0.3.0
type AidInStore int32
func (AidInStore) ToAid ¶ added in v0.3.0
func (a AidInStore) ToAid() Aid
type Aidu ¶ added in v0.3.0
type Aidu uint64 /* ptt-aidu */
type AllowRejectEmail ¶ added in v0.8.1
type AllowRejectEmail struct { Op AllowRejectEmailOp Pattern string LowerPattern string }
func NewAllowRejectEmail ¶ added in v0.8.1
func NewAllowRejectEmail(line string) *AllowRejectEmail
type AllowRejectEmailOp ¶ added in v0.8.1
type AllowRejectEmailOp byte
const ( ALLOW_REJECT_EMAIL_OP_A AllowRejectEmailOp = 'A' ALLOW_REJECT_EMAIL_OP_P AllowRejectEmailOp = 'P' ALLOW_REJECT_EMAIL_OP_S AllowRejectEmailOp = 'S' ALLOW_REJECT_EMAIL_OP_D AllowRejectEmailOp = 'D' ALLOW_REJECT_EMAIL_OP_PERCENT AllowRejectEmailOp = '%' )
type ArticleSummaryRaw ¶ added in v0.3.0
type ArticleSummaryRaw struct { Aid Aid BoardID *BoardID_t *FileHeaderRaw }
func NewArticleSummaryRaw ¶ added in v0.4.2
func NewArticleSummaryRaw(idx SortIdx, boardID *BoardID_t, header *FileHeaderRaw) *ArticleSummaryRaw
type BM_t ¶
We have 3 different ids for board:
- BoardID_t: (brdname)
- Bid: (int32) (bid starting from 1)
- BidInStore (int32) (Bid - 1)
type Bid ¶
type Bid int32
We have 3 different ids for board:
- BoardID_t: (brdname)
- Bid: (int32) (bid starting from 1)
- BidInStore (int32) (Bid - 1)
func (Bid) ToBidInStore ¶ added in v0.2.3
func (b Bid) ToBidInStore() BidInStore
type BidInStore ¶ added in v0.2.3
type BidInStore int32
We have 3 different ids for board:
- BoardID_t: (brdname)
- Bid: (int32) (bid starting from 1)
- BidInStore (int32) (Bid - 1)
func (BidInStore) ToBid ¶ added in v0.2.3
func (b BidInStore) ToBid() Bid
type BoardDetailRaw ¶ added in v0.18.0
type BoardDetailRaw struct { Bid Bid LastPostTime types.Time4 Total int32 *BoardHeaderRaw }
type BoardHeaderRaw ¶
type BoardHeaderRaw struct { // Require updating SHM_VERSION if BOARD_HEADER_RAW_SZ is changed. Brdname BoardID_t /* bid */ Title BoardTitle_t BM BM_t /* BMs' userid, token '/' */ Pad1 [3]byte BrdAttr BrdAttr /* board的屬性 */ ChessCountry ChessCode /* 棋國 */ VoteLimitPosts_ uint8 /* (已停用) 連署 : 文章篇數下限 */ VoteLimitLogins uint8 /* 連署 : 登入次數下限 */ Pad2_1 [1]uint8 /* (已停用) 連署 : 註冊時間限制 */ BUpdate types.Time4 /* note update time */ PostLimitPosts_ uint8 /* (已停用) 發表文章 : 文章篇數下限 */ PostLimitLogins uint8 /* 發表文章 : 登入次數下限 */ Pad2_2 [1]uint8 /* (已停用) 發表文章 : 註冊時間限制 */ BVote uint8 /* 正舉辦 Vote 數 */ VTime types.Time4 /* Vote close time */ Level PERM /* 可以看此板的權限 */ PermReload types.Time4 /* 最後設定看板的時間 */ Gid Bid /* 看板所屬的類別 ID */ Next [2]Bid /* 在同一個gid下一個看板 動態產生*/ FirstChild [2]Bid /* 屬於這個看板的第一個子看板 */ Parent Bid /* 這個看板的 parent 看板 bid */ ChildCount int32 /* 有多少個child */ NUser int32 /* 多少人在這板 */ PostExpire Bid /* postexpire 看板連結的 bid */ EndGamble types.Time4 PostType [33]byte PostTypeF byte FastRecommendPause uint8 /* 快速連推間隔 */ VoteLimitBadpost uint8 /* 連署 : 劣文上限 */ PostLimitBadpost uint8 /* 發表文章 : 劣文上限 */ Pad3 [3]byte SRexpire types.Time4 /* SR Records expire time */ Pad4 [40]byte }
func (*BoardHeaderRaw) IsOpenBRD ¶ added in v0.12.0
func (b *BoardHeaderRaw) IsOpenBRD() (isValid bool)
IsOpenBRD
https://github.com/ptt/pttbbs/blob/master/include/perm.h#L74
type BoardID_t ¶
We have 3 different ids for board:
- BoardID_t: (brdname)
- Bid: (int32) (bid starting from 1)
- BidInStore (int32) (Bid - 1)
func (*BoardID_t) IsValid ¶ added in v0.3.0
Valid BoardID
https://github.com/ptt/pttbbs/blob/master/common/bbs/string.c#L21
type BoardStat ¶ added in v0.2.3
type BoardStat struct { //BoardStat // // BoardStat should be used as read-only process, // Or we need to be very careful that the referenced // board does not write back to Shm or file. Bid Bid Attr BoardStatAttr Board *BoardHeaderRaw // obtain first in load-board-stat to be processed for showBrdList IsGroupOp bool }
type BoardStatAttr ¶ added in v0.2.3
type BoardStatAttr uint8
const ( NBRD_INVALID BoardStatAttr = 0 NBRD_FAV BoardStatAttr = 1 NBRD_BOARD BoardStatAttr = 2 NBRD_LINE BoardStatAttr = 4 NBRD_FOLDER BoardStatAttr = 8 NBRD_TAG BoardStatAttr = 16 NBRD_UNREAD BoardStatAttr = 32 NBRD_SYMBOLIC BoardStatAttr = 64 )
func (BoardStatAttr) String ¶ added in v0.2.3
func (b BoardStatAttr) String() string
type BoardSummaryRaw ¶ added in v0.2.3
type BoardSummaryRaw struct { Gid Bid Bid Bid BrdAttr BrdAttr StatAttr BoardStatAttr Brdname *BoardID_t Title *BoardTitle_t BM []*UserID_t Reason RestrictReason LastPostTime types.Time4 NUser int32 Total int32 }
func NewBoardSummaryRaw ¶ added in v0.10.0
func NewBoardSummaryRaw(boardStat *BoardStat, lastPostTime types.Time4, total int32) (summary *BoardSummaryRaw)
func NewBoardSummaryRawWithReason ¶ added in v0.10.0
func NewBoardSummaryRawWithReason(boardStat *BoardStat) (summary *BoardSummaryRaw)
type BoardTitle_t ¶
We have 3 different ids for board:
- BoardID_t: (brdname)
- Bid: (int32) (bid starting from 1)
- BidInStore (int32) (Bid - 1)
func (*BoardTitle_t) BoardClass ¶ added in v0.2.3
func (t *BoardTitle_t) BoardClass() []byte
BoardClass
https://github.com/ptt/pttbbs/blob/master/mbbsd/board.c#L1517
func (*BoardTitle_t) BoardType ¶ added in v0.2.3
func (t *BoardTitle_t) BoardType() []byte
BoardType
https://github.com/ptt/pttbbs/blob/master/mbbsd/board.c#L1517
func (*BoardTitle_t) RealTitle ¶ added in v0.2.3
func (t *BoardTitle_t) RealTitle() []byte
RealTitle
https://github.com/ptt/pttbbs/blob/master/mbbsd/board.c#L1517
type BrdAttr ¶ added in v0.2.3
type BrdAttr uint32
const ( // TODO BRD 快爆了,怎麼辦? 準備從 pad3 偷一個來當 attr2 吧... // #define BRD_NOZAP 0x00000001 /* 不可 ZAP */ BRD_NOCOUNT BrdAttr = 0x00000002 /* 不列入統計 */ //#define BRD_NOTRAN 0x00000004 /* 不轉信 */ BRD_GROUPBOARD BrdAttr = 0x00000008 /* 群組板 */ BRD_HIDE BrdAttr = 0x00000010 /* 隱藏板 (看板好友才可看) */ BRD_POSTMASK BrdAttr = 0x00000020 /* 限制發表或閱讀 */ BRD_ANONYMOUS BrdAttr = 0x00000040 /* 匿名板 */ BRD_DEFAULTANONYMOUS BrdAttr = 0x00000080 /* 預設匿名板 */ BRD_NOCREDIT BrdAttr = 0x00000100 /* 發文無獎勵看板 */ BRD_VOTEBOARD BrdAttr = 0x00000200 /* 連署機看板 */ BRD_WARNEL BrdAttr = 0x00000400 /* 已警告要廢除 */ BRD_TOP BrdAttr = 0x00000800 /* 熱門看板群組 */ BRD_NORECOMMEND BrdAttr = 0x00001000 /* 不可推薦 */ BRD_ANGELANONYMOUS BrdAttr = 0x00002000 /* 小天使可匿名 */ BRD_BMCOUNT BrdAttr = 0x00004000 /* 板主設定列入記錄 */ BRD_SYMBOLIC BrdAttr = 0x00008000 /* symbolic link to board */ BRD_NOBOO BrdAttr = 0x00010000 /* 不可噓 */ // BRD_LOCALSAVE 0x00020000 /* 預設 Local Save */ BRD_RESTRICTEDPOST BrdAttr = 0x00040000 /* 板友才能發文 */ BRD_GUESTPOST BrdAttr = 0x00080000 /* guest能 post */ BRD_COOLDOWN BrdAttr = 0x00100000 /* 冷靜 */ BRD_CPLOG BrdAttr = 0x00200000 /* 自動留轉錄記錄 */ BRD_NOFASTRECMD BrdAttr = 0x00400000 /* 禁止快速推文 */ BRD_IPLOGRECMD BrdAttr = 0x00800000 /* 推文記錄 IP */ BRD_OVER18 BrdAttr = 0x01000000 /* 十八禁 */ BRD_NOREPLY BrdAttr = 0x02000000 /* 不可回文 */ BRD_ALIGNEDCMT BrdAttr = 0x04000000 /* 對齊式的推文 */ BRD_NOSELFDELPOST BrdAttr = 0x08000000 /* 不可自刪 */ BRD_BM_MASK_CONTENT BrdAttr = 0x10000000 /* 允許板主刪除特定文字 */ )
type Career_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type CommentType ¶ added in v0.14.0
type CommentType uint8
const ( COMMENT_TYPE_UNKNOWN CommentType = 0 COMMENT_TYPE_RECOMMEND CommentType = 1 COMMENT_TYPE_BOO CommentType = 2 COMMENT_TYPE_COMMENT CommentType = 3 COMMENT_TYPE_FORWARD CommentType = 4 COMMENT_TYPE_REPLY CommentType = 5 COMMENT_TYPE_EDIT CommentType = 6 COMMENT_TYPE_DELETED CommentType = 7 COMMENT_TYPE_BASIC CommentType = 3 COMMENT_TYPE_BASIC_DATE CommentType = 4 )
func (CommentType) Bytes ¶ added in v0.14.0
func (c CommentType) Bytes() []byte
func (CommentType) String ¶ added in v0.14.0
func (c CommentType) String() string
type EditFlag ¶ added in v0.12.0
type EditFlag int
const ( /* ----------------------------------------------------- */ /* 編輯器選項 */ /* ----------------------------------------------------- */ EDITFLAG_NONE EditFlag = 0x00000000 EDITFLAG_TEXTONLY EditFlag = 0x00000001 EDITFLAG_UPLOAD EditFlag = 0x00000002 EDITFLAG_ALLOWLARGE EditFlag = 0x00000004 EDITFLAG_ALLOWTITLE EditFlag = 0x00000008 // #define EDITFLAG_ANONYMOUS (0x00000010) EDITFLAG_KIND_NEWPOST EditFlag = 0x00000010 EDITFLAG_KIND_REPLYPOST EditFlag = 0x00000020 EDITFLAG_KIND_SENDMAIL EditFlag = 0x00000040 EDITFLAG_KIND_MAILLIST EditFlag = 0x00000080 EDITFLAG_WARN_NOSELFDEL EditFlag = 0x00000100 )
type EmailDBOp ¶
type EmailDBOp uint8
const ( REGMAILDB_REQ_COUNT EmailDBOp REGMAILDB_REQ_SET REGCHECK_REQ_AMBIGUOUS VERIFYDB_MESSAGE )
type Email_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type FileHeaderRaw ¶ added in v0.2.3
type FileHeaderRaw struct { Filename Filename_t /* M.1120582370.A.1EA [19+1], create time */ Modified types.Time4 /* last modified time */ Pad byte /* padding, not used */ Recommend int8 /* important level */ Owner Owner_t /* uid[.] */ Date Date_t /* [02/02] or space(5) */ Title Title_t /* TODO this multi is a mess now. */ Pad2 byte Multi [4]byte // union as either money (int) or anon_uid (int) or vote_limits (4 unsigned char) or refer (2 unsigned int) //union { ///* TODO: MOVE money to outside multi!!!!!! */ //int money; //int anon_uid; ///* different order to match alignment */ //struct { // unsigned char posts; // unsigned char logins; // unsigned char regtime; // unsigned char badpost; //} vote_limits; //struct { // /* is this ordering correct? */ // unsigned int ref:31; // unsigned int flag:1; //} refer; //} multi; /* rocker: if bit32 on ==> reference */ /* XXX dirty, split into flag and money if money of each file is less than 16bit? */ Filemode FileMode /* must be last field @ boards.c */ Pad3 [3]byte }
func (*FileHeaderRaw) AnonUID ¶ added in v0.2.3
func (f *FileHeaderRaw) AnonUID() (anonUID int32)
func (*FileHeaderRaw) IsDeleted ¶ added in v0.3.0
func (f *FileHeaderRaw) IsDeleted() bool
func (*FileHeaderRaw) Money ¶ added in v0.2.3
func (f *FileHeaderRaw) Money() (money int32)
func (*FileHeaderRaw) SetAnonUID ¶ added in v0.12.0
func (f *FileHeaderRaw) SetAnonUID(uid UID) (err error)
func (*FileHeaderRaw) SetMoney ¶ added in v0.12.0
func (f *FileHeaderRaw) SetMoney(money int32) (err error)
func (*FileHeaderRaw) VoteLimitBadpost ¶ added in v0.2.3
func (f *FileHeaderRaw) VoteLimitBadpost() uint8
func (*FileHeaderRaw) VoteLimitLogins ¶ added in v0.2.3
func (f *FileHeaderRaw) VoteLimitLogins() uint8
func (*FileHeaderRaw) VoteLimitPosts ¶ added in v0.2.3
func (f *FileHeaderRaw) VoteLimitPosts() uint8
func (*FileHeaderRaw) VoteLimitRegTime ¶ added in v0.2.3
func (f *FileHeaderRaw) VoteLimitRegTime() uint8
func (*FileHeaderRaw) VoteLimits ¶ added in v0.2.3
func (f *FileHeaderRaw) VoteLimits() *VoteLimits
type FileMode ¶ added in v0.3.0
type FileMode uint8
const ( FILE_NONE FileMode = 0x00 FILE_LOCAL FileMode = 0x01 /* local saved, non-mail */ FILE_READ FileMode = 0x01 /* already read, mail only */ FILE_MARKED FileMode = 0x02 /* non-mail + mail */ FILE_DIGEST FileMode = 0x04 /* digest, non-mail */ FILE_REPLIED FileMode = 0x04 /* replied, mail only */ FILE_BOTTOM FileMode = 0x08 /* push_bottom, non-mail */ FILE_MULTI FileMode = 0x08 /* multi send, mail only */ FILE_SOLVED FileMode = 0x10 /* problem solved, sysop/BM non-mail only */ FILE_HIDE FileMode = 0x20 /* hide, in announce */ FILE_BID FileMode = 0x20 /* bid, in non-announce */ FILE_BM FileMode = 0x40 /* BM only, in announce */ FILE_VOTE FileMode = 0x40 /* for vote, in non-announce */ FILE_ANONYMOUS FileMode = 0x80 /* anonymous file */ )
type Filename_t ¶
func (*Filename_t) Basename ¶ added in v0.18.0
func (f *Filename_t) Basename() string
func (*Filename_t) CreateTime ¶ added in v0.3.0
func (f *Filename_t) CreateTime() (types.Time4, error)
func (*Filename_t) DeletedName ¶ added in v0.19.0
func (f *Filename_t) DeletedName() string
func (*Filename_t) Eq ¶ added in v0.18.0
func (f *Filename_t) Eq(f2 *Filename_t) bool
Eq
It's possible that the timestamp Compare only with the timestamp and the rnd.
func (*Filename_t) IsDeleted ¶ added in v0.18.0
func (f *Filename_t) IsDeleted() bool
func (*Filename_t) Postfix ¶ added in v0.3.0
func (f *Filename_t) Postfix() []byte
func (*Filename_t) String ¶ added in v0.4.0
func (f *Filename_t) String() string
func (*Filename_t) ToAidu ¶ added in v0.3.0
func (f *Filename_t) ToAidu() Aidu
func (*Filename_t) Type ¶ added in v0.3.0
func (f *Filename_t) Type() RecordType
type FriendOnline ¶ added in v0.5.0
type FriendOnline uint32
func (FriendOnline) ToFriendStat ¶ added in v0.5.0
func (f FriendOnline) ToFriendStat() FriendStat
func (FriendOnline) ToUtmpID ¶ added in v0.5.0
func (f FriendOnline) ToUtmpID() UtmpID
type FriendStat ¶ added in v0.5.0
type FriendStat uint8
func (FriendStat) HasPerm ¶ added in v0.5.0
func (f FriendStat) HasPerm(f1 FriendStat) bool
type FriendType ¶ added in v0.2.3
type FriendType int
const ( FRIEND_OVERRIDE FriendType = iota FRIEND_REJECT FRIEND_ALOHA FRIEND_SPECIAL FRIEND_CANVOTE BOARD_WATER BOARD_VISIBLE )
func (FriendType) Filename ¶ added in v0.2.3
func (f FriendType) Filename() string
type IPv4_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type MailQueue ¶
type MailQueue struct { FilePath Filename_t Subject Subject_t MailTime types.Time4 Sender UserID_t Username Nickname_t RCPT RCPT_t Method int32 Niamod []byte }
type MsgQueueRaw ¶
type Nickname_t ¶
type Nickname_t [NICKNAMESZ]byte
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type PERM ¶
type PERM uint32
const ( PERM_INVALID PERM = 0o00000000000 PERM_BASIC PERM = 0o00000000001 /* 基本權力 */ PERM_CHAT PERM = 0o00000000002 /* 進入聊天室 */ PERM_PAGE PERM = 0o00000000004 /* 找人聊天 */ PERM_POST PERM = 0o00000000010 /* 發表文章 */ PERM_LOGINOK PERM = 0o00000000020 /* 註冊程序認證 */ PERM_MAILLIMIT PERM = 0o00000000040 /* 信件無上限 */ PERM_CLOAK PERM = 0o00000000100 /* 目前隱形中 */ PERM_SEECLOAK PERM = 0o00000000200 /* 看見忍者 */ PERM_XEMPT PERM = 0o00000000400 /* 永久保留帳號 */ PERM_SYSOPHIDE PERM = 0o00000001000 /* 站長隱身術 */ PERM_BM PERM = 0o00000002000 /* 板主 */ PERM_ACCOUNTS PERM = 0o00000004000 /* 帳號總管 */ PERM_CHATROOM PERM = 0o00000010000 /* 聊天室總管 */ PERM_BOARD PERM = 0o00000020000 /* 看板總管 */ PERM_SYSOP PERM = 0o00000040000 /* 站長 */ PERM_BBSADM PERM = 0o00000100000 /* BBSADM */ PERM_NOTOP PERM = 0o00000200000 /* 不列入排行榜 */ PERM_VIOLATELAW PERM = 0o00000400000 /* 違法通緝中 */ PERM_ANGEL PERM = 0o00001000000 /* 有資格擔任小天使 */ PERM_NOREGCODE PERM = 0o00002000000 /* 不允許認證碼註冊 */ PERM_VIEWSYSOP PERM = 0o00004000000 /* 視覺站長 */ PERM_LOGUSER PERM = 0o00010000000 /* 觀察使用者行蹤 */ PERM_NOCITIZEN PERM = 0o00020000000 /* 搋奪公權 */ PERM_SYSSUPERSUBOP PERM = 0o00040000000 /* 群組長 */ PERM_ACCTREG PERM = 0o00100000000 /* 帳號審核組 */ PERM_PRG PERM = 0o00200000000 /* 程式組 */ PERM_ACTION PERM = 0o00400000000 /* 活動組 */ PERM_PAINT PERM = 0o01000000000 /* 美工組 */ PERM_POLICE_MAN PERM = 0o02000000000 /* 警察總管 */ PERM_SYSSUBOP PERM = 0o04000000000 /* 小組長 */ PERM_OLDSYSOP PERM = 0o10000000000 /* 退休站長 */ PERM_POLICE PERM = 0o20000000000 /* 警察 */ )
const ( PERM_DEFAULT PERM = PERM_BASIC | PERM_CHAT | PERM_PAGE PERM_MANAGER PERM = PERM_ACCTREG | PERM_ACTION | PERM_PAINT PERM_ADMIN PERM = PERM_ACCOUNTS | PERM_BOARD | PERM_SYSOP | PERM_SYSSUBOP | PERM_SYSSUPERSUBOP | PERM_MANAGER PERM_LOGINCLOAK PERM = PERM_SYSOP | PERM_ACCOUNTS PERM_SEEULEVELS PERM = PERM_SYSOP PERM_SEEBLEVELS PERM = PERM_SYSOP | PERM_BM PERM_NOTIMEOUT PERM = PERM_SYSOP PERM_READMAIL PERM = PERM_BASIC PERM_FORWARD PERM = PERM_LOGINOK /* to do the forwarding */ PERM_INTERNET PERM = PERM_LOGINOK /* 身份認證過關的才能寄信到 Internet */ )
func (PERM) HasBasicUserPerm ¶ added in v0.2.3
func (PERM) HasUserPerm ¶ added in v0.2.3
type Passwd_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type Phone_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type RealName_t ¶
type RealName_t [REALNAMESZ]byte
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type RecordType ¶ added in v0.3.0
type RecordType uint8
const ( RECORD_TYPE_M RecordType = iota RECORD_TYPE_G // not RECORD_TYPE_M will be TYPE_G )
func (RecordType) String ¶ added in v0.3.0
func (r RecordType) String() string
type RegMailDBReq ¶
type RegMailDBReq struct { RegMailDBReqHeader UserID UserID_t Email Email_t }
type RegMailDBReqHeader ¶
type Reg_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
type RestrictReason ¶ added in v0.2.3
type RestrictReason uint8
const ( RESTRICT_REASON_NONE RestrictReason = 0 RESTRICT_REASON_FORBIDDEN RestrictReason = 1 RESTRICT_REASON_HIDDEN RestrictReason = 2 RESTRICT_REASON_NUMLOGIN_DAYS RestrictReason = 3 RESTRICT_REASON_BADPOST RestrictReason = 4 )
func (RestrictReason) String ¶ added in v0.2.3
func (r RestrictReason) String() string
type ServiceMode ¶
type ServiceMode int
const ( DEV ServiceMode // Development Mode PRODUCTION // Production Mode DEBUG // Debug Mode (in production) )
func (ServiceMode) String ¶
func (s ServiceMode) String() string
type SortByCategory ¶
type SortByCategory int
const ( SORT_BY_ID SortByCategory = 0 SORT_BY_CLASS SortByCategory = 1 SORT_BY_STAT SortByCategory = 2 SORT_BY_IDLE SortByCategory = 3 SORT_BY_FROM SortByCategory = 4 SORT_BY_FIVE SortByCategory = 5 SORT_BY_SEX SortByCategory = 6 SORT_BY_UID SortByCategory = 7 SORT_BY_PID SortByCategory = 8 SORT_BY_MAX SortByCategory = 9 )
func (SortByCategory) String ¶
func (d SortByCategory) String() string
type SortIdx ¶ added in v0.2.3
type SortIdx int
func (SortIdx) ToSortIdxInStore ¶ added in v0.10.0
func (s SortIdx) ToSortIdxInStore() SortIdxInStore
type SortIdxInStore ¶ added in v0.10.0
type SortIdxInStore int
func (SortIdxInStore) ToSortIdx ¶ added in v0.10.0
func (s SortIdxInStore) ToSortIdx() SortIdx
type StampType ¶ added in v0.12.0
type StampType uint8
type Stat ¶ added in v0.4.0
type Stat int
const ( STAT_LOGIN Stat = iota STAT_SHELLLOGIN STAT_VEDIT STAT_TALKREQUEST STAT_WRITEREQUEST STAT_MORE STAT_SYSWRITESOCKET STAT_SYSSELECT STAT_SYSREADSOCKET STAT_DOSEND STAT_SEARCHUSER STAT_THREAD STAT_SELECTREAD STAT_QUERY STAT_DOTALK STAT_FRIENDDESC STAT_FRIENDDESC_FILE STAT_PICKMYFRIEND STAT_PICKBFRIEND STAT_GAMBLE STAT_DOPOST STAT_READPOST STAT_RECOMMEND STAT_TODAYLOGIN_MIN STAT_TODAYLOGIN_MAX STAT_SIGINT STAT_SIGQUIT STAT_SIGILL STAT_SIGABRT STAT_SIGFPE STAT_SIGBUS STAT_SIGSEGV STAT_READPOST_12HR STAT_READPOST_1DAY STAT_READPOST_3DAY STAT_READPOST_7DAY STAT_READPOST_OLD STAT_SIGXCPU STAT_BOARDREC STAT_BOARDREC_SCPU STAT_BOARDREC_UCPU STAT_DORECOMMEND STAT_DORECOMMEND_SCPU STAT_DORECOMMEND_UCPU STAT_QUERY_SCPU STAT_QUERY_UCPU STAT_LOGIND_NEWCONN STAT_LOGIND_OVERLOAD STAT_LOGIND_BANNED STAT_LOGIND_AUTHFAIL STAT_LOGIND_SERVSTART STAT_LOGIND_SERVFAIL STAT_LOGIND_PASSWDPROMPT STAT_MBBSD_ENTER STAT_MBBSD_EXIT STAT_MBBSD_ABORTED /* insert here. don't forget update shmctl.c */ STAT_NUM STAT_MAX Stat = 512 )
type StateMode ¶ added in v0.3.0
type StateMode uint16
const ( MODE_STARTED StateMode = 0x0001 /* 是否已經進入系統 */ MODE_POST StateMode = 0x0002 /* 是否可以在 currboard 發表文章 */ MODE_POSTCHECKED StateMode = 0x0004 /* 是否已檢查在 currboard 發表文章的權限 */ MODE_BOARD StateMode = 0x0008 /* 是否可以在 currboard 刪除、mark文章 */ MODE_GROUPOP StateMode = 0x0010 /* 是否為小組長 (可以在 MENU 開板) */ MODE_DIGEST StateMode = 0x0020 /* 是否為 digest mode */ MODE_SELECT StateMode = 0x0080 /* 搜尋使用者標題 */ MODE_DIRTY StateMode = 0x0100 /* 是否更動過 userflag */ )
type SubjectType ¶ added in v0.12.0
type SubjectType int
const ( SUBJECT_NORMAL SubjectType = 0 SUBJECT_REPLY SubjectType = 1 SUBJECT_FORWARD SubjectType = 2 SUBJECT_LOCKED SubjectType = 3 SUBJECT_DELETED SubjectType = 4 )
type UFlag ¶
type UFlag uint32
const ( UF_FAV_NOHILIGHT UFlag = 0x00000001 // false if hilight favorite UF_FAV_ADDNEW UFlag = 0x00000002 // true to add new board into one's fav // #define UF_PAGER 0x00000004 // deprecated by cuser.pager: true if pager was OFF last session // #define UF_CLOAK 0x00000008 // deprecated by cuser.invisible: true if cloak was ON last session UF_FRIEND UFlag = 0x00000010 // true if show friends only UF_BRDSORT UFlag = 0x00000020 // true if the boards sorted alphabetical UF_ADBANNER UFlag = 0x00000040 // (was: MOVIE_FLAG, true if show advertisement banner UF_ADBANNER_USONG UFlag = 0x00000080 // true if show user songs in banner // #define UF_MIND 0x00000100 // deprecated: true if mind search mode open <-Heat UF_DBCS_AWARE UFlag = 0x00000200 // true if DBCS-aware enabled. UF_DBCS_NOINTRESC UFlag = 0x00000400 // no Escapes interupting DBCS characters UF_DBCS_DROP_REPEAT UFlag = 0x00000800 // detect and drop repeated input from evil clients // #define UF_DBCS_??? 0x00000800 // reserved UF_NO_MODMARK UFlag = 0x00001000 // true if modified files are NOT marked UF_COLORED_MODMARK UFlag = 0x00002000 // true if mod-mark is colored. // #define UF_MODMARK_??? 0x00004000 // reserved // #define UF_MODMARK_??? 0x00008000 // reserved UF_DEFBACKUP UFlag = 0x00010000 // true if user defaults to backup UF_NEW_ANGEL_PAGER UFlag = 0x00020000 // true if user (angel) wants the new pager UF_REJ_OUTTAMAIL UFlag = 0x00040000 // true if don't accept outside mails UF_SECURE_LOGIN UFlag = 0x00080000 // true if login from insecure (ex, telnet) connection will be rejected. UF_FOREIGN UFlag = 0x00100000 // true if a foreign UF_LIVERIGHT UFlag = 0x00200000 // true if get "liveright" already // #define UF_COUNTRY_??? 0x00400000 // reserved // #define UF_COUNTRY_??? 0x00800000 // reserved UF_MENU_LIGHTBAR UFlag = 0x01000000 // true to use lightbar-based menu UF_CURSOR_ASCII UFlag = 0x02000000 // true to enable ASCII-safe cursor. )
func (UFlag) HasUserFlag ¶ added in v0.17.0
type UID ¶ added in v0.15.2
type UID int32
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
func (UID) ToUIDInStore ¶ added in v0.15.2
func (u UID) ToUIDInStore() UIDInStore
type UIDInStore ¶ added in v0.15.2
type UIDInStore int32
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
func (UIDInStore) ToUID ¶ added in v0.15.2
func (u UIDInStore) ToUID() UID
type UserID_t ¶
We have 3 different ids for user:
- UserID_t: (username)
- UID: (int32) (uid starting from 1)
- UIDInStore: (int32) (UID - 1)
func (*UserID_t) IsValid ¶ added in v0.3.3
valid UserID
https://github.com/ptt/pttbbs/blob/master/common/bbs/names.c
type UserInfoRaw ¶
type UserInfoRaw struct { // Require updating SHM_VERSION if USER_INFO_RAW_SZ is changed. UID UID /* Used to find user name in passwd file XXX need to check whether it is Uid or UidInStore */ Pid types.Pid_t /* kill() to notify user of talk request */ SockAddr int32 /* ... */ /* user data */ UserLevel PERM UserID UserID_t Nickname Nickname_t From From_t /* machine name the user called in from */ FromIP types.InAddr_t // was: int from_alias; DarkWin uint16 DarkLose uint16 Gap0 byte AngelPause uint8 // TODO move to somewhere else in future. DarkTie uint16 /* friends */ FriendTotal int32 /* 好友比較的cache 大小 */ NFriends int16 /* 下面 friend[] 只用到前幾個, 用來 bsearch */ Unused3_ int16 MyFriend [MAX_FRIEND]int32 Gap1 [4]byte FriendOnline [MAX_FRIEND]FriendOnline /* point到線上好友 utmpshm的位置 */ /* 好友比較的cache 前兩個bit是狀態 */ Gap2 [4]byte Reject [MAX_REJECT]int32 Gap3 [4]byte /* messages */ MsgCount uint8 Unused4_ [3]byte Msgs [MAX_MSGS]MsgQueueRaw Gap4 [MSG_QUEUE_RAW_SZ]byte /* user status */ Birth int8 /* 是否是生日 Ptt*/ Active uint8 /* When allocated this field is true */ Invisible bool /* Used by cloaking function in Xyz menu */ Mode UserOpMode /* UL/DL, Talk Mode, Chat Mode, ... */ Pager PagerMode /* pager toggle, YEA, or NA */ Unused5_ byte Conn6Win uint16 LastAct types.Time4 /* 上次使用者動的時間 */ Alerts byte /* mail alert, passwd update... */ UnusedMind_ byte Conn6Lose uint16 UnusedMind2_ byte /* chatroom/talk/games calling */ Sig byte /* signal type */ Conn6Tie uint16 DestUID int32 /* talk uses this to identify who called */ DestUip int32 /* dest index in utmpshm->uinfo[] */ SockActive uint8 /* Used to coordinate talk requests */ /* chat */ InChat uint8 /* for in_chat commands */ Chatid ChatID_t /* chat id, if in chat mode */ /* games */ LockMode uint8 /* 不准 multi_login 玩的東西 */ Turn byte /* 遊戲的先後 */ Mateid UserID_t /* 遊戲對手的 id */ Color byte /* 暗棋 顏色 */ /* game record */ FiveWin uint16 FiveLose uint16 FiveTie uint16 ChcWin uint16 ChcLose uint16 ChcTie uint16 ChessEloRating uint16 GoWin uint16 GoLose uint16 GoTie uint16 /* misc */ WithMe WithMe_t BrcID uint32 // XXX affected by NOKILLWATERBALL WBTime types.Time4 }
type UserOpMode ¶ added in v0.5.0
type UserOpMode uint8
const ( // it's better that we explicitly specify // the number in the code, // to compare with c-pttbbs. USER_OP_IDLE UserOpMode = 0 USER_OP_MMENU UserOpMode = 1 /* menu mode */ USER_OP_ADMIN UserOpMode = 2 USER_OP_MAIL UserOpMode = 3 USER_OP_TMENU UserOpMode = 4 USER_OP_UMENU UserOpMode = 5 USER_OP_XMENU UserOpMode = 6 USER_OP_CLASS UserOpMode = 7 USER_OP_PMENU UserOpMode = 8 USER_OP_NMENU UserOpMode = 9 USER_OP_PSALE UserOpMode = 10 USER_OP_POSTING UserOpMode = 11 /* boards & class */ USER_OP_READBRD UserOpMode = 12 USER_OP_READING UserOpMode = 13 USER_OP_READNEW UserOpMode = 14 USER_OP_SELECT UserOpMode = 15 USER_OP_RMAIL UserOpMode = 16 /* mail menu */ USER_OP_SMAIL UserOpMode = 17 USER_OP_CHATING UserOpMode = 18 /* talk menu */ USER_OP_XMODE UserOpMode = 19 USER_OP_FRIEND UserOpMode = 20 USER_OP_LAUSERS UserOpMode = 21 USER_OP_LUSERS UserOpMode = 22 USER_OP_MONITOR UserOpMode = 23 USER_OP_PAGE UserOpMode = 24 USER_OP_TQUERY UserOpMode = 25 USER_OP_TALK UserOpMode = 26 USER_OP_EDITPLAN UserOpMode = 27 /* user menu */ USER_OP_EDITSIG UserOpMode = 28 USER_OP_VOTING UserOpMode = 29 USER_OP_XINFO UserOpMode = 30 USER_OP_MSYSOP UserOpMode = 31 // USER_OP_WWW 32 // USER_OP_BIG2 33 USER_OP_REPLY UserOpMode = 34 USER_OP_HIT UserOpMode = 35 USER_OP_DBACK UserOpMode = 36 USER_OP_NOTE UserOpMode = 37 USER_OP_EDITING UserOpMode = 38 USER_OP_MAILALL UserOpMode = 39 USER_OP_MJ UserOpMode = 40 USER_OP_P_FRIEND UserOpMode = 41 USER_OP_LOGIN UserOpMode = 42 /* main menu */ USER_OP_DICT UserOpMode = 43 // USER_OP_BRIDGE 44 USER_OP_ARCHIE UserOpMode = 45 USER_OP_GOPHER UserOpMode = 46 USER_OP_NEWS UserOpMode = 47 USER_OP_LOVE UserOpMode = 48 USER_OP_EDITEXP UserOpMode = 49 USER_OP_IPREG UserOpMode = 50 USER_OP_NADM UserOpMode = 51 USER_OP_DRINK UserOpMode = 52 USER_OP_CAL UserOpMode = 53 // USER_OP_PROVERB 54 USER_OP_ANNOUNCE UserOpMode = 55 /* announce */ USER_OP_EDNOTE UserOpMode = 56 USER_OP_CDICT UserOpMode = 57 USER_OP_LOBJ UserOpMode = 58 USER_OP_OSONG UserOpMode = 59 USER_OP_CHICKEN UserOpMode = 60 USER_OP_TICKET UserOpMode = 61 // USER_OP_GUESSNUM 62 USER_OP_AMUSE UserOpMode = 63 USER_OP_OTHELLO UserOpMode = 64 USER_OP_DICE UserOpMode = 65 // USER_OP_VICE 66 // USER_OP_BBCALL 67 USER_OP_VIOLATELAW UserOpMode = 68 USER_OP_M_FIVE UserOpMode = 69 USER_OP_M_CONN6 UserOpMode = 70 // USER_OP_TENHALF 71 // USER_OP_CARD_99 72 // USER_OP_RAIL_WAY 73 USER_OP_SREG UserOpMode = 74 USER_OP_CHC UserOpMode = 75 /* Chinese chess */ USER_OP_DARK UserOpMode = 76 /* 中國暗棋 */ // USER_OP_TMPJACK 77 // USER_OP_JCEE 78 USER_OP_REEDIT UserOpMode = 79 // USER_OP_BLOGGING 80 /* 已停用 */ USER_OP_CHESSWATCHING UserOpMode = 81 USER_OP_UMODE_GO UserOpMode = 82 USER_OP_DEBUGSLEEPING UserOpMode = 83 USER_OP_UMODE_CONN6 UserOpMode = 84 USER_OP_REVERSI UserOpMode = 85 USER_OP_UMODE_BBSLUA UserOpMode = 86 USER_OP_UMODE_ASCIIMOVIE UserOpMode = 87 USER_OP_MODE_MAX UserOpMode = 88 /* 所有其他選單動態須在此之前 */ )
type Userec2Raw ¶ added in v0.7.1
type UserecRaw ¶
type UserecRaw struct { Version uint32 // Require const-bytes to have correct Unsafe.Sizeof UserID UserID_t /* 使用者ID (alpha-number only) */ RealName RealName_t /* 真實姓名 */ Nickname Nickname_t /* 暱稱 */ PasswdHash Passwd_t /* 密碼 (hashed bytes) */ Pad1 byte UFlag UFlag /* 習慣, see uflags.h */ Unused1 uint32 /* 從前放習慣2, 使用前請先清0 */ UserLevel PERM /* 權限 */ NumLoginDays uint32 /* 上線資歷 (每日最多+1的登入次數) */ NumPosts uint32 /* 文章篇數 */ FirstLogin types.Time4 /* 註冊時間 */ LastLogin types.Time4 /* 最近上站時間(包含隱身) */ LastHost IPv4_t /* 上次上站來源 */ Money int32 /* Ptt幣 */ Unused2 [4]byte Email Email_t /* Email */ Address Address_t /* 住址 */ Justify Reg_t /* 審核資料 */ UnusedBirth [3]uint8 /* 生日 月日年 */ Over18 bool /* 是否已滿18歲 */ PagerUIType uint8 /* 呼叫器界面類別 (was: WATER_*) */ Pager PagerMode /* 呼叫器狀態 */ Invisible bool /* 隱形狀態 */ Unused4 [2]byte Exmailbox uint32 /* 購買信箱數 */ // r3968 移出 sizeof(chicken_t)=128 bytes Unused5 [4]byte Career Career_t /* 學歷職業 */ UnusedPhone Phone_t /* 電話 */ Unused6 uint32 /* 從前放轉換前的 numlogins, 使用前請先清0 */ Chkpad1 [44]byte Role uint32 /* Role-specific permissions */ LastSeen types.Time4 /* 最近上站時間(隱身不計) */ TimeSetAngel types.Time4 /* 上次得到天使時間 */ TimePlayAngel types.Time4 /* 上次與天使互動時間 (by day) */ LastSong types.Time4 /* 上次點歌時間 */ LoginView uint32 /* 進站畫面 */ Unused8 uint8 // was: channel Pad2 uint8 VlCount uint16 /* 違法記錄 ViolateLaw counter */ FiveWin uint16 /* 五子棋戰績 勝 */ FiveLose uint16 /* 五子棋戰績 敗 */ FiveTie uint16 /* 五子棋戰績 和 */ ChcWin uint16 /* 象棋戰績 勝 */ ChcLose uint16 /* 象棋戰績 敗 */ ChcTie uint16 /* 象棋戰績 和 */ Conn6Win uint16 /* 六子棋戰績 勝 */ Conn6Lose uint16 /* 六子棋戰績 敗 */ Conn6Tie uint16 /* 六子棋戰績 和 */ UnusedMind [2]byte /* 舊心情 */ GoWin uint16 /* 圍棋戰績 勝 */ GoLose uint16 /* 圍棋戰績 敗 */ GoTie uint16 /* 圍棋戰績 和 */ DarkWin uint16 /* 暗棋戰績 勝 */ DarkLose uint16 /* 暗棋戰績 敗 */ UaVersion uint8 /* Applicable user agreement version */ Signature uint8 /* 慣用簽名檔 */ Unused10 uint8 /* 從前放好文章數, 使用前請先清0 */ BadPost uint8 /* 評價為壞文章數 */ DarkTie uint16 /* 暗棋戰績 和 */ MyAngel UserID_t /* 我的小天使 */ Pad3 byte ChessEloRating uint16 /* 象棋等級分 */ WithMe WithMe_t /* 我想找人下棋,聊天.... */ TimeRemoveBadPost types.Time4 /* 上次刪除劣文時間 */ TimeViolateLaw types.Time4 /* 被開罰單時間 */ PadTail [28]byte }
type VerifyDBMessage ¶
type VerifyDBMessage struct { RegMailDBReqHeader Message []byte }
type VerifyDBStatus ¶
type VerifyDBStatus int8
const ( VERIFYDB_OK VerifyDBStatus = 0 VERIFYDB_ERROR VerifyDBStatus = -1 )
type VerifyDBVMethod ¶
type VerifyDBVMethod int32
const ( VMETHOD_UNSET VerifyDBVMethod = iota VMETHOD_EMAIL )
type VoteLimits ¶ added in v0.2.3
XXX need to ensure Multi.
type WaterBall ¶ added in v0.5.0
type WaterBall uint8
const ( WATERBALL_GENERAL WaterBall = 0 WATERBALL_PREEDIT WaterBall = 1 WATERBALL_ALOHA WaterBall = 2 WATERBALL_SYSOP WaterBall = 3 WATERBALL_CONFIRM WaterBall = 4 WATERBALL_ANGEL WaterBall = 5 WATERBALL_ANSWER WaterBall = 6 WATERBALL_CONFIRM_ANGEL WaterBall = 7 WATERBALL_CONFIRM_ANSWER WaterBall = 8 )
type WithMe_t ¶ added in v0.5.0
type WithMe_t uint32
const ( WITHME_ALLFLAG WithMe_t = 0x55555555 WITHME_TALK WithMe_t = 0x00000001 WITHME_NOTALK WithMe_t = 0x00000002 WITHME_FIVE WithMe_t = 0x00000004 WITHME_NOFIVE WithMe_t = 0x00000008 WITHME_PAT WithMe_t = 0x00000010 WITHME_NOPAT WithMe_t = 0x00000020 WITHME_CHESS WithMe_t = 0x00000040 WITHME_NOCHESS WithMe_t = 0x00000080 WITHME_DARK WithMe_t = 0x00000100 WITHME_NODARK WithMe_t = 0x00000200 WITHME_GO WithMe_t = 0x00000400 WITHME_NOGO WithMe_t = 0x00000800 WITHME_CONN6 WithMe_t = 0x00001000 WITHME_NOCONN6 WithMe_t = 0x00002000 )
Source Files ¶
- 00-config-default.go
- 00-config.go
- ChessCode.go
- allow_reject_email.go
- article_summary.go
- board_detail.go
- board_header_raw.go
- board_stat.go
- board_summary.go
- brd_symbol.go
- brdattr.go
- bsort_by.go
- comment_type.go
- common.go
- config.go
- config_util.go
- const.go
- emaildb.go
- errors.go
- file_header_raw.go
- file_mode.go
- friend_type.go
- mail_queue.go
- modes.go
- msg_mode.go
- msg_queue_raw.go
- perm.go
- perm2.go
- record_type.go
- restrict_reason.go
- service_mode.go
- sort_by_category.go
- stamp_type.go
- statistic.go
- subject_type.go
- testinit.go
- types.go
- uflags.go
- user_info_raw.go
- userec2_raw.go
- userec_raw.go
- utils.go
- var.go
- verifydb.go
- withme.go