diff options
-rw-r--r-- | Plugin/Log.pm | 73 | ||||
-rwxr-xr-x | idalius.pl | 115 |
2 files changed, 185 insertions, 3 deletions
diff --git a/Plugin/Log.pm b/Plugin/Log.pm index 135cd85..a5dee69 100644 --- a/Plugin/Log.pm +++ b/Plugin/Log.pm @@ -31,12 +31,61 @@ sub configure { return $self; } -# FIXME Not triggered yet -sub on_001 { +# IRC 001 +sub on_welcome { my ($self, $logger, $server, $message, $irc) = @_; $logger->("$t{info}Connected to $t{host}$server$t{info} --- \"$t{message}$message$t{info}\"$t{reset}"); } +# IRC 002 +sub on_your_host { + my ($self, $logger, $message, $irc) = @_; + $logger->("$t{info} --- \"$t{message}$message$t{info}\"$t{reset}"); +} + +# IRC 003 +sub on_created { + my ($self, $logger, $message, $irc) = @_; + $logger->("$t{info} --- \"$t{message}$message$t{info}\"$t{reset}"); +} + +# IRC 004 +sub on_my_info { + my ($self, $logger, $message, $irc) = @_; + $logger->("$t{info} --- \"$t{message}$message$t{info}\"$t{reset}"); +} + +# IRC 251 +sub on_251_user_client { + my ($self, $logger, $message, $irc) = @_; + $logger->("$t{info}Online: \"$t{message}$message$t{info}\"$t{reset}"); +} + +# IRC 252 +sub on_252_user_op { + my ($self, $logger, $count, $message, $irc) = @_; + $logger->("$t{info}Online: \"$t{message}$count $message$t{info}\"$t{reset}"); +} + +# IRC 253 +sub on_253_user_unknown { + my ($self, $logger, $count, $message, $irc) = @_; + $logger->("$t{info}Online: \"$t{message}$count $message$t{info}\"$t{reset}"); +} + +# IRC 254 +sub on_254_user_channels { + my ($self, $logger, $count, $message, $irc) = @_; + $logger->("$t{info}Online: \"$t{message}$count $message$t{info}\"$t{reset}"); +} + +# IRC 255 +sub on_255_user_me { + my ($self, $logger, $message, $irc) = @_; + $logger->("$t{info}Online: \"$t{message}$message$t{info}\"$t{reset}"); +} + + sub on_message { my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_; $logger->("$t{bracket}\[$t{channel}$where->[0]$t{bracket}\] $t{nick}$who: $t{message}$what$t{reset}"); @@ -92,5 +141,25 @@ sub on_topic { sub on_ping { my ($self, $logger, $server, $irc) = @_; $logger->("$t{misc}IRC ping from $server$t{reset}"); + return; +} + +sub on_motd_content { + my ($self, $logger, $server, $motd, $irc) = @_; + $logger->("$t{info}MOTD: $t{message}$motd$t{reset}"); + return; } + +sub on_motd_begin { + my ($self, $logger, $server, $message, $irc) = @_; + $logger->("$t{info}$message$t{reset}"); + return; +} + +sub on_motd_end { + my ($self, $logger, $server, $message, $irc) = @_; + $logger->("$t{info}$message$t{reset}"); + return; +} + 1; @@ -55,7 +55,18 @@ POE::Session->create( _default _start irc_001 + irc_002 + irc_003 + irc_004 + irc_251 + irc_252 + irc_253 + irc_254 + irc_255 irc_302 + irc_372 + irc_375 + irc_376 irc_kick irc_ctcp_action irc_public @@ -315,13 +326,115 @@ sub irc_001 { my ($poek, $server, $message) = @_[KERNEL, ARG0, ARG1]; my @empty = (); - trigger_modules("001", undef, undef, \@empty, ($server, $message)); + trigger_modules("welcome", undef, undef, \@empty, ($server, $message)); # FIXME move to forward ping module $poek->delay(custom_ping => $ping_delay); return; } +# 002 (your host) +sub irc_002 { + my $message = $_[ARG1]; + my @empty = (); + + trigger_modules("your_host", undef, undef, \@empty, ($message)); + return; +} + +# 003 (created) +sub irc_003 { + my $message = $_[ARG1]; + my @empty = (); + + trigger_modules("created", undef, undef, \@empty, ($message)); + return; +} + +# 004 (myinfo) +sub irc_004 { + my $message = $_[ARG1]; + my @empty = (); + + trigger_modules("my_info", undef, undef, \@empty, ($message)); + return; +} + +# 251 (luserclient) +sub irc_251 { + my $message = $_[ARG1]; + my @empty = (); + + trigger_modules("251_user_client", undef, undef, \@empty, ($message)); + return; +} + +# 252 (luserop) +sub irc_252 { + my ($count, $message) = @{$_[ARG2]}; + my @empty = (); + + trigger_modules("252_user_op", undef, undef, \@empty, ($count, $message)); + return; +} + +# 253 (luserunknown) +sub irc_253 { + my ($count, $message) = @{$_[ARG2]}; + my @empty = (); + + trigger_modules("253_user_unknown", undef, undef, \@empty, ($count, $message)); + return; +} + +# 254 (luserchannels) +sub irc_254 { + my ($count, $message) = @{$_[ARG2]}; + my @empty = (); + + trigger_modules("254_user_channels", undef, undef, \@empty, ($count, $message)); + return; +} + +# 255 (luserme) +sub irc_255 { + my ($message) = $_[ARG1]; + my @empty = (); + + trigger_modules("255_user_me", undef, undef, \@empty, ($message)); + return; +} + + + +# 372 (MOTD content) +sub irc_372 { + my ($server, $motd) = @_[ARG0..ARG1]; + my @empty = (); + + trigger_modules("motd_content", undef, undef, \@empty, ($server, $motd)); + return; +} + +# 375 (MOTD begin) +sub irc_375 { + my ($server, $message) = @_[ARG0..ARG1]; + my @empty = (); + + trigger_modules("motd_begin", undef, undef, \@empty, ($server, $message)); + return; +} + +# 376 (MOTD end) +sub irc_376 { + my ($server, $message) = @_[ARG0..ARG1]; + my @empty = (); + + trigger_modules("motd_end", undef, undef, \@empty, ($server, $message)); + return; +} + + sub irc_ctcp_action { my ($sender, $who, $where, $what) = @_[SENDER, ARG0 .. ARG2]; my $nick = ( split /!/, $who )[0]; |