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

@ -112,6 +112,7 @@ func init() {
viper.BindPFlags(rootCmd.PersistentFlags())
viper.BindPFlags(rootCmd.Flags())
viper.SetDefault("auto_ctcp", true)
viper.SetDefault("verify_certificates", true)
viper.SetDefault("https.enabled", true)
viper.SetDefault("https.port", 443)

View File

@ -3,6 +3,10 @@ address = ""
port = 80
# Hex encode the users IP and use it as the ident
hexIP = false
# Automatically reply to common CTCP messages
auto_ctcp = true
# Verify the certificate chain presented by the IRC server, if this check fails
# the user will be able to choose to still connect
verify_certificates = true
# Defaults for the client connect form
@ -63,11 +67,11 @@ secret = ""
[dcc]
# Receive files through DCC, the user gets to choose if they want to accept the file,
# the file then gets streamed to the user
# the file download then gets proxied to the user
enabled = true
[dcc.autoget]
# Instead of streaming the file to the user, dispatch automatically downloads
# Instead of proxying the file download directly to the user, dispatch automatically downloads
# DCC files and sends a download link to the user once its done
enabled = false
# Delete the file after the user has downloaded it once
@ -75,7 +79,7 @@ delete = true
# Delete the file after a certain time period of inactivity, not implemented yet
delete_after = "30m"
# Strict-Transport-Security
# HTTP Strict-Transport-Security
[https.hsts]
enabled = false
max_age = 31536000

View File

@ -13,6 +13,7 @@ type Config struct {
Port string
Dev bool
HexIP bool
AutoCTCP bool `mapstructure:"auto_ctcp"`
VerifyCertificates bool `mapstructure:"verify_certificates"`
Headers map[string]string
Defaults Defaults

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:

View File

@ -30,7 +30,9 @@ func createNickInUseHandler(i *irc.Client, state *State) func(string) string {
func connectIRC(network *storage.Network, state *State, srcIP []byte) *irc.Client {
cfg := state.srv.Config()
ircCfg := network.IRCConfig()
ircCfg.AutoCTCP = cfg.AutoCTCP
if ircCfg.TLS {
ircCfg.TLSConfig = &tls.Config{