* Use nick() for initial NICK.

* Parse Numeric:433.
* Added %botnick for storing the bot's nick.
* Renamed mode() to cmode() in API::IRC's @EXPORT_OK
This commit is contained in:
Elijah Perrault committed 2011-01-20 20:59:50 -07:00
1 parent ccc66f5a4e
commit 43bcb86d90
4 files changed
+18 -6

No files matched your search

+1 -3
View File
@@ -169,9 +169,7 @@ foreach my $cskey (keys %cservers) {
socksnd($cskey, "USER ".$cservers{$cskey}{'ident'}[0]." * * :".$cservers{$cskey}{'realname'}[0]) or socksnd($cskey, "USER ".$cservers{$cskey}{'ident'}[0]." * * :".$cservers{$cskey}{'realname'}[0]) or
err(2, "Failed to connect to server: ".$cskey." [".$cservers{$cskey}{'host'}[0].":".$cservers{$cskey}{'port'}[0]."]", 0) err(2, "Failed to connect to server: ".$cskey." [".$cservers{$cskey}{'host'}[0].":".$cservers{$cskey}{'port'}[0]."]", 0)
and next; and next;
socksnd($cskey, "NICK ".$cservers{$cskey}{'nick'}[0]) or API::IRC::nick($cskey, $cservers{$cskey}{'nick'}[0]);
err(2, "Failed to connect to server: ".$cskey." [".$cservers{$cskey}{'host'}[0].":".$cservers{$cskey}{'port'}[0]."]", 0)
and next;
# Create the process. # Create the process.
$SOCKPROC{$cskey} = Async->new(sub { $SOCKPROC{$cskey} = Async->new(sub {
# Infinite loop. # Infinite loop.
+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev 3.0 Indev
================================================================== ==================================================================
* Parse Numeric:433.
* Added nick() to API::IRC. * Added nick() to API::IRC.
* Added %got_001 to Parser::IRC for checking if we've been * Added %got_001 to Parser::IRC for checking if we've been
sent 001. sent 001.
+3 -1
View File
@@ -9,7 +9,7 @@ use warnings;
use Exporter; use Exporter;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT_OK = qw(cjoin cpart mode privmsg notice quit); our @EXPORT_OK = qw(cjoin cpart cmode privmsg notice quit nick);
# Join a channel. # Join a channel.
@@ -71,6 +71,8 @@ sub nick
my ($svr, $newnick) = @_; my ($svr, $newnick) = @_;
Auto::socksnd($svr, "NICK $newnick"); Auto::socksnd($svr, "NICK $newnick");
$Parser::IRC::botnick{$svr} = $newnick;
} }
# Quit IRC. # Quit IRC.
+13 -2
View File
@@ -7,15 +7,16 @@ package Parser::IRC;
use strict; use strict;
use warnings; use warnings;
use API::Std qw(conf_get); use API::Std qw(conf_get);
use API::IRC qw(cjoin); use API::IRC qw(cjoin nick);
# Raw parsing hash. # Raw parsing hash.
our %RAWC = ( our %RAWC = (
'001' => \&num001, '001' => \&num001,
'433' => \&num433,
); );
# Variables for various functions. # Variables for various functions.
our (%got_001); our (%got_001, %botnick);
# Parse raw data. # Parse raw data.
sub _parse sub _parse
@@ -68,4 +69,14 @@ sub num001
} }
} }
# Parse: Numeric:433
sub num433
{
my ($svr, undef) = @_;
if (defined $botnick{$svr}) {
nick($svr, $botnick{$svr}."_");
}
}
1; 1;