From 56ef5b0f3025f2af8eb1a83f12fc86ca3e63cb8f Mon Sep 17 00:00:00 2001 From: Kevin Lyda <kevin@lyda.ie> Date: Fri, 9 May 2025 15:15:49 +0100 Subject: [PATCH] More set/show --- NOTES.md | 4 +- repl/command.go | 124 +++++++++++++++++++++++++++++++++--------------- repl/set.go | 102 +++++++++++++++++++++++++++++++++++++++ repl/show.go | 38 ++++++++++++++- 4 files changed, 226 insertions(+), 42 deletions(-) diff --git a/NOTES.md b/NOTES.md index dcea2db..8df25d9 100644 --- a/NOTES.md +++ b/NOTES.md @@ -32,7 +32,7 @@ repl.commands? * Messages: ~~ADD~~, CURRENT, ~~DIRECTORY~~, BACK, CHANGE, FIRST, REMOVE, NEXT, ~~READ~~ * Messages edit: CHANGE, REPLY, FORWARD * Moving messages: COPY, MOVE - * Compound commands: SET and SHOW + * Compound commands: SET and SHOW - make HELP work for them. * Mail: MAIL, FORWARD, * Implement batch jobs * ~~Editor - need an embedded editor~~ Implemented using tview; good enough @@ -60,7 +60,7 @@ repl.commands? * Commands for a local mail system? * Commands to connect to Mattermost or mastodon? * Commands to manage users. - * `SHOW VERSION` - [versioninfo](https://github.com/earthboundkid/versioninfo) will work for go install. + * ~~SHOW VERSION~~ * Check db version; notify user if it changes; refuse to write to db if it has. ## Module links diff --git a/repl/command.go b/repl/command.go index 9472a1c..88e4f1b 100644 --- a/repl/command.go +++ b/repl/command.go @@ -891,8 +891,8 @@ will be displayed. However, if there are new messages, the first new message will be displayed. Each time you enter the command, the next page, or if there are no more pages, the next message will be displayed. - Format: - READ [message-number] + Format: + READ [message-number] The message's relative number is found by the DIRECTORY command. If you specify a number greater than the number of messages in the folder, the @@ -976,8 +976,8 @@ the help on the SEEN command.`, Description: `Removes a folder. Only the owner of a folder or a privileged user can remove the folder. - Format: - REMOVE folder-name`, + Format: + REMOVE folder-name`, MinArgs: 1, MaxArgs: 1, Action: ActionRemove, @@ -987,8 +987,8 @@ remove the folder. read message with "RE:" preceeding it. Format and qualifiers is exactly the same as the ADD command except for /NOINDENT and /EXTRACT. - Format: - REPLY [file-name]`, + Format: + REPLY [file-name]`, MaxArgs: 1, Action: ActionReply, Flags: dclish.Flags{ @@ -1014,8 +1014,8 @@ the same as the ADD command except for /NOINDENT and /EXTRACT. Description: `Invokes the VAX/VMS Personal Mail Utility (MAIL) to send a reply mail message to the owner of the currently read message. - Format: - RESPOND [file-name] + Format: + RESPOND [file-name] If you wish to use another method for sending the mail, define BULL_MAILER to point to a command procedure. This procedure will then be @@ -1078,8 +1078,8 @@ username and subject of the message.`, Description: `Searches the currently selected folder for the message containing the first occurrence of the specified text string. - Format: - SEARCH [search-string] + Format: + SEARCH [search-string] The search starts from the first message in the current folder. The search includes both the text of the message, and the description @@ -1183,8 +1183,8 @@ message.`, Description: `The SET command is used with other commands to define or change characteristics of the BULLETIN Utility. - Format: - SET option`, + Format: + SET option`, Commands: dclish.Commands{ "ACCESS": { Description: `Controls access to a private folder. A private folder can only be @@ -1348,8 +1348,8 @@ If no expiration date is entered when prompted for a date, or if prompting has been disabled via SET NOPROMPT_EXPIRE, this value will be used. - Format: - SET DEFAULT_EXPIRE days + Format: + SET DEFAULT_EXPIRE days If -1 is specified, messages will become permanent. If 0 is specified, no default expiration date will be present. The latter should never be @@ -1478,8 +1478,8 @@ the folder was created by the owner. In order to apply this to a specific folder, first select the folder (using the SELECT command), and then enter the SET READNEW command. - Format: - SET [NO]READNEW + Format: + SET READNEW NOTE: If you have several folders with READNEW enabled, each folder's messages will be displayed separately. However, if you EXIT the READNEW @@ -1503,12 +1503,6 @@ SYSTEM for a description of a SYSTEM folder).`, folder. This is a privileged qualifier. It will only affect brand new users (or those that have never logged in). Use /ALL to modify all users.`, - }, - "/FOLDER": { - Description: `/FOLDER=foldername - - Specifies the folder for which the option is to modified. If not - specified, the selected folder is modified. Valid only with NOREADNEW.`, }, "/PERMANENT": { Description: `/[NO]PERMANENT @@ -1518,6 +1512,42 @@ SYSTEM for a description of a SYSTEM folder).`, }, }, }, + "NOREADNEW": { + Description: `Turns off READNEW. + Format: + SET NOREADNEW + +NOTE: If you have several folders with READNEW enabled, each folder's +messages will be displayed separately. However, if you EXIT the READNEW +mode before all the folders have been displayed, you will not be alerted +of the new messages in the undisplayed folders the next time you login. +However, if you enter BULLETIN, you will be told that new messages are +present in those other folders. Also, it is not possible to EXIT the +READNEW mode if there are SYSTEM folders which have new messages. Typing +the EXIT command will cause you to skip to those folders. (See HELP SET +SYSTEM for a description of a SYSTEM folder).`, + Flags: dclish.Flags{ + "/ALL": { + Description: ` Specifies that the SET [NO]READNEW option is the default for all users + for the specified folder. This is a privileged qualifier. The + difference between this and /DEFAULT is that the latter will only + apply to new users (i.e. any users which have never executed + BULLETIN).`, + }, + "/DEFAULT": { + Description: ` Specifies that the [NO]READNEW option is the default for the specified + folder. This is a privileged qualifier. It will only affect brand new + users (or those that have never logged in). Use /ALL to modify all + users.`, + }, + "/FOLDER": { + Description: `/FOLDER=foldername + + Specifies the folder for which the option is to modified. If not + specified, the selected folder is modified.`, + }, + }, + }, "SHOWNEW": { Description: `Controls whether a directory listing of new messages for the current folder will be displayed when logging in. This is similar to READNEW, @@ -1529,18 +1559,44 @@ accessing BULLETIN. In order to apply this to a specific folder, first select the folder (using the SELECT command), and then enter the SET SHOWNEW command. - Format: - SET [NO]SHOWNEW`, + Format: + SET SHOWNEW`, Flags: dclish.Flags{ "/ALL": { - Description: ` Specifies that the SET [NO]SHOWNEW option is the default for all users + Description: ` Specifies that the SET SHOWNEW option is the default for all users for + the specified folder. This is a privileged qualifier. The difference + between this and /DEFAULT is that the latter will only apply to new + users (i.e. any users which have never executed BULLETIN).`, + }, + "/DEFAULT": { + Description: ` Specifies that the SHOWNEW option is the default for the specified + folder. This is a privileged qualifier. It will only affect brand new + users (or those that have never logged in). Use /ALL to modify all + users.`}, + "/PERMANENT": { + Description: `/[NO]PERMANENT + + Specifies that SHOWNEW is a permanent flag and cannot be changed by + the individual, except if changing to READNEW. This is a privileged + qualifier.`, + }, + }, + }, + "NOSHOWNEW": { + Description: `Turns off SHOWNEW + + Format: + SET NOSHOWNEW`, + Flags: dclish.Flags{ + "/ALL": { + Description: ` Specifies that the SET NOSHOWNEW option is the default for all users for the specified folder. This is a privileged qualifier. The difference between this and /DEFAULT is that the latter will only apply to new users (i.e. any users which have never executed BULLETIN).`, }, "/DEFAULT": { - Description: ` Specifies that the [NO]SHOWNEW option is the default for the specified + Description: ` Specifies that the NOSHOWNEW option is the default for the specified folder. This is a privileged qualifier. It will only affect brand new users (or those that have never logged in). Use /ALL to modify all users.`, @@ -1549,14 +1605,7 @@ In order to apply this to a specific folder, first select the folder Description: `/FOLDER=foldername Specifies the folder for which the option is to modified. If not - specified, the selected folder is modified. Valid only with NOSHOWNEW.`, - }, - "/PERMANENT": { - Description: `/[NO]PERMANENT - - Specifies that SHOWNEW is a permanent flag and cannot be changed by - the individual, except if changing to READNEW. This is a privileged - qualifier.`, + specified, the selected folder is modified.`, }, }, }, @@ -1565,7 +1614,7 @@ In order to apply this to a specific folder, first select the folder is allowed to have SYSTEM and SHUTDOWN messages added to it. This is a privileged command. - Format: + Format: SET [NO]SYSTEM By default, the GENERAL folder is a SYSTEM folder, and the setting for @@ -1593,6 +1642,7 @@ the SELECT command, information about that folder is shown. Format: SHOW FOLDER [folder-name]`, + MaxArgs: 1, Flags: dclish.Flags{ "/FULL": { Description: ` Control whether all information of the folder is displayed. This @@ -1604,9 +1654,7 @@ the SELECT command, information about that folder is shown. }, "NEW": { Description: `Shows folders which have new unread messages for which BRIEF or READNEW -have been set. (Note: If you enter BULLETIN but do not read new unread -messages, you will not be notified about them the next time you enter -BULLETIN. This is a design "feature" and cannot easily be changed.)`, +have been set.`, }, "PRIVILEGES": { Description: `Shows the privileges necessary to use privileged commands. Also shows diff --git a/repl/set.go b/repl/set.go index 4b296bc..f87749f 100644 --- a/repl/set.go +++ b/repl/set.go @@ -10,6 +10,48 @@ import ( "git.lyda.ie/kevin/bulletin/dclish" ) +// ActionSetAccess handles the `SET ACCESS` command. +func ActionSetAccess(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetAccess.") + return nil +} + +// ActionSetAlways handles the `SET ALWAYS` command. +func ActionSetAlways(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetAlways.") + return nil +} + +// ActionSetNoalways handles the `SET NOALWAYS` command. +func ActionSetNoalways(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetNoalways.") + return nil +} + +// ActionSetBrief handles the `SET BRIEF` command. +func ActionSetBrief(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetBrief.") + return nil +} + +// ActionSetNobrief handles the `SET NOBRIEF` command. +func ActionSetNobrief(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetNobrief.") + return nil +} + +// ActionSetDefaultExpire handles the `SET DEFAULT_EXPIRE` command. +func ActionSetDefaultExpire(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetDefaultExpire.") + return nil +} + +// ActionSetExpireLimit handles the `SET EXPIRE_LIMIT` command. +func ActionSetExpireLimit(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetExpireLimit.") + return nil +} + // ActionSetFolder handles the `SET FOLDER` command. This selects a folder. func ActionSetFolder(cmd *dclish.Command) error { if len(cmd.Args) != 1 { @@ -33,3 +75,63 @@ func ActionSetFolder(cmd *dclish.Command) error { // WRITE(6,'('' See '',A,'' if you wish to access folder.'')') return errors.New("Unable to select the folder") } + +// ActionSetNotify handles the `SET NOTIFY` command. +func ActionSetNotify(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetNotify.") + return nil +} + +// ActionSetNonotify handles the `SET NONOTIFY` command. +func ActionSetNonotify(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetNonotify.") + return nil +} + +// ActionSetPrivileges handles the `SET PRIVILEGES` command. +func ActionSetPrivileges(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetPrivileges.") + return nil +} + +// ActionSetPromptExpire handles the `SET PROMPT_EXPIRE` command. +func ActionSetPromptExpire(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetPromptExpire.") + return nil +} + +// ActionSetNoPromptExpire handles the `SET NOPROMPT_EXPIRE` command. +func ActionSetNoPromptExpire(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetNopromptExpire.") + return nil +} + +// ActionSetReadNew handles the `SET READNEW` command. +func ActionSetReadNew(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetReadNew.") + return nil +} + +// ActionSetNoReadNew handles the `SET READNEW` command. +func ActionSetNoReadNew(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetNoReadNew.") + return nil +} + +// ActionSetShowNew handles the `SET SHOWNEW` command. +func ActionSetShowNew(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetShowNew.") + return nil +} + +// ActionSetNoShowNew handles the `SET SHOWNEW` command. +func ActionSetNoShowNew(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetNoShowNew.") + return nil +} + +// ActionSetSystem handles the `SET SYSTEM` command. +func ActionSetSystem(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionSetSystem.") + return nil +} diff --git a/repl/show.go b/repl/show.go index 1ffa725..b3c4df2 100644 --- a/repl/show.go +++ b/repl/show.go @@ -9,9 +9,43 @@ import ( "git.lyda.ie/kevin/bulletin/dclish" ) -// ActionShowVersion handles the `SHOW VERSION` command. This selects a folder. +// ActionShowFlags handles the `SHOW FLAGS` command. +func ActionShowFlags(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionShowFlags.") + return nil +} + +// ActionShowFolder handles the `SHOW FOLDER` command. +func ActionShowFolder(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionShowFolder.") + return nil +} + +// ActionShowNew handles the `SHOW NEW` command. +func ActionShowNew(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionShowNew.") + return nil +} + +// ActionShowPrivileges handles the `SHOW PRIVILEGES` command. +func ActionShowPrivileges(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionShowPrivileges.") + return nil +} + +// ActionShowUser handles the `SHOW USER` command. +func ActionShowUser(_ *dclish.Command) error { + fmt.Println("TODO: implement ActionShowUser.") + return nil +} + +// ActionShowVersion handles the `SHOW VERSION` command. func ActionShowVersion(_ *dclish.Command) error { - fmt.Printf("BULLETIN Version %s\n", versioninfo.Version) + rev := versioninfo.Revision + if len(rev) > 7 { + rev = rev[len(rev)-7:] + } + fmt.Printf("BULLETIN Version 2.0.7g (%s)\n", rev) fmt.Printf("Linked on %s\n", versioninfo.LastCommit.Format("2006-05-04 15:02:01")) return nil -- GitLab