From: Luke Fitzgerald Date: Wed, 11 Aug 2010 17:49:09 +0000 (-0700) Subject: Add an config option to change the ping interval X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d2c72d8ae195525bcfb8f99c7f1e740fd3a84104;p=quix0rs-gnu-social.git Add an config option to change the ping interval --- diff --git a/plugins/Irc/IrcPlugin.php b/plugins/Irc/IrcPlugin.php index e073d6f13d..c555580c38 100644 --- a/plugins/Irc/IrcPlugin.php +++ b/plugins/Irc/IrcPlugin.php @@ -60,6 +60,7 @@ class IrcPlugin extends ImPlugin { public $channels = null; public $transporttype = null; public $encoding = null; + public $pinginterval = null; public $regcheck = null; public $unregregexp = null; @@ -359,6 +360,9 @@ class IrcPlugin extends ImPlugin { if (!isset($this->encoding)) { $this->encoding = 'UTF-8'; } + if (!isset($this->pinginterval)) { + $this->pinginterval = 120; + } if (!isset($this->regcheck)) { $this->regcheck = true; diff --git a/plugins/Irc/README b/plugins/Irc/README index bc45688f1e..0a5d9ea83f 100644 --- a/plugins/Irc/README +++ b/plugins/Irc/README @@ -23,6 +23,8 @@ nickservidentifyregexp: Override existing regexp matching request for identifica channels: Channels for bot to idle in transporttype: Set to 'ssl' to enable SSL encoding: Set to change encoding +pinginterval: Set to change the number of seconds between pings (helps keep the connection open) + Defaults to 120 seconds regcheck: Check user's nicknames are registered, enabled by default, set to false to disable regregexp: Override existing regexp matching response from NickServ if nick checked is registered. Must contain a capturing group catching the nick diff --git a/plugins/Irc/ircmanager.php b/plugins/Irc/ircmanager.php index 5c8e09e356..f036ef3091 100644 --- a/plugins/Irc/ircmanager.php +++ b/plugins/Irc/ircmanager.php @@ -78,7 +78,7 @@ class IrcManager extends ImManager { if ($this->messageWaiting) { return 1; } else { - return 120; + return $this->plugin->pinginterval; } } @@ -89,7 +89,7 @@ class IrcManager extends ImManager { */ public function idle() { // Send a ping if necessary - if (empty($this->lastPing) || time() - $this->lastPing > 120) { + if (empty($this->lastPing) || time() - $this->lastPing > $this->plugin->pinginterval) { $this->sendPing(); }