From: Jeff Halter Date: Thu, 15 Sep 2022 20:51:37 +0000 (-0700) Subject: Clean up some linter warnings X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/commitdiff_plain/043c00da52efd5b7d9ef15750945ee55e6f78e7a?ds=sidebyside;hp=--cc Clean up some linter warnings --- 043c00da52efd5b7d9ef15750945ee55e6f78e7a diff --git a/hotline/access.go b/hotline/access.go index e2e728c..90740fc 100644 --- a/hotline/access.go +++ b/hotline/access.go @@ -1,25 +1,25 @@ package hotline const ( - accessDeleteFile = 0 // File System Maintenance: Can Delete Files - accessUploadFile = 1 // File System Maintenance: Can Upload Files - accessDownloadFile = 2 // File System Maintenance: Can Download Files - accessRenameFile = 3 // File System Maintenance: Can Rename Files - accessMoveFile = 4 // File System Maintenance: Can Move Files - accessCreateFolder = 5 // File System Maintenance: Can Create Folders - accessDeleteFolder = 6 // File System Maintenance: Can Delete Folders - accessRenameFolder = 7 // File System Maintenance: Can Rename Folders - accessMoveFolder = 8 // File System Maintenance: Can Move Folders - accessReadChat = 9 // Chat: Can Read Chat - accessSendChat = 10 // Chat: Can Send Chat - accessOpenChat = 11 // Chat: Can Initial Private Chat - accessCloseChat = 12 // Present in the Hotline 1.9 protocol documentation, but seemingly unused - accessShowInList = 13 // Present in the Hotline 1.9 protocol documentation, but seemingly unused - accessCreateUser = 14 // User Maintenance: Can Create Accounts - accessDeleteUser = 15 // User Maintenance: Can Delete Accounts - accessOpenUser = 16 // User Maintenance: Can Read Accounts - accessModifyUser = 17 // User Maintenance: Can Modify Accounts - accessChangeOwnPass = 18 // Present in the Hotline 1.9 protocol documentation, but seemingly unused + accessDeleteFile = 0 // File System Maintenance: Can Delete Files + accessUploadFile = 1 // File System Maintenance: Can Upload Files + accessDownloadFile = 2 // File System Maintenance: Can Download Files + accessRenameFile = 3 // File System Maintenance: Can Rename Files + accessMoveFile = 4 // File System Maintenance: Can Move Files + accessCreateFolder = 5 // File System Maintenance: Can Create Folders + accessDeleteFolder = 6 // File System Maintenance: Can Delete Folders + accessRenameFolder = 7 // File System Maintenance: Can Rename Folders + accessMoveFolder = 8 // File System Maintenance: Can Move Folders + accessReadChat = 9 // Chat: Can Read Chat + accessSendChat = 10 // Chat: Can Send Chat + accessOpenChat = 11 // Chat: Can Initial Private Chat + // accessCloseChat = 12 // Present in the Hotline 1.9 protocol documentation, but seemingly unused + // accessShowInList = 13 // Present in the Hotline 1.9 protocol documentation, but seemingly unused + accessCreateUser = 14 // User Maintenance: Can Create Accounts + accessDeleteUser = 15 // User Maintenance: Can Delete Accounts + accessOpenUser = 16 // User Maintenance: Can Read Accounts + accessModifyUser = 17 // User Maintenance: Can Modify Accounts + // accessChangeOwnPass = 18 // Present in the Hotline 1.9 protocol documentation, but seemingly unused accessNewsReadArt = 20 // News: Can Read Articles accessNewsPostArt = 21 // News: Can Post Articles accessDisconUser = 22 // User Maintenance: Can Disconnect Users (Note: Turns username red in user list) diff --git a/hotline/config.go b/hotline/config.go index aeae275..a30bbf7 100644 --- a/hotline/config.go +++ b/hotline/config.go @@ -1,5 +1,11 @@ package hotline +const ( + userIdleSeconds = 300 // time in seconds before an inactive user is marked idle + idleCheckInterval = 10 // time in seconds to check for idle users + trackerUpdateFrequency = 300 // time in seconds between tracker re-registration +) + type Config struct { Name string `yaml:"Name" validate:"required,max=50"` // Name used for Tracker registration Description string `yaml:"Description" validate:"required,max=200"` // Description used for Tracker registration diff --git a/hotline/field.go b/hotline/field.go index c9db3d9..3378552 100644 --- a/hotline/field.go +++ b/hotline/field.go @@ -58,10 +58,12 @@ const fieldNewsArtDate = 330 const fieldNewsArtPrevArt = 331 const fieldNewsArtNextArt = 332 const fieldNewsArtData = 333 -const fieldNewsArtFlags = 334 + +// const fieldNewsArtFlags = 334 const fieldNewsArtParentArt = 335 const fieldNewsArt1stChildArt = 336 -const fieldNewsArtRecurseDel = 337 + +// const fieldNewsArtRecurseDel = 337 type Field struct { ID []byte // Type of field diff --git a/hotline/file_wrapper.go b/hotline/file_wrapper.go index f3fd559..b55e9f4 100644 --- a/hotline/file_wrapper.go +++ b/hotline/file_wrapper.go @@ -26,7 +26,6 @@ type fileWrapper struct { rsrcPath string // path to the file resource fork infoPath string // path to the file information fork incompletePath string // path to partially transferred temp file - saveMetaData bool // if true, enables saving of info and resource forks in sidecar files infoFork *FlatFileInformationFork ffo *flattenedFileObject } diff --git a/hotline/server.go b/hotline/server.go index 9cf93d0..ec83522 100644 --- a/hotline/server.go +++ b/hotline/server.go @@ -33,12 +33,6 @@ type requestCtx struct { name string } -const ( - userIdleSeconds = 300 // time in seconds before an inactive user is marked idle - idleCheckInterval = 10 // time in seconds to check for idle users - trackerUpdateFrequency = 300 // time in seconds between tracker re-registration -) - var nostalgiaVersion = []byte{0, 0, 2, 0x2c} // version ID used by the Nostalgia client type Server struct { diff --git a/hotline/server_test.go b/hotline/server_test.go index bf608e1..0eb76f0 100644 --- a/hotline/server_test.go +++ b/hotline/server_test.go @@ -41,7 +41,6 @@ func TestServer_handleFileTransfer(t *testing.T) { TrackerPassID [4]byte Stats *Stats FS FileStore - outbox chan Transaction mux sync.Mutex flatNewsMux sync.Mutex FlatNews []byte diff --git a/hotline/transaction.go b/hotline/transaction.go index 9800be3..8d7d9ed 100644 --- a/hotline/transaction.go +++ b/hotline/transaction.go @@ -240,5 +240,5 @@ func (t *Transaction) GetField(id int) Field { } func (t *Transaction) IsError() bool { - return bytes.Compare(t.ErrorCode, []byte{0, 0, 0, 1}) == 0 + return bytes.Equal(t.ErrorCode, []byte{0, 0, 0, 1}) } diff --git a/hotline/transaction_handlers.go b/hotline/transaction_handlers.go index 56f7afa..5a9ea5e 100644 --- a/hotline/transaction_handlers.go +++ b/hotline/transaction_handlers.go @@ -1293,7 +1293,7 @@ func HandleDelNewsItem(cc *ClientConn, t *Transaction) (res []Transaction, err e } } - if bytes.Compare(cats[delName].Type, []byte{0, 3}) == 0 { + if bytes.Equal(cats[delName].Type, []byte{0, 3}) { if !cc.Authorize(accessNewsDeleteCat) { return append(res, cc.NewErrReply(t, "You are not allowed to delete news categories.")), nil }