mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 17:58:59 +00:00
Added IRCScraper from nZEDb, must be run manualy.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class Net_SmartIRC_module_PingFix
|
||||
{
|
||||
public $name = 'PingFix';
|
||||
public $version = '1.0';
|
||||
public $description = 'An active-pinging system to keep the bot from dropping the connection';
|
||||
public $author = 'Garrett W.';
|
||||
public $license = 'LGPL';
|
||||
|
||||
private $irc;
|
||||
private $thid;
|
||||
|
||||
function __construct (&$irc) {
|
||||
$this->irc = $irc;
|
||||
$this->thid = $this->irc->registerTimehandler(
|
||||
$this->irc->_rxtimeout/8*1000, $this, 'pingCheck'
|
||||
);
|
||||
}
|
||||
|
||||
function __destruct () {
|
||||
$this->irc->unregisterTimeid($this->thid);
|
||||
}
|
||||
|
||||
function pingCheck () {
|
||||
if (time() - $this->irc->_lastrx > $this->irc->_rxtimeout) {
|
||||
$this->irc->reconnect();
|
||||
$this->irc->_lastrx = time();
|
||||
} elseif (time() - $this->irc->_lastrx > $this->irc->_rxtimeout/2) {
|
||||
$this->irc->_send('PING '.$this->irc->_address, SMARTIRC_CRITICAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user