diff --git a/repl/args.go b/repl/args.go index dd8845509ba00d43c1ccee4cdc150ab41452146d..e9931556f2e370d335f11a68147561dacd2bd852 100644 --- a/repl/args.go +++ b/repl/args.go @@ -4,6 +4,7 @@ import ( "fmt" "strconv" "strings" + "time" ) // ParseNumberList takes a string with a number list @@ -41,3 +42,8 @@ func ParseNumberList(input string) ([]int64, error) { } return result, nil } + +// ParseDate converts a "yyyy-mm-dd" formatted string to time.Time. +func ParseDate(arg string) (time.Time, error) { + return time.Parse("2006-01-02", arg) +} diff --git a/repl/command.go b/repl/command.go index 074fdcf18d4adac2b8fb6b5e4186d2e80108e5f4..155216091ba65092a202f13850f81d69c139d40b 100644 --- a/repl/command.go +++ b/repl/command.go @@ -1630,6 +1630,7 @@ sites make BULLETIN/LOGIN an optional command for users to store in their own LOGIN.COM, so this command can be used to show which users have done this.`, MaxArgs: 1, + Action: ActionShowUser, Flags: dclish.Flags{ "/ALL": { Description: ` Specifies that information for all users is to be displayed. This is a @@ -1658,14 +1659,6 @@ have done this.`, specified, the date of the current message is used. Only valid for folders or with /LOGIN. Use /START for newsgroups.`, }, - "/START": { - Description: `/START=[number] - - Specifies to display only those users whose latest read message number - is equal to or greather than the specified number. If no number is - specified, the message number of the current message is used. Only - valid for newsgroups. Use /SINCE for folders and with /LOGIN.`, - }, }, }, "VERSION": { diff --git a/repl/show.go b/repl/show.go index f800729579d7cf967be9bb0464051a9a5963e26f..3f4a05ec6081523c2dbcdc746593345fc6d72075 100644 --- a/repl/show.go +++ b/repl/show.go @@ -118,8 +118,10 @@ func ActionShowPrivileges(_ *dclish.Command) error { func ActionShowUser(cmd *dclish.Command) error { showAll := false if cmd.Flags["/ALL"].Value == "true" { - // TODO: Check permissions. showAll = true + // TODO: Check permissions. + fmt.Println("ERROR: No privs to use command.") + return nil } showLogin := false if cmd.Flags["/LOGIN"].Value == "true" { @@ -131,9 +133,16 @@ func ActionShowUser(cmd *dclish.Command) error { // TODO: Check permissions. folder = folders.FindFolder(cmd.Flags["/FOLDER"].Value) } - since := cmd.Flags["/FOLDER"].Value + if cmd.Flags["/FOLDER"].Value != "" { + since, err := ParseDate(cmd.Flags["/FOLDER"].Value) + if err != nil { + fmt.Println("ERROR: Invalid date specified.") + return nil + } + fmt.Printf("TODO: select messages since %s.\n", since.Format("2006-05-04")) + } fmt.Println("TODO: implement ActionShowUser.") - fmt.Printf("TODO: %t %t %s %s.\n", showAll, showLogin, folder.Name, since) + fmt.Printf("TODO: %t %t %s.\n", showAll, showLogin, folder.Name) return nil }