2015-11-12 09:07:53 +00:00
|
|
|
// Copyright 2015 Robert S. Gerus. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
2015-11-12 11:55:51 +00:00
|
|
|
|
2015-11-08 19:55:47 +00:00
|
|
|
package bot
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/arachnist/gorepost/irc"
|
|
|
|
)
|
|
|
|
|
2015-11-12 08:30:12 +00:00
|
|
|
// pingpong responds to server pings. IRC servers disconnect idle clients that
|
|
|
|
// don't respond to PINGs.
|
2015-11-29 14:50:31 +00:00
|
|
|
func pingpong(output func(irc.Message), msg irc.Message) {
|
|
|
|
output(irc.Message{
|
2015-11-08 19:55:47 +00:00
|
|
|
Command: "PONG",
|
|
|
|
Trailing: msg.Trailing,
|
2015-11-29 14:50:31 +00:00
|
|
|
})
|
2015-11-08 19:55:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2015-11-11 20:38:33 +00:00
|
|
|
addCallback("PING", "ping", pingpong)
|
2015-11-08 19:55:47 +00:00
|
|
|
}
|