simbot-commits Mailing List for SimBot (Page 7)
Status: Abandoned
Brought to you by:
kstange
This list is closed, nobody may subscribe to it.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(88) |
Jun
(11) |
Jul
(64) |
Aug
(74) |
Sep
(1) |
Oct
(4) |
Nov
(12) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(1) |
Nov
(4) |
Dec
|
| 2007 |
Jan
(5) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Pete P. <fou...@us...> - 2005-07-26 01:52:29
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29431 Modified Files: simbot.pl Log Message: Remove unneeded debug statement Index: simbot.pl =================================================================== RCS file: /cvsroot/simbot/simbot/simbot.pl,v retrieving revision 1.127 retrieving revision 1.128 diff -u -d -p -r1.127 -r1.128 --- simbot.pl 25 Jul 2005 09:34:10 -0000 1.127 +++ simbot.pl 26 Jul 2005 01:52:20 -0000 1.128 @@ -2019,7 +2019,6 @@ sub server_supports { &debug(DEBUG_INFO, "Server supports: ${message}\n"); foreach my $cur_block (split(/ /, $message)) { - &debug(DEBUG_STD, "$cur_block "); if(my ($ircd) = $cur_block =~ m/^IRCD=(\S+)/) { if($ircd =~ m/dancer/) { &debug(DEBUG_STD, "We're on a Dancer IRCD server, setting no-forward user mode\n"); |
|
From: Kevin S. <ks...@us...> - 2005-07-26 01:44:14
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27782/plugins Modified Files: services.chanserv.pl Log Message: Barring any likely logic flaws generated by my brain, this removes nickname linking support, adds checking for registration via nickserv, ghosting for nick recovery, and makes login not happen when nickserv randomly appears, but rather only when it says, "Hey, you're not logged in." Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -p -r1.10 -r1.11 --- services.chanserv.pl 25 Jul 2005 15:03:38 -0000 1.10 +++ services.chanserv.pl 26 Jul 2005 01:44:05 -0000 1.11 @@ -39,11 +39,12 @@ our $shut_up = 0; # SERVICES_LOGIN: Here, we log into nickserv if we have a services username and # password, since logging in would be tricky, at best, without them. sub services_login { + my $kernel = $_[0]; my $pass = &SimBot::option('services', 'pass'); if ($pass) { &SimBot::debug(3, "Logging into services...\n"); - &SimBot::send_message("nickserv", "identify $pass"); + $kernel->post(bot => sl => "nickserv identify $pass"); } } @@ -51,33 +52,30 @@ sub services_login { # something. Here, we handle different possible cases. sub check_response { my ($kernel, $nick, undef, $text) = @_; - my $user = &SimBot::option('services', 'user'); my $pass = &SimBot::option('services', 'pass'); my $me = $SimBot::chosen_nick; + my $want = &SimBot::option('global', 'nickname'); my $chan = &SimBot::option('network', 'channel'); if (lc($nick) eq lc("NickServ")) { $services_online = 1; if ($text =~ /is( not|n\'t) registered/i) { # Try to register!! - &SimBot::debug(2, "Nickname $me is not registered; Trying to register it now...\n"); - &SimBot::send_message("nickserv", "register $pass"); + if ($me eq $want) { + &SimBot::debug(3, "Nickname $me is not registered; trying to register it now...\n"); + $kernel->post(bot => sl => "nickserv register $pass"); + } + } elsif ($text =~ /Nickname: ([^\s]+)/i) { + &SimBot::debug(4, "Nickname $1 is already registered; waiting for nickserv to ask for us to identify...\n"); } elsif ($text =~ /Your nickname is now registered/i) { &SimBot::debug(3, "Nickname $me registered successfully.\n"); $logged_in = 1; - # Special case. If username is set, link this nickname to main. - if (defined $user && lc($me) ne lc($user)) { - &SimBot::debug(3, "Attempting to link nickname registration to $user...\n"); - &SimBot::send_message("nickserv", "link $user $pass"); - } if ($locked_out) { &request_unban($kernel, undef, $chan); } if ($shut_up) { &request_voice($kernel, undef, $chan); } - } elsif ($text =~ /Your nickname is now linked/i) { - &SimBot::debug(3, "Nickname linked to $user successfully.\n"); } elsif ($text =~ /Password incorrect/i) { if ($logged_in == 0) { &SimBot::debug(1, "Services reports login failure.\n"); @@ -86,7 +84,7 @@ sub check_response { } } elsif ($text =~ /This nickname is owned by someone else/i) { $logged_in = 0; - &services_login; + &services_login($kernel); } elsif ($text =~ /you are now recognized/i) { &SimBot::debug(3, "Services reports successful login.\n"); $logged_in = 1; @@ -102,7 +100,7 @@ sub check_response { } elsif ($text =~ /Access denied/i) { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; - &services_login; + &services_login($kernel); } elsif ($text =~ m/Your nickname is not yet authenticated/i) { &SimBot::debug(1, "Services reports: $text"); } @@ -117,7 +115,7 @@ sub check_response { } elsif ($text =~ /Password identification is required/i) { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; - &services_login; + &services_login($kernel); } } } @@ -131,13 +129,13 @@ sub request_unban { if($services_online && $logged_in) { if ($msg =~ /banned/i) { &SimBot::debug(2, "Could not join. Asking services for unban from $channel...\n"); - &SimBot::send_message("ChanServ", "unban $channel"); + $kernel->post(bot => sl => "chanserv unban $channel"); } else { # Try Invite &SimBot::debug(2, "Could not join. Asking services for invite to $channel...\n"); - &SimBot::send_message("ChanServ", "invite $channel"); + $kernel->post(bot => sl => "chanserv invite $channel"); } } elsif ($services_online) { - &services_login; + &services_login($kernel); } } } @@ -149,10 +147,10 @@ sub request_voice { $shut_up = 1; if($services_online && $logged_in) { &SimBot::debug(2, "Could not speak. Asking for voice on $channel...\n"); - &SimBot::send_message("ChanServ", "voice $channel"); + $kernel->post(bot => sl => "chanserv voice $channel"); $shut_up = 0; } elsif ($services_online) { - &services_login; + &services_login($kernel); } } } @@ -170,32 +168,44 @@ sub process_join { sub process_notify { my ($kernel, undef, undef, @nicks) = @_; my $found = 0; + my $me = $SimBot::chosen_nick; + my $want = &SimBot::option('global', 'nickname'); + my $pass = &SimBot::option('services', 'pass'); + foreach(@nicks) { if($_ eq "NickServ") { $found = 1; } } - if ((!$services_online || $locked_out || $shut_up) && $found) { - &services_login; - } + + if ((!$services_online) && $found) { + if ($me eq $want) { + # Just check registration. Nickserv will let us know whether + # we need to log in. + # XXX: This should be delayed. + $kernel->post(bot => sl => "nickserv info"); + } else { + $kernel->post(bot => sl => "nickserv ghost $want $pass"); + } + } $services_online = $found; } # KICK_USER: Kicks a user through ChanServ. sub kick_user { - my (undef, $channel, $user, $message) = @_; + my ($kernel, $channel, $user, $message) = @_; &SimBot::debug(3, "Asking Channel Service to kick $user from $channel ($message)...\n"); - &SimBot::send_message("ChanServ", "kick $channel $user $message"); + $kernel->post(bot => sl => "chanserv kick $channel $user $message"); } # BAN_USER: Kickbans a user through ChanServ. sub ban_user { - my (undef, $channel, $user, $time, $message) = @_; - my $hours = int($time / 3600); - &SimBot::debug(3, "Asking Channel Service to ban $user (" . - &SimBot::hostmask($user) . - ") from $channel ($message)...\n"); - &SimBot::send_message("ChanServ", "ban $channel " . &SimBot::hostmask($user) . "$message"); + my ($kernel, $channel, $user, $time, $message) = @_; + my $hours = int($time / 3600); + &SimBot::debug(3, "Asking Channel Service to ban $user (" . + &SimBot::hostmask($user) . + ") from $channel ($message)...\n"); + $kernel->post(bot => sl => "chanserv ban $channel " . &SimBot::hostmask($user) . "$message"); } # XXX: Freenode, at least, you can't unban specific users, it appears. |
|
From: Pete P. <fou...@us...> - 2005-07-26 00:59:29
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18110/plugins Modified Files: weather.pl Log Message: We now make our best guess at the complete timestamp based on the data in the METAR. If a station doesn't update for over a month, it'll be wrong, but hey, so will the weather. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -p -r1.104 -r1.105 --- weather.pl 24 Jul 2005 02:15:56 -0000 1.104 +++ weather.pl 26 Jul 2005 00:58:48 -0000 1.105 @@ -916,11 +916,26 @@ sub parse_metar { } elsif($cur_block =~ m/^(\d{2})(\d{2})(\d{2})Z$/) { # DAY/TIME - $timedate{'day'} = int $1; + my $day = int $1; + $timedate{'day'} = $day; $timedate{'hour'} = int $2; $timedate{'minute'} = int $3; $timedate{'timezone'} = 'UTC'; + if(!defined $timedate{'unixtime'}) { + my ($gmday, $month, $year) = (gmtime())[3, 4, 5]; + if($day > $gmday) { + # the day is after today UTC, so therefore it is probably + # last month. + $month -= 1; + if($month < 0) { + # Month is 0 based (0 = Jan, 11 = Dec) + $month = 11; + $year -= 1; + } + } + $timedate{'unixtime'} = timegm(0, $timedate{'minute'}, $timedate{'hour'}, $day, $month, $year); + } } elsif($cur_block =~ m/^(\d{3}|VRB|GRID\d{3})(\d{2})(?:G(\d{2}))?KT$/) { # WIND # dddss[Ggg]KT |
|
From: Kevin S. <ks...@us...> - 2005-07-25 15:03:48
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6013/plugins Modified Files: services.chanserv.pl Log Message: Theoretically sound, yes... but if this condition actually happens, we really can't assume was accurate, because we're obviously not logged in. Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -p -r1.9 -r1.10 --- services.chanserv.pl 25 Jul 2005 14:59:17 -0000 1.9 +++ services.chanserv.pl 25 Jul 2005 15:03:38 -0000 1.10 @@ -84,7 +84,8 @@ sub check_response { } else { &SimBot::debug(1, "Services command failed: Incorrect password.\n"); } - } elsif ($text =~ /This nickname is owned by someone else/i && $logged_in == 0) { + } elsif ($text =~ /This nickname is owned by someone else/i) { + $logged_in = 0; &services_login; } elsif ($text =~ /you are now recognized/i) { &SimBot::debug(3, "Services reports successful login.\n"); |
|
From: Kevin S. <ks...@us...> - 2005-07-25 14:59:28
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5073/plugins Modified Files: services.chanserv.pl Log Message: Missing quotation mark... Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -p -r1.8 -r1.9 --- services.chanserv.pl 25 Jul 2005 14:52:59 -0000 1.8 +++ services.chanserv.pl 25 Jul 2005 14:59:17 -0000 1.9 @@ -103,7 +103,7 @@ sub check_response { $logged_in = 0; &services_login; } elsif ($text =~ m/Your nickname is not yet authenticated/i) { - &SimBot::debug(1, "Services reports: $text); + &SimBot::debug(1, "Services reports: $text"); } } |
|
From: Kevin S. <ks...@us...> - 2005-07-25 14:54:45
|
Update of /cvsroot/simbot/simbot/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3970 Modified Files: .cvsignore Log Message: weather isn't supposed to be in CVS, so shut up. Index: .cvsignore =================================================================== RCS file: /cvsroot/simbot/simbot/data/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- .cvsignore 6 May 2005 21:23:53 -0000 1.2 +++ .cvsignore 25 Jul 2005 14:54:35 -0000 1.3 @@ -1,4 +1,5 @@ irclog +weather info *.pag *.dir |
|
From: Kevin S. <ks...@us...> - 2005-07-25 14:53:32
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3418/plugins Modified Files: services.chanserv.pl Log Message: Check for "nickname belongs to someone else" again. This introduces the slight chance that in order of operations, simbot will try to log in twice. Also cleaned out the code for specialized hostmasks, as it would be a waste of time to write that code. Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -p -r1.7 -r1.8 --- services.chanserv.pl 25 Jul 2005 14:33:45 -0000 1.7 +++ services.chanserv.pl 25 Jul 2005 14:52:59 -0000 1.8 @@ -31,7 +31,7 @@ use strict; # Start with the assumption Services are online, we are not locked out, and # we are not logged in, and we are not shut up. -our $services_online = 1; +our $services_online = 0; our $logged_in = 0; our $locked_out = 0; our $shut_up = 0; @@ -39,7 +39,6 @@ our $shut_up = 0; # SERVICES_LOGIN: Here, we log into nickserv if we have a services username and # password, since logging in would be tricky, at best, without them. sub services_login { - my ($kernel) = @_; my $pass = &SimBot::option('services', 'pass'); if ($pass) { @@ -85,6 +84,8 @@ sub check_response { } else { &SimBot::debug(1, "Services command failed: Incorrect password.\n"); } + } elsif ($text =~ /This nickname is owned by someone else/i && $logged_in == 0) { + &services_login; } elsif ($text =~ /you are now recognized/i) { &SimBot::debug(3, "Services reports successful login.\n"); $logged_in = 1; @@ -100,8 +101,8 @@ sub check_response { } elsif ($text =~ /Access denied/i) { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; - &services_login($kernel); - } elsif ($text =~ m/Your nickname is not yet authenticated./) { + &services_login; + } elsif ($text =~ m/Your nickname is not yet authenticated/i) { &SimBot::debug(1, "Services reports: $text); } } @@ -115,7 +116,7 @@ sub check_response { } elsif ($text =~ /Password identification is required/i) { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; - &services_login($kernel); + &services_login; } } } @@ -135,7 +136,7 @@ sub request_unban { &SimBot::send_message("ChanServ", "invite $channel"); } } elsif ($services_online) { - &services_login($kernel); + &services_login; } } } @@ -150,7 +151,7 @@ sub request_voice { &SimBot::send_message("ChanServ", "voice $channel"); $shut_up = 0; } elsif ($services_online) { - &services_login($kernel); + &services_login; } } } @@ -174,7 +175,7 @@ sub process_notify { } } if ((!$services_online || $locked_out || $shut_up) && $found) { - &services_login($kernel); + &services_login; } $services_online = $found; } @@ -207,30 +208,14 @@ sub ban_user { # &SimBot::send_message("ChanServ", "unban $channel " . &SimBot::hostmask($user)); #} -# XXX: This needs to be very smart or go away. - -# MASK_USERHOST: Checks to see if a special network-related hostmasking is -# in place and ensures it is generalized properly. -#sub mask_userhost { -# my ($user, $host) = split(/@/, $_[1]); -# if ($host =~ /\.users\.undernet\.org$/) { -# return "*\@$host"; -# } else { -# return undef; -# } -#} - # Register Plugin &SimBot::plugin_register(plugin_id => "services::chanserv", - event_server_connect => \&services_login, event_server_ison => \&process_notify, event_private_notice => \&check_response, event_channel_nojoin => \&request_unban, event_channel_mejoin => \&process_join, event_channel_novoice => \&request_voice, -# TODO query_userhost_mask => \&mask_userhost, - list_nicks_ison => "NickServ", ); |
|
From: Pete P. <fou...@us...> - 2005-07-25 14:33:53
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32060/plugins Modified Files: services.chanserv.pl Log Message: Don't silently drop a not yet authenticated error. Hey, Shadowfire, you ever gonna give me my auth email? Huh? Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- services.chanserv.pl 25 Jul 2005 14:05:22 -0000 1.6 +++ services.chanserv.pl 25 Jul 2005 14:33:45 -0000 1.7 @@ -101,6 +101,8 @@ sub check_response { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; &services_login($kernel); + } elsif ($text =~ m/Your nickname is not yet authenticated./) { + &SimBot::debug(1, "Services reports: $text); } } |
|
From: Kevin S. <ks...@us...> - 2005-07-25 14:05:31
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25601/plugins Modified Files: services.chanserv.pl Log Message: more changes to comments Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -p -r1.5 -r1.6 --- services.chanserv.pl 25 Jul 2005 13:58:43 -0000 1.5 +++ services.chanserv.pl 25 Jul 2005 14:05:22 -0000 1.6 @@ -18,7 +18,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # NOTE: This plugin has only been heavily tested on a Freenode. Additional -# testing and feedback from other networks are needed and welcome. +# testing on other networks would be greatly appreciated. +# +# TODO: ChanServ/NickServ works basically the same everywhere, but the message +# strings tend to vary. Form these into lists to avoid messy matching +# in the logic below. package SimBot::plugin::services::chanserv; |
|
From: Kevin S. <ks...@us...> - 2005-07-25 13:58:51
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24415/plugins Modified Files: services.chanserv.pl Log Message: and disable case sensitivity on some regex. Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- services.chanserv.pl 25 Jul 2005 13:57:20 -0000 1.4 +++ services.chanserv.pl 25 Jul 2005 13:58:43 -0000 1.5 @@ -90,10 +90,10 @@ sub check_response { if ($shut_up) { &request_voice($kernel, undef, $chan); } - } elsif ($text =~ /You have already identified/) { + } elsif ($text =~ /You have already identified/i) { &SimBot::debug(2, "Services reports already logged in.\n"); $logged_in = 1; - } elsif ($text =~ /Access denied./) { + } elsif ($text =~ /Access denied/i) { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; &services_login($kernel); @@ -106,7 +106,7 @@ sub check_response { my $chan = $1; &SimBot::debug(3, "Services reports successful unban command.\n"); $kernel->post(bot => join => $chan); - } elsif ($text =~ /Password identification is required/) { + } elsif ($text =~ /Password identification is required/i) { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; &services_login($kernel); |
|
From: Kevin S. <ks...@us...> - 2005-07-25 13:57:30
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24177/plugins Modified Files: services.chanserv.pl Log Message: Mostly comments cleanup. Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- services.chanserv.pl 25 Jul 2005 08:06:15 -0000 1.3 +++ services.chanserv.pl 25 Jul 2005 13:57:20 -0000 1.4 @@ -36,7 +36,6 @@ our $shut_up = 0; # password, since logging in would be tricky, at best, without them. sub services_login { my ($kernel) = @_; - my $user = &SimBot::option('services', 'user'); my $pass = &SimBot::option('services', 'pass'); if ($pass) { @@ -82,9 +81,6 @@ sub check_response { } else { &SimBot::debug(1, "Services command failed: Incorrect password.\n"); } -# Assuming this to not be necessary... for now.... -# } elsif ($text =~ /This nickname is owned by someone else/i && $logged_in == 0) { -# &services_login($kernel); } elsif ($text =~ /you are now recognized/i) { &SimBot::debug(3, "Services reports successful login.\n"); $logged_in = 1; @@ -101,8 +97,6 @@ sub check_response { &SimBot::debug(2, "Services reports not yet logged in.\n"); $logged_in = 0; &services_login($kernel); - } else { - &SimBot::debug(4, "Services message: $text\n"); } } @@ -110,7 +104,6 @@ sub check_response { $services_online = 1; if ($text =~ /bans matching .* cleared on (\#.*)/i) { my $chan = $1; - $locked_out = 0; &SimBot::debug(3, "Services reports successful unban command.\n"); $kernel->post(bot => join => $chan); } elsif ($text =~ /Password identification is required/) { @@ -197,6 +190,8 @@ sub ban_user { &SimBot::send_message("ChanServ", "ban $channel " . &SimBot::hostmask($user) . "$message"); } +# XXX: Freenode, at least, you can't unban specific users, it appears. + # UNBAN_USER: Unbans a user through ChanServ. #sub unban_user { # my (undef, $channel, $user, $message) = @_; @@ -206,11 +201,10 @@ sub ban_user { # &SimBot::send_message("ChanServ", "unban $channel " . &SimBot::hostmask($user)); #} +# XXX: This needs to be very smart or go away. + # MASK_USERHOST: Checks to see if a special network-related hostmasking is # in place and ensures it is generalized properly. - -# this won't work, I guess.. -# but how can this be fixed,this is a common used plugin #sub mask_userhost { # my ($user, $host) = split(/@/, $_[1]); # if ($host =~ /\.users\.undernet\.org$/) { @@ -220,7 +214,6 @@ sub ban_user { # } #} - # Register Plugin &SimBot::plugin_register(plugin_id => "services::chanserv", event_server_connect => \&services_login, |
|
From: Kevin S. <ks...@us...> - 2005-07-25 09:34:35
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3144 Modified Files: ChangeLog TODO simbot.pl Log Message: This reworks the base word score for "interesting" words to compensate for the long-term growth of the database. The formula may need some work, but this is already better. I also beat up some debug code a little bit. Index: ChangeLog =================================================================== RCS file: /cvsroot/simbot/simbot/ChangeLog,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -p -r1.78 -r1.79 --- ChangeLog 25 Jul 2005 08:06:13 -0000 1.78 +++ ChangeLog 25 Jul 2005 09:34:07 -0000 1.79 @@ -2,6 +2,13 @@ Version 1.0 alpha: (25 Jul 2005) * simbot.pl: - Added message value returned to callbacks attached to the nojoin (banned/invite-only) event. + - The starting score for finding interesting words is more adaptive + so oft used interesting words should be able to keep a positive + score better. The query_word_score callbacks now receive the + start score. + - The debug function now accepts constants in addition to numbers + for the different levels. DEBUG_NO_PREFIX allows callers to avoid + having the PREFIX text attached to the beginning of their line. * plugins/services.chanserv.pl: - Rewrote the chanserv support to automatically attempt to register with nickserv, and to automatically try to link nicknames with Index: TODO =================================================================== RCS file: /cvsroot/simbot/simbot/TODO,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -p -r1.18 -r1.19 --- TODO 25 Jul 2005 08:06:14 -0000 1.18 +++ TODO 25 Jul 2005 09:34:10 -0000 1.19 @@ -8,7 +8,6 @@ Targets for 1.0 Beta - Implement automatic database backups. - Implement learning ignore by hostmask/nickname. - Implement autokick plugin. -- Make interesting word base score adaptive by db size, because over time a constant is not enough, and lots of words become uninteresting. - Improve data storage format by converting to DBD-SQLite. - Convert all private messaging to private notices, to comply better with RFC 2812 section 3.3.2. - Verify backwards compatibility with LWP < 5.802. We should never offer to accept gzipped content if we can't decode it. Index: simbot.pl =================================================================== RCS file: /cvsroot/simbot/simbot/simbot.pl,v retrieving revision 1.126 retrieving revision 1.127 diff -u -d -p -r1.126 -r1.127 --- simbot.pl 25 Jul 2005 08:06:14 -0000 1.126 +++ simbot.pl 25 Jul 2005 09:34:10 -0000 1.127 @@ -54,17 +54,26 @@ use vars qw( %conf %chat_words $chosen_n %plugin_help %plugin_params %hostmask_cache ); -# Error Descriptions -use constant ERROR_DESCRIPTIONS +# Debug Constants +use constant DEBUG_PREFIX => ('', 'ERROR: ', 'ALERT: ', '', 'DEBUG: ', 'SPAM: '); +use constant DEBUG_NONE => 0; +use constant DEBUG_ERR => 1; [...1049 lines suppressed...] } -&debug(5, "Starting main event loop.\n"); +&debug(DEBUG_SPAM, "Starting main event loop.\n"); $kernel->run(); -&debug(5, "Exited main event loop.\n"); +&debug(DEBUG_SPAM, "Exited main event loop.\n"); &save; if ($terminating == 2) { - &debug(3, "Restarting script...\n"); + &debug(DEBUG_STD, "Restarting script...\n"); exec "./simbot.pl" . (defined $args{debug} ? " --debug=$args{debug}" : "") . (defined $args{config} ? " --config=\"$args{config}\"" : ""); } else { - &debug(3, "Terminated.\n"); + &debug(DEBUG_STD, "Terminated.\n"); if($terminating > 2) { exit $terminating; #abnormal exit } else { |
|
From: Kevin S. <ks...@us...> - 2005-07-25 09:34:34
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3144/plugins Modified Files: aspell.pl sqlite-logger.pl Log Message: This reworks the base word score for "interesting" words to compensate for the long-term growth of the database. The formula may need some work, but this is already better. I also beat up some debug code a little bit. Index: aspell.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/aspell.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- aspell.pl 4 May 2005 20:39:05 -0000 1.6 +++ aspell.pl 25 Jul 2005 09:34:18 -0000 1.7 @@ -33,7 +33,7 @@ package SimBot::plugin::aspell; # for more information on the different modes. use constant SUGGESTION_MODE => 'fast'; -use constant CORRECT_SPELLING_BONUS => 50; +use constant CORRECT_SPELLING_BONUS => 0.01; use warnings; use strict; @@ -97,10 +97,11 @@ sub get_spelling { # SCORE_WORD: gives a score modifier to a word sub score_word { if(CORRECT_SPELLING_BONUS) { - my $word = $_[1]; + my $word = $_[1]; + my $score = $_[2]; if($SPELLER->check($word)) { - &SimBot::debug(4, "$word:+" . CORRECT_SPELLING_BONUS . '(aspell) '); - return CORRECT_SPELLING_BONUS; + &SimBot::debug(4, "$word:+" . int(CORRECT_SPELLING_BONUS * $score) . '(aspell) ', SimBot::DEBUG_NO_PREFIX); + return int(CORRECT_SPELLING_BONUS * $score); } } return 0; Index: sqlite-logger.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/sqlite-logger.pl,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -p -r1.45 -r1.46 --- sqlite-logger.pl 19 Jul 2005 02:26:39 -0000 1.45 +++ sqlite-logger.pl 25 Jul 2005 09:34:18 -0000 1.46 @@ -728,15 +728,15 @@ sub update_nick_context { } # SCORE_WORD: Gives a score modifier to a word -# for seen, we give a 40 point bonus to words that are the +# for seen, we give bonus to words that are the # nicknames of people we have seen. sub score_word { my $word = $_[1]; if (get_nickchan_id($word)) { - &SimBot::debug(4, "${word}:+1000(sqlite-logger) "); + &SimBot::debug(4, "${word}:+1000(sqlite-logger) ", SimBot::DEBUG_NO_PREFIX); return 1000; } - &SimBot::debug(5, "${word}:+0(sqlite-logger) "); + &SimBot::debug(5, "${word}:+0(sqlite-logger) ", SimBot::DEBUG_NO_PREFIX); return 0; } |
|
From: Kevin S. <ks...@us...> - 2005-07-25 08:06:25
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16572/plugins Modified Files: services.chanserv.pl Removed Files: services.dalnet.pl Log Message: See the ChangeLog for details. We moved to freenode, #SimBot, this makes our chanserv plugin actually work decently, and we nuke dalnet's separate plugin because I see no reason why one plugin can't handle all chanserv networks. Index: services.chanserv.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/services.chanserv.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- services.chanserv.pl 26 Jul 2004 22:41:31 -0000 1.2 +++ services.chanserv.pl 25 Jul 2005 08:06:15 -0000 1.3 @@ -1,8 +1,7 @@ # SimBot NickServ/ChanServ style Services Plugin # # Copyright (C) 2004, Vincent Gevers <http://allowee.net/> -# -# $id:$ +# Copyright (C) 2005, Kevin Stange <ke...@si...> # # This program is free software; you can redistribute it and/or modify # under the terms of the GNU General Public License as published by @@ -18,7 +17,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# NOTE: This plugin has only been tested on a few networks that use ChanServ Services +# NOTE: This plugin has only been heavily tested on a Freenode. Additional +# testing and feedback from other networks are needed and welcome. package SimBot::plugin::services::chanserv; @@ -35,88 +35,124 @@ our $shut_up = 0; # SERVICES_LOGIN: Here, we log into nickserv if we have a services username and # password, since logging in would be tricky, at best, without them. sub services_login { - my ($kernel, undef, $nick) = @_; - my $user = &SimBot::option('services', 'user'); - my $pass = &SimBot::option('services', 'pass'); - - if (defined $nick) { - &SimBot::debug(3, "Setting masked user mode...\n"); - $kernel->post(bot => mode => $nick, "+x"); - } + my ($kernel) = @_; + my $user = &SimBot::option('services', 'user'); + my $pass = &SimBot::option('services', 'pass'); - if ($pass && $user) { - &SimBot::debug(3, "Logging into Services as $user...\n"); - &SimBot::send_message("nickserv", "identify $pass"); + if ($pass) { + &SimBot::debug(3, "Logging into services...\n"); + &SimBot::send_message("nickserv", "identify $pass"); } } -# CHECK_RESPONSE: When we try to log in or run a command, NickServ will tell us +# CHECK_RESPONSE: When we try to log in or run a command, services will tell us # something. Here, we handle different possible cases. sub check_response { my ($kernel, $nick, undef, $text) = @_; - my $user = &SimBot::option('global', 'nickname'); - - if ($nick eq "NickServ") { - if ($text =~ /Password accepted - you are now recognized/) { - &SimBot::debug(3, "Services reports successful login.\n"); - $logged_in = 1; - $services_online = 1; - if ($locked_out) { - &request_invite($kernel, undef, &SimBot::option('network', 'channel')); - } - if ($shut_up) { - &request_voice($kernel, undef, &SimBot::option('network', 'channel')); - } - } elsif ($text =~ /Password incorrect./) { - &SimBot::debug(2, "Services reports login failure.\n"); - $logged_in = 0; - $services_online = 1; - } elsif ($text =~ /You have already identified/) { - &SimBot::debug(2, "Services reports already logged in.\n"); - $logged_in = 1; - $services_online = 1; - } elsif ($text =~ /Access denied./) { - &SimBot::debug(2, "Services reports not yet logged in.\n"); - $logged_in = 0; - $services_online = 1; - &services_login($kernel); - } elsif ($text =~ /Your nick isn\'t registered/) { - &SimBot::debug(2, "Services reports nickname $user as not registered.\n"); - $logged_in = 0; - $services_online = 1; - } else { - &SimBot::debug(4, "Services message: $text\n"); - } + my $user = &SimBot::option('services', 'user'); + my $pass = &SimBot::option('services', 'pass'); + my $me = $SimBot::chosen_nick; + my $chan = &SimBot::option('network', 'channel'); + if (lc($nick) eq lc("NickServ")) { + $services_online = 1; + + if ($text =~ /is( not|n\'t) registered/i) { + # Try to register!! + &SimBot::debug(2, "Nickname $me is not registered; Trying to register it now...\n"); + &SimBot::send_message("nickserv", "register $pass"); + } elsif ($text =~ /Your nickname is now registered/i) { + &SimBot::debug(3, "Nickname $me registered successfully.\n"); + $logged_in = 1; + # Special case. If username is set, link this nickname to main. + if (defined $user && lc($me) ne lc($user)) { + &SimBot::debug(3, "Attempting to link nickname registration to $user...\n"); + &SimBot::send_message("nickserv", "link $user $pass"); + } + if ($locked_out) { + &request_unban($kernel, undef, $chan); + } + if ($shut_up) { + &request_voice($kernel, undef, $chan); + } + } elsif ($text =~ /Your nickname is now linked/i) { + &SimBot::debug(3, "Nickname linked to $user successfully.\n"); + } elsif ($text =~ /Password incorrect/i) { + if ($logged_in == 0) { + &SimBot::debug(1, "Services reports login failure.\n"); + } else { + &SimBot::debug(1, "Services command failed: Incorrect password.\n"); + } +# Assuming this to not be necessary... for now.... +# } elsif ($text =~ /This nickname is owned by someone else/i && $logged_in == 0) { +# &services_login($kernel); + } elsif ($text =~ /you are now recognized/i) { + &SimBot::debug(3, "Services reports successful login.\n"); + $logged_in = 1; + if ($locked_out) { + &request_unban($kernel, undef, $chan); + } + if ($shut_up) { + &request_voice($kernel, undef, $chan); + } + } elsif ($text =~ /You have already identified/) { + &SimBot::debug(2, "Services reports already logged in.\n"); + $logged_in = 1; + } elsif ($text =~ /Access denied./) { + &SimBot::debug(2, "Services reports not yet logged in.\n"); + $logged_in = 0; + &services_login($kernel); + } else { + &SimBot::debug(4, "Services message: $text\n"); + } } + + if (lc($nick) eq lc("ChanServ")) { + $services_online = 1; + if ($text =~ /bans matching .* cleared on (\#.*)/i) { + my $chan = $1; + $locked_out = 0; + &SimBot::debug(3, "Services reports successful unban command.\n"); + $kernel->post(bot => join => $chan); + } elsif ($text =~ /Password identification is required/) { + &SimBot::debug(2, "Services reports not yet logged in.\n"); + $logged_in = 0; + &services_login($kernel); + } + } } -# REQUEST_INVITE: If the bot is out of the channel, request an invitation +# REQUEST_UNBAN: If the bot is out of the channel, request an unban # from ChanServ. -sub request_invite { - my ($kernel, undef, $channel) = @_; +sub request_unban { + my ($kernel, undef, $channel, undef, $msg) = @_; if (&SimBot::option('services', 'pass')) { - $locked_out = 1; - if($services_online && $logged_in) { - &SimBot::debug(2, "Could not join. Asking for invitation to $channel...\n"); - &SimBot::send_message("ChanServ", "invite $channel"); - } elsif ($services_online) { - &services_login($kernel); - } - } + $locked_out = 1; + if($services_online && $logged_in) { + if ($msg =~ /banned/i) { + &SimBot::debug(2, "Could not join. Asking services for unban from $channel...\n"); + &SimBot::send_message("ChanServ", "unban $channel"); + } else { # Try Invite + &SimBot::debug(2, "Could not join. Asking services for invite to $channel...\n"); + &SimBot::send_message("ChanServ", "invite $channel"); + } + } elsif ($services_online) { + &services_login($kernel); + } + } } # REQUEST_VOICE: If the bot was not able to speak, request a voice from ChanServ. sub request_voice { my ($kernel, undef, $channel) = @_; if (&SimBot::option('services', 'pass')) { - $shut_up = 1; - if($services_online && $logged_in) { - &SimBot::debug(2, "Could not speak. Asking for voice on $channel...\n"); - &SimBot::send_message("ChanServ", "voice $channel"); - $shut_up = 0; - } elsif ($services_online) { - &services_login($kernel); - } + $shut_up = 1; + if($services_online && $logged_in) { + &SimBot::debug(2, "Could not speak. Asking for voice on $channel...\n"); + &SimBot::send_message("ChanServ", "voice $channel"); + $shut_up = 0; + } elsif ($services_online) { + &services_login($kernel); + } } } @@ -127,18 +163,19 @@ sub process_join { $locked_out = 0; } -# PROCESS_NOTIFY: Check to see if nickserv is online, and if not previously online, -# log in. Also log in if we're waiting for nickserv and detect that services are available. +# PROCESS_NOTIFY: Check to see if nickserv is online, and if not previously +# online, log in. Also log in if we're waiting for nickserv and detect that +# services are available. sub process_notify { my ($kernel, undef, undef, @nicks) = @_; my $found = 0; foreach(@nicks) { - if($_ eq "NickServ") { - $found = 1; - } + if($_ eq "NickServ") { + $found = 1; + } } if ((!$services_online || $locked_out || $shut_up) && $found) { - &services_login($kernel); + &services_login($kernel); } $services_online = $found; } @@ -146,8 +183,8 @@ sub process_notify { # KICK_USER: Kicks a user through ChanServ. sub kick_user { my (undef, $channel, $user, $message) = @_; - &SimBot::debug(3, "Asking Channel Service to kick $user from $channel ($message)...\n"); - &SimBot::send_message("ChanServ", "kick $channel $user $message"); + &SimBot::debug(3, "Asking Channel Service to kick $user from $channel ($message)...\n"); + &SimBot::send_message("ChanServ", "kick $channel $user $message"); } # BAN_USER: Kickbans a user through ChanServ. @@ -161,27 +198,27 @@ sub ban_user { } # UNBAN_USER: Unbans a user through ChanServ. -sub unban_user { - my (undef, $channel, $user, $message) = @_; - &SimBot::debug(3, "Asking Channel Service to unban $user (" . - &SimBot::hostmask($user) . - ") from $channel...\n"); - &SimBot::send_message("ChanServ", "unban $channel " . &SimBot::hostmask($user)); -} +#sub unban_user { +# my (undef, $channel, $user, $message) = @_; +# &SimBot::debug(3, "Asking Channel Service to unban $user (" . +# &SimBot::hostmask($user) . +# ") from $channel...\n"); +# &SimBot::send_message("ChanServ", "unban $channel " . &SimBot::hostmask($user)); +#} # MASK_USERHOST: Checks to see if a special network-related hostmasking is # in place and ensures it is generalized properly. # this won't work, I guess.. # but how can this be fixed,this is a common used plugin -sub mask_userhost { - my ($user, $host) = split(/@/, $_[1]); - if ($host =~ /\.users\.undernet\.org$/) { - return "*\@$host"; - } else { - return undef; - } -} +#sub mask_userhost { +# my ($user, $host) = split(/@/, $_[1]); +# if ($host =~ /\.users\.undernet\.org$/) { +# return "*\@$host"; +# } else { +# return undef; +# } +#} # Register Plugin @@ -189,16 +226,15 @@ sub mask_userhost { event_server_connect => \&services_login, event_server_ison => \&process_notify, event_private_notice => \&check_response, - event_channel_nojoin => \&request_invite, + event_channel_nojoin => \&request_unban, event_channel_mejoin => \&process_join, event_channel_novoice => \&request_voice, - query_userhost_mask => \&mask_userhost, +# TODO query_userhost_mask => \&mask_userhost, - list_nicks_ison => "ChanServ", + list_nicks_ison => "NickServ", ); # Override Default Command Operations $SimBot::commands{kick} = \&kick_user; $SimBot::commands{ban} = \&ban_user; -$SimBot::commands{unban} = \&unban_user; --- services.dalnet.pl DELETED --- |
|
From: Kevin S. <ks...@us...> - 2005-07-25 08:06:25
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16572 Modified Files: ChangeLog TODO simbot.pl Log Message: See the ChangeLog for details. We moved to freenode, #SimBot, this makes our chanserv plugin actually work decently, and we nuke dalnet's separate plugin because I see no reason why one plugin can't handle all chanserv networks. Index: ChangeLog =================================================================== RCS file: /cvsroot/simbot/simbot/ChangeLog,v retrieving revision 1.77 retrieving revision 1.78 diff -u -d -p -r1.77 -r1.78 --- ChangeLog 24 Jul 2005 01:41:08 -0000 1.77 +++ ChangeLog 25 Jul 2005 08:06:13 -0000 1.78 @@ -1,3 +1,15 @@ +Version 1.0 alpha: (25 Jul 2005) + * simbot.pl: + - Added message value returned to callbacks attached to the nojoin + (banned/invite-only) event. + * plugins/services.chanserv.pl: + - Rewrote the chanserv support to automatically attempt to register + with nickserv, and to automatically try to link nicknames with + the nickname represented by the services "user." Additional error + handling has been added as well. + * plugins/services.dalnet.pl: + - Dropped in favor of handling all chanserv operations in one plugin. + Version 1.0 alpha: (23 Jul 2005) * plugins/8ball.pl: - SimBot has acquired a Magic Eight Ball. Ask it a question! @@ -5,21 +17,21 @@ Version 1.0 alpha: (23 Jul 2005) Version 1.0 alpha: (18 Jul 2005) * plugins/weather.pl: - Added our own METAR parser. With luck, this will be more sane. - - If we can figure out a valid time for the report, we tell the user how - old the report is instead of the UTC time. + - If we can figure out a valid time for the report, we tell the user + how old the report is instead of the UTC time. Version 1.0 alpha: (08 May 2005) * plugins/time.pl: - New plugin! - Shows the current time in a number of time zones. - - %time <zones> shows the local time and the requested zones, + - %time <zones> shows the local time and the requested zones, otherwise shows local and those defined in config.ini. Failing that, local and UTC. Version 1.0 alpha: (07 May 2005) * plugins/weather.pl: - - Some unit conversion support. Add 'm' or 'metric' to show metric units, - 'us' or 'imp' or 'imperial' for imperial units. + - Some unit conversion support. Add 'm' or 'metric' to show metric + units, 'us' or 'imp' or 'imperial' for imperial units. - Support for UK post codes * tools/create_postalcode_db.pl: - Replaces tools/create_zip_db.pl Index: TODO =================================================================== RCS file: /cvsroot/simbot/simbot/TODO,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -p -r1.17 -r1.18 --- TODO 19 Jul 2005 12:29:28 -0000 1.17 +++ TODO 25 Jul 2005 08:06:14 -0000 1.18 @@ -16,7 +16,7 @@ Targets for 1.0 Beta Targets for 1.0 Final ====================== -- Test dalnet and chanserv style services plugins. Preferrably, merge these two services plugins, unless it's absolutely impossible. +- Test chanserv style services plugin on other than freenode. - Polish (as in make better, not Poland) the documentation. - Standardize and clean up the debug output. - Test the hell out of every feature. Index: simbot.pl =================================================================== RCS file: /cvsroot/simbot/simbot/simbot.pl,v retrieving revision 1.125 retrieving revision 1.126 diff -u -d -p -r1.125 -r1.126 --- simbot.pl 25 Jul 2005 03:07:47 -0000 1.125 +++ simbot.pl 25 Jul 2005 08:06:14 -0000 1.126 @@ -181,7 +181,7 @@ our %event_channel_join = (); # e our %event_channel_part = (); # eventname = PARTED (message) our %event_channel_quit = (); # eventname = QUIT (message) our %event_channel_mejoin = (); # eventname = JOINED () -our %event_channel_nojoin = (); # eventname = NOTJOINED () +our %event_channel_nojoin = (); # eventname = NOTJOINED (message) our %event_channel_novoice = (); # eventname = CANTSAY () our %event_channel_invite = (); # eventname = INVITED () @@ -1759,7 +1759,7 @@ sub channel_kick { my ($chan, $nick, $reason) = @_[ ARG1, ARG2, ARG3 ]; &debug(3, "$nick was kicked from $chan by $kicker. ($reason)\n"); - if ($nick eq $chosen_nick && $chan eq option('network', 'channel')) { + if ($nick eq $chosen_nick && lc($chan) eq lc(option('network', 'channel'))) { &debug(2, "Kicked from $chan... Attempting to rejoin!\n"); $kernel->post(bot => join => $chan); } @@ -1788,7 +1788,7 @@ sub channel_nojoin { my ($chan, $msg) = split(/ :/, $_[ ARG1 ]); &debug(2, "Unable to join $chan. ($msg)\n"); foreach(keys(%event_channel_nojoin)) { - &plugin_callback($_, $event_channel_nojoin{$_}, ($chosen_nick, $chan, 'NOTJOINED')); + &plugin_callback($_, $event_channel_nojoin{$_}, ($chosen_nick, $chan, 'NOTJOINED', $msg)); } } |
|
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"); |
|
From: Pete P. <fou...@us...> - 2005-07-24 11:45:37
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4115/plugins Modified Files: 8ball.pl Log Message: grammar Index: 8ball.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/8ball.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- 8ball.pl 24 Jul 2005 02:12:12 -0000 1.2 +++ 8ball.pl 24 Jul 2005 11:45:29 -0000 1.3 @@ -54,8 +54,8 @@ use constant BLANK_SAYINGS => ( use constant INTROS => ( q(pulls out a Magic 8 Ball and concentrates deeply on $nick's question:), q(drops the magic 8 ball on the floor, catches it as it rolls away, and shows the answer to $nick's question:), - q(vigorously shakes the 8-ball, to find the answer to $nick's question:), -); + q(vigorously shakes the 8-ball to find the answer to $nick's question:), +); #' use constant BLANK_INTROS => ( q(pulls out a Magic 8 Ball and concentrates deeply on nothingness:), |
|
From: Pete P. <fou...@us...> - 2005-07-24 02:16:10
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2695/plugins Modified Files: weather.pl Log Message: Argh. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -p -r1.103 -r1.104 --- weather.pl 23 Jul 2005 23:03:21 -0000 1.103 +++ weather.pl 24 Jul 2005 02:15:56 -0000 1.104 @@ -512,7 +512,7 @@ sub got_metar { } if($worst_clouds !~ m/fair skies/ || !defined $wxhash->{'sky_conditions'}) { - if($worst_clouds !~ m/overcast/) { + if($worst_clouds !~ m/overcast|fair/) { $worst_clouds .= ' clouds'; } push(@reply_with, $worst_clouds); |
|
From: Pete P. <fou...@us...> - 2005-07-24 02:12:21
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2272/plugins Modified Files: 8ball.pl Log Message: 22:08 @KewlioMZX> % *<SimBot> vigorously shakes the 8-ball, to find the answer to <user>'s question: <answer> Index: 8ball.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/8ball.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- 8ball.pl 24 Jul 2005 01:41:08 -0000 1.1 +++ 8ball.pl 24 Jul 2005 02:12:12 -0000 1.2 @@ -54,6 +54,7 @@ use constant BLANK_SAYINGS => ( use constant INTROS => ( q(pulls out a Magic 8 Ball and concentrates deeply on $nick's question:), q(drops the magic 8 ball on the floor, catches it as it rolls away, and shows the answer to $nick's question:), + q(vigorously shakes the 8-ball, to find the answer to $nick's question:), ); use constant BLANK_INTROS => ( |
|
From: Pete P. <fou...@us...> - 2005-07-24 01:41:20
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30371/plugins Added Files: 8ball.pl Log Message: SimBot has acquired a Magic Eight Ball. Ask it a question! --- NEW FILE: 8ball.pl --- # SimBot Magic Eight Ball # # Copyright (C) 2005 Pete Pearson # # This program is free software; you can redistribute and/or modify it # under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package SimBot::plugin::8ball; use warnings; use strict; # http://en.wikipedia.org/wiki/Magic_8-ball use constant SAYINGS => ( 'Signs point to yes.', 'Yes.', 'Reply hazy, try again.', 'Without a doubt.', 'My sources say no.', 'As I see it, yes.', 'You may rely on it.', 'Concentrate and ask again.', 'Outlook not so good.', 'It is decidedly so.', 'Better not tell you now.', 'Very doubtful.', 'Yes - definitely.', 'It is certain.', 'Cannot predict now.', 'Most likely.', 'Ask again later.', 'My reply is no.', 'Outlook good.', "Don't count on it.", ); use constant BLANK_SAYINGS => ( 'Concentrate and ask again.', 'Ask again later.', 'Reply hazy, try again.', ); # $nick will be replaced by the supplicant's nick use constant INTROS => ( q(pulls out a Magic 8 Ball and concentrates deeply on $nick's question:), q(drops the magic 8 ball on the floor, catches it as it rolls away, and shows the answer to $nick's question:), ); use constant BLANK_INTROS => ( q(pulls out a Magic 8 Ball and concentrates deeply on nothingness:), ); sub consult_the_8ball { my ($kernel, $nick, $channel, undef, $question) = @_; &SimBot::debug(3, "8ball: Consulting the Magic Eight Ball for $nick\n"); my $message; if(defined $question) { $message = &SimBot::pick((INTROS)) . ' ' . &SimBot::pick((SAYINGS)); } else { $message = &SimBot::pick((BLANK_INTROS)) . ' ' . &SimBot::pick((BLANK_SAYINGS)); } $message =~ s/\$nick/$nick/g; &SimBot::send_action($channel, $message); } # Register plugin &SimBot::plugin_register(plugin_id => '8ball', plugin_help => 'Consults the Magic 8 Ball. Be sure to ask a question!', plugin_params => '<question>', event_plugin_call => \&consult_the_8ball, ); |
|
From: Pete P. <fou...@us...> - 2005-07-24 01:41:17
|
Update of /cvsroot/simbot/simbot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30371 Modified Files: ChangeLog Log Message: SimBot has acquired a Magic Eight Ball. Ask it a question! Index: ChangeLog =================================================================== RCS file: /cvsroot/simbot/simbot/ChangeLog,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -p -r1.76 -r1.77 --- ChangeLog 19 Jul 2005 02:33:28 -0000 1.76 +++ ChangeLog 24 Jul 2005 01:41:08 -0000 1.77 @@ -1,3 +1,7 @@ +Version 1.0 alpha: (23 Jul 2005) + * plugins/8ball.pl: + - SimBot has acquired a Magic Eight Ball. Ask it a question! + Version 1.0 alpha: (18 Jul 2005) * plugins/weather.pl: - Added our own METAR parser. With luck, this will be more sane. |
|
From: Pete P. <fou...@us...> - 2005-07-23 23:03:45
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5125/plugins Modified Files: weather.pl Log Message: few clouds Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.102 retrieving revision 1.103 diff -u -d -p -r1.102 -r1.103 --- weather.pl 23 Jul 2005 03:01:14 -0000 1.102 +++ weather.pl 23 Jul 2005 23:03:21 -0000 1.103 @@ -512,7 +512,7 @@ sub got_metar { } if($worst_clouds !~ m/fair skies/ || !defined $wxhash->{'sky_conditions'}) { - if($worst_clouds =~ m/scattered|broken/) { + if($worst_clouds !~ m/overcast/) { $worst_clouds .= ' clouds'; } push(@reply_with, $worst_clouds); |
|
From: Pete P. <fou...@us...> - 2005-07-23 03:01:23
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22119/plugins Modified Files: weather.pl Log Message: Wow. Stupid logic bug. (!~ != =~) Cloud cover should now properly be shown when it isn't fair skies. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.101 retrieving revision 1.102 diff -u -d -p -r1.101 -r1.102 --- weather.pl 21 Jul 2005 23:46:32 -0000 1.101 +++ weather.pl 23 Jul 2005 03:01:14 -0000 1.102 @@ -511,7 +511,7 @@ sub got_metar { } } - if($worst_clouds =~ m/fair skies/ || !defined $wxhash->{'sky_conditions'}) { + if($worst_clouds !~ m/fair skies/ || !defined $wxhash->{'sky_conditions'}) { if($worst_clouds =~ m/scattered|broken/) { $worst_clouds .= ' clouds'; } |
|
From: Pete P. <fou...@us...> - 2005-07-19 20:34:33
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12453/plugins Modified Files: weather.pl Log Message: time zone and a debug statement Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.98 retrieving revision 1.99 diff -u -d -p -r1.98 -r1.99 --- weather.pl 19 Jul 2005 20:30:13 -0000 1.98 +++ weather.pl 19 Jul 2005 20:34:12 -0000 1.99 @@ -343,7 +343,7 @@ sub got_metar { } $raw_metar =~ s/\s+/ /ig; - &SimBot::debug(3, "weather: METAR is " . $raw_metar . "\n"); + &SimBot::debug(4, "weather: METAR is " . $raw_metar . "\n"); my $station_name_query = $dbh->prepare_cached( 'SELECT name, state, country FROM stations' @@ -395,7 +395,8 @@ sub got_metar { } else { $reply .= sprintf('at %d:%02d', $wxhash->{'report_time'}->{'hour'}, - $wxhash->{'report_time'}->{'minute'}); + $wxhash->{'report_time'}->{'minute'}) + . ' ' . $wxhash->{'report_time'}->{'timezone'}; } $reply .= " at $station_name"; my @reply_with; |
|
From: Pete P. <fou...@us...> - 2005-07-19 20:30:23
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10957/plugins Modified Files: weather.pl Log Message: If NOAA tells us no data available, tell the user that and give them the link to look up stations at. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -p -r1.97 -r1.98 --- weather.pl 19 Jul 2005 20:27:08 -0000 1.97 +++ weather.pl 19 Jul 2005 20:30:13 -0000 1.98 @@ -330,6 +330,12 @@ sub got_metar { } # my ($datestamp, $raw_metar) = split(/\n/, $response->content); my $raw_metar; + if($response->content =~ m|no data available|) { + &SimBot::send_message(&SimBot::option('network', 'channel'), + "$nick: Sorry, there is no report available for \"$station\". " + . FIND_STATION_AT); + return; + } unless(($raw_metar) = $response->content =~ m|<FONT FACE="Monospace,Courier">(.*?)</FONT>|s) { &SimBot::debug(1, "NOAA made no sense. They said:\n" . $response->content . "\n"); &SimBot::send_message(&SimBot::option('network', 'channel'), "$nick: I couldn't make sense of what NOAA told me."); |