]>
Commit | Line | Data |
---|---|---|
4970d698 ER |
1 | --- eventum-1.6.1/misc/irc/bot.php 2005-09-17 17:49:09.000000000 +0300 |
2 | +++ eventum/misc/irc/bot.php 2007-01-16 09:45:12.170099815 +0200 | |
3 | @@ -39,22 +39,19 @@ | |
b147e8c8 ER |
4 | |
5 | ini_set("memory_limit", "256M"); | |
6 | ||
7 | +// compat with earlier releases where didn't have array -glen | |
8 | +if (empty($irc_channels)) { | |
9 | + $irc_channels = array(); | |
10 | + $irc_channels[$irc_default_project] = $irc_default_channel; | |
11 | +} | |
12 | + | |
1105b2cd ER |
13 | // the following is the list of IRC channels that the bot should connect to, |
14 | // and the associated project name | |
b147e8c8 | 15 | -$channels = array( |
622e4f4b | 16 | - Project::getID('Default Project') => array( |
1105b2cd | 17 | - '#issues', |
b147e8c8 ER |
18 | - ) |
19 | -); | |
20 | -$irc_server_hostname = 'localhost'; | |
21 | -$irc_server_port = 6667; | |
22 | -$nickname = 'EventumBOT'; | |
23 | -$realname = 'Eventum Issue Tracking System'; | |
24 | -// do you need a username/password to connect to this server? if | |
25 | -// so, fill in the next two variables | |
26 | -$username = ''; | |
27 | -$password = ''; | |
28 | - | |
29 | +$channels = array(); | |
30 | +foreach ($irc_channels as $proj => $chan) { | |
31 | + $proj_id = Project::getID($proj); | |
a9085278 | 32 | + $channels[$proj_id] = is_array($chan) ? $chan : array($chan); |
b147e8c8 | 33 | +} |
3955d156 | 34 | |
1105b2cd ER |
35 | // ============================================ |
36 | // ============================================ | |
4970d698 | 37 | @@ -270,7 +267,7 @@ |
b147e8c8 ER |
38 | function _getChannels($prj_id) |
39 | { | |
40 | global $channels; | |
41 | - return $channels[$prj_id]; | |
42 | + return @$channels[$prj_id]; | |
43 | } | |
44 | ||
45 | ||
4970d698 | 46 | @@ -411,10 +408,12 @@ |
33a6b04f ER |
47 | $irc->registerActionhandler(SMARTIRC_TYPE_QUERY, '^!?list-quarantined', $bot, 'listQuarantinedIssues'); |
48 | ||
49 | $irc->connect($irc_server_hostname, $irc_server_port); | |
50 | -if (!empty($username)) { | |
51 | - $irc->login($nickname, $realname, 0, $username, $password); | |
52 | -} else { | |
53 | +if (empty($username)) { | |
54 | $irc->login($nickname, $realname); | |
cf8be08a | 55 | +} elseif (empty($password)) { |
33a6b04f ER |
56 | + $irc->login($nickname, $realname, 0, $username); |
57 | +} else { | |
58 | + $irc->login($nickname, $realname, 0, $username, $password); | |
59 | } | |
60 | $irc->listen(); | |
61 | $irc->disconnect(); |