cvs: pearbot / PEARbot.php

From: Date: Fri, 25 Jul 2003 11:38:13 +0000
Subject: cvs: pearbot / PEARbot.php
Groups: php.pear.bot 
Request: Send a blank email to pear-bot+get-11@lists.php.net to get a copy of this message
meebey Fri Jul 25 07:38:13 2003 EDT Modified files: /pearbot PEARbot.php Log: - added some PEAR CS. - optimized reverseverify(). - fixed bug in onjoin(), channel name check needs to be strtolower()ed. Index: pearbot/PEARbot.php diff -u pearbot/PEARbot.php:1.6 pearbot/PEARbot.php:1.7 --- pearbot/PEARbot.php:1.6 Sun Apr 27 16:20:23 2003 +++ pearbot/PEARbot.php Fri Jul 25 07:38:13 2003 @@ -1,7 +1,7 @@ #!/home/meebey/php <?php /** - * $Id: PEARbot.php,v 1.6 2003/04/27 20:20:23 meebey Exp $ + * $Id: PEARbot.php,v 1.7 2003/07/25 11:38:13 meebey Exp $ * * PEARbot * this is an IRC service bot for #pear written in PHP @@ -72,6 +72,8 @@ if ($userip == $dbip) { if ($dbnickname != $nick) { $foundnick = $dbnickname; + } else { + $foundnick = $nick; } break; @@ -79,15 +81,10 @@ } if ($foundnick !== false) { - $result = $this->verify($irc, $foundnick, $nick); + return $foundnick; } else { - $result = $this->verify($irc, $nick); - } - - if ($result !== false) - return $result; - else return false; + } } function verify(&$irc, $nickname, $ircnickname = null) @@ -122,7 +119,7 @@ } } - + return false; } } @@ -130,10 +127,11 @@ function onjoin(&$irc, &$data) { // don't verify ourself - if (strpos($data->nick, $irc->_nick) !== false) + if ($data->nick == $irc->_nick) { return; + } - if ($data->channel == '#pear') { + if (strtolower($data->channel) == '#pear') { $result = $this->reverseverify($irc, $data->host, $data->nick); if ($result !== false) { @@ -151,7 +149,7 @@ $requester = $data->nick; $lookupfor = $data->messageex[1]; $lowerlookupfor = strtolower($data->messageex[1]); - + if (isset($irc->channel['#pear']->users[$lowerlookupfor])) { $host = $irc->channel['#pear']->users[$lowerlookupfor]->host; } else { @@ -160,9 +158,10 @@ } $result = $this->reverseverify($irc, $host, $lookupfor); - - if ($result !== false) - $irc->message(SMARTIRC_TYPE_CHANNEL, '#pear', $requester.": ".$lookupfor." is ".$result); + + if ($result !== false) { + $irc->message(SMARTIRC_TYPE_CHANNEL, '#pear', $requester.": ".$lookupfor." is ".$result); + } } }

« previous php.pear.bot (#11) next »