diff options
author | Luke Fitzgerald <lw.fitzgerald@googlemail.com> | 2010-08-11 10:49:09 -0700 |
---|---|---|
committer | Luke Fitzgerald <lw.fitzgerald@googlemail.com> | 2010-08-11 10:49:09 -0700 |
commit | d2c72d8ae195525bcfb8f99c7f1e740fd3a84104 (patch) | |
tree | c369d47bb532450bdc00237c834927d25775b666 | |
parent | daa3fef96dc709b9aca1fb44802c45612320987f (diff) |
Add an config option to change the ping interval
-rw-r--r-- | plugins/Irc/IrcPlugin.php | 4 | ||||
-rw-r--r-- | plugins/Irc/README | 2 | ||||
-rw-r--r-- | plugins/Irc/ircmanager.php | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/plugins/Irc/IrcPlugin.php b/plugins/Irc/IrcPlugin.php index e073d6f13..c555580c3 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 bc45688f1..0a5d9ea83 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 5c8e09e35..f036ef309 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(); } |