Our usermodes are now tracked in Proto::IRC::umodes.

This commit is contained in:
Elijah Perrault committed 2011-03-04 20:45:31 -07:00
1 parent 963f55cc01
commit 10fbddd2a6
2 files changed
+31

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
===============================================================================
* Our usermodes are now tracked in Proto::IRC::umodes.
* Added events on_cmode and on_umode.
* Added event on_myinfo for RPL_MYINFO (numeric 004).
* Raw hooks now take hook names and support multiple hooks. This changes
+30
View File
@@ -204,6 +204,36 @@ hook_add('on_disconnect', 'core.irc.deldata', sub {
return 1;
});
# Track our usermodes.
hook_add('on_umode', 'core.irc.state.umode', sub {
my (($svr, $modes)) = @_;
# Remove anything after a space.
$modes =~ s/(\s.*)//xsm;
# Split the modes.
my @modes = split //, $modes;
# Set operator to 1.
my $op = 1;
# Iterate through the modes.
foreach (@modes) {
if ($_ eq '-') { $op = 0 }
elsif ($_ eq '+') { $op = 1 }
else {
# Adjust our modes.
if ($op) {
$Proto::IRC::umodes{$svr} .= $_;
}
else {
$Proto::IRC::umodes{$svr} =~ s/($_)//xsm;
}
}
}
return 1;
});
1;
# vim: set ai et sw=4 ts=4: