Add an config option to change the ping interval

This commit is contained in:
Luke Fitzgerald 2010-08-11 10:49:09 -07:00
parent daa3fef96d
commit d2c72d8ae1
3 changed files with 8 additions and 2 deletions

View File

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

View File

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

View File

@ -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();
}