From 4f8b19c6866ae61c2ca36b7c9935669ee2089ef2 Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 21 Oct 2020 01:14:13 +0200 Subject: Add PingDelay option (irc) (#1269) --- bridge/irc/irc.go | 9 ++++++++- matterbridge.toml.sample | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index 2ac678e0..4be15b51 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -246,6 +246,13 @@ func (b *Birc) getClient() (*girc.Client, error) { debug = b.Log.Writer() } + pingDelay, err := time.ParseDuration(b.GetString("pingdelay")) + if err != nil || pingDelay == 0 { + pingDelay = time.Minute + } + + b.Log.Debugf("setting pingdelay to %s", pingDelay) + i := girc.New(girc.Config{ Server: server, ServerPass: b.GetString("Password"), @@ -255,7 +262,7 @@ func (b *Birc) getClient() (*girc.Client, error) { Name: b.GetString("Nick"), SSL: b.GetBool("UseTLS"), TLSConfig: &tls.Config{InsecureSkipVerify: b.GetBool("SkipTLSVerify"), ServerName: server}, //nolint:gosec - PingDelay: time.Minute, + PingDelay: pingDelay, // skip gIRC internal rate limiting, since we have our own throttling AllowFlood: true, Debug: debug, diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index c82b33ce..aab2f482 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -103,6 +103,12 @@ ColorNicks=false #OPTIONAL (default empty) RunCommands=["PRIVMSG user hello","PRIVMSG chanserv something"] +#PingDelay specifies how long to wait to send a ping to the irc server. +#You can use s for second, m for minute +#String +#OPTIONAL (default 1m) +PingDelay="1m" + #StripMarkdown strips markdown from messages #OPTIONAL (default false) StripMarkdown=false -- cgit v1.2.3