cvs: pearbot / PEARbot.php

From: Date: Fri, 25 Jul 2003 15:17:28 +0000
Subject: cvs: pearbot / PEARbot.php
Groups: php.pear.bot 
Request: Send a blank email to pear-bot+get-13@lists.php.net to get a copy of this message
meebey Fri Jul 25 11:17:28 2003 EDT Modified files: /pearbot PEARbot.php Log: - updated pear2username() method for MDB. Index: pearbot/PEARbot.php diff -u pearbot/PEARbot.php:1.8 pearbot/PEARbot.php:1.9 --- pearbot/PEARbot.php:1.8 Fri Jul 25 10:59:06 2003 +++ pearbot/PEARbot.php Fri Jul 25 11:17:28 2003 @@ -1,7 +1,7 @@ #!/home/meebey/php <?php /** - * $Id: PEARbot.php,v 1.8 2003/07/25 14:59:06 meebey Exp $ + * $Id: PEARbot.php,v 1.9 2003/07/25 15:17:28 meebey Exp $ * * PEARbot * this is an IRC service bot for #pear written in PHP @@ -43,9 +43,16 @@ function nick2pearusername(&$irc, $nickname) { + global $mdb; + $query = "SELECT pearusername FROM dnsentries WHERE nickname='".$nickname."'"; - $result = dbquery($query); - $row = mysql_fetch_array($result); + $result = $mdb->query($query); + if (MDB::isError($result)) { + $this->mdbError($irc, $result); + return; + } + + $row = $mdb->fetchRow($result); return $row['pearusername']; } @@ -56,7 +63,7 @@ $query = "SELECT nickname,dnsalias FROM dnsentries"; $result = $mdb->query($query); if (MDB::isError($result)) { - mdbError($result); + $this->mdbError($irc, $result); return; } @@ -172,7 +179,7 @@ $irc->setReceiveTimeout(600); $irc->setTransmitTimeout(600); $irc->registerActionhandler(SMARTIRC_TYPE_JOIN, '.*', $bot, 'onjoin'); -$irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL|SMARTIRC_TYPE_QUERY, '^!who ', $bot, 'who'); +$irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL|SMARTIRC_TYPE_QUERY|SMARTIRC_TYPE_NOTICE, '^!who ', $bot, 'who'); $irc->connect('efnet.skynet.be', 6668); $irc->login($config['nick'], $config['real_name'], 8, $config['ident']); $irc->join('#pear');

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