Documentation ¶
Index ¶
- Constants
- Variables
- func GetBoardArticleFilePath(workDirectory string, boardId string, filename string) (string, error)
- func GetBoardArticlesDirectoryPath(workDirectory string, boardId string) (string, error)
- func GetBoardNameFilePath(workDirectory string, boardId string) (string, error)
- func GetBoardPath(workDirectory string) (string, error)
- func GetBoardTreasureFilePath(workDirectory string, boardId string, path []string, filename string) (string, error)
- func GetBoardTreasuresDirectoryPath(workDirectory string, boardId string, path []string) (string, error)
- func GetLoginRecentPath(workDirectory string, userid string) (string, error)
- func GetPasswdsPath(workDirectory string) (string, error)
- func GetUserFavoritePath(workDirectory string, userid string) (string, error)
- func GetUserMailPath(workDirectory string, userId string, filename string) (string, error)
- type BoardHeader
- func (b *BoardHeader) BM() []string
- func (b *BoardHeader) BoardId() string
- func (b *BoardHeader) ClassId() string
- func (b *BoardHeader) IsAlignedComment() bool
- func (b *BoardHeader) IsAngelAnonymous() bool
- func (b *BoardHeader) IsAnonymous() bool
- func (b *BoardHeader) IsBMCount() bool
- func (b *BoardHeader) IsBMMaskContent() bool
- func (b *BoardHeader) IsCPLog() bool
- func (b *BoardHeader) IsClass() bool
- func (b *BoardHeader) IsCooldown() bool
- func (b *BoardHeader) IsDefaultAnonymous() bool
- func (b *BoardHeader) IsGroupBoard() bool
- func (b *BoardHeader) IsGuestPost() bool
- func (b *BoardHeader) IsHide() bool
- func (b *BoardHeader) IsIPLogRecommend() bool
- func (b *BoardHeader) IsIsSymbolic() bool
- func (b *BoardHeader) IsNoBoo() bool
- func (b *BoardHeader) IsNoCount() bool
- func (b *BoardHeader) IsNoCredit() bool
- func (b *BoardHeader) IsNoFastRecommend() bool
- func (b *BoardHeader) IsNoRecommend() bool
- func (b *BoardHeader) IsNoReply() bool
- func (b *BoardHeader) IsNoSelfDeletePost() bool
- func (b *BoardHeader) IsOver18() bool
- func (b *BoardHeader) IsPostMask() bool
- func (b *BoardHeader) IsRestrictedPost() bool
- func (b *BoardHeader) IsTop() bool
- func (b *BoardHeader) IsVoteBoard() bool
- func (b *BoardHeader) IsWarnEL() bool
- func (b *BoardHeader) Title() string
- type Connector
- func (c *Connector) GetBoardArticleFilePath(boardId string, filename string) (string, error)
- func (c *Connector) GetBoardArticleRecordsPath(boardId string) (string, error)
- func (c *Connector) GetBoardRecordsPath() (string, error)
- func (c *Connector) GetBoardTreasureFilePath(boardId string, treasureId []string, filename string) (string, error)
- func (c *Connector) GetBoardTreasureRecordsPath(boardId string, treasureId []string) (string, error)
- func (c *Connector) GetUserFavoriteRecordsPath(userId string) (string, error)
- func (c *Connector) GetUserRecordsPath() (string, error)
- func (c *Connector) Open(dataSourceName string) error
- func (c *Connector) ReadArticleRecordsFile(filename string) ([]bbs.ArticleRecord, error)
- func (c *Connector) ReadBoardArticleFile(filename string) ([]byte, error)
- func (c *Connector) ReadBoardRecordsFile(path string) ([]bbs.BoardRecord, error)
- func (c *Connector) ReadUserFavoriteRecordsFile(filename string) ([]bbs.FavoriteRecord, error)
- func (c *Connector) ReadUserRecordsFile(filename string) ([]bbs.UserRecord, error)
- type FavAttr
- type FavBoardItem
- type FavFile
- type FavFolder
- type FavFolderItem
- type FavItem
- func (f *FavItem) BoardId() string
- func (favt *FavItem) GetBoard() *FavBoardItem
- func (favt *FavItem) GetFolder() *FavFolderItem
- func (favt *FavItem) GetLine() *FavLineItem
- func (favi *FavItem) MarshalBinary() ([]byte, error)
- func (f *FavItem) Records() []bbs.FavoriteRecord
- func (f *FavItem) Title() string
- func (f *FavItem) Type() bbs.FavoriteType
- type FavItemType
- type FavLineItem
- type FileHeader
- func (f *FileHeader) Date() string
- func (f *FileHeader) Filename() string
- func (h *FileHeader) IsVotePost() bool
- func (h *FileHeader) MarshalToByte() ([]byte, error)
- func (f *FileHeader) Modified() time.Time
- func (f *FileHeader) Money() int
- func (f *FileHeader) Owner() string
- func (f *FileHeader) Recommend() int
- func (f *FileHeader) Title() string
- type LoginAttempt
- type LoginRecentRecord
- type Userec
- func (u *Userec) HashedPassword() string
- func (u *Userec) LastHost() string
- func (u *Userec) LastLogin() time.Time
- func (r *Userec) MarshalToByte() ([]byte, error)
- func (u *Userec) Money() int
- func (u *Userec) Nickname() string
- func (u *Userec) NumLoginDays() int
- func (u *Userec) NumPosts() int
- func (u *Userec) RealName() string
- func (u *Userec) UserId() string
- func (u *Userec) VerifyPassword(password string) error
- type UserecGameScore
- type VoteLimits
Constants ¶
const ( PosOfPTTBoardName = 0 PosOfPTTBoardTitle = PosOfPTTBoardName + PTT_IDLEN + 1 PosOfPTTBM = PosOfPTTBoardTitle + PTT_BTLEN + 1 PosOfBrdAttr = 3 + PTT_IDLEN*3 + 3 + PosOfPTTBM PosOfChessCountry = PosOfBrdAttr + 4 PosOfVoteLimitPosts = PosOfChessCountry + 1 PosOfVoteLimitLogins = PosOfVoteLimitPosts + 1 PosOfBUpdate = 1 + PosOfVoteLimitLogins + 1 PosOfPostLimitPosts = PosOfBUpdate + 4 PosOfPostLimitLogins = PosOfPostLimitPosts + 1 PosOfBVote = 1 + PosOfPostLimitLogins + 1 PosOfVTime = PosOfBVote + 1 PosOfLevel = PosOfVTime + 4 PosOfPermReload = PosOfLevel + 4 PosOfGid = PosOfPermReload + 4 PosOfNext = PosOfGid + 4 PosOfFirstChild = PosOfNext + 8 PosOfParent = PosOfFirstChild + 8 PosOfChildCount = PosOfParent + 4 PosOfNuser = PosOfChildCount + 4 PosOfPostExpire = PosOfNuser + 4 PosOfEndGamble = PosOfPostExpire + 4 PosOfPostType = PosOfEndGamble + 4 PosOfPostTypeF = PosOfPostType + 33 PosOfFastRecommendPause = PosOfPostTypeF + 1 PosOfVoteLimitBadPost = PosOfFastRecommendPause + 1 PosOfPostLimitBadPost = PosOfVoteLimitBadPost + 1 PosOfSRExpire = 3 + PosOfPostLimitBadPost + 1 )
const ( PTT_BRD_POSTMASK = 0x00000020 PTT_BRD_GROUPBOARD = 0x00000008 PTT_PERM_SYSOP = 000000040000 PTT_PERM_BM = 000000002000 PTT_BRD_HIDE = 0x00000010 )
const ( ////////// //pttstruch.h ////////// PTT_IDLEN = 12 /* Length of bid/uid */ PTT_IPV4LEN = 15 /* a.b.c.d form */ PTT_PASS_INPUT_LEN = 8 /* Length of valid input password length. For DES, set to 8. */ PTT_PASSLEN = 14 /* Length of encrypted passwd field */ PTT_REGLEN = 38 /* Length of registration data */ PTT_REALNAMESZ = 20 /* Size of real-name field */ PTT_NICKNAMESZ = 24 /* SIze of nick-name field */ PTT_EMAILSZ = 50 /* Size of email field */ PTT_ADDRESSSZ = 50 /* Size of address field */ PTT_CAREERSZ = 40 /* Size of career field */ PTT_PHONESZ = 20 /* Size of phone field */ PTT_PASSWD_VERSION = 4194 /* passwd version */ PTT_TTLEN = 64 /* Length of title */ PTT_FNLEN = 28 /* Length of filename */ )
const ( ////////// //pttstruch.h: 292 ////////// PTT_FILE_LOCAL = 0x01 /* local saved, non-mail */ PTT_FILE_READ = 0x01 /* already read, mail only */ PTT_FILE_MARKED = 0x02 /* non-mail + mail */ PTT_FILE_DIGEST = 0x04 /* digest, non-mail */ PTT_FILE_REPLIED = 0x04 /* replied, mail only */ PTT_FILE_BOTTOM = 0x08 /* push_bottom, non-mail */ PTT_FILE_MULTI = 0x08 /* multi send, mail only */ PTT_FILE_SOLVED = 0x10 /* problem solved, sysop/BM non-mail only */ PTT_FILE_HIDE = 0x20 /* hide, in announce */ PTT_FILE_BID = 0x20 /* bid, in non-announce */ PTT_FILE_BM = 0x40 /* BM only, in announce */ PTT_FILE_VOTE = 0x40 /* for vote, in non-announce */ PTT_FILE_ANONYMOUS = 0x80 /* anonymous file */ )
const ( PosOfPttFileHeaderFilename = 0 PosOfPttFileHeaderModified = PosOfPttFileHeaderFilename + PTT_FNLEN PosOfPttFileHeaderRecommend = 1 + PosOfPttFileHeaderModified + 4 PosOfPttFileHeaderOwner = PosOfPttFileHeaderRecommend + 1 PosOfPttFileHeaderDate = PosOfPttFileHeaderOwner + PTT_IDLEN + 2 PosOfPttFileHeaderTitle = PosOfPttFileHeaderDate + 6 PosOfPttFileHeaderUnionMulti = 1 + PosOfPttFileHeaderTitle + PTT_TTLEN + 1 PosOfPttFileHeaderFilemode = PosOfPttFileHeaderUnionMulti + 4 )
const ( PosOfPttPasswdVersion = 0 PosOfPttPasswdUserId = PosOfPttPasswdVersion + 4 PosOfPttPasswdRealName = PosOfPttPasswdUserId + PTT_IDLEN + 1 PosOfPttPasswdNickname = PosOfPttPasswdRealName + 20 PosOfPttPasswdPassword = PosOfPttPasswdNickname + 24 PosOfPttPasswdUserFlag = PosOfPttPasswdPassword + 15 PosOfPttPasswdUserLevel = PosOfPttPasswdUserFlag + 4 + 4 PosOfPttPasswdNumLoginDays = PosOfPttPasswdUserLevel + 4 PosOfPttPasswdNumPosts = PosOfPttPasswdNumLoginDays + 4 PosOfPttPasswdFirstLogin = PosOfPttPasswdNumPosts + 4 PosOfPttPasswdLastLogin = PosOfPttPasswdFirstLogin + 4 PosOfPttPasswdLastHost = PosOfPttPasswdLastLogin + 4 PosOfPttPasswdMoney = PosOfPttPasswdLastHost + PTT_IPV4LEN + 1 PosOfPttPasswdEmail = PosOfPttPasswdMoney + 4 + 4 PosOfPttPasswdAddress = PosOfPttPasswdEmail + PTT_EMAILSZ PosOfPttPasswdJustify = PosOfPttPasswdAddress + PTT_ADDRESSSZ PosOfPttPasswdOver18 = PosOfPttPasswdJustify + PTT_REGLEN + 1 + 3 PosOfPttPasswdPagerUiType = PosOfPttPasswdOver18 + 1 PosOfPttPasswdPager = PosOfPttPasswdPagerUiType + 1 PosOfPttPasswdInvisible = PosOfPttPasswdPager + 1 PosOfPttPasswdExMailBox = PosOfPttPasswdInvisible + 1 + 2 PosOfPttPasswdCareer = PosOfPttPasswdExMailBox + 4 + 4 PosOfPttPasswdRole = PosOfPttPasswdCareer + 40 + 20 + 4 + 44 PosOfPttPasswdLastSeen = PosOfPttPasswdRole + 4 PosOfPttPasswdTimeSetAngel = PosOfPttPasswdLastSeen + 4 PosOfPttPasswdTimePlayAngel = PosOfPttPasswdTimeSetAngel + 4 PosOfPttPasswdLastSong = PosOfPttPasswdTimePlayAngel + 4 PosOfPttPasswdLoginView = PosOfPttPasswdLastSong + 4 PosOfPttPasswdLawCounter = PosOfPttPasswdLoginView + 2 PosOfPttPasswdFiveWin = PosOfPttPasswdLawCounter + 2 PosOfPttPasswdFiveLose = PosOfPttPasswdFiveWin + 2 PosOfPttPasswdFiveTie = PosOfPttPasswdFiveLose + 2 PosOfPttPasswdChcWin = PosOfPttPasswdFiveTie + 2 PosOfPttPasswdChcLose = PosOfPttPasswdChcWin + 2 PosOfPttPasswdChcTie = PosOfPttPasswdChcLose + 2 PosOfPttPasswdConn6Win = PosOfPttPasswdChcTie + 2 PosOfPttPasswdConn6Lose = PosOfPttPasswdConn6Win + 2 PosOfPttPasswdConn6Tie = PosOfPttPasswdConn6Lose + 2 PosOfPttPasswdGoWin = PosOfPttPasswdConn6Tie + 4 PosOfPttPasswdGoLose = PosOfPttPasswdGoWin + 2 PosOfPttPasswdGoTie = PosOfPttPasswdGoLose + 2 PosOfPttPasswdDarkWin = PosOfPttPasswdGoTie + 2 PosOfPttPasswdDarkLose = PosOfPttPasswdDarkWin + 2 PosOfPttPasswdUaVersion = PosOfPttPasswdDarkLose + 2 PosOfPttPasswdSignature = PosOfPttPasswdUaVersion + 1 PosOfPttPasswdBadPost = PosOfPttPasswdSignature + 2 PosOfPttPasswdDarkTie = PosOfPttPasswdBadPost + 1 PosOfPttPasswdMyAngel = PosOfPttPasswdDarkTie + 2 PosOfPttPasswdChessEloRating = PosOfPttPasswdMyAngel + PTT_IDLEN + 1 + 1 PosOfPttPasswdWithMe = PosOfPttPasswdChessEloRating + 2 PosOfPttPasswdTimeRemoveBadPost = PosOfPttPasswdWithMe + 4 PosOfPttPasswdTimeViolateLaw = PosOfPttPasswdTimeRemoveBadPost + 4 )
const (
PTT_BTLEN = 48
)
const (
TIME4TBytes = 4 // Bytes for time4_t
)
const (
// UserIdLength is fixed to 12
UserIdLength = 12
)
Variables ¶
var ( InvalidFavTypeError = errors.New("invalid Favorite type") IndexOutOfBoundError = errors.New("index out of range, file format invalid") )
var (
InvalidLoginsBadFormat = errors.New("Invalid logins.bad line format")
)
Functions ¶
func GetBoardArticleFilePath ¶ added in v0.2.1
Get Directory article file path of board, `workDirectory` is BBSHome usually, `boardId` means which board, and filename is actual file in board, notice that, we will check is file exist or user has permission for open this file. eg, .DIR file, so please check filename before call this function.
func GetBoardArticlesDirectoryPath ¶ added in v0.2.1
Get Directory normal file path of board
func GetBoardNameFilePath ¶
Get Directory digest file path of board
func GetBoardPath ¶
Get Board file path of system
func GetBoardTreasureFilePath ¶ added in v0.2.1
func GetBoardTreasuresDirectoryPath ¶
func GetBoardTreasuresDirectoryPath(workDirectory string, boardId string, path []string) (string, error)
GetBoardTreasuresDirectoryPath return dir file path of specific board and path, `workDirectory` is BBSHome usually, `boardId` means which board and `path` is a slice figure out each directory, eg: `["M.971228479.A", "M.1035338027.A"]` in formosa BBS or `["D690", "D6C2", "D6D1"]` in pttbbs.
func GetLoginRecentPath ¶
Get Login Recent file path of user
func GetPasswdsPath ¶
Get Passwd file path of system
func GetUserFavoritePath ¶
Get Favorite file path of user
func GetUserMailPath ¶
Get Directory digest file path of board, `workDirectory` is BBSHome usually, `userId` means which user, and filename is actual file in user, notice that, we will check is file exist or user has permission for open this file. eg, .DIR file, so please check filename before call this function.
Types ¶
type BoardHeader ¶
type BoardHeader struct { BrdName string Brdattr uint32 // uid[.] ChessCountry string VoteLimitPosts uint8 VoteLimitLogins uint8 BUpdate time.Time PostLimitPosts uint8 PostLimitLogins uint8 BVote uint8 VTime time.Time Level uint32 PermReload time.Time // Parent class id, first item is start from 1. Gid int32 Next []int32 FirstChild []int32 Parent int32 ChildCount int32 Nuser int32 PostExpire int32 EndGamble time.Time PostType string PostTypeF string FastRecommendPause uint8 VoteLimitBadPost uint8 PostLimitBadPost uint8 SRexpire time.Time // contains filtered or unexported fields }
func NewBoardHeaderWithByte ¶
func NewBoardHeaderWithByte(data []byte) (*BoardHeader, error)
func OpenBoardHeaderFile ¶
func OpenBoardHeaderFile(filename string) ([]*BoardHeader, error)
func (*BoardHeader) BM ¶
func (b *BoardHeader) BM() []string
func (*BoardHeader) BoardId ¶ added in v0.2.1
func (b *BoardHeader) BoardId() string
func (*BoardHeader) ClassId ¶ added in v0.2.4
func (b *BoardHeader) ClassId() string
func (*BoardHeader) IsAlignedComment ¶
func (b *BoardHeader) IsAlignedComment() bool
func (*BoardHeader) IsAngelAnonymous ¶
func (b *BoardHeader) IsAngelAnonymous() bool
func (*BoardHeader) IsAnonymous ¶
func (b *BoardHeader) IsAnonymous() bool
func (*BoardHeader) IsBMCount ¶
func (b *BoardHeader) IsBMCount() bool
func (*BoardHeader) IsBMMaskContent ¶
func (b *BoardHeader) IsBMMaskContent() bool
func (*BoardHeader) IsCPLog ¶
func (b *BoardHeader) IsCPLog() bool
func (*BoardHeader) IsClass ¶ added in v0.2.1
func (b *BoardHeader) IsClass() bool
func (*BoardHeader) IsCooldown ¶
func (b *BoardHeader) IsCooldown() bool
func (*BoardHeader) IsDefaultAnonymous ¶
func (b *BoardHeader) IsDefaultAnonymous() bool
func (*BoardHeader) IsGroupBoard ¶ added in v0.2.1
func (b *BoardHeader) IsGroupBoard() bool
func (*BoardHeader) IsGuestPost ¶
func (b *BoardHeader) IsGuestPost() bool
func (*BoardHeader) IsHide ¶
func (b *BoardHeader) IsHide() bool
func (*BoardHeader) IsIPLogRecommend ¶
func (b *BoardHeader) IsIPLogRecommend() bool
func (*BoardHeader) IsIsSymbolic ¶
func (b *BoardHeader) IsIsSymbolic() bool
func (*BoardHeader) IsNoBoo ¶
func (b *BoardHeader) IsNoBoo() bool
func (*BoardHeader) IsNoCount ¶
func (b *BoardHeader) IsNoCount() bool
func (*BoardHeader) IsNoCredit ¶
func (b *BoardHeader) IsNoCredit() bool
func (*BoardHeader) IsNoFastRecommend ¶
func (b *BoardHeader) IsNoFastRecommend() bool
func (*BoardHeader) IsNoRecommend ¶
func (b *BoardHeader) IsNoRecommend() bool
func (*BoardHeader) IsNoReply ¶
func (b *BoardHeader) IsNoReply() bool
func (*BoardHeader) IsNoSelfDeletePost ¶
func (b *BoardHeader) IsNoSelfDeletePost() bool
func (*BoardHeader) IsOver18 ¶
func (b *BoardHeader) IsOver18() bool
func (*BoardHeader) IsPostMask ¶
func (b *BoardHeader) IsPostMask() bool
func (*BoardHeader) IsRestrictedPost ¶
func (b *BoardHeader) IsRestrictedPost() bool
func (*BoardHeader) IsTop ¶
func (b *BoardHeader) IsTop() bool
func (*BoardHeader) IsVoteBoard ¶
func (b *BoardHeader) IsVoteBoard() bool
func (*BoardHeader) IsWarnEL ¶
func (b *BoardHeader) IsWarnEL() bool
func (*BoardHeader) Title ¶
func (b *BoardHeader) Title() string
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
func (*Connector) GetBoardArticleFilePath ¶ added in v0.2.2
func (*Connector) GetBoardArticleRecordsPath ¶ added in v0.2.1
func (*Connector) GetBoardRecordsPath ¶
func (*Connector) GetBoardTreasureFilePath ¶ added in v0.2.2
func (*Connector) GetBoardTreasureRecordsPath ¶ added in v0.2.1
func (*Connector) GetUserFavoriteRecordsPath ¶ added in v0.2.3
func (*Connector) GetUserRecordsPath ¶
func (*Connector) Open ¶ added in v0.2.1
Open connect a file directory or SHMs, dataSourceName pointer to bbs home And it can append argument for SHM for example `file:///home/bbs/?UTMP=1993`
func (*Connector) ReadArticleRecordsFile ¶ added in v0.2.2
func (*Connector) ReadBoardArticleFile ¶ added in v0.2.1
ReadBoardArticleFile returns raw file of specific filename article.
func (*Connector) ReadBoardRecordsFile ¶
func (*Connector) ReadUserFavoriteRecordsFile ¶ added in v0.2.3
func (*Connector) ReadUserRecordsFile ¶
type FavBoardItem ¶
type FavBoardItem struct { BoardId uint32 LastVisit time.Time Attr uint32 // contains filtered or unexported fields }
FavBoardItem represents a Board in FavFolder. FavBoardItem takes 12 bytes
func NewFavBoardItem ¶
func NewFavBoardItem(data []byte, startIndex int) (*FavBoardItem, int, error)
NewFavBoardItem takes a []byte and parse it starting from startIndex, return FavBoardItem, end index and error
func (*FavBoardItem) MarshalBinary ¶
func (favbi *FavBoardItem) MarshalBinary() ([]byte, error)
type FavFile ¶
FavFile represents the entire fav file. Starts with 2 bytes of Version and at most 1 FavFolder.
func NewFavFile ¶
NewFavFile parse data and return FavFile
func (*FavFile) MarshalBinary ¶
type FavFolder ¶
type FavFolder struct { NAlloc uint16 DataTail uint16 NBoards uint16 NLines uint8 NFolders uint8 LineId uint8 FolderId uint8 FavItems []*FavItem }
FavFolder represents a folder in .fav file. Each folder could contain NBoards of board, NLines of lines and NFolders of sub-folders.
func NewFavFolder ¶
NewFavFolder takes a []byte, parse it starting with startIndex, return an instance of FavFolder, endIndex and error.
func (*FavFolder) MarshalBinary ¶
type FavFolderItem ¶
FavFolderItem represents a Folder in FavFolder. FavFolderItem takes 50 bytes
func NewFavFolderItem ¶
func NewFavFolderItem(data []byte, startIndex int) (*FavFolderItem, int, error)
NewFavFolderItem takes a []byte and parse it starting from startIndex, return FavFolderItem, end index and error
func (*FavFolderItem) MarshalBinary ¶
func (favfi *FavFolderItem) MarshalBinary() ([]byte, error)
type FavItem ¶
type FavItem struct { FavType FavItemType FavAttr uint8 Item interface{} // This could be either FavBoardItem / FavFolderItem / FavLineItem }
FavItem represents 1 Item in FavFolder
func NewFavItem ¶
NewFavItem parse data starting from startIndex and return FavItem. FavItem.Item might be either FavBoardItem, FavFolderItem or FavLineItem
func (*FavItem) GetBoard ¶
func (favt *FavItem) GetBoard() *FavBoardItem
GetBoard tries to cast Item to FavBoardItem; return nil if it is not
func (*FavItem) GetFolder ¶
func (favt *FavItem) GetFolder() *FavFolderItem
GetFolder tries to cast Item to FavFolderItem; return nil if it is not
func (*FavItem) GetLine ¶
func (favt *FavItem) GetLine() *FavLineItem
GetLine tries to cast Item to FavLineItem; return nil if it is not
func (*FavItem) MarshalBinary ¶
type FavItemType ¶
type FavItemType uint8
const ( FavItemTypeBoard FavItemType = 1 // FAVT_BOARD FavItemTypeFolder FavItemType = 2 // FAVT_FOLDER FavItemTypeLine FavItemType = 3 // FAVT_LINE )
type FavLineItem ¶
type FavLineItem struct {
LineId uint8
}
FavLineItem represents a Line in FavFolder. FavLineItem takes 1 byte
func NewFavLineItem ¶
func NewFavLineItem(data []byte, startIndex int) (*FavLineItem, int, error)
NewFavLineItem takes a []byte and parse it starting from startIndex, return FavLineItem, end index and error
func (*FavLineItem) MarshalBinary ¶
func (favli *FavLineItem) MarshalBinary() ([]byte, error)
type FileHeader ¶
type FileHeader struct { AnnoUid int VoteLimits ReferRef uint // 至底公告? ReferFlag bool // 至底公告? Filemode uint8 // contains filtered or unexported fields }
FileHeader records article's metainfo
func NewFileHeaderWithByte ¶
func NewFileHeaderWithByte(data []byte) (*FileHeader, error)
func OpenFileHeaderFile ¶
func OpenFileHeaderFile(filename string) ([]*FileHeader, error)
OpenFileHeaderFile function open a .DIR file in board directory. It returns slice of FileHeader.
func (*FileHeader) Date ¶
func (f *FileHeader) Date() string
func (*FileHeader) Filename ¶
func (f *FileHeader) Filename() string
func (*FileHeader) IsVotePost ¶
func (h *FileHeader) IsVotePost() bool
func (*FileHeader) MarshalToByte ¶
func (h *FileHeader) MarshalToByte() ([]byte, error)
func (*FileHeader) Modified ¶
func (f *FileHeader) Modified() time.Time
func (*FileHeader) Money ¶
func (f *FileHeader) Money() int
func (*FileHeader) Owner ¶
func (f *FileHeader) Owner() string
func (*FileHeader) Recommend ¶
func (f *FileHeader) Recommend() int
func (*FileHeader) Title ¶
func (f *FileHeader) Title() string
type LoginAttempt ¶
LoginAttempt represents an entry in logins.bad file to indicate a successful or failed login attempt for a UserId. Note that UserId could be empty if the logins.bad is under user dir.
func OpenBadLoginFile ¶
func OpenBadLoginFile(filename string) ([]*LoginAttempt, error)
OpenBadLoginFile opens logins.bad file and returns a slice of LoginAttempt. Note that depending on different format of logins.bad as descirbed above, each LoginAttempt might not have LoginAttempt.UserId field
func (*LoginAttempt) IsUnderBbsHome ¶
func (l *LoginAttempt) IsUnderBbsHome() bool
IsUnderBbsHome return true if this LoginAttempt was read from logins.bad from under BBSHOME. The difference between logins.bad between under BBSHOME and under User Dir is whether it contains UserId
func (*LoginAttempt) MarshalText ¶
func (l *LoginAttempt) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler to marshal receiver to text
func (*LoginAttempt) UnmarshalText ¶
func (l *LoginAttempt) UnmarshalText(text []byte) error
UnmarshalText implements encoding.TextUnmarshaler to unmarshal text to the receiver
type LoginRecentRecord ¶
LoginRecentRecord records Login record, please see https://github.com/ptt/pttbbs/blob/446c2bc34867286a2a093615ea69501f32c127e4/mbbsd/mbbsd.c#L1123
func NewLoginRecentRecord ¶
func NewLoginRecentRecord(line string) (*LoginRecentRecord, error)
func OpenLoginRecentFile ¶
func OpenLoginRecentFile(filename string) ([]*LoginRecentRecord, error)
type Userec ¶
type Userec struct { Version uint32 // Magic Number UserFlag uint32 UserLevel uint32 // 權限 Email string Address string Justify string Over18 bool PagerUIType uint8 Pager uint8 Invisible bool ExMailBox uint32 Career string Role uint32 LastSeen time.Time TimeSetAngel time.Time TimePlayAngel time.Time LastSong time.Time LoginView uint32 ViolateLaw uint16 Five UserecGameScore ChineseChess UserecGameScore Conn6 UserecGameScore GoChess UserecGameScore DarkChess UserecGameScore UaVersion uint8 // User Agreement Version Signature uint8 BadPost uint8 MyAngel string ChessEloRating uint16 WithMe uint32 TimeRemoveBadPost time.Time TimeViolateLaw time.Time // contains filtered or unexported fields }
func NewUserecWithByte ¶
func OpenUserecFile ¶
func (*Userec) HashedPassword ¶
func (*Userec) MarshalToByte ¶
func (*Userec) Nickname ¶
Nickname return a string for user's nickname, this string may change depend on user's mood, return empty string if this bbs system do not support
func (*Userec) NumLoginDays ¶
NumLoginDays return how many days this have been login since account created.
func (*Userec) RealName ¶
RealName return a string for user's real name, this string may not be changed return empty string if this bbs system do not support
func (*Userec) VerifyPassword ¶
VerifyPassword will check user's password is OK. it will return null when OK and error when there are something wrong