Add auto_ctcp config option

This commit is contained in:
Ken-Håvard Lieng 2020-06-16 01:22:23 +02:00
parent fcf0c17682
commit 2ea4584c97
6 changed files with 17 additions and 5 deletions

View file

@ -25,6 +25,8 @@ type Config struct {
Account string
Password string
// Automatically reply to common CTCP messages
AutoCTCP bool
// Version is the reply to VERSION and FINGER CTCP messages
Version string
// Source is the reply to SOURCE CTCP messages

View file

@ -58,8 +58,10 @@ func (c *Client) handleMessage(msg *Message) {
msg.meta = c.state.renameUser(msg.Sender, msg.LastParam())
case PRIVMSG:
if ctcp := msg.ToCTCP(); ctcp != nil {
c.handleCTCP(ctcp, msg)
if c.Config.AutoCTCP {
if ctcp := msg.ToCTCP(); ctcp != nil {
c.handleCTCP(ctcp, msg)
}
}
case MODE: