mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
time command
This commit is contained in:
parent
f0305cf01a
commit
4d2d18caf1
@ -47,6 +47,7 @@ var (
|
|||||||
PRIVMSG: NewPrivMsgCommand,
|
PRIVMSG: NewPrivMsgCommand,
|
||||||
PROXY: NewProxyCommand,
|
PROXY: NewProxyCommand,
|
||||||
QUIT: NewQuitCommand,
|
QUIT: NewQuitCommand,
|
||||||
|
TIME: NewTimeCommand,
|
||||||
TOPIC: NewTopicCommand,
|
TOPIC: NewTopicCommand,
|
||||||
USER: NewUserCommand,
|
USER: NewUserCommand,
|
||||||
VERSION: NewVersionCommand,
|
VERSION: NewVersionCommand,
|
||||||
@ -932,3 +933,16 @@ func NewInviteCommand(args []string) (editableCommand, error) {
|
|||||||
channel: args[1],
|
channel: args[1],
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TimeCommand struct {
|
||||||
|
BaseCommand
|
||||||
|
target string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTimeCommand(args []string) (editableCommand, error) {
|
||||||
|
cmd := &TimeCommand{}
|
||||||
|
if len(args) > 0 {
|
||||||
|
cmd.target = args[0]
|
||||||
|
}
|
||||||
|
return cmd, nil
|
||||||
|
}
|
||||||
|
@ -54,6 +54,7 @@ const (
|
|||||||
PRIVMSG StringCode = "PRIVMSG"
|
PRIVMSG StringCode = "PRIVMSG"
|
||||||
PROXY StringCode = "PROXY"
|
PROXY StringCode = "PROXY"
|
||||||
QUIT StringCode = "QUIT"
|
QUIT StringCode = "QUIT"
|
||||||
|
TIME StringCode = "TIME"
|
||||||
TOPIC StringCode = "TOPIC"
|
TOPIC StringCode = "TOPIC"
|
||||||
USER StringCode = "USER"
|
USER StringCode = "USER"
|
||||||
VERSION StringCode = "VERSION"
|
VERSION StringCode = "VERSION"
|
||||||
|
@ -374,6 +374,11 @@ func (target *Client) RplInviting(invitee *Client, channel string) {
|
|||||||
"%s %s", invitee.Nick(), channel)
|
"%s %s", invitee.Nick(), channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (target *Client) RplTime() {
|
||||||
|
target.NumericReply(RPL_TIME,
|
||||||
|
"%s :%s", target.server.name, time.Now().Format(time.RFC1123))
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// errors (also numeric)
|
// errors (also numeric)
|
||||||
//
|
//
|
||||||
|
@ -791,3 +791,11 @@ func (msg *InviteCommand) HandleServer(server *Server) {
|
|||||||
|
|
||||||
channel.Invite(target, client)
|
channel.Invite(target, client)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (msg *TimeCommand) HandleServer(server *Server) {
|
||||||
|
if (msg.target != "") && (msg.target != server.name) {
|
||||||
|
msg.Client().ErrNoSuchServer(msg.target)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
msg.Client().RplTime()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user