5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-09 16:50:30 +00:00

Add PingDelay option (irc) (#1269)

This commit is contained in:
Wim 2020-10-21 01:14:13 +02:00 committed by GitHub
parent 84ab223b81
commit 4f8b19c686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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,

View File

@ -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