]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/transaction.go
Replace unsafe conn.Read with io.ReadFull
[rbdr/mobius] / hotline / transaction.go
index 835d194b24e5c445bcc741013c8e1f587125ab32..e7bfa58318a9f1baa4330e14ae5709ee55da3546 100644 (file)
@@ -40,18 +40,18 @@ const (
        tranGetFileInfo          = 206
        tranSetFileInfo          = 207
        tranMoveFile             = 208
-       // tranMakeFileAlias        = 209 TODO: implement file alias command
-       tranDownloadFldr = 210
+       tranMakeFileAlias        = 209 // TODO: implement file alias command
+       tranDownloadFldr         = 210
        // tranDownloadInfo         = 211 TODO: implement file transfer queue
        // tranDownloadBanner     = 212 TODO: figure out what this is used for
-       tranUploadFldr        = 213
-       tranGetUserNameList   = 300
-       tranNotifyChangeUser  = 301
-       tranNotifyDeleteUser  = 302
-       tranGetClientInfoText = 303
-       tranSetClientUserInfo = 304
-       tranListUsers         = 348
-       // tranUpdateUser         = 349 TODO: implement user updates from the > 1.5 account editor
+       tranUploadFldr         = 213
+       tranGetUserNameList    = 300
+       tranNotifyChangeUser   = 301
+       tranNotifyDeleteUser   = 302
+       tranGetClientInfoText  = 303
+       tranSetClientUserInfo  = 304
+       tranListUsers          = 348
+       tranUpdateUser         = 349
        tranNewUser            = 350
        tranDeleteUser         = 351
        tranGetUser            = 352
@@ -214,7 +214,7 @@ func ReadFields(paramCount []byte, buf []byte) ([]Field, error) {
        return fields, nil
 }
 
-func (t Transaction) MarshalBinary() (data []byte, err error) {
+func (t *Transaction) MarshalBinary() (data []byte, err error) {
        payloadSize := t.Size()
 
        fieldCount := make([]byte, 2)
@@ -238,7 +238,7 @@ func (t Transaction) MarshalBinary() (data []byte, err error) {
 }
 
 // Size returns the total size of the transaction payload
-func (t Transaction) Size() []byte {
+func (t *Transaction) Size() []byte {
        bs := make([]byte, 4)
 
        fieldSize := 0
@@ -251,7 +251,7 @@ func (t Transaction) Size() []byte {
        return bs
 }
 
-func (t Transaction) GetField(id int) Field {
+func (t *Transaction) GetField(id int) Field {
        for _, field := range t.Fields {
                if id == int(binary.BigEndian.Uint16(field.ID)) {
                        return field