Parse NAME replies (Numeric:353).
This commit is contained in:
1 parent
c1ab769a58
commit
6f9a250211
2 files changed
+42
-1
No files matched your search
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
|
|||||||
|
|
||||||
3.0 Indev
|
3.0 Indev
|
||||||
==================================================================
|
==================================================================
|
||||||
|
* Parse NAME replies (Numeric:353).
|
||||||
* Parse Numeric:005 and store PREFIX's data.
|
* Parse Numeric:005 and store PREFIX's data.
|
||||||
* Bug fix: The bot's nick is now stored correctly.
|
* Bug fix: The bot's nick is now stored correctly.
|
||||||
* Added server:modes config option for setting modes on
|
* Added server:modes config option for setting modes on
|
||||||
|
|||||||
+41
-1
@@ -13,6 +13,7 @@ use API::IRC;
|
|||||||
our %RAWC = (
|
our %RAWC = (
|
||||||
'001' => \&num001,
|
'001' => \&num001,
|
||||||
'005' => \&num005,
|
'005' => \&num005,
|
||||||
|
'353' => \&num353,
|
||||||
'432' => \&num432,
|
'432' => \&num432,
|
||||||
'433' => \&num433,
|
'433' => \&num433,
|
||||||
'438' => \&num438,
|
'438' => \&num438,
|
||||||
@@ -27,7 +28,7 @@ our %RAWC = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
# Variables for various functions.
|
# Variables for various functions.
|
||||||
our (%got_001, %botnick, %botchans, %csprefix);
|
our (%got_001, %botnick, %botchans, %csprefix, %chanusers);
|
||||||
|
|
||||||
# Events.
|
# Events.
|
||||||
API::Std::event_add("on_rcjoin");
|
API::Std::event_add("on_rcjoin");
|
||||||
@@ -133,6 +134,45 @@ sub num005
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Parse: Numeric:353
|
||||||
|
# NAMES reply.
|
||||||
|
sub num353
|
||||||
|
{
|
||||||
|
my ($svr, @ex) = @_;
|
||||||
|
|
||||||
|
# Get rid of the colon.
|
||||||
|
$ex[5] = substr($ex[5], 1);
|
||||||
|
# Delete the old chanusers hash if it exists.
|
||||||
|
delete $chanusers{$svr}{$ex[4]} if (defined $chanusers{$svr}{$ex[4]});
|
||||||
|
# Iterate through each user.
|
||||||
|
for (my $i = 5; $i < scalar(@ex); $i++) {
|
||||||
|
my $fi = 0;
|
||||||
|
foreach (keys %{ $csprefix{$svr} }) {
|
||||||
|
# Check if the user has status in the channel.
|
||||||
|
if (substr($ex[$i], 0, 1) eq $csprefix{$svr}{$_}) {
|
||||||
|
# He/she does. Lets set that.
|
||||||
|
if (defined $chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))}) {
|
||||||
|
# If the user has multiple statuses.
|
||||||
|
$chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} .= $_;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Or not.
|
||||||
|
$chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} = $_;
|
||||||
|
}
|
||||||
|
$fi = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# They had status, so go to the next user.
|
||||||
|
next if $fi;
|
||||||
|
# They didn't, set them as a normal user.
|
||||||
|
if (!defined $chanusers{$svr}{$ex[4]}{lc($ex[$i])}) {
|
||||||
|
$chanusers{$svr}{$ex[4]}{lc($ex[$i])} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
# Parse: Numeric:432
|
# Parse: Numeric:432
|
||||||
# Erroneous nickname.
|
# Erroneous nickname.
|
||||||
sub num432
|
sub num432
|
||||||
|
|||||||
Reference in new issue
Block a user