* 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:
1 parent
ccc66f5a4e
commit
43bcb86d90
4 files changed
+18
-6
No files matched your search
@@ -169,9 +169,7 @@ foreach my $cskey (keys %cservers) {
|
||||
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)
|
||||
and next;
|
||||
socksnd($cskey, "NICK ".$cservers{$cskey}{'nick'}[0]) or
|
||||
err(2, "Failed to connect to server: ".$cskey." [".$cservers{$cskey}{'host'}[0].":".$cservers{$cskey}{'port'}[0]."]", 0)
|
||||
and next;
|
||||
API::IRC::nick($cskey, $cservers{$cskey}{'nick'}[0]);
|
||||
# Create the process.
|
||||
$SOCKPROC{$cskey} = Async->new(sub {
|
||||
# Infinite loop.
|
||||
|
||||
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Indev
|
||||
==================================================================
|
||||
* Parse Numeric:433.
|
||||
* Added nick() to API::IRC.
|
||||
* Added %got_001 to Parser::IRC for checking if we've been
|
||||
sent 001.
|
||||
|
||||
+3
-1
@@ -9,7 +9,7 @@ use warnings;
|
||||
use 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.
|
||||
@@ -71,6 +71,8 @@ sub nick
|
||||
my ($svr, $newnick) = @_;
|
||||
|
||||
Auto::socksnd($svr, "NICK $newnick");
|
||||
|
||||
$Parser::IRC::botnick{$svr} = $newnick;
|
||||
}
|
||||
|
||||
# Quit IRC.
|
||||
|
||||
+13
-2
@@ -7,15 +7,16 @@ package Parser::IRC;
|
||||
use strict;
|
||||
use warnings;
|
||||
use API::Std qw(conf_get);
|
||||
use API::IRC qw(cjoin);
|
||||
use API::IRC qw(cjoin nick);
|
||||
|
||||
# Raw parsing hash.
|
||||
our %RAWC = (
|
||||
'001' => \&num001,
|
||||
'433' => \&num433,
|
||||
);
|
||||
|
||||
# Variables for various functions.
|
||||
our (%got_001);
|
||||
our (%got_001, %botnick);
|
||||
|
||||
# Parse raw data.
|
||||
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;
|
||||
Reference in new issue
Block a user