]> git.r.bdr.sh - rbdr/mobius/commitdiff
Clean up some linter warnings
authorJeff Halter <redacted>
Thu, 15 Sep 2022 20:51:37 +0000 (13:51 -0700)
committerJeff Halter <redacted>
Thu, 15 Sep 2022 20:51:37 +0000 (13:51 -0700)
hotline/access.go
hotline/config.go
hotline/field.go
hotline/file_wrapper.go
hotline/server.go
hotline/server_test.go
hotline/transaction.go
hotline/transaction_handlers.go

index e2e728caf9c7a136ac2f8b97f06ad12f77cefe69..90740fc16fafd77e75338b52252061afdf00b52f 100644 (file)
@@ -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)
index aeae27534716eb6d11af1ec9856a2e8981f0bc1b..a30bbf77465c1a21dd6a9e04fb2ef5bfc0a6b45b 100644 (file)
@@ -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
index c9db3d9adce3418f5d5a83bb261635eb403500b6..3378552a8f0da2408691919cc16d53e85d61a9f2 100644 (file)
@@ -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
index f3fd55947d97b8c75403f16c5037b65da2df3060..b55e9f42acf98e5937e3376a5378dd03e881bdcf 100644 (file)
@@ -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
 }
index 9cf93d0edead8eb6ba75eee603ac4c34b053d349..ec835228607d8f3052d858b24a2c9b8b1320a914 100644 (file)
@@ -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 {
index bf608e1c3da5992255d55b6a1d44ff74ba143b70..0eb76f0768e27c67c236c2460f2b7da8c24d23a2 100644 (file)
@@ -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
index 9800be3f336dea1b2234f614c885faa9c3a2a02d..8d7d9ed43b60ac41a296bca25c9224ad1172c763 100644 (file)
@@ -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})
 }
index 56f7afa0d90f1f1c24f5ff81a08fc341420184f7..5a9ea5ef40400ae19dbbe427420d010555c72adb 100644 (file)
@@ -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
                }