return res, err
}
+var fileTypeFLDR = [4]byte{0x66, 0x6c, 0x64, 0x72}
+
func HandleGetFileInfo(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
fileName := t.GetField(FieldFileName).Data
filePath := t.GetField(FieldFilePath).Data
NewField(FieldFileName, []byte(encodedName)),
NewField(FieldFileTypeString, fw.ffo.FlatFileInformationFork.friendlyType()),
NewField(FieldFileCreatorString, fw.ffo.FlatFileInformationFork.friendlyCreator()),
- NewField(FieldFileType, fw.ffo.FlatFileInformationFork.TypeSignature),
- NewField(FieldFileCreateDate, fw.ffo.FlatFileInformationFork.CreateDate),
- NewField(FieldFileModifyDate, fw.ffo.FlatFileInformationFork.ModifyDate),
+ NewField(FieldFileType, fw.ffo.FlatFileInformationFork.TypeSignature[:]),
+ NewField(FieldFileCreateDate, fw.ffo.FlatFileInformationFork.CreateDate[:]),
+ NewField(FieldFileModifyDate, fw.ffo.FlatFileInformationFork.ModifyDate[:]),
}
// Include the optional FileComment field if there is a comment.
}
// Include the FileSize field for files.
- if !bytes.Equal(fw.ffo.FlatFileInformationFork.TypeSignature, []byte{0x66, 0x6c, 0x64, 0x72}) {
+ if fw.ffo.FlatFileInformationFork.TypeSignature != fileTypeFLDR {
fields = append(fields, NewField(FieldFileSize, fw.totalSize()))
}
// performed. This seems to be the only place in the Hotline protocol where a data field contains another data field.
func HandleUpdateUser(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
for _, field := range t.Fields {
-
var subFields []Field
// Create a new scanner for parsing incoming bytes into transaction tokens
}
func HandleGetUserNameList(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
- res = append(res, cc.NewReply(t, cc.Server.connectedUsers()...))
-
- return res, err
+ return []Transaction{cc.NewReply(t, cc.Server.connectedUsers()...)}, nil
}
func HandleTranAgreed(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
func HandleGetNewsArtNameList(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
if !cc.Authorize(accessNewsReadArt) {
res = append(res, cc.NewErrReply(t, "You are not allowed to read news."))
- return res, err
+ return res, nil
}
+
pathStrs := ReadNewsPath(t.GetField(FieldNewsPath).Data)
var cat NewsCategoryListData15
b, err := io.ReadAll(&nald)
if err != nil {
-
+ return res, fmt.Errorf("error loading news articles: %w", err)
}
res = append(res, cc.NewReply(t, NewField(FieldNewsArtListData, b)))
- return res, err
+ return res, nil
}
// HandleGetNewsArtData requests information about the specific news article.
replyFields := []Field{NewField(FieldChatSubject, []byte(privChat.Subject))}
for _, c := range sortedClients(privChat.ClientConn) {
-
b, err := io.ReadAll(&User{
ID: *c.ID,
Icon: c.Icon,