/[irc-logger]/trunk/bin/irc-logger.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/irc-logger.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 76 by dpavlin, Thu Feb 7 17:09:54 2008 UTC revision 77 by dpavlin, Thu Feb 7 17:48:51 2008 UTC
# Line 973  sub root_handler { Line 973  sub root_handler {
973    
974          my $search = $q->param('search') || $q->param('grep') || '';          my $search = $q->param('search') || $q->param('grep') || '';
975    
976          if ($request->url =~ m#/rss#i) {          if ($request->url =~ m#/rss(?:/(tags)(?:=(\d+))?)#i) {
977                    my $show = lc($1);
978                    my $arg = $2 || 50;
979    
980                  my $type = 'RSS';       # Atom                  my $type = 'RSS';       # Atom
981    
982                  $response->content_type( 'application/' . lc($type) . '+xml' );                  $response->content_type( 'application/' . lc($type) . '+xml' );
# Line 983  sub root_handler { Line 986  sub root_handler {
986    
987                  my $feed = XML::Feed->new( $type );                  my $feed = XML::Feed->new( $type );
988    
989                  $feed->title( "last $last_x_tags from $CHANNEL" );                  if ( $show eq 'tags' ) {
990                  $feed->link( $url );                          $feed->title( "tags from $CHANNEL" );
991                  $feed->description( "collects messages which have tags// in them" );                          $feed->link( "$url/tags" );
992                            $feed->description( "tag cloud created from messages on channel $CHANNEL which have tags// in them" );
                 foreach my $m ( @last_tags ) {  
 #                       warn dump( $m );  
                         #my $tags = join(' ', @{$m->{tags}} );  
993                          my $feed_entry = XML::Feed::Entry->new($type);                          my $feed_entry = XML::Feed::Entry->new($type);
994                          $feed_entry->title( $m->{nick} . '@' . $m->{time} );                          $feed_entry->title( "$arg tags from $CHANNEL" );
995                          $feed_entry->author( $m->{nick} );                          $feed_entry->author( $NICK );
996                          $feed_entry->link( '/#' . $m->{id}  );                          $feed_entry->link( '/#tags'  );
                         $feed_entry->issued( DateTime::Format::Flexible->build( $m->{time} ) );  
   
                         my $message = $filter->{message}->( $m->{message} );  
                         $message .= "<br/>\n" unless $message =~ m!<(/p|br/?)>!;  
                         warn "## message = $message\n";  
                         from_to( $message, $ENCODING, 'UTF-8' );  
997    
                         #$feed_entry->summary(  
998                          $feed_entry->content(                          $feed_entry->content(
999                                  "<![CDATA[$message]]>"                                  qq{<![CDATA[<style type="text/css">}
1000                                    . $cloud->css
1001                                    . qq{</style>}
1002                                    . $cloud->html( $arg )
1003                                    . qq{]]>}
1004                          );                          );
                         $feed_entry->category( join(', ', @{$m->{tags}}) );  
1005                          $feed->add_entry( $feed_entry );                          $feed->add_entry( $feed_entry );
1006    
1007                    } else {
1008    
1009                            $feed->title( "last $last_x_tags from $CHANNEL" );
1010                            $feed->link( $url );
1011                            $feed->description( "collects messages which have tags// in them" );
1012    
1013                            foreach my $m ( @last_tags ) {
1014    #                               warn dump( $m );
1015                                    #my $tags = join(' ', @{$m->{tags}} );
1016                                    my $feed_entry = XML::Feed::Entry->new($type);
1017                                    $feed_entry->title( $m->{nick} . '@' . $m->{time} );
1018                                    $feed_entry->author( $m->{nick} );
1019                                    $feed_entry->link( '/#' . $m->{id}  );
1020                                    $feed_entry->issued( DateTime::Format::Flexible->build( $m->{time} ) );
1021    
1022                                    my $message = $filter->{message}->( $m->{message} );
1023                                    $message .= "<br/>\n" unless $message =~ m!<(/p|br/?)>!;
1024                                    warn "## message = $message\n";
1025                                    from_to( $message, $ENCODING, 'UTF-8' );
1026    
1027                                    #$feed_entry->summary(
1028                                    $feed_entry->content(
1029                                            "<![CDATA[$message]]>"
1030                                    );
1031                                    $feed_entry->category( join(', ', @{$m->{tags}}) );
1032                                    $feed->add_entry( $feed_entry );
1033                            }
1034                  }                  }
1035    
1036                  $response->content( $feed->as_xml );                  $response->content( $feed->as_xml );
# Line 1020  sub root_handler { Line 1044  sub root_handler {
1044          $response->content_type("text/html; charset=$ENCODING");          $response->content_type("text/html; charset=$ENCODING");
1045    
1046          my $html =          my $html =
1047                  qq{<html><head><title>$NICK</title><style type="text/css">$style} .                  qq{<html><head><title>$NICK</title><style type="text/css">$style}
1048                  $cloud->css .                  . $cloud->css
1049                  qq{</style></head><body>} .                  . qq{</style></head><body>}
1050                  qq{                  . qq{
1051                  <form method="post" class="search" action="/">                  <form method="post" class="search" action="/">
1052                  <input type="text" name="search" value="$search" size="10">                  <input type="text" name="search" value="$search" size="10">
1053                  <input type="submit" value="search">                  <input type="submit" value="search">
1054                  </form>                  </form>
1055                  } .                  }
1056                  $cloud->html(500) .                  . $cloud->html(500)
1057                  qq{<p>};                  . qq{<p>};
1058    
1059          if ($request->url =~ m#/tags?#) {          if ($request->url =~ m#/tags?#) {
1060                  # nop                  # nop

Legend:
Removed from v.76  
changed lines
  Added in v.77

  ViewVC Help
Powered by ViewVC 1.1.26