Loading NOTES.md +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ Switch between MAIL and BULLETIN modes? MAIL commands are documented * Review sql queries and clean out the ones not used. * Review sql queries and find duplicates. * Use [dupl](https://github.com/mibk/dupl) to find things to generalise. There's a `make dupl` target. * flag abbreviations with values don't seem to work? Polishing. Review each command and put a + next to each as it is Loading repl/folders.go +14 −5 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ func ActionCreate(cmd *dclish.Command) error { } // ActionSelect handles the `SELECT` command. This selects a folder. // This is based on `SELECT_FOLDER` in bulletin5.for. func ActionSelect(cmd *dclish.Command) error { if strings.Contains(cmd.Args[0], "%") { return errors.New("Folder name cannot contain a %") Loading @@ -133,23 +134,31 @@ func ActionSelect(cmd *dclish.Command) error { fmt.Printf("Folder has been set to '%s'.\n", folder.Name) return nil } // TODO: Should be: // WRITE(6,'('' You are not allowed to access folder.'')') // WRITE(6,'('' See '',A,'' if you wish to access folder.'')') return errors.New("Unable to select the folder") } // ActionModify handles the `MODIFY` command. This modifies a folder. // This is based on `MODIFY_FOLDER` in bulletin1.for. func ActionModify(cmd *dclish.Command) error { if this.User.Login != this.Folder.Owner && this.User.Admin == 0 { return errors.New("Must be folder owner or admin to modify the folder") } var err error description := this.Folder.Description if cmd.Flags["/DESCRIPTION"].Set { description = cmd.Flags["/DESCRIPTION"].Value description, err = ask.GetLine("Enter one line description of folder: ") if err != nil { return err } if len(description) > 53 { return errors.New("Description must be < 53 characters") } } owner := this.Folder.Owner if cmd.Flags["/OWNER"].Set { if this.User.Admin == 0 { return errors.New("Must be an admin to modify the folder owner") } owner = cmd.Flags["/OWNER"].Value } name := this.Folder.Name Loading @@ -161,7 +170,7 @@ func ActionModify(cmd *dclish.Command) error { } ctx := storage.Context() err := this.Q.UpdateFolderMain(ctx, storage.UpdateFolderMainParams{ err = this.Q.UpdateFolderMain(ctx, storage.UpdateFolderMainParams{ Description: description, Owner: owner, NewName: name, Loading Loading
NOTES.md +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ Switch between MAIL and BULLETIN modes? MAIL commands are documented * Review sql queries and clean out the ones not used. * Review sql queries and find duplicates. * Use [dupl](https://github.com/mibk/dupl) to find things to generalise. There's a `make dupl` target. * flag abbreviations with values don't seem to work? Polishing. Review each command and put a + next to each as it is Loading
repl/folders.go +14 −5 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ func ActionCreate(cmd *dclish.Command) error { } // ActionSelect handles the `SELECT` command. This selects a folder. // This is based on `SELECT_FOLDER` in bulletin5.for. func ActionSelect(cmd *dclish.Command) error { if strings.Contains(cmd.Args[0], "%") { return errors.New("Folder name cannot contain a %") Loading @@ -133,23 +134,31 @@ func ActionSelect(cmd *dclish.Command) error { fmt.Printf("Folder has been set to '%s'.\n", folder.Name) return nil } // TODO: Should be: // WRITE(6,'('' You are not allowed to access folder.'')') // WRITE(6,'('' See '',A,'' if you wish to access folder.'')') return errors.New("Unable to select the folder") } // ActionModify handles the `MODIFY` command. This modifies a folder. // This is based on `MODIFY_FOLDER` in bulletin1.for. func ActionModify(cmd *dclish.Command) error { if this.User.Login != this.Folder.Owner && this.User.Admin == 0 { return errors.New("Must be folder owner or admin to modify the folder") } var err error description := this.Folder.Description if cmd.Flags["/DESCRIPTION"].Set { description = cmd.Flags["/DESCRIPTION"].Value description, err = ask.GetLine("Enter one line description of folder: ") if err != nil { return err } if len(description) > 53 { return errors.New("Description must be < 53 characters") } } owner := this.Folder.Owner if cmd.Flags["/OWNER"].Set { if this.User.Admin == 0 { return errors.New("Must be an admin to modify the folder owner") } owner = cmd.Flags["/OWNER"].Value } name := this.Folder.Name Loading @@ -161,7 +170,7 @@ func ActionModify(cmd *dclish.Command) error { } ctx := storage.Context() err := this.Q.UpdateFolderMain(ctx, storage.UpdateFolderMainParams{ err = this.Q.UpdateFolderMain(ctx, storage.UpdateFolderMainParams{ Description: description, Owner: owner, NewName: name, Loading