forked from External/ergo
minimal who command
This commit is contained in:
parent
d8951e1b48
commit
d370abcd4c
4 changed files with 72 additions and 1 deletions
|
|
@ -35,6 +35,7 @@ var (
|
|||
"QUIT": NewQuitCommand,
|
||||
"TOPIC": NewTopicCommand,
|
||||
"USER": NewUserMsgCommand,
|
||||
"WHO": NewWhoCommand,
|
||||
"WHOIS": NewWhoisCommand,
|
||||
}
|
||||
)
|
||||
|
|
@ -485,7 +486,7 @@ type WhoisCommand struct {
|
|||
masks []string
|
||||
}
|
||||
|
||||
// [ <target> ] <mask> *( "," <mask> )
|
||||
// WHOIS [ <target> ] <mask> *( "," <mask> )
|
||||
func NewWhoisCommand(args []string) (EditableCommand, error) {
|
||||
if len(args) < 1 {
|
||||
return nil, NotEnoughArgsError
|
||||
|
|
@ -506,3 +507,24 @@ func NewWhoisCommand(args []string) (EditableCommand, error) {
|
|||
masks: strings.Split(masks, ","),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type WhoCommand struct {
|
||||
BaseCommand
|
||||
mask string
|
||||
operatorOnly bool
|
||||
}
|
||||
|
||||
// WHO [ <mask> [ "o" ] ]
|
||||
func NewWhoCommand(args []string) (EditableCommand, error) {
|
||||
cmd := &WhoCommand{}
|
||||
|
||||
if len(args) > 0 {
|
||||
cmd.mask = args[0]
|
||||
}
|
||||
|
||||
if (len(args) > 1) && (args[1] == "o") {
|
||||
cmd.operatorOnly = true
|
||||
}
|
||||
|
||||
return cmd, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue