8 // List of Hotline protocol field types taken from the official 1.9 protocol document
16 FieldUserPassword = 106
18 FieldTransferSize = 108
19 FieldChatOptions = 109
21 FieldUserAlias = 111 // TODO: implement
25 FieldChatSubject = 115
26 FieldWaitingCount = 116
28 FieldNoServerAgreement = 152
30 FieldCommunityBannerID = 161
32 FieldFileNameWithInfo = 200
35 FieldFileResumeData = 203
36 FieldFileTransferOptions = 204
37 FieldFileTypeString = 205
38 FieldFileCreatorString = 206
40 FieldFileCreateDate = 208
41 FieldFileModifyDate = 209
42 FieldFileComment = 210
43 FieldFileNewName = 211
44 FieldFileNewPath = 212
47 FieldAutomaticResponse = 215
48 FieldFolderItemCount = 220
49 FieldUsernameWithInfo = 300
50 FieldNewsArtListData = 321
51 FieldNewsCatName = 322
52 FieldNewsCatListData15 = 323
55 FieldNewsArtDataFlav = 327
56 FieldNewsArtTitle = 328
57 FieldNewsArtPoster = 329
58 FieldNewsArtDate = 330
59 FieldNewsArtPrevArt = 331
60 FieldNewsArtNextArt = 332
61 FieldNewsArtData = 333
62 FieldNewsArtFlags = 334 // TODO: what is this used for?
63 FieldNewsArtParentArt = 335
64 FieldNewsArt1stChildArt = 336
65 FieldNewsArtRecurseDel = 337 // TODO: implement news article recusive deletion
69 ID []byte // Type of field
70 FieldSize []byte // Size of the data part
71 Data []byte // Actual field content
74 type requiredField struct {
79 func NewField(id uint16, data []byte) Field {
80 idBytes := make([]byte, 2)
81 binary.BigEndian.PutUint16(idBytes, id)
84 binary.BigEndian.PutUint16(bs, uint16(len(data)))
93 func (f Field) Payload() []byte {
94 return slices.Concat(f.ID, f.FieldSize, f.Data)
97 func getField(id int, fields *[]Field) *Field {
98 for _, field := range *fields {
99 if id == int(binary.BigEndian.Uint16(field.ID)) {