1
0
Fork 0
forked from External/ergo

capability: Add server-time

This commit is contained in:
Daniel Oaks 2016-08-13 22:04:21 +10:00
parent e04ef1ca11
commit ef592d160c
3 changed files with 13 additions and 0 deletions

View file

@ -343,6 +343,16 @@ func (client *Client) destroy() {
// Send sends an IRC line to the client.
func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
// attach server-time
if client.capabilities[ServerTime] {
if tags == nil {
tags = ircmsg.MakeTags("time", time.Now().Format(time.RFC3339))
} else {
(*tags)["time"] = ircmsg.MakeTagValue(time.Now().Format(time.RFC3339))
}
}
// send out the message
ircmsg := ircmsg.MakeMessage(tags, prefix, command, params...)
line, err := ircmsg.Line()
if err != nil {