aboutsummaryrefslogtreecommitdiff
path: root/hotline/transaction_handlers.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-18 15:34:50 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-18 15:34:50 -0700
commita55350daaf83498b7a237c027ad0dd2377f06fee (patch)
treeb9f8c43a7b0778a8c2be01e72ecba24484f97a46 /hotline/transaction_handlers.go
parent153e2eac3b51a6a426556752fa2c532cfe53f026 (diff)
Adopt more fixed size array types for struct fields
Diffstat (limited to 'hotline/transaction_handlers.go')
-rw-r--r--hotline/transaction_handlers.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go
index cff19d5..3d7ba14 100644
--- a/hotline/transaction_handlers.go
+++ b/hotline/transaction_handlers.go
@@ -373,6 +373,8 @@ func HandleSendInstantMsg(cc *ClientConn, t *Transaction) (res []Transaction, er
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
@@ -396,9 +398,9 @@ func HandleGetFileInfo(cc *ClientConn, t *Transaction) (res []Transaction, err e
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.
@@ -407,7 +409,7 @@ func HandleGetFileInfo(cc *ClientConn, t *Transaction) (res []Transaction, err e
}
// 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()))
}
@@ -773,7 +775,6 @@ func HandleListUsers(cc *ClientConn, t *Transaction) (res []Transaction, err err
// 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
@@ -1937,7 +1938,6 @@ func HandleJoinChat(cc *ClientConn, t *Transaction) (res []Transaction, err erro
replyFields := []Field{NewField(FieldChatSubject, []byte(privChat.Subject))}
for _, c := range sortedClients(privChat.ClientConn) {
-
b, err := io.ReadAll(&User{
ID: *c.ID,
Icon: c.Icon,