implement version config option to override default ctcp version
This commit is contained in:
parent
b1b6facde1
commit
3a576d1db9
@ -36,7 +36,6 @@
|
||||
- [ ] `Client.AddTmpCallback()` for one time use callbacks?
|
||||
- [ ] add option to enable PRIVMSG/NOTICE text wrapping (and maybe per-default?) (`Config.DisableResponseWrap`?)
|
||||
- [ ] optional flood toggle which uses `EventLimiter` so the user doesn't have to implement it themselves?
|
||||
- [ ] allow users to supply a custom `VERSION` for the CTCP reply so they don't have to implement their own CTCP `VERSION` handler?
|
||||
- [ ] allow support for proxy URLs (passing to `golang.org/x/net/proxy`?)
|
||||
- [ ] allow users to specify a local/bind address using `net.Dialer{}.LocalAddr`
|
||||
- [ ] add more generic helpers: `Away()`, `Invite()`, `Kick()`, `Oper()`, generic `Ping()` and `Pong()`, `VHost()`, `Whois()` and `Who()`
|
||||
|
@ -74,6 +74,10 @@ type Config struct {
|
||||
// support. Only use this if DisableTracking and DisableCapTracking are
|
||||
// not enabled, otherwise you will need to handle CAP negotiation yourself.
|
||||
SupportedCaps []string
|
||||
// Version is the application version information that will be used in
|
||||
// response to a CTCP VERSION, if default CTCP replies have not been
|
||||
// overwritten or a VERSION handler was already supplied.
|
||||
Version string
|
||||
// ReconnectDelay is the a duration of time to delay before attempting a
|
||||
// reconnection. Defaults to 10s (minimum of 10s).
|
||||
ReconnectDelay time.Duration
|
||||
|
5
ctcp.go
5
ctcp.go
@ -251,6 +251,11 @@ func handleCTCPPong(client *Client, ctcp CTCPEvent) {
|
||||
// as the os type (darwin, linux, windows, etc) and architecture type (x86,
|
||||
// arm, etc).
|
||||
func handleCTCPVersion(client *Client, ctcp CTCPEvent) {
|
||||
if client.Config.Version != "" {
|
||||
client.SendCTCPReply(ctcp.Source.Name, CTCP_VERSION, client.Config.Version)
|
||||
return
|
||||
}
|
||||
|
||||
client.SendCTCPReplyf(
|
||||
ctcp.Source.Name, CTCP_VERSION,
|
||||
"girc (github.com/lrstanley/girc) using %s (%s, %s)",
|
||||
|
Loading…
Reference in New Issue
Block a user