--- eventum-1.6.1/misc/irc/bot.php.orig 2005-09-17 17:28:04.000000000 +0300 +++ eventum-1.6.1/misc/irc/bot.php 2005-09-17 17:49:09.000000000 +0300 @@ -27,8 +27,9 @@ // // @(#) $Id$ // +require_once('/etc/eventum/core.php'); +include_once('/etc/eventum/irc.php'); -include_once("../../config.inc.php"); include_once(APP_INC_PATH . "db_access.php"); include_once(APP_INC_PATH . "class.auth.php"); include_once(APP_INC_PATH . "class.lock.php"); @@ -38,22 +39,19 @@ ini_set("memory_limit", "256M"); +// compat with earlier releases where didn't have array -glen +if (empty($irc_channels)) { + $irc_channels = array(); + $irc_channels[$irc_default_project] = $irc_default_channel; +} + // the following is the list of IRC channels that the bot should connect to, // and the associated project name -$channels = array( - Project::getID('Default Project') => array( - '#issues', - ) -); -$irc_server_hostname = 'localhost'; -$irc_server_port = 6667; -$nickname = 'EventumBOT'; -$realname = 'Eventum Issue Tracking System'; -// do you need a username/password to connect to this server? if -// so, fill in the next two variables -$username = ''; -$password = ''; - +$channels = array(); +foreach ($irc_channels as $proj => $chan) { + $proj_id = Project::getID($proj); + $channels[$proj_id] = $chan; +} // ============================================ // ============================================ @@ -269,7 +267,7 @@ function _getChannels($prj_id) { global $channels; - return $channels[$prj_id]; + return @$channels[$prj_id]; } @@ -410,14 +408,16 @@ $irc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!?list-quarantined', $bot, 'listQuarantinedIssues'); $irc->connect($irc_server_hostname, $irc_server_port); -if (!empty($username)) { - $irc->login($nickname, $realname, 0, $username, $password); -} else { +if (empty($username)) { $irc->login($nickname, $realname); +} elseif (empty($password)) { + $irc->login($nickname, $realname, 0, $username); +} else { + $irc->login($nickname, $realname, 0, $username, $password); } $irc->listen(); $irc->disconnect(); // release the lock Lock::release('irc_bot'); -?> \ No newline at end of file +?>