Changeset 19333

Show
Ignore:
Timestamp:
09/15/08 20:35:36 (5 years ago)
Author:
daisuke
Message:

とりあえずログ取ったりできるようになった

Location:
lang/perl/Morris/trunk
Files:
3 added
5 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Morris/trunk/eg/morris.conf.example.conf

    r19289 r19333  
    2020 
    2121    # Takes logs for a channel, and puts it in a file 
    22     # Unimplemented yet. 
    2322    <Plugin Channel::Log::File> 
    24         Channel \#endeworks 
     23        Channel \#channelname 
    2524        Directory /path/to/directory 
    2625    </Plugin> 
  • lang/perl/Morris/trunk/lib/Morris.pm

    r19289 r19333  
    22 
    33package Morris; 
     4use 5.008; 
    45 
    56our $AUTHORITY = 'cpan:DMAKI'; 
  • lang/perl/Morris/trunk/lib/Morris/Plugin/Channel/Join.pm

    r19289 r19333  
    3838sub join_channels { 
    3939    my $self = shift; 
    40     $self->connection->irc_join( { channels => $self->channels } ); 
     40    $self->connection->irc_join( { channels => [ $self->channels ] } ); 
    4141} 
    4242 
  • lang/perl/Morris/trunk/lib/Morris/Plugin/Channel/Log.pm

    r19289 r19333  
    22 
    33package Morris::Plugin::Channel::Log; 
    4 use Moose; 
     4use Moose::Role; 
    55 
    66with 'Morris::Plugin'; 
     
    1212); 
    1313 
    14 __PACKAGE__->meta->make_immutable; 
     14requires 'log_message'; 
    1515 
    16 no Moose; 
     16no Moose::Role; 
    1717 
    1818sub register { 
    1919    my ($self, $conn) = @_; 
    20     $conn->register_hook( 'channel.public', sub { $self->log_message(@_) } ); 
     20    $conn->register_hook( 'channel.public', sub { $self->handle_message(@_) } ); 
    2121} 
    2222 
    23 sub log_message { 
     23sub handle_message { 
    2424    my ($self, $args) = @_; 
    2525 
    2626    my $message = $args->{message}; 
     27 
    2728    # make sure this is from the correct channel 
    28  
    2929    if ($message->channel eq $self->channel) { 
    30         print "incoming ", $message->message, "\n"; 
     30        $self->log_message($args); 
    3131    } 
    3232} 
  • lang/perl/Morris/trunk/lib/Morris/Plugin/Reply/Templated.pm

    r19289 r19333  
    11# $Id$ 
     2 
     31; 
    24 
    35__END__