From 53422a7545d77c767cbc737c043eab7d01c64411 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Mon, 24 Jan 2011 19:16:42 -0700 Subject: [PATCH] Parse Numeric:005 and store PREFIX's data. --- doc/CHANGELOG | 1 + src/Parser/IRC.pm | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index bd16261..1832b0a 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev ================================================================== + * Parse Numeric:005 and store PREFIX's data. * Bug fix: The bot's nick is now stored correctly. * Added server:modes config option for setting modes on connect. diff --git a/src/Parser/IRC.pm b/src/Parser/IRC.pm index f486eb0..2732508 100644 --- a/src/Parser/IRC.pm +++ b/src/Parser/IRC.pm @@ -12,6 +12,7 @@ use API::IRC; # Raw parsing hash. our %RAWC = ( '001' => \&num001, + '005' => \&num005, '432' => \&num432, '433' => \&num433, '438' => \&num438, @@ -26,7 +27,7 @@ our %RAWC = ( ); # Variables for various functions. -our (%got_001, %botnick, %botchans); +our (%got_001, %botnick, %botchans, %csprefix); # Events. API::Std::event_add("on_rcjoin"); @@ -108,6 +109,30 @@ sub num001 return 1; } +# Parse: Numeric:005 +# Prefixes. +sub num005 +{ + my ($svr, @ex) = @_; + + # Find PREFIX. + foreach my $ex (@ex) { + if (substr($ex, 0, 7) eq "PREFIX=") { + # Found. + my $rpx = substr($ex, 8); + my ($pm, $pp) = split('\)', $rpx); + my @apm = split(//, $pm); + my @app = split(//, $pp); + foreach my $ppm (@apm) { + # Store data. + $csprefix{$svr}{$ppm} = shift(@app); + } + } + } + + return 1; +} + # Parse: Numeric:432 # Erroneous nickname. sub num432