simbot-commits Mailing List for SimBot (Page 5)
Status: Abandoned
Brought to you by:
kstange
This list is closed, nobody may subscribe to it.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(88) |
Jun
(11) |
Jul
(64) |
Aug
(74) |
Sep
(1) |
Oct
(4) |
Nov
(12) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(1) |
Nov
(4) |
Dec
|
| 2007 |
Jan
(5) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Pete P. <fou...@us...> - 2005-08-11 13:43:48
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25898/templates Modified Files: error.401.default.tmpl Log Message: TMPL_VAR not TMPL_VAL Index: error.401.default.tmpl =================================================================== RCS file: /cvsroot/simbot/simbot/templates/error.401.default.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- error.401.default.tmpl 10 Aug 2005 11:50:59 -0000 1.1 +++ error.401.default.tmpl 11 Aug 2005 13:43:38 -0000 1.2 @@ -1,5 +1,5 @@ <p>This server could not verify that you are authorized to access the URL -<q><TMPL_VAL NAME=request_url></q>. This probably means that you entered the +<q><TMPL_VAR NAME=request_url></q>. This probably means that you entered the wrong user name or password, however it could also mean that your browser does not understand how to provide the credentials required.</p> |
|
From: Kevin S. <ks...@us...> - 2005-08-11 13:39:41
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25178/plugins Modified Files: httpd.pl Log Message: Standards compliance for the index can be accomplished with a </li> Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -p -r1.17 -r1.18 --- httpd.pl 10 Aug 2005 19:29:36 -0000 1.17 +++ httpd.pl 11 Aug 2005 13:39:31 -0000 1.18 @@ -72,7 +72,7 @@ sub index_handler { foreach my $url (keys %SimBot::hash_plugin_httpd_pages) { my $title = $SimBot::hash_plugin_httpd_pages{$url}->{'title'}; - $msg .= qq(<li><a href="$url">$title</a>\n); + $msg .= qq(<li><a href="$url">$title</a></li>\n); } $msg .= "</ul>\n"; |
|
From: Pete P. <fou...@us...> - 2005-08-10 19:29:45
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3677/plugins Modified Files: httpd.pl Log Message: Success is not an error. Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -p -r1.16 -r1.17 --- httpd.pl 10 Aug 2005 19:26:00 -0000 1.16 +++ httpd.pl 10 Aug 2005 19:29:36 -0000 1.17 @@ -176,7 +176,7 @@ sub admin_page { POE::Kernel->post('simbot', 'restart', "web admin"); $response->code(RC_OK); $response->content('OK, restarting'); - return; + return RC_OK; } elsif(($say) = $request->uri =~ m|\?say=(\S+)$|) { $say =~ s/\+/ /g; $say =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
|
From: Pete P. <fou...@us...> - 2005-08-10 19:27:00
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2970/plugins Modified Files: sqlite-logger.pl Log Message: Links like (http://what.ever/) are now linked with the ()s on the outside. Index: sqlite-logger.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/sqlite-logger.pl,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -p -r1.52 -r1.53 --- sqlite-logger.pl 10 Aug 2005 18:39:50 -0000 1.52 +++ sqlite-logger.pl 10 Aug 2005 19:26:52 -0000 1.53 @@ -946,15 +946,12 @@ sub linkify { my @words = split(/\s+/, $_[0]); my $curWord; - foreach $curWord (@words) { - my $url = $curWord; - + foreach $curWord (@words) { # remove things that commonly surround URLs - $url =~ s{^\(}{}; - $url =~ s{\)$}{}; - $url =~ s{^<}{}; - $url =~ s{>$}{}; - + my ($word_prefix, $word, $word_suffix) = $curWord + =~ m@^(["'\(<\[]?)(\S*?)(["'\)>\]]?)$@; #' + my $url = $word; + # map some common host names to protocols $url =~ s{^(www|web)\.} {http://$1\.}; $url =~ s{^ftp\.} {ftp://ftp\.}; @@ -966,7 +963,7 @@ sub linkify { } if($url =~ m{^((http|ftp|news|nntp|irc|aim)s?:[\w.?/=\-\&\;]+)}) { - $curWord = qq(<a href="$1">$curWord</a>); + $curWord = qq($word_prefix<a href="$1">$word</a>$word_suffix); next; } @@ -978,7 +975,7 @@ sub linkify { # Yup. Let's assume it's a web site... $host = 'http://' . $host; - $curWord = qq(<a href="${host}/${path}">$curWord</a>); + $curWord = qq($word_prefix<a href="${host}/${path}">$word</a>$word_suffix); } } } |
|
From: Pete P. <fou...@us...> - 2005-08-10 19:26:07
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2841/plugins Modified Files: httpd.pl Log Message: Bad login/pass won't crash simbot. Again. Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -p -r1.15 -r1.16 --- httpd.pl 10 Aug 2005 11:50:59 -0000 1.15 +++ httpd.pl 10 Aug 2005 19:26:00 -0000 1.16 @@ -162,8 +162,7 @@ sub admin_page { if($user ne &SimBot::option('plugin.httpd', 'admin_user') || $pass ne &SimBot::option('plugin.httpd', 'admin_pass')) { - $response->www_authenticate = - 'Basic realm="simbot admin"'; + $response->www_authenticate('Basic realm="simbot admin"'); $response->code(RC_UNAUTHORIZED); return RC_UNAUTHORIZED; } |
|
From: Pete P. <fou...@us...> - 2005-08-10 18:39:58
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20690/plugins Modified Files: sqlite-logger.pl Log Message: What was I thinking when I wrote this? Index: sqlite-logger.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/sqlite-logger.pl,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -p -r1.51 -r1.52 --- sqlite-logger.pl 10 Aug 2005 18:37:30 -0000 1.51 +++ sqlite-logger.pl 10 Aug 2005 18:39:50 -0000 1.52 @@ -977,8 +977,7 @@ sub linkify { |museum|\w\w)$}ix) { # Yup. Let's assume it's a web site... $host = 'http://' . $host; - } - if($host =~ m/:/) { + $curWord = qq(<a href="${host}/${path}">$curWord</a>); } } |
|
From: Pete P. <fou...@us...> - 2005-08-10 18:37:45
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20054/plugins Modified Files: sqlite-logger.pl Log Message: Links in the HTML no longer get cut off at the ; in & Index: sqlite-logger.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/sqlite-logger.pl,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -p -r1.50 -r1.51 --- sqlite-logger.pl 10 Aug 2005 11:50:59 -0000 1.50 +++ sqlite-logger.pl 10 Aug 2005 18:37:30 -0000 1.51 @@ -746,7 +746,8 @@ sub row_hashref_to_template_hashref { # this does things like linkify URLs, escape characters that # need escaping, munge email addresses, and things like that. sub f_content { - my $content = encode_entities($_[0]); + my $content = $_[0]; + $content = encode_entities($content); # linkify $content = &linkify($content); @@ -964,7 +965,7 @@ sub linkify { next; } - if($url =~ m{^((http|ftp|news|nntp|irc|aim)s?:[\w.?/=\-\&]+)}) { + if($url =~ m{^((http|ftp|news|nntp|irc|aim)s?:[\w.?/=\-\&\;]+)}) { $curWord = qq(<a href="$1">$curWord</a>); next; } |
|
From: Pete P. <fou...@us...> - 2005-08-10 16:49:51
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27467/templates Modified Files: base.default.tmpl irclog.default.tmpl Log Message: Add a pinch of CSS, and stir. Index: base.default.tmpl =================================================================== RCS file: /cvsroot/simbot/simbot/templates/base.default.tmpl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- base.default.tmpl 9 Aug 2005 02:30:49 -0000 1.3 +++ base.default.tmpl 10 Aug 2005 16:49:37 -0000 1.4 @@ -11,13 +11,15 @@ h1 { border-bottom: 1px solid #000; margin-bottom: 0; } - -#content { margin: 1em 0; } - #footer { border-top: 1px solid #000; margin-top: 0; } +#content { margin: 1em 0; } +.ts { color: #777; font-size: 90%; margin-right: .5em; } +span.nick { color: #006; font-weight: bold; } +.row { padding: .1em 0 .1em 10em; text-indent: -9em; } +.row.kicked { color: #500; } </style> </head><body> <h1><TMPL_VAR NAME=title></h1> Index: irclog.default.tmpl =================================================================== RCS file: /cvsroot/simbot/simbot/templates/irclog.default.tmpl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- irclog.default.tmpl 10 Aug 2005 14:56:12 -0000 1.2 +++ irclog.default.tmpl 10 Aug 2005 16:49:38 -0000 1.3 @@ -8,25 +8,25 @@ <div class="row <TMPL_VAR NAME=event>"> <span class="ts"><TMPL_VAR NAME=timestamp></span> <span class="msg"><TMPL_IF EXPR="event eq 'SAY'"> - <<TMPL_VAR NAME=source_nick>> <TMPL_VAR NAME=content> + <<span class="nick"><TMPL_VAR NAME=source_nick></span>> <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'NOTICE'"> - -<TMPL_VAR NAME=source_nick>- <TMPL_VAR NAME=content> + -<span class="nick"><TMPL_VAR NAME=source_nick></span>- <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'ACTION'"> - ⢠<TMPL_VAR NAME=source_nick> <TMPL_VAR NAME=content> + ⢠<span class="nick"><TMPL_VAR NAME=source_nick></span> <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'JOINED'"> - â <TMPL_VAR NAME=source_nick> joined. + â <span class="nick"><TMPL_VAR NAME=source_nick></span> joined. <TMPL_ELSE><TMPL_IF EXPR="event eq 'PARTED'"> - â <TMPL_VAR NAME=source_nick> left. + â <span class="nick"><TMPL_VAR NAME=source_nick></span> left. <TMPL_ELSE><TMPL_IF EXPR="event eq 'QUIT'"> - â <TMPL_VAR NAME=source_nick> quit IRC. + â <span class="nick"><TMPL_VAR NAME=source_nick></span> quit IRC. <TMPL_ELSE><TMPL_IF EXPR="event eq 'TOPIC'"> - â´ <TMPL_VAR NAME=source_nick> set the topic to: <TMPL_VAR NAME=content> + â´ <span class="nick"><TMPL_VAR NAME=source_nick></span> set the topic to: <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'MODE'"> - â <TMPL_VAR NAME=source_nick> set mode <TMPL_VAR NAME=content> + â <span class="nick"><TMPL_VAR NAME=source_nick></span> set mode <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'KICKED'"> - â <TMPL_VAR NAME=target_nick> was kicked by <TMPL_VAR NAME=source_nick> (<TMPL_VAR NAME=content>) + â <span class="nick"><TMPL_VAR NAME=target_nick></span> was kicked by <span class="nick"><TMPL_VAR NAME=source_nick></span> (<TMPL_VAR NAME=content>) <TMPL_ELSE><TMPL_IF EXPR="event eq 'NICK'"> - â <TMPL_VAR NAME=source_nick> is now known as <TMPL_VAR NAME=target_nick> + â <span class="nick"><TMPL_VAR NAME=source_nick></span> is now known as <span class="nick"><TMPL_VAR NAME=target_nick></span>. </TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF> </TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF></span> </div> |
|
From: Pete P. <fou...@us...> - 2005-08-10 14:56:22
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29285/templates Modified Files: irclog.default.tmpl Log Message: Slightly friendlier to broken browsers like IE. Index: irclog.default.tmpl =================================================================== RCS file: /cvsroot/simbot/simbot/templates/irclog.default.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- irclog.default.tmpl 10 Aug 2005 11:51:00 -0000 1.1 +++ irclog.default.tmpl 10 Aug 2005 14:56:12 -0000 1.2 @@ -14,11 +14,11 @@ <TMPL_ELSE><TMPL_IF EXPR="event eq 'ACTION'"> ⢠<TMPL_VAR NAME=source_nick> <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'JOINED'"> - â <TMPL_VAR NAME=source_nick> joined. + â <TMPL_VAR NAME=source_nick> joined. <TMPL_ELSE><TMPL_IF EXPR="event eq 'PARTED'"> - â <TMPL_VAR NAME=source_nick> left. + â <TMPL_VAR NAME=source_nick> left. <TMPL_ELSE><TMPL_IF EXPR="event eq 'QUIT'"> - â <TMPL_VAR NAME=source_nick> quit IRC. + â <TMPL_VAR NAME=source_nick> quit IRC. <TMPL_ELSE><TMPL_IF EXPR="event eq 'TOPIC'"> â´ <TMPL_VAR NAME=source_nick> set the topic to: <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'MODE'"> |
|
From: Pete P. <fou...@us...> - 2005-08-10 11:51:09
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16455/templates Added Files: error.401.default.tmpl error.500.default.tmpl irclog.default.tmpl Log Message: - Added a template for the HTML IRC log. - Make recap use the - Removed row_hashref_to_html as it isn't used. - Removed f_nick. Any nickname formatting should be done in the template. - Added error pages. - Added templates for error pages. Currently only 401 and 500 are provided, other errors will be displayed using 500's template. --- NEW FILE: error.401.default.tmpl --- <p>This server could not verify that you are authorized to access the URL <q><TMPL_VAL NAME=request_url></q>. This probably means that you entered the wrong user name or password, however it could also mean that your browser does not understand how to provide the credentials required.</p> <p>Please check your user name and password, and click Reload or Refresh to try again.</p> --- NEW FILE: error.500.default.tmpl --- <p>The server encountered an internal error and was unable to complete your request.</p> --- NEW FILE: irclog.default.tmpl --- <!-- SimBot Default IRC Log template Copy to irclog.local.tmpl before editing --> <h4>IRC log for <TMPL_VAR NAME=channel> from <TMPL_VAR NAME=start_time> to <TMPL_VAR NAME=end_time>.</h4> <TMPL_LOOP NAME=ircloop> <div class="row <TMPL_VAR NAME=event>"> <span class="ts"><TMPL_VAR NAME=timestamp></span> <span class="msg"><TMPL_IF EXPR="event eq 'SAY'"> <<TMPL_VAR NAME=source_nick>> <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'NOTICE'"> -<TMPL_VAR NAME=source_nick>- <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'ACTION'"> ⢠<TMPL_VAR NAME=source_nick> <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'JOINED'"> â <TMPL_VAR NAME=source_nick> joined. <TMPL_ELSE><TMPL_IF EXPR="event eq 'PARTED'"> â <TMPL_VAR NAME=source_nick> left. <TMPL_ELSE><TMPL_IF EXPR="event eq 'QUIT'"> â <TMPL_VAR NAME=source_nick> quit IRC. <TMPL_ELSE><TMPL_IF EXPR="event eq 'TOPIC'"> â´ <TMPL_VAR NAME=source_nick> set the topic to: <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'MODE'"> â <TMPL_VAR NAME=source_nick> set mode <TMPL_VAR NAME=content> <TMPL_ELSE><TMPL_IF EXPR="event eq 'KICKED'"> â <TMPL_VAR NAME=target_nick> was kicked by <TMPL_VAR NAME=source_nick> (<TMPL_VAR NAME=content>) <TMPL_ELSE><TMPL_IF EXPR="event eq 'NICK'"> â <TMPL_VAR NAME=source_nick> is now known as <TMPL_VAR NAME=target_nick> </TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF> </TMPL_IF></TMPL_IF></TMPL_IF></TMPL_IF></span> </div> </TMPL_LOOP> <!-- End irclog --> |
|
From: Pete P. <fou...@us...> - 2005-08-10 11:51:08
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16455/plugins Modified Files: httpd.pl recap.pl sqlite-logger.pl Log Message: - Added a template for the HTML IRC log. - Make recap use the - Removed row_hashref_to_html as it isn't used. - Removed f_nick. Any nickname formatting should be done in the template. - Added error pages. - Added templates for error pages. Currently only 401 and 500 are provided, other errors will be displayed using 500's template. Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -p -r1.14 -r1.15 --- httpd.pl 9 Aug 2005 02:33:57 -0000 1.14 +++ httpd.pl 10 Aug 2005 11:50:59 -0000 1.15 @@ -56,48 +56,66 @@ sub index_handler { my ($req_root) = $request->uri =~ m|^/([^\?]*)|; &SimBot::debug(3, 'httpd: handling request for ' . $request->uri . ", req root $req_root\n"); + my $code = 500; # An error by default. - if(defined $SimBot::hash_plugin_httpd_pages{$req_root}) { + if($req_root && defined $SimBot::hash_plugin_httpd_pages{$req_root}) { my $handler = $SimBot::hash_plugin_httpd_pages{$req_root}->{'handler'}; - &$handler($request, $response, \&get_template); + $code = &$handler($request, $response, \&get_template); - if(defined $response->code && $response->code == RC_UNAUTHORIZED) { - $response->content('Bad login/pass or your browser does not know how to log in.'); - } elsif(!defined $response->content - || length $response->content == 0) - { - # Hey! Our plugin didn't do anything useful. - $response->code(RC_INTERNAL_SERVER_ERROR); - $response->content("something's broken"); - # FIXME: We need error pages... - } elsif(!defined $response->code) { - $response->code(RC_OK); # assume everything's OK + } else { + if($req_root) { # a page was requested, but we don't have it. + $code = RC_NOT_FOUND; + } else { + # do the index page + my $msg; + $msg .= "<ul>\n"; + foreach my $url (keys %SimBot::hash_plugin_httpd_pages) { + my $title = $SimBot::hash_plugin_httpd_pages{$url}->{'title'}; + + $msg .= qq(<li><a href="$url">$title</a>\n); + } + $msg .= "</ul>\n"; + + $code = RC_OK; + $response->push_header("Content-Type", "text/html"); + + my $template = &get_template('base'); + $template->param( + title => 'Index', + content => $msg, + ); + $response->content($template->output()); } - - $heap->{client}->put($response); - $kernel->yield('shutdown'); - return; } - my $msg; - $msg .= "<ul>\n"; - foreach my $url (keys %SimBot::hash_plugin_httpd_pages) { - my $title = $SimBot::hash_plugin_httpd_pages{$url}->{'title'}; - - $msg .= qq(<li><a href="$url">$title</a>\n); + if(!defined $code || int $code >= 300 || int $code < 200) { + # Plugin gave us no return value, or an error code, or an absurd number + # make the error page. + if(!defined $code || $code < 200 || $code >= 600) { + # no code, or code absurd. + $code = RC_INTERNAL_SERVER_ERROR; + } + my $err_template = &get_template("error.$code"); + if(!defined $err_template) { $err_template = &get_template('error.500'); } + if(!defined $err_template) { + $response->code(RC_INTERNAL_SERVER_ERROR); + $response->content("An internal error prevented us from completing your request, and no template was available for the error message."); + } else { + $response->code($code); + $err_template->param( + request_url => $request->uri, + ); + my $base_template = &get_template('base'); + $base_template->param( + content => $err_template->output(), + title => "$code " . status_message($code), + ); + $response->content($base_template->output()); + } + } - $msg .= "</ul>\n"; - - $response->code(RC_OK); - $response->push_header("Content-Type", "text/html"); - - my $template = &get_template('base'); - $template->param( - title => 'Index', - content => $msg, - ); - $response->content($template->output()); + $response->code($code); $heap->{client}->put($response); $kernel->yield('shutdown'); } @@ -111,7 +129,7 @@ sub get_template { } elsif(-r "templates/${template}.default.tmpl") { $file_name = "templates/${template}.default.tmpl"; } else { - &SimBot::debug(&SimBot::DEBUG_WARN, "httpd: No template $template available!"); + &SimBot::debug(&SimBot::DEBUG_WARN, "httpd: No template $template available!\n"); return; } @@ -131,13 +149,14 @@ sub admin_page { my ($request, $response) = @_; if(!defined &SimBot::option('plugin.httpd', 'admin_pass')) { - die "In admin_page with no password!"; + &SimBot::debug(&SimBot::DEBUG_WARN, "httpd: in admin_page with no password defined!\n"); + return 500; # internal server error } if(!defined $request->authorization_basic) { $response->www_authenticate('Basic realm="simbot admin"'); $response->code(RC_UNAUTHORIZED); - return; + return RC_UNAUTHORIZED; } my ($user, $pass) = $request->authorization_basic; if($user ne &SimBot::option('plugin.httpd', 'admin_user') @@ -146,7 +165,7 @@ sub admin_page { $response->www_authenticate = 'Basic realm="simbot admin"'; $response->code(RC_UNAUTHORIZED); - return; + return RC_UNAUTHORIZED; } my $msg; my $say; @@ -184,6 +203,7 @@ sub admin_page { content => $msg, ); $response->content($template->output()); + return RC_OK; } sub messup_httpd { Index: recap.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/recap.pl,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -p -r1.21 -r1.22 --- recap.pl 9 Aug 2005 02:31:41 -0000 1.21 +++ recap.pl 10 Aug 2005 11:50:59 -0000 1.22 @@ -122,6 +122,7 @@ sub recap_page { content => &SimBot::htmlize(join("\n", @backlog)), ); $response->content($template->output()); + return 200; } # Register Plugin Index: sqlite-logger.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/sqlite-logger.pl,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -p -r1.49 -r1.50 --- sqlite-logger.pl 7 Aug 2005 18:33:27 -0000 1.49 +++ sqlite-logger.pl 10 Aug 2005 11:50:59 -0000 1.50 @@ -697,13 +697,12 @@ sub row_hashref_to_text { return $msg; } -sub row_hashref_to_html { +# This turns the row hashref into a hashref with a human readable timestamp +# and user nicks instead of IDs. +sub row_hashref_to_template_hashref { my ($row) = @_; - my $msg = '<div class="row ' . lc($row->{'event'}) . '">'; - - - # timestamp + # TIMESTAMP my (undef, undef, undef, $cur_day, $cur_month, $cur_yr) = localtime; $cur_month += 1; # localtime gives us 0..11, we want 1..12 $cur_yr += 1900; # localtime gives us number of years since 1900 @@ -712,72 +711,36 @@ sub row_hashref_to_html { $month += 1; $yr += 1900; - $msg .= '<span class="ts">'; - + $row->{'timestamp'} = ''; if($cur_day != $day || $cur_month != $month || $cur_yr != $yr) { - $msg .= (MONTHS)[$month-1] . " $day "; + $row->{'timestamp'} .= (MONTHS)[$month-1] . " $day "; } - if($cur_yr != $yr) { $msg .= "$yr "; } + if($cur_yr != $yr) { $row->{'timestamp'} .= "$yr "; } - $msg .= $hr . ':' . sprintf('%02d',$min) . '</span> '; + $row->{'timestamp'} .= $hr . ':' . sprintf('%02d',$min); - # event -# $msg .= q(<span class=") . lc($row->{'event'}) . q(">); - $msg .= q(<span class="msg">); - if($row->{'event'} eq 'SAY') { - $msg .= '<' . &f_nick($row->{'source_nick_id'}) - . '> ' . f_content($row->{'content'}); - } elsif($row->{'event'} eq 'NOTICE') { - $msg .= '-' . &f_nick($row->{'source_nick_id'}) - . '- ' . f_content($row->{'content'}); - } elsif($row->{'event'} eq 'ACTION') { - $msg .= '* ' . &f_nick($row->{'source_nick_id'}) - . ' ' . f_content($row->{'content'}); - } elsif($row->{'event'} eq 'JOINED') { - $msg .= '* ' . &f_nick($row->{'source_nick_id'}) - . ' joined.'; - } elsif($row->{'event'} eq 'PARTED') { - $msg .= '* ' . &f_nick($row->{'source_nick_id'}) - . ' left (' . f_content($row->{'content'}) . ')'; - } elsif($row->{'event'} eq 'QUIT') { - $msg .= '* ' . &f_nick($row->{'source_nick_id'}) - . ' quit (' . f_content($row->{'content'}) . ')'; - } elsif($row->{'event'} eq 'TOPIC') { - $msg .= '* ' . &f_nick($row->{'source_nick_id'}) - . ' changed the topic to: ' . f_content($row->{'content'}); - } elsif($row->{'event'} eq 'MODE') { - $msg .= '* ' . &f_nick($row->{'source_nick_id'}) - . ' set ' . f_content($row->{'content'}); - } elsif($row->{'event'} eq 'KICKED') { - $msg .= '* ' . &f_nick($row->{'target_nick_id'}) - . ' was kicked by ' . &f_nick($row->{'source_nick_id'}) - . ' (' . f_content($row->{'content'}) . ')'; - } elsif($row->{'event'} eq 'NICK') { - $msg .= '* ' . &f_nick($row->{'source_nick_id'}) - . ' is now known as ' . &f_nick($row->{'target_nick_id'}); - - } else { # Oh, great, we forgot one. - $msg .= 'UNKNOWN EVENT ' . $row->{'event'} . ':'; - if(defined $row->{'source_nick_id'}) - { $msg .= ' source:' . &f_nick($row->{'source_nick_id'}); } - if(defined $row->{'target_nick_id'}) - { $msg .= ' target:' . &f_nick($row->{'target_nick_id'}); } - if(defined f_content($row->{'content'})) - { $msg .= ' content:' . f_content($row->{'content'}); } + # NICKS + if(defined $row->{'source_nick_id'}) { + $row->{'source_nick'} = + &get_nickchan_name($row->{'source_nick_id'}); } - $msg .= q(</span></div>); - return $msg; + if(defined $row->{'target_nick_id'}) { + $row->{'target_nick'} = + &get_nickchan_name($row->{'target_nick_id'}); + } + + # CONTENT + if(defined $row->{'content'}) { + $row->{'content'} = &f_content($row->{'content'}); + } + + return $row; } ### FORMATTING FUNCTIONS ### -sub f_nick { - return '<span class="nick">' - . &get_nickchan_name($_[0]) - . '</span>'; -} # f_content is used to format the content part of chat. # this does things like linkify URLs, escape characters that @@ -785,9 +748,6 @@ sub f_nick { sub f_content { my $content = encode_entities($_[0]); - # mask email - - # linkify $content = &linkify($content); @@ -866,25 +826,25 @@ sub seen_nlp_match { } sub web_request { - my ($request, $response) = @_; + my ($request, $response, $get_template) = @_; my $query = &create_query_hash($request->uri); if(defined $query->{'recap'}) { - &web_recap($query, $response); + return &web_recap($query, $response, $get_template); } else { - &web_log($query, $response); + return &web_log($query, $response, $get_template); } } sub web_recap { my ($query, $response) = @_; - + return 501; # not implemented } sub web_log { - my ($query, $response) = @_; + my ($query, $response, $get_template) = @_; my (undef, undef, undef, $start_day, $start_month, $start_year) = localtime; @@ -929,14 +889,6 @@ sub web_log { my $start_time = timelocal(0,$start_min,$start_hour,$start_day, $start_month-1, $start_year); my $end_time = timelocal(59,$end_min,$end_hour,$end_day, $end_month-1, $end_year); - - my $message = - '<div id="header">IRC log for ' - . &get_nickchan_name($channel_id) - . ' from ' . scalar localtime($start_time) - . ' to ' . scalar localtime($end_time) - . '. Generated ' . scalar localtime() - . "</div>\n"; my $log_query = $dbh->prepare_cached( 'SELECT time, source_nick_id, event, target_nick_id, content' @@ -949,11 +901,28 @@ sub web_log { $log_query->execute($channel_id, $start_time, $end_time); my $row; + my @loop_data; while($row = $log_query->fetchrow_hashref) { - $message .= &row_hashref_to_html($row) . "\n"; + push(@loop_data, &row_hashref_to_template_hashref($row)); } - $response->content($message); + + my $irclog_template = &$get_template('irclog'); + $irclog_template->param( + ircloop => \@loop_data, + channel => &get_nickchan_name($channel_id), + start_time => scalar localtime($start_time), + end_time => scalar localtime($end_time), + ); + + my $base_template = &$get_template('base'); + $base_template->param( + content => $irclog_template->output(), + title => 'IRC Log', + ); + + $response->content($base_template->output()); $response->push_header("Content-Type", "text/html"); + return 200; # OK } sub create_query_hash { |
|
From: Pete P. <fou...@us...> - 2005-08-10 11:51:07
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16455 Modified Files: ChangeLog Log Message: - Added a template for the HTML IRC log. - Make recap use the - Removed row_hashref_to_html as it isn't used. - Removed f_nick. Any nickname formatting should be done in the template. - Added error pages. - Added templates for error pages. Currently only 401 and 500 are provided, other errors will be displayed using 500's template. Index: ChangeLog =================================================================== RCS file: /cvsroot/simbot/simbot/ChangeLog,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -p -r1.80 -r1.81 --- ChangeLog 9 Aug 2005 01:12:59 -0000 1.80 +++ ChangeLog 10 Aug 2005 11:50:59 -0000 1.81 @@ -1,3 +1,13 @@ +Version 1.0 alpha: (09 Aug 2005) + * templates/irclog.default.tmpl: + - Template used for making the HTML version of the IRC log. Don't like + the traditional "<JohnDoe> Hi!"? Change it here. + * plugins/httpd.pl: + - Error pages. Plugins must return a HTTP status code on the page + callback. If they don't, we'll assume 500 (Internal Server Error). + For codes 300-500, we'll look for a error.NNN template. If we can't + find one, we'll use error.500. Failing that, we use a hard coded page. + Version 1.0 alpha: (08 Aug 2005) * plugins/httpd.pl: - I forgot to update the changelog when I created this plugin... |
|
From: Pete P. <fou...@us...> - 2005-08-10 04:23:07
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30939/templates Modified Files: base.default.tmpl Log Message: Now with unicode goodness! Index: base.default.tmpl =================================================================== RCS file: /cvsroot/simbot/simbot/templates/base.default.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- base.default.tmpl 9 Aug 2005 01:13:00 -0000 1.1 +++ base.default.tmpl 9 Aug 2005 01:17:01 -0000 1.2 @@ -3,6 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head> <!-- SimBot Default Base Template Copy to base.local.tmpl before editing --> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>SimBot » <TMPL_VAR NAME=title></title> </head><body> <div id="content"> |
|
From: Pete P. <fou...@us...> - 2005-08-10 03:47:53
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11218/plugins Modified Files: recap.pl Log Message: Use the base template when outputting for web. Index: recap.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/recap.pl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -p -r1.20 -r1.21 --- recap.pl 29 Jul 2005 06:44:40 -0000 1.20 +++ recap.pl 9 Aug 2005 02:31:41 -0000 1.21 @@ -112,11 +112,16 @@ sub nick_change { } sub recap_page { - my ($request, $response) = @_; + my ($request, $response, $get_template) = @_; # $response->code(RC_OK); $response->push_header("Content-Type", "text/html"); - $response->content(&SimBot::htmlize(join("\n", @backlog))); + my $template = &$get_template('base'); + $template->param( + title => 'Recent Chatter', + content => &SimBot::htmlize(join("\n", @backlog)), + ); + $response->content($template->output()); } # Register Plugin |
|
From: Pete P. <fou...@us...> - 2005-08-10 03:46:36
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11109/templates Modified Files: base.default.tmpl Log Message: make the default template a little nicer looking. Index: base.default.tmpl =================================================================== RCS file: /cvsroot/simbot/simbot/templates/base.default.tmpl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- base.default.tmpl 9 Aug 2005 01:17:01 -0000 1.2 +++ base.default.tmpl 9 Aug 2005 02:30:49 -0000 1.3 @@ -5,7 +5,22 @@ Copy to base.local.tmpl before editing --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>SimBot » <TMPL_VAR NAME=title></title> +<style type="text/css"> +h1 { + text-shadow: 4px 4px 5px #AAA; + border-bottom: 1px solid #000; + margin-bottom: 0; +} + +#content { margin: 1em 0; } + +#footer { + border-top: 1px solid #000; + margin-top: 0; +} +</style> </head><body> +<h1><TMPL_VAR NAME=title></h1> <div id="content"> <TMPL_VAR NAME=content> </div> |
|
From: Pete P. <fou...@us...> - 2005-08-10 03:46:00
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24095/templates Log Message: Directory /cvsroot/simbot/simbot/templates added to the repository |
|
From: Pete P. <fou...@us...> - 2005-08-10 03:24:40
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145 Modified Files: simbot.pl Log Message: The sb_version and sb_link params in the templates now work. Index: simbot.pl =================================================================== RCS file: /cvsroot/simbot/simbot/simbot.pl,v retrieving revision 1.135 retrieving revision 1.136 diff -u -d -p -r1.135 -r1.136 --- simbot.pl 9 Aug 2005 01:01:49 -0000 1.135 +++ simbot.pl 9 Aug 2005 01:32:36 -0000 1.136 @@ -83,6 +83,8 @@ use constant VERBOSE => 3; use constant PROJECT => "SimBot"; # Software Version use constant VERSION => "1.0 alpha"; +# Software Home +use constant HOME_PAGE => 'http://simbot.sf.net/'; our %numbers_groups = ( |
|
From: Pete P. <fou...@us...> - 2005-08-10 03:23:53
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2265/plugins Modified Files: httpd.pl Log Message: DEBUG_WARN not DEBUG_WARNING Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -p -r1.12 -r1.13 --- httpd.pl 9 Aug 2005 01:32:36 -0000 1.12 +++ httpd.pl 9 Aug 2005 01:38:19 -0000 1.13 @@ -111,7 +111,7 @@ sub get_template { } elsif(-r "templates/${template}.default.tmpl") { $file_name = "templates/${template}.default.tmpl"; } else { - &SimBot::debug(&SimBot::DEBUG_WARNING, "httpd: No template $template available!"); + &SimBot::debug(&SimBot::DEBUG_WARN, "httpd: No template $template available!"); return; } |
|
From: Pete P. <fou...@us...> - 2005-08-10 03:22:03
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1145/plugins Modified Files: httpd.pl Log Message: The sb_version and sb_link params in the templates now work. Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -p -r1.11 -r1.12 --- httpd.pl 9 Aug 2005 01:12:59 -0000 1.11 +++ httpd.pl 9 Aug 2005 01:32:36 -0000 1.12 @@ -115,11 +115,16 @@ sub get_template { return; } - return HTML::Template->new( filename => $file_name, + my $templ_obj = HTML::Template->new( filename => $file_name, die_on_bad_params => 0, case_sensitive => 1, loop_context_vars => 1, ); + $templ_obj->param( + sb_version => &SimBot::PROJECT . ' ' . &SimBot::VERSION, + sb_link => &SimBot::HOME_PAGE, + ); + return $templ_obj; } sub admin_page { |
|
From: Pete P. <fou...@us...> - 2005-08-10 03:17:55
|
Update of /cvsroot/simbot/simbot/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30356/templates Added Files: .cvsignore base.default.tmpl Log Message: Adding templates to the httpd plugin. --- NEW FILE: .cvsignore --- *.local.tmpl --- NEW FILE: base.default.tmpl --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head> <!-- SimBot Default Base Template Copy to base.local.tmpl before editing --> <title>SimBot » <TMPL_VAR NAME=title></title> </head><body> <div id="content"> <TMPL_VAR NAME=content> </div> <div id="footer"> We probably donât have standards compliance yet, but itâs <a href="http://validator.w3.org/check?uri=referer">worth a shot</a>.<br/> <a href="<TMPL_VAR ESCAPE=HTML NAME=sb_link>"><TMPL_VAR NAME=sb_version></a> </div> </body> </html> |
|
From: Pete P. <fou...@us...> - 2005-08-10 02:58:12
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30356 Modified Files: ChangeLog INSTALL Log Message: Adding templates to the httpd plugin. Index: ChangeLog =================================================================== RCS file: /cvsroot/simbot/simbot/ChangeLog,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -p -r1.79 -r1.80 --- ChangeLog 25 Jul 2005 09:34:07 -0000 1.79 +++ ChangeLog 9 Aug 2005 01:12:59 -0000 1.80 @@ -1,3 +1,15 @@ +Version 1.0 alpha: (08 Aug 2005) + * plugins/httpd.pl: + - I forgot to update the changelog when I created this plugin... + instead of faking dates for everything, here it all is: + - Internal web server for SimBot. Right now, sqlite-logger and recap + use it. It also provides an admin page where you can restart SimBot + and even make it say things. + - Added templates. + * templates/base.default.tmpl: + - This is the basic template that defines every page. More templates will + come soon... + Version 1.0 alpha: (25 Jul 2005) * simbot.pl: - Added message value returned to callbacks attached to the nojoin Index: INSTALL =================================================================== RCS file: /cvsroot/simbot/simbot/INSTALL,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -p -r1.26 -r1.27 --- INSTALL 28 Jul 2005 01:56:26 -0000 1.26 +++ INSTALL 9 Aug 2005 01:12:59 -0000 1.27 @@ -65,6 +65,10 @@ intend to use any of the stock plugins p * Required by: httpd +[ HTML::Template::Pro ] + + * Required by: httpd + All of these modules are available in the CPAN repository, so you can install them in most Perl environments by running: |
|
From: Pete P. <fou...@us...> - 2005-08-10 02:43:36
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28810 Modified Files: simbot.pl Log Message: fix a warning Index: simbot.pl =================================================================== RCS file: /cvsroot/simbot/simbot/simbot.pl,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -p -r1.134 -r1.135 --- simbot.pl 7 Aug 2005 18:25:26 -0000 1.134 +++ simbot.pl 9 Aug 2005 01:01:49 -0000 1.135 @@ -584,7 +584,7 @@ sub htmlize { # This doesn't make harvesting impossible, but it does make it more difficult. # Viewers without javascript see [email removed] instead. sub html_mask_email { - my ($user, $host) = @_[0] =~ m/^(\S+)@(\S+)$/; + my ($user, $host) = $_[0] =~ m/^(\S+)@(\S+)$/; my ($nuser, $nhost); for(my $i; $i < length $user; $i++) { $nuser .= '&#' . ord(substr($user, $i, 1)) . ';'; |
|
From: Pete P. <fou...@us...> - 2005-08-10 02:39:06
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30356/plugins Modified Files: httpd.pl Log Message: Adding templates to the httpd plugin. Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -p -r1.10 -r1.11 --- httpd.pl 28 Jul 2005 01:56:26 -0000 1.10 +++ httpd.pl 9 Aug 2005 01:12:59 -0000 1.11 @@ -23,26 +23,12 @@ use strict; use POE; use POE::Component::Server::TCP; use POE::Filter::HTTPD; -#use POE::Component::Server::HTTP; use HTTP::Status; +use HTML::Template::Pro; our $aliases; -#our $kernel; use vars qw( $kernel ); -#$aliases = POE::Component::Server::HTTP->new( -## Alias => 'simbot_plugin_httpd', -# Port => (defined &SimBot::option('plugin.httpd', 'port') -# ? &SimBot::option('plugin.httpd', 'port') -# : 8000), -# ContentHandler => { -# '/' => \&index_handler, -# }, -# Headers => { -# Server => 'SimBot', -# }, -#); - POE::Component::Server::TCP->new( Alias => 'web_server', Port => (defined &SimBot::option('plugin.httpd', 'port') @@ -67,14 +53,13 @@ sub index_handler { my $response = HTTP::Response->new(200); - #my ($req_root) = $request->uri =~ m|^http://.*?/([^/\?]*)|; my ($req_root) = $request->uri =~ m|^/([^\?]*)|; &SimBot::debug(3, 'httpd: handling request for ' . $request->uri . ", req root $req_root\n"); if(defined $SimBot::hash_plugin_httpd_pages{$req_root}) { my $handler = $SimBot::hash_plugin_httpd_pages{$req_root}->{'handler'}; - &$handler($request, $response); + &$handler($request, $response, \&get_template); if(defined $response->code && $response->code == RC_UNAUTHORIZED) { $response->content('Bad login/pass or your browser does not know how to log in.'); @@ -94,7 +79,7 @@ sub index_handler { return; } - my $msg = &page_header('SimBot'); + my $msg; $msg .= "<ul>\n"; foreach my $url (keys %SimBot::hash_plugin_httpd_pages) { my $title = $SimBot::hash_plugin_httpd_pages{$url}->{'title'}; @@ -105,25 +90,36 @@ sub index_handler { $response->code(RC_OK); $response->push_header("Content-Type", "text/html"); - $response->content($msg); + + my $template = &get_template('base'); + $template->param( + title => 'Index', + content => $msg, + ); + $response->content($template->output()); $heap->{client}->put($response); $kernel->yield('shutdown'); } -sub page_header { - my ($title) = @_; +sub get_template { + my $template = $_[0]; + my $file_name; - return <<EOT; -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head> -<link rel="generator" href="http://simbot.sf.net/" /> -<title>$title</title> -</head> -<body> -EOT + if(-r "templates/${template}.local.tmpl") { + $file_name = "templates/${template}.local.tmpl"; + } elsif(-r "templates/${template}.default.tmpl") { + $file_name = "templates/${template}.default.tmpl"; + } else { + &SimBot::debug(&SimBot::DEBUG_WARNING, "httpd: No template $template available!"); + return; + } + return HTML::Template->new( filename => $file_name, + die_on_bad_params => 0, + case_sensitive => 1, + loop_context_vars => 1, + ); } sub admin_page { @@ -147,8 +143,8 @@ sub admin_page { $response->code(RC_UNAUTHORIZED); return; } - my $msg = &page_header('SimBot Admin'); - + my $msg; + my $say; if($request->uri =~ m|\?restart$|) { if(!defined $kernel) { @@ -158,13 +154,13 @@ sub admin_page { $response->code(RC_OK); $response->content('OK, restarting'); return; - } elsif(my ($say) = $request->uri =~ m|\?say=(\S+)$|) { + } elsif(($say) = $request->uri =~ m|\?say=(\S+)$|) { $say =~ s/\+/ /g; $say =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; &SimBot::debug(3, "Speech requested by web admin\n"); &SimBot::send_message(&SimBot::option('network', 'channel'), $say); - } elsif(my ($say) = $request->uri =~ m|\?action=(\S+)$|) { + } elsif(($say) = $request->uri =~ m|\?action=(\S+)$|) { $say =~ s/\+/ /g; $say =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; &SimBot::debug(3, "Action requested by web admin\n"); @@ -175,7 +171,13 @@ sub admin_page { $msg .= '<li><form method="get" action=""><label for="say">Say: </label><input name="say"/></form></li>'; $msg .= '<li><form method="get" action=""><label for="action">Action: </label><input name="action"/></form></li>'; $response->code(RC_OK); - $response->content($msg); + + my $template = &get_template('base'); + $template->param( + title => 'Admin', + content => $msg, + ); + $response->content($template->output()); } sub messup_httpd { |
|
From: Kevin S. <ks...@us...> - 2005-08-10 02:28:50
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5677 Modified Files: simbot.pl Log Message: Initialize to 0 in for loops Index: simbot.pl =================================================================== RCS file: /cvsroot/simbot/simbot/simbot.pl,v retrieving revision 1.136 retrieving revision 1.137 diff -u -d -p -r1.136 -r1.137 --- simbot.pl 9 Aug 2005 01:32:36 -0000 1.136 +++ simbot.pl 9 Aug 2005 01:52:57 -0000 1.137 @@ -588,10 +588,10 @@ sub htmlize { sub html_mask_email { my ($user, $host) = $_[0] =~ m/^(\S+)@(\S+)$/; my ($nuser, $nhost); - for(my $i; $i < length $user; $i++) { + for(my $i = 0; $i < length $user; $i++) { $nuser .= '&#' . ord(substr($user, $i, 1)) . ';'; } - for(my $i; $i < length $host; $i++) { + for(my $i = 0; $i < length $host; $i++) { $nhost .= '&#' . ord(substr($host, $i, 1)) . ';'; } |
|
From: Pete P. <fou...@us...> - 2005-08-10 02:23:56
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11427/plugins Modified Files: httpd.pl Log Message: - Remove the 500 generator page. - Fix the HTML in the admin page. Index: httpd.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/httpd.pl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -p -r1.13 -r1.14 --- httpd.pl 9 Aug 2005 01:38:19 -0000 1.13 +++ httpd.pl 9 Aug 2005 02:33:57 -0000 1.14 @@ -175,6 +175,7 @@ sub admin_page { $msg .= '<ul><li><a href="/admin?restart">Restart Simbot</a></li>'; $msg .= '<li><form method="get" action=""><label for="say">Say: </label><input name="say"/></form></li>'; $msg .= '<li><form method="get" action=""><label for="action">Action: </label><input name="action"/></form></li>'; + $msg .= '</ul>'; $response->code(RC_OK); my $template = &get_template('base'); @@ -196,11 +197,6 @@ sub messup_httpd { 'handler' => \&admin_page, }; } - - $SimBot::hash_plugin_httpd_pages{'fiveohoh'} = { - 'title' => 'Internal Server Error Generation Department', - 'handler' => sub {}, - }; } sub cleanup_httpd { |