[SimBot-commits] CVS: simbot simbot.pl,1.124,1.125
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2005-07-25 03:07:57
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31830 Modified Files: simbot.pl Log Message: We now pay a little attention to RPL_ISUPPORT (005). - If the IRCD is dancer, we try to set the no-forwards user mode. This should prevent plugins getting confused, although a proper fix would be better. - Some comments on what we should do with WATCH, MODES, and STATUSMSG WATCH should replace polling ison on servers that support it MODES and STATUSMSG are more channel management features, and aren't useful until simbot does that kind of thing. Index: simbot.pl =================================================================== RCS file: /cvsroot/simbot/simbot/simbot.pl,v retrieving revision 1.124 retrieving revision 1.125 diff -u -d -p -r1.124 -r1.125 --- simbot.pl 19 Jul 2005 02:50:00 -0000 1.124 +++ simbot.pl 25 Jul 2005 03:07:47 -0000 1.125 @@ -326,6 +326,7 @@ POE::Component::IRC->new('bot'); POE::Session->new ( _start => \&initialize, irc_001 => \&irc_connected, # connected + irc_005 => \&server_supports, # RPL_ISUPPORT irc_433 => \&pick_new_nick, # nickname in use irc_socketerr => \&socket_error, # internet wants to yell at us irc_error => \&server_error, # server wants to yell at us @@ -1991,6 +1992,56 @@ sub server_banned { } +# SERVER_SUPPORTS: called when the server tells us some information about +# itself. Right now, we use it to figure out what network we are on +# and enable any network specific modes. +# In the future, this could be used to make any channel management features +# more efficient by configuring the number of modes that can be set at once, +# how many bans the server allows, if the server supports invite and ban +# exceptions, etc +# Also, could be used to push ignores serverside with the SILENCE command +sub server_supports { + my ($message) = $_[ARG1] =~ m/^(.*):.*?$/; + &debug(4, "Server supports: ${message}\n"); + + foreach my $cur_block (split(/ /, $message)) { + &debug(3, "$cur_block "); + if(my ($ircd) = $cur_block =~ m/^IRCD=(\S+)/) { + if($ircd =~ m/dancer/) { + &debug(3, "We're on a Dancer IRCD server, setting no-forward user mode\n"); + + # +Q tells the server not to try to forward us to another + # channel. + # FIXME: Channel forwarding should work, or at least be handled + # nicely. Right now many plugins assume that the channel we are + # in is the channel defined in the config file, which may + # not be true. + $kernel->post(bot => mode => $chosen_nick => '+Q'); + } + + # } elsif(my ($maxwatch) = $cur_block =~ m/^WATCH=(\d+)/) { + # hmm... the server supports watch lists + # let's use them instead of polling with ison + + + + # } elsif(my ($maxmodes) = $cur_block =~ m/^MODES=(\d+)/) { + # This tells us how many mode changes can be done at once. + # mode flags count as 1, arguments count as 1 + # (so +b foo counts as 2, while +i counts as 1) + + # } elsif(my ($modeflags) = $cur_block =~ m/^STATUSMSG=(\S+)/) { + # This tells us what mode flags (+%@ etc) we can stick in front + # of a channel name to message that channels voiced/halfops/ops + # + means we can use +#channel to message the channel's voiced, + # halfops, and ops. % is halfops and ops, @ is ops. + + # we should use this for any wallchops type command + # if the server tells us it can + } + } +} + # SOCKET_ERROR: Spit out the error, then reconnect to IRC. sub socket_error { &debug(1, "$_[ARG0]\n"); |