5 "github.com/jhalter/mobius/concat"
10 const fieldUserName = 102
11 const fieldUserID = 103
12 const fieldUserIconID = 104
13 const fieldUserLogin = 105
14 const fieldUserPassword = 106
15 const fieldRefNum = 107
16 const fieldTransferSize = 108
17 const fieldChatOptions = 109
18 const fieldUserAccess = 110
19 const fieldUserAlias = 111
20 const fieldUserFlags = 112
21 const fieldOptions = 113
22 const fieldChatID = 114
23 const fieldChatSubject = 115
24 const fieldWaitingCount = 116
25 const fieldVersion = 160
26 const fieldCommunityBannerID = 161
27 const fieldServerName = 162
28 const fieldFileNameWithInfo = 200
29 const fieldFileName = 201
30 const fieldFilePath = 202
31 const fieldFileTypeString = 205
32 const fieldFileCreatorString = 206
33 const fieldFileSize = 207
34 const fieldFileCreateDate = 208
35 const fieldFileModifyDate = 209
36 const fieldFileComment = 210
37 const fieldFileNewName = 211
38 const fieldFileNewPath = 212
39 const fieldFileType = 213
40 const fieldQuotingMsg = 214 // Defined but unused in the Hotline Protocol spec
41 const fieldAutomaticResponse = 215
42 const fieldFolderItemCount = 220
43 const fieldUsernameWithInfo = 300
44 const fieldNewsArtListData = 321
45 const fieldNewsCatName = 322
46 const fieldNewsCatListData15 = 323
47 const fieldNewsPath = 325
48 const fieldNewsArtID = 326
49 const fieldNewsArtDataFlav = 327
50 const fieldNewsArtTitle = 328
51 const fieldNewsArtPoster = 329
52 const fieldNewsArtDate = 330
53 const fieldNewsArtPrevArt = 331
54 const fieldNewsArtNextArt = 332
55 const fieldNewsArtData = 333
56 const fieldNewsArtFlags = 334
57 const fieldNewsArtParentArt = 335
58 const fieldNewsArt1stChildArt = 336
59 const fieldNewsArtRecurseDel = 337
62 ID []byte // Type of field
63 FieldSize []byte // Size of the data part
64 Data []byte // Actual field content
67 type requiredField struct {
73 func NewField(id uint16, data []byte) Field {
74 idBytes := make([]byte, 2)
75 binary.BigEndian.PutUint16(idBytes, id)
78 binary.BigEndian.PutUint16(bs, uint16(len(data)))
87 func (f Field) Payload() []byte {
88 return concat.Slices(f.ID, f.FieldSize, f.Data)
91 type FileNameWithInfo struct {
92 Type string // file type code
93 Creator []byte // File creator code
94 FileSize uint32 // File Size in bytes
95 NameScript []byte // TODO: What is this?
96 NameSize []byte // Length of name field
97 Name string // File name
100 func (f FileNameWithInfo) Payload() []byte {
101 name := []byte(f.Name)
102 nameSize := make([]byte, 2)
103 binary.BigEndian.PutUint16(nameSize, uint16(len(name)))
107 fSize := make([]byte, 4)
108 binary.BigEndian.PutUint32(fSize, kb)
110 return concat.Slices(