Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11ea707bbe | ||
|
|
506921214d | ||
|
|
9de77699f9 | ||
|
|
f0807a8306 | ||
|
|
3ce0003c9e | ||
|
|
51d8bb69dd | ||
|
|
c3ac079e14 | ||
|
|
ad3340d82a | ||
|
|
978a1585c8 | ||
|
|
4337f29d0a | ||
|
|
a587bab1c9 | ||
|
|
1b13f4c39b | ||
|
|
e61fdee14c | ||
|
|
9b0e692a8f | ||
|
|
70723dfe68 | ||
|
|
10fbddd2a6 | ||
|
|
963f55cc01 | ||
|
|
123357c448 | ||
|
|
0b6ed4c0cc | ||
|
|
004c89f416 | ||
|
|
d4ff35a5f9 | ||
|
|
f4448302e2 | ||
|
|
348ee6dc79 | ||
|
|
604097ee1c | ||
|
|
3a7ffb24ee | ||
|
|
60edbba15d | ||
|
|
12ed97b398 | ||
|
|
bd6571bbf5 | ||
|
|
c15c945262 | ||
|
|
5f1bf3785c | ||
|
|
45bb7e668c | ||
|
|
c268f27308 | ||
|
|
62551dc6c9 | ||
|
|
12356984fc | ||
|
|
223cdd7860 | ||
|
|
9e8018c98e | ||
|
|
0e708c5ee3 | ||
|
|
a66d6993cd | ||
|
|
328eac87b0 | ||
|
|
0e46850a65 | ||
|
|
5da0eb0f6e | ||
|
|
8c037a9a35 | ||
|
|
4e0384d645 | ||
|
|
117ef08c23 | ||
|
|
e67b4b265c | ||
|
|
4dbfac1f5e | ||
|
|
956cd12e5b |
No files matched your search
@@ -11,24 +11,23 @@
|
||||
The future of IRC bots is here! Xelhua gives to you, Auto 3.0, a new version of
|
||||
the popular Auto IRC bot.
|
||||
|
||||
In this alpha6 release, we have added:
|
||||
In this alpha7 release, we have added:
|
||||
|
||||
* Support for Microsoft Windows. See doc/WINDOWS if running on Windows.
|
||||
* Added an UNO module for playing the classic game of UNO.
|
||||
* Added an Eval module for evaluating Perl code.
|
||||
* Added a BotStats module for returning statistics about the bot.
|
||||
* PRIVMSG's and NOTICE's that would create a resulting message of >512 bytes are
|
||||
now divided into multiple messages.
|
||||
* Support for multiple configuration files using bin/auto -c=FILENAME. See
|
||||
bin/auto -h for details.
|
||||
* Added network-wide user tracking through Core::IRC::Users.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* Fixed a bug that occurs when our configured nickname is in use.
|
||||
* Fixed a bug with multi-prefix support.
|
||||
* Fixed a bug with SASL timeouts.
|
||||
* Fixed a bug where a CAP entry for a network was not recreated on a reconnect.
|
||||
* Fixed a bug where incoming PART's from ourselves were not parsed.
|
||||
* Fixed a bug in UNO where rehashing during a game caused a crash.
|
||||
* Fixed a bug where appropriate data was not cleared after a disconnect.
|
||||
* Fixed a bug where Vim modelines were in an incorrect spot in modules.
|
||||
|
||||
Incompatibilities:
|
||||
|
||||
* Module API changes. Minimum version is now 3.0.0a6 from 3.0.0a4.
|
||||
* Many API changes - Minimum version bumped to 3.0.0a7.
|
||||
|
||||
We thank you for choosing Auto. Please remember that he is still in mid-
|
||||
development stages. But we hope we've piqued your interest, as Auto's upcoming
|
||||
@@ -38,4 +37,4 @@ there for everyone to use.
|
||||
Auto's goal is to create an efficient, stable and highly customizable IRC bot
|
||||
in Perl. To offer an alternative to other platforms.
|
||||
|
||||
Enjoy Auto 3.0.0 Alpha 6!
|
||||
Enjoy Auto 3.0.0 Alpha 7!
|
||||
@@ -14,6 +14,7 @@ use English qw(-no_match_vars);
|
||||
use Sys::Hostname;
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use Getopt::Long;
|
||||
use DBI;
|
||||
use Class::Unload;
|
||||
use FindBin qw($Bin);
|
||||
@@ -42,9 +43,10 @@ use Parser::Config;
|
||||
use Parser::Lang;
|
||||
use Proto::IRC;
|
||||
use Core::IRC;
|
||||
use Core::IRC::Users;
|
||||
use Core::Cmd;
|
||||
|
||||
our $VERSION = 3.0.0;
|
||||
our $VERSION = 3.000000;
|
||||
local $PROGRAM_NAME = 'auto';
|
||||
|
||||
# Check for build files.
|
||||
@@ -97,6 +99,63 @@ API::Std::event_add('on_sigterm');
|
||||
API::Std::event_add('on_sigint');
|
||||
API::Std::event_add('on_sighup');
|
||||
|
||||
# Get arguments.
|
||||
our ($DEBUG, $NUC);
|
||||
my ($opt_help, $opt_version, $USECONFIG);
|
||||
GetOptions(
|
||||
'nuc' => \$NUC,
|
||||
'c=s' => \$USECONFIG,
|
||||
'config=s' => \$USECONFIG,
|
||||
'h' => \$opt_help,
|
||||
'help' => \$opt_help,
|
||||
'd' => \$DEBUG,
|
||||
'debug' => \$DEBUG,
|
||||
'v' => \$opt_version,
|
||||
'version' => \$opt_version
|
||||
);
|
||||
|
||||
# If we were passed -h, print help.
|
||||
if ($opt_help) {
|
||||
print <<'HELP';
|
||||
|
||||
Usage: $PROGRAM_NAME [options]
|
||||
--help, -h Prints this help.
|
||||
--version, -v Prints the version of this Auto.
|
||||
--debug, -d Runs Auto in debug mode. Debug mode will print out debug
|
||||
messages, including IRC raw data, to screen. This will also
|
||||
stop Auto from forking into the background.
|
||||
|
||||
--config=FILENAME, -c Uses etc/FILENAME for the configuration file.
|
||||
|
||||
HELP
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# If we were passed -v, print version.
|
||||
if ($opt_version) {
|
||||
say q{};
|
||||
say NAME.' version '.VER.', subversion '.SVER.', revision '.REV.' ('.VER.q{.}.SVER.q{.}.REV.RSTAGE.').';
|
||||
print <<'VERINFO';
|
||||
|
||||
Copyright (C) 2010-2011, Xelhua Development Group. All rights reserved.
|
||||
|
||||
Auto is released under the licensing terms of the New (3-Clause) BSD License,
|
||||
which may be found in doc/LICENSE.
|
||||
|
||||
For documentation, you might refer to README, doc/*, and the Xelhua Wiki at
|
||||
http://wiki.xelhua.org. Documentation for modules is stored in Man Page and
|
||||
HTML form in autodoc/.
|
||||
|
||||
For support, visit the Xelhua Forums at http://forums.xelhua.org, or drop by
|
||||
the official IRC chatroom at irc.xelhua.org #xelhua. Please report bugs and
|
||||
request new features at http://rm.xelhua.org.
|
||||
|
||||
VERINFO
|
||||
exit 1;
|
||||
}
|
||||
|
||||
undef $opt_help;
|
||||
undef $opt_version;
|
||||
|
||||
# Print startup message.
|
||||
say <<'EOF';
|
||||
@@ -111,18 +170,6 @@ say '* '.NAME.' (version '.VER.q{.}.SVER.q{.}.REV.RSTAGE.') is starting up...';
|
||||
|
||||
our ($APID, %TIMERS);
|
||||
|
||||
# Get arguments.
|
||||
our $DEBUG = 0;
|
||||
our $NUC = 0;
|
||||
if (defined $ARGV[0]) {
|
||||
foreach (@ARGV) {
|
||||
given ($_) {
|
||||
when ('-d') { $DEBUG = 1; }
|
||||
when ('-nuc') { $NUC = 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Check for updates.
|
||||
Lib::Auto::checkver();
|
||||
|
||||
@@ -132,10 +179,14 @@ if ($ENFEAT =~ /ipv6/) { require IO::Socket::INET6; }
|
||||
if ($ENFEAT =~ /ssl/) { require IO::Socket::SSL; }
|
||||
|
||||
# Parse configuration file.
|
||||
say '* Parsing configuration file auto.conf...';
|
||||
our $CONF = Parser::Config->new('auto.conf') or err(1, 'Failed to parse configuration file!', 1);
|
||||
my $configfile = 'auto.conf';
|
||||
if ($USECONFIG) { $configfile = $USECONFIG; }
|
||||
say "* Parsing configuration file $configfile...";
|
||||
our $CONF = Parser::Config->new($configfile) or err(1, 'Failed to parse configuration file!', 1);
|
||||
our %SETTINGS = $CONF->parse or err(1, 'Failed to parse configuration file!', 1);
|
||||
say ' Success';
|
||||
undef $configfile;
|
||||
undef $USECONFIG;
|
||||
|
||||
if (conf_get('die')) {
|
||||
if ((conf_get('die'))[0][0] == 1) {
|
||||
@@ -422,6 +473,7 @@ while (1) {
|
||||
err(2, "Lost connection to $sockid!", 0);
|
||||
$SELECT->remove($sock);
|
||||
delete $SOCKET{$sockid};
|
||||
API::Std::event_run('on_disconnect', $sockid);
|
||||
if (!keys %SOCKET) {
|
||||
# No more connections, stop the program.
|
||||
API::Std::event_run('on_shutdown');
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ foreach my $line (@MPBUF) {
|
||||
$got_end = 1;
|
||||
}
|
||||
|
||||
if ($got_end and $line ne '__END__') {
|
||||
if ($got_end and $line ne '__END__' and $line !~ m/^# vim:/sm) {
|
||||
$podbuf .= $line."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,30 @@ Auto IRC Bot 3.0: Change Log
|
||||
===============================================================================
|
||||
|
||||
|
||||
3.0 Alpha 7
|
||||
===============================================================================
|
||||
* Fixed a bug in UNO where rehashing during a game caused a crash.
|
||||
* Proto::IRC::umodes renamed to Proto::IRC::botinfo{svr}{modes}.
|
||||
* Fixed a bug where incoming PART's from ourselves were not parsed.
|
||||
* 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
|
||||
rchook_add and rchook_del.
|
||||
* Vim modelines must be at the bottom of files. Modules updated.
|
||||
* Renamed Lib::Users to Core::IRC::Users.
|
||||
* Added Lib::Users, for network-wide user tracking. This brings many new
|
||||
possibilities to modules, including an account system.
|
||||
* Added hook on_namesreply.
|
||||
* All data related to a network is now deleted on disconnect.
|
||||
* Added hook on_disconnect.
|
||||
* Added various options to bin/auto, including support for multiple config
|
||||
files. See bin/auto -h for details.
|
||||
* Changed on_nick, on_quit, on_part, and on_kick source hashrefs to include
|
||||
server, removing svr.
|
||||
* Bumped minimum API version to 3.0.0a7.
|
||||
* Fixed the arguments on_whoreply passes.
|
||||
|
||||
3.0 Alpha 6
|
||||
===============================================================================
|
||||
* Bug fix: Fixed an issue with SASL timeout.
|
||||
|
||||
@@ -21,15 +21,15 @@ my $features = 'base ssl sqlite';
|
||||
if (defined $ARGV[0]) {
|
||||
foreach (@ARGV) {
|
||||
if ($_ eq '-h' or $_ eq '--help') {
|
||||
println '*** ./install help ***';
|
||||
println ' --enable-sasl - Enable support for SASL.';
|
||||
println '*** ./install help ***';
|
||||
println ' --enable-sasl - Enable support for SASL.';
|
||||
println ' --enable-ipv6 - Enable support for IPv6.';
|
||||
println ' --disable-ssl - Disable support for SSL.';
|
||||
println '*** End of Help ***';
|
||||
exit 1;
|
||||
println '*** End of Help ***';
|
||||
exit 1;
|
||||
}
|
||||
elsif ($_ eq '--enable-sasl') {
|
||||
$features .= ' sasl';
|
||||
$features .= ' sasl';
|
||||
}
|
||||
elsif ($_ eq '--disable-ssl') {
|
||||
$features =~ s/ ssl//g;
|
||||
@@ -44,7 +44,7 @@ if (defined $ARGV[0]) {
|
||||
$features =~ s/(sqlite|mysql)/pgsql/g;
|
||||
}
|
||||
else {
|
||||
println "Warning: Unknown option '$_'";
|
||||
println "Warning: Unknown option '$_'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -11,6 +11,8 @@ our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(ban cjoin cpart cmode umode kick privmsg notice quit nick names
|
||||
topic who usrc match_mask);
|
||||
|
||||
# Create the on_disconnect event.
|
||||
API::Std::event_add('on_disconnect');
|
||||
|
||||
# Set a ban, based on config bantype value.
|
||||
sub ban
|
||||
@@ -67,8 +69,6 @@ sub cpart
|
||||
Auto::socksnd($svr, "PART $chan :Leaving");
|
||||
}
|
||||
|
||||
if (defined $Proto::IRC::botchans{$svr}{$chan}) { delete $Proto::IRC::botchans{$svr}{$chan}; }
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -188,12 +188,12 @@ sub quit {
|
||||
Auto::socksnd($svr, "QUIT :$reason");
|
||||
}
|
||||
else {
|
||||
Auto::socksnd($svr, "QUIT :Leaving");
|
||||
Auto::socksnd($svr, 'QUIT :Leaving');
|
||||
}
|
||||
|
||||
delete $Proto::IRC::got_001{$svr} if (defined $Proto::IRC::got_001{$svr});
|
||||
delete $Proto::IRC::botinfo{$svr} if (defined $Proto::IRC::botinfo{$svr});
|
||||
|
||||
|
||||
# Trigger on_disconnect.
|
||||
API::Std::event_run('on_disconnect', $svr);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ sub slog
|
||||
# It is, continue.
|
||||
|
||||
# Split the network and channel.
|
||||
my ($net, $chan) = split '/', (conf_get('logchan'))[0][0];
|
||||
my ($net, $chan) = split m/[\/]/xsm, (conf_get('logchan'))[0][0];
|
||||
$chan = lc $chan;
|
||||
|
||||
# Check if we're connected to the network.
|
||||
|
||||
+15
-9
@@ -9,7 +9,7 @@ use Exporter;
|
||||
use base qw(Exporter);
|
||||
|
||||
|
||||
our (%LANGE, %MODULE, %EVENTS, %HOOKS, %CMDS);
|
||||
our (%LANGE, %MODULE, %EVENTS, %HOOKS, %CMDS, %RAWHOOKS);
|
||||
our @EXPORT_OK = qw(conf_get trans err awarn timer_add timer_del cmd_add
|
||||
cmd_del hook_add hook_del rchook_add rchook_del match_user
|
||||
has_priv mod_exists ratelimit_check fpfmt);
|
||||
@@ -26,7 +26,7 @@ sub mod_init
|
||||
if (keys %Auto::SOCKET) { API::Log::slog('MODULES: Attempting to load '.$name.' (version '.$version.') by '.$author.'...'); }
|
||||
|
||||
# Check if this module is compatible with this version of Auto.
|
||||
if ($autover !~ m/^3\.0\.0a(6)$/xsm) {
|
||||
if ($autover !~ m/^3\.0\.0a(7)$/xsm) {
|
||||
API::Log::dbug('MODULES: Failed to load '.$name.': Incompatible with your version of Auto.');
|
||||
API::Log::alog('MODULES: Failed to load '.$name.': Incompatible with your version of Auto.');
|
||||
if (keys %Auto::SOCKET) { API::Log::slog('MODULES: Failed to load '.$name.': Incompatible with your version of Auto.'); }
|
||||
@@ -263,12 +263,16 @@ sub timer_del
|
||||
# Hook onto a raw command.
|
||||
sub rchook_add
|
||||
{
|
||||
my ($cmd, $sub) = @_;
|
||||
my ($cmd, $name, $sub) = @_;
|
||||
$cmd = uc $cmd;
|
||||
|
||||
if (defined $Proto::IRC::RAWC{$cmd}) { return; }
|
||||
|
||||
$Proto::IRC::RAWC{$cmd} = $sub;
|
||||
# Make sure core doesn't already handle this.
|
||||
if (defined $Proto::IRC::RAWC{$cmd}) { return }
|
||||
# If the hook already exists, ignore it.
|
||||
if (defined $RAWHOOKS{$cmd}{$name}) { return }
|
||||
|
||||
# Create the hook.
|
||||
$RAWHOOKS{$cmd}{$name} = $sub;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -276,12 +280,14 @@ sub rchook_add
|
||||
# Delete a raw command hook.
|
||||
sub rchook_del
|
||||
{
|
||||
my ($cmd) = @_;
|
||||
my ($cmd, $name) = @_;
|
||||
$cmd = uc $cmd;
|
||||
|
||||
if (!defined $Proto::IRC::RAWC{$cmd}) { return; }
|
||||
# Make sure the hook exists.
|
||||
if (!defined $RAWHOOKS{$cmd}{$name}) { return }
|
||||
|
||||
delete $Proto::IRC::RAWC{$cmd};
|
||||
# Delete it.
|
||||
delete $RAWHOOKS{$cmd}{$name};
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
+50
-4
@@ -28,12 +28,12 @@ hook_add("on_uprivmsg", "ctcp_version_reply", sub {
|
||||
|
||||
# QUIT hook; delete user from chanusers.
|
||||
hook_add("on_quit", "quit_update_chanusers", sub {
|
||||
my (($svr, $src, undef)) = @_;
|
||||
my (($src, undef)) = @_;
|
||||
my %src = %{ $src };
|
||||
|
||||
# Delete the user from all channels.
|
||||
foreach my $ccu (keys %{ $Proto::IRC::chanusers{$svr} }) {
|
||||
if (defined $Proto::IRC::chanusers{$svr}{$ccu}{$src{nick}}) { delete $Proto::IRC::chanusers{$svr}{$ccu}{$src{nick}}; }
|
||||
foreach my $ccu (keys %{ $Proto::IRC::chanusers{$src{svr}}}) {
|
||||
if (defined $Proto::IRC::chanusers{$src{svr}}{$ccu}{$src{nick}}) { delete $Proto::IRC::chanusers{$src{svr}}{$ccu}{$src{nick}}; }
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -125,7 +125,7 @@ hook_add("on_connect", "autojoin", sub {
|
||||
|
||||
# WHO reply.
|
||||
hook_add('on_whoreply', 'selfwho.getdata', sub {
|
||||
my (($svr, $nick, undef, $user, $mask, undef, undef, undef, undef, undef)) = @_;
|
||||
my (($svr, $nick, undef, $user, $mask, undef, undef, undef, undef)) = @_;
|
||||
|
||||
# Check if it's for us.
|
||||
if ($nick eq $Proto::IRC::botinfo{$svr}{nick}) {
|
||||
@@ -188,6 +188,52 @@ sub clear_usercmd_timer
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Server data deletion on disconnect.
|
||||
hook_add('on_disconnect', 'core.irc.deldata', sub {
|
||||
my ($svr) = @_;
|
||||
|
||||
# Delete all data related to the server.
|
||||
if (defined $Proto::IRC::got_001{$svr}) { delete $Proto::IRC::got_001{$svr} }
|
||||
if (defined $Proto::IRC::botinfo{$svr}) { delete $Proto::IRC::botinfo{$svr} }
|
||||
if (defined $Proto::IRC::botchans{$svr}) { delete $Proto::IRC::botchans{$svr} }
|
||||
if (defined $Proto::IRC::chanusers{$svr}) { delete $Proto::IRC::chanusers{$svr} }
|
||||
if (defined $Proto::IRC::csprefix{$svr}) { delete $Proto::IRC::csprefix{$svr} }
|
||||
if (defined $Proto::IRC::chanmodes{$svr}) { delete $Proto::IRC::chanmodes{$svr} }
|
||||
if (defined $Proto::IRC::cap{$svr}) { delete $Proto::IRC::cap{$svr} }
|
||||
|
||||
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::botinfo{$svr}{modes} .= $_;
|
||||
}
|
||||
else {
|
||||
$Proto::IRC::botinfo{$svr}{modes} =~ s/($_)//xsm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
|
||||
1;
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
@@ -0,0 +1,132 @@
|
||||
# lib/Core/IRC/Users.pm - IRC user tracking.
|
||||
# Copyright (C) 2010-2011 Xelhua Development Group, et al.
|
||||
# This program is free software; rights to this code are stated in doc/LICENSE.
|
||||
package Core::IRC::Users;
|
||||
use strict;
|
||||
use warnings;
|
||||
use API::Std qw(hook_add);
|
||||
our %users;
|
||||
|
||||
# Initialize the ircusers_create and ircusers_delete events.
|
||||
API::Std::event_add('ircusers_create');
|
||||
API::Std::event_add('ircusers_delete');
|
||||
|
||||
# Create the on_rcjoin hook.
|
||||
hook_add('on_rcjoin', 'ircusers.onjoin', sub {
|
||||
my ($src, $chan) = @_;
|
||||
|
||||
# Add the user to the users hash, if not already defined.
|
||||
if (!$users{$src->{svr}}{lc $src->{nick}}) {
|
||||
$users{$src->{svr}}{lc $src->{nick}} = $src->{nick};
|
||||
API::Std::event_run('ircusers_create', ($src->{svr}, $src->{nick}));
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Create the on_namesreply hook.
|
||||
hook_add('on_namesreply', 'ircusers.names', sub {
|
||||
my ($svr, $chan, undef) = @_;
|
||||
|
||||
# Iterate through the users for this channel.
|
||||
foreach (keys %{$Proto::IRC::chanusers{$svr}{$chan}}) {
|
||||
# Check if the user already exists.
|
||||
if (!$users{$svr}{$_}) {
|
||||
# They do not; WHO them.
|
||||
API::IRC::who($svr, $_);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Create the on_whoreply hook.
|
||||
hook_add('on_whoreply', 'ircusers.who', sub {
|
||||
my ($svr, $nick, undef) = @_;
|
||||
|
||||
# Ensure it is not us.
|
||||
if (lc $nick ne lc $Proto::IRC::botinfo{$svr}{nick}) {
|
||||
# It is not. Check if they're already in the users hash.
|
||||
if (!$users{$svr}{lc $nick}) {
|
||||
# They are not; add them.
|
||||
$users{$svr}{lc $nick} = $nick;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Create the on_nick hook.
|
||||
hook_add('on_nick', 'ircusers.onnick', sub {
|
||||
my ($src, $newnick) = @_;
|
||||
|
||||
# Modify the user's entry in the users hash.
|
||||
if ($users{$src->{svr}}{lc $src->{nick}}) {
|
||||
$users{$src->{svr}}{lc $newnick} = $newnick;
|
||||
delete $users{$src->{svr}}{lc $src->{nick}};
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Create the on_kick hook.
|
||||
hook_add('on_kick', 'ircusers.onkick', sub {
|
||||
my ($src, $kchan, $user, undef) = @_;
|
||||
|
||||
# Ensure there is a users hash entry for this user.
|
||||
if ($users{$src->{svr}}{lc $user}) {
|
||||
# Figure out if the user is in any other channel we're in.
|
||||
my $ri = 0;
|
||||
foreach my $chan (keys %{$Proto::IRC::chanusers{$src->{svr}}}) {
|
||||
if ($chan ne $kchan) {
|
||||
if (defined $Proto::IRC::chanusers{$src->{svr}}{$chan}{lc $user}) { $ri++; last; }
|
||||
}
|
||||
}
|
||||
if (!$ri) {
|
||||
# They are not, delete them.
|
||||
delete $users{$src->{svr}}{lc $user};
|
||||
API::Std::event_run('ircusers_delete', ($src->{svr}, $user));
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Create the on_part hook.
|
||||
hook_add('on_part', 'ircusers.onpart', sub {
|
||||
my ($src, $pchan, undef) = @_;
|
||||
|
||||
# Ensure there is a users hash entry for this user.
|
||||
if ($users{$src->{svr}}{lc $src->{nick}}) {
|
||||
# Figure out if the user is in any other channel we're in.
|
||||
my $ri = 0;
|
||||
foreach my $chan (keys %{$Proto::IRC::chanusers{$src->{svr}}}) {
|
||||
if ($chan ne $pchan) {
|
||||
if (defined $Proto::IRC::chanusers{$src->{svr}}{$chan}{lc $src->{nick}}) { $ri++; last; }
|
||||
}
|
||||
}
|
||||
if (!$ri) {
|
||||
# They are not, delete them.
|
||||
delete $users{$src->{svr}}{lc $src->{nick}};
|
||||
API::Std::event_run('ircusers_delete', ($src->{svr}, $src->{nick}));
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Create the on_quit hook.
|
||||
hook_add('on_quit', 'ircusers.onquit', sub {
|
||||
my ($src, undef) = @_;
|
||||
|
||||
# Delete the user's entry from the users hash.
|
||||
if ($users{$src->{svr}}{lc $src->{nick}}) {
|
||||
delete $users{$src->{svr}}{lc $src->{nick}};
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
|
||||
1;
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
@@ -214,6 +214,8 @@ sub ircsock {
|
||||
}
|
||||
}
|
||||
|
||||
# Create a CAP entry if it doesn't already exist.
|
||||
if (!$Proto::IRC::cap{$svrname}) { $Proto::IRC::cap{$svrname} = 'multi-prefix' }
|
||||
# Send PASS if we have one.
|
||||
if (defined $cdata->{'pass'}[0]) {
|
||||
Auto::socksnd($svrname, 'PASS :'.$cdata->{'pass'}[0]) or return;
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ sub installmods
|
||||
chomp $response;
|
||||
if (lc $response eq 'y') {
|
||||
println 'What modules would you like to install? (separate by commas)';
|
||||
println 'Available modules: Badwords, Bitly, BotStats, Calc, ChanTopics, Dictionary, EightBall, Eval, FML, Greet, HelloChan, IsItUp, LinkTitle, QDB, SASLAuth, Weather';
|
||||
println 'Available modules: Badwords, Bitly, BotStats, Calc, ChanTopics, Dictionary, EightBall, Eval, FML, Greet, HelloChan, IsItUp, LinkTitle, QDB, SASLAuth, UNO, Weather';
|
||||
print '> ';
|
||||
my $modules = <STDIN>; chomp $modules;
|
||||
$modules =~ s/ //g;
|
||||
|
||||
+114
-72
@@ -42,14 +42,19 @@ our (%got_001, %botinfo, %botchans, %csprefix, %chanusers, %chanmodes, %cap);
|
||||
|
||||
# Events.
|
||||
API::Std::event_add('on_capack');
|
||||
API::Std::event_add('on_cmode');
|
||||
API::Std::event_add('on_umode');
|
||||
API::Std::event_add('on_connect');
|
||||
API::Std::event_add('on_rcjoin');
|
||||
API::Std::event_add('on_ucjoin');
|
||||
API::Std::event_add('on_isupport');
|
||||
API::Std::event_add('on_kick');
|
||||
API::Std::event_add('on_myinfo');
|
||||
API::Std::event_add('on_namesreply');
|
||||
API::Std::event_add('on_nick');
|
||||
API::Std::event_add('on_notice');
|
||||
API::Std::event_add('on_part');
|
||||
API::Std::event_add('on_upart');
|
||||
API::Std::event_add('on_cprivmsg');
|
||||
API::Std::event_add('on_uprivmsg');
|
||||
API::Std::event_add('on_quit');
|
||||
@@ -60,7 +65,7 @@ API::Std::event_add('on_whoreply');
|
||||
sub ircparse
|
||||
{
|
||||
my ($svr, $data) = @_;
|
||||
|
||||
|
||||
# Split spaces into @ex.
|
||||
my @ex = split /\s+/, $data;
|
||||
|
||||
@@ -69,22 +74,28 @@ sub ircparse
|
||||
# If it's a ping...
|
||||
if ($ex[0] eq 'PING') {
|
||||
# send a PONG.
|
||||
Auto::socksnd($svr, "PONG ".$ex[1]);
|
||||
Auto::socksnd($svr, "PONG $ex[1]");
|
||||
}
|
||||
# If it's AUTHENTICATE
|
||||
elsif ($ex[0] eq 'AUTHENTICATE') {
|
||||
if (API::Std::mod_exists("SASLAuth")) {
|
||||
if (API::Std::mod_exists('SASLAuth')) {
|
||||
M::SASLAuth::handle_authenticate($svr, @ex);
|
||||
}
|
||||
}
|
||||
# Check if it's handled by core.
|
||||
elsif (defined $RAWC{$ex[1]}) {
|
||||
&{ $RAWC{$ex[1]} }($svr, @ex);
|
||||
}
|
||||
else {
|
||||
# otherwise, check %RAWC for ex[1].
|
||||
if (defined $RAWC{$ex[1]}) {
|
||||
&{ $RAWC{$ex[1]} }($svr, @ex);
|
||||
# otherwise, check for a raw hook.
|
||||
if (defined $API::Std::RAWHOOKS{$ex[1]}) {
|
||||
foreach (keys %{$API::Std::RAWHOOKS{$ex[1]}}) {
|
||||
&{ $API::Std::RAWHOOKS{$ex[1]}{$_} }($svr, @ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -96,7 +107,7 @@ sub ircparse
|
||||
# Successful connection.
|
||||
sub num001 {
|
||||
my ($svr, @ex) = @_;
|
||||
|
||||
|
||||
$got_001{$svr} = 1;
|
||||
|
||||
# In case we don't get NICK from the server.
|
||||
@@ -111,7 +122,7 @@ sub num001 {
|
||||
|
||||
# Trigger on_connect.
|
||||
API::Std::event_run('on_connect', $svr);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -124,6 +135,9 @@ sub num004 {
|
||||
API::Log::alog "! $svr: $ex[3] running version $ex[4]";
|
||||
API::Log::dbug "! $svr: $ex[3] running version $ex[4]";
|
||||
|
||||
# Trigger on_myinfo.
|
||||
API::Std::event_run('on_myinfo', ($svr, @ex[3..$#ex]));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -144,7 +158,8 @@ sub num352 {
|
||||
my ($svr, @ex) = @_;
|
||||
|
||||
# Trigger on_whoreply.
|
||||
API::Std::event_run('on_whoreply', ($svr, $ex[2], $ex[3], $ex[4], $ex[5], $ex[6], @ex[7..$#ex]));
|
||||
$ex[9] =~ s/^://xsm;
|
||||
API::Std::event_run('on_whoreply', ($svr, $ex[7], $ex[3], $ex[4], $ex[5], $ex[6], $ex[8], $ex[9], @ex[10..$#ex]));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -153,43 +168,46 @@ sub num352 {
|
||||
# NAMES reply.
|
||||
sub num353 {
|
||||
my ($svr, @ex) = @_;
|
||||
|
||||
|
||||
# Get rid of the colon.
|
||||
$ex[5] = substr($ex[5], 1);
|
||||
$ex[5] =~ s/^://xsm;
|
||||
# Delete the old chanusers hash if it exists.
|
||||
delete $chanusers{$svr}{$ex[4]} if (defined $chanusers{$svr}{$ex[4]});
|
||||
if (defined $chanusers{$svr}{$ex[4]}) { delete $chanusers{$svr}{$ex[4]} }
|
||||
# Iterate through each user.
|
||||
for (my $i = 5; $i < scalar(@ex); $i++) {
|
||||
for (5..$#ex) {
|
||||
my $fi = 0;
|
||||
PFITER: foreach (keys %{ $csprefix{$svr} }) {
|
||||
PFITER: foreach my $spfx (keys %{ $csprefix{$svr} }) {
|
||||
# Check if the user has status in the channel.
|
||||
if (substr($ex[$i], 0, 1) eq $csprefix{$svr}{$_}) {
|
||||
if (substr($ex[$_], 0, 1) eq $csprefix{$svr}{$spfx}) {
|
||||
# He/she does. Lets set that.
|
||||
if (defined $chanusers{$svr}{$ex[4]}{lc $ex[$i]}) {
|
||||
if (defined $chanusers{$svr}{$ex[4]}{lc $ex[$_]}) {
|
||||
# If the user has multiple statuses.
|
||||
$chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} = $chanusers{$svr}{$ex[4]}{lc $ex[$i]}.$_;
|
||||
delete $chanusers{$svr}{$ex[4]}{lc $ex[$i]};
|
||||
$chanusers{$svr}{$ex[4]}{lc substr $ex[$_], 1} = $chanusers{$svr}{$ex[4]}{lc $ex[$_]}.$spfx;
|
||||
delete $chanusers{$svr}{$ex[4]}{lc $ex[$_]};
|
||||
}
|
||||
else {
|
||||
# Or not.
|
||||
$chanusers{$svr}{$ex[4]}{lc(substr($ex[$i], 1))} = $_;
|
||||
$chanusers{$svr}{$ex[4]}{lc substr $ex[$_], 1} = $spfx;
|
||||
}
|
||||
$fi = 1;
|
||||
$ex[$i] = substr $ex[$i], 1;
|
||||
$ex[$_] = substr $ex[$_], 1;
|
||||
}
|
||||
}
|
||||
# Check if there's still a prefix.
|
||||
foreach (keys %{$csprefix{$svr}}) {
|
||||
if (substr($ex[$i], 0, 1) eq $csprefix{$svr}{$_}) { goto 'PFITER' }
|
||||
foreach my $spfx (keys %{$csprefix{$svr}}) {
|
||||
if (substr($ex[$_], 0, 1) eq $csprefix{$svr}{$spfx}) { goto 'PFITER' }
|
||||
}
|
||||
# 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;
|
||||
if (!defined $chanusers{$svr}{$ex[4]}{lc $ex[$_]}) {
|
||||
$chanusers{$svr}{$ex[4]}{lc $ex[$_]} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Trigger on_namesreply.
|
||||
API::Std::event_run('on_namesreply', ($svr, $ex[4], @ex[5..$#ex]));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -208,17 +226,17 @@ sub num396 {
|
||||
# Erroneous nickname.
|
||||
sub num432 {
|
||||
my ($svr, undef) = @_;
|
||||
|
||||
|
||||
if ($got_001{$svr}) {
|
||||
err(3, "Got error from server[".$svr."]: Erroneous nickname.", 0);
|
||||
err(3, "Got error from server[$svr]: Erroneous nickname.", 0);
|
||||
}
|
||||
else {
|
||||
err(2, "Got error from server[".$svr."] before 001: Erroneous nickname. Closing connection.", 0);
|
||||
API::IRC::quit($svr, "An error occurred.");
|
||||
err(2, "Got error from server[$svr] before connection complete: Erroneous nickname. Closing connection.", 0);
|
||||
API::IRC::quit($svr, 'An error occurred.');
|
||||
}
|
||||
|
||||
delete $botinfo{$svr}{newnick} if (defined $botinfo{$svr}{newnick});
|
||||
|
||||
|
||||
if (defined $botinfo{$svr}{newnick}) { delete $botinfo{$svr}{newnick} }
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -226,11 +244,11 @@ sub num432 {
|
||||
# Nickname is already in use.
|
||||
sub num433 {
|
||||
my ($svr, undef) = @_;
|
||||
|
||||
|
||||
if (defined $botinfo{$svr}{newnick}) {
|
||||
API::IRC::nick($svr, $botinfo{$svr}{newnick}."_");
|
||||
API::IRC::nick($svr, $botinfo{$svr}{newnick}.'_');
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -238,14 +256,14 @@ sub num433 {
|
||||
# Nick change too fast.
|
||||
sub num438 {
|
||||
my ($svr, @ex) = @_;
|
||||
|
||||
|
||||
if (defined $botinfo{$svr}{newnick}) {
|
||||
API::Std::timer_add("num438_".$botinfo{$svr}{newnick}, 1, $ex[11], sub {
|
||||
API::Std::timer_add('num438_'.$botinfo{$svr}{newnick}, 1, $ex[11], sub {
|
||||
API::IRC::nick($Proto::IRC::botinfo{$svr}{newnick});
|
||||
delete $botinfo{$svr}{newnick} if (defined $botinfo{$svr}{newnick});
|
||||
if (defined $botinfo{$svr}{newnick}) { delete $botinfo{$svr}{newnick} }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -253,9 +271,9 @@ sub num438 {
|
||||
# You're banned creep!
|
||||
sub num465 {
|
||||
my ($svr, undef) = @_;
|
||||
|
||||
err(3, "Banned from ".$svr."! Closing link...", 0);
|
||||
|
||||
|
||||
err(3, "Banned from $svr.! Closing link...", 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -263,9 +281,9 @@ sub num465 {
|
||||
# Cannot join channel: Channel is full.
|
||||
sub num471 {
|
||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||
|
||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Channel is full.", 0);
|
||||
|
||||
|
||||
err(3, "Cannot join channel $chan on $svr: Channel is full.", 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -273,9 +291,9 @@ sub num471 {
|
||||
# Cannot join channel: Channel is invite-only.
|
||||
sub num473 {
|
||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||
|
||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Channel is invite-only.", 0);
|
||||
|
||||
|
||||
err(3, "Cannot join channel $chan on $svr: Channel is invite-only.", 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -283,8 +301,8 @@ sub num473 {
|
||||
# Cannot join channel: Banned from channel.
|
||||
sub num474 {
|
||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||
|
||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Banned from channel.", 0);
|
||||
|
||||
err(3, "Cannot join channel $chan on $svr: Banned from channel.", 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -293,8 +311,8 @@ sub num474 {
|
||||
# Cannot join channel: Bad key.
|
||||
sub num475 {
|
||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||
|
||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Bad key.", 0);
|
||||
|
||||
err(3, "Cannot join channel $chan on $svr: Bad key.", 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -304,7 +322,7 @@ sub num475 {
|
||||
sub num477 {
|
||||
my ($svr, (undef, undef, undef, $chan)) = @_;
|
||||
|
||||
err(3, "Cannot join channel ".$chan." on ".$svr.": Need registered nickname.", 0);
|
||||
err(3, "Cannot join channel $chan on $svr: Need registered nickname.", 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -385,7 +403,9 @@ sub cjoin {
|
||||
# Parse: KICK
|
||||
sub kick {
|
||||
my ($svr, @ex) = @_;
|
||||
|
||||
my %src = API::IRC::usrc(substr($ex[0], 1));
|
||||
$src{svr} = $svr;
|
||||
|
||||
# Update chanusers.
|
||||
delete $chanusers{$svr}{$ex[2]}{$ex[3]} if defined $chanusers{$svr}{$ex[2]}{$ex[3]};
|
||||
@@ -421,7 +441,7 @@ sub kick {
|
||||
else {
|
||||
# We weren't. Update chanusers and trigger on_kick.
|
||||
if (defined $chanusers{$svr}{$ex[2]}{$ex[3]}) { delete $chanusers{$svr}{$ex[2]}{$ex[3]}; }
|
||||
API::Std::event_run("on_kick", ($svr, \%src, $ex[2], $ex[3], $msg));
|
||||
API::Std::event_run("on_kick", (\%src, $ex[2], $ex[3], $msg));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -434,7 +454,9 @@ sub mode {
|
||||
if ($ex[2] ne $botinfo{$svr}{nick}) {
|
||||
# Set data we'll need later.
|
||||
my $chan = $ex[2];
|
||||
$ex[3] =~ s/^://xsm;
|
||||
my $modes = $ex[3];
|
||||
my $fmodes = join ' ', @ex[3..$#ex];
|
||||
$modes =~ s/^://xsm;
|
||||
# Get rid of the useless data, so the mode parser will work smoothly.
|
||||
shift @ex; shift @ex; shift @ex; shift @ex;
|
||||
@@ -511,8 +533,14 @@ sub mode {
|
||||
}
|
||||
}
|
||||
}
|
||||
# Trigger on_cmode.
|
||||
API::Std::event_run('on_cmode', ($svr, $chan, $fmodes));
|
||||
}
|
||||
else {
|
||||
# User mode change; trigger on_umode.
|
||||
$ex[3] =~ s/^://xsm;
|
||||
API::Std::event_run('on_umode', ($svr, @ex[3..$#ex]));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -522,7 +550,8 @@ sub nick {
|
||||
$nex =~ s/^://gxsm;
|
||||
|
||||
my %src = API::IRC::usrc(substr($uex, 1));
|
||||
|
||||
$src{svr} = $svr;
|
||||
|
||||
# Check if this is coming from ourselves.
|
||||
if ($src{nick} eq $botinfo{$svr}{nick}) {
|
||||
# It is. Update bot nick hash.
|
||||
@@ -537,7 +566,7 @@ sub nick {
|
||||
delete $chanusers{$svr}{$chk}{$src{nick}};
|
||||
}
|
||||
}
|
||||
API::Std::event_run("on_nick", ($svr, \%src, $nex));
|
||||
API::Std::event_run("on_nick", (\%src, $nex));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -566,24 +595,35 @@ sub notice {
|
||||
# Parse: PART
|
||||
sub part {
|
||||
my ($svr, @ex) = @_;
|
||||
my %src = API::IRC::usrc(substr($ex[0], 1));
|
||||
|
||||
# Delete them from chanusers.
|
||||
delete $chanusers{$svr}{$ex[2]}{$src{nick}} if defined $chanusers{$svr}{$ex[2]}{$src{nick}};
|
||||
my %src = API::IRC::usrc(substr($ex[0], 1));
|
||||
$src{svr} = $svr;
|
||||
|
||||
# Set $msg to the part message.
|
||||
my $msg = 0;
|
||||
if (defined $ex[3]) {
|
||||
$msg = substr($ex[3], 1);
|
||||
if (defined $ex[4]) {
|
||||
for (my $i = 4; $i < scalar(@ex); $i++) {
|
||||
$msg .= " ".$ex[$i];
|
||||
# Check if it's from us or someone else.
|
||||
if ($src{nick} eq $botinfo{$svr}{nick}) {
|
||||
# Delete this channel from botchans.
|
||||
if ($botchans{$svr}{$ex[2]}) { delete $botchans{$svr}{$ex[2]}; }
|
||||
# Trigger on_upart.
|
||||
API::Std::event_run('on_upart', ($svr, $ex[2]));
|
||||
}
|
||||
else {
|
||||
# Delete them from chanusers.
|
||||
delete $chanusers{$svr}{$ex[2]}{$src{nick}} if defined $chanusers{$svr}{$ex[2]}{$src{nick}};
|
||||
|
||||
# Set $msg to the part message.
|
||||
my $msg = 0;
|
||||
if (defined $ex[3]) {
|
||||
$msg = substr($ex[3], 1);
|
||||
if (defined $ex[4]) {
|
||||
for (my $i = 4; $i < scalar(@ex); $i++) {
|
||||
$msg .= " ".$ex[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Trigger on_part.
|
||||
API::Std::event_run("on_part", ($svr, \%src, $ex[2], $msg));
|
||||
# Trigger on_part.
|
||||
API::Std::event_run("on_part", (\%src, $ex[2], $msg));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -718,7 +758,9 @@ sub privmsg {
|
||||
# Parse: QUIT
|
||||
sub quit {
|
||||
my ($svr, @ex) = @_;
|
||||
|
||||
my %src = API::IRC::usrc(substr($ex[0], 1));
|
||||
$src{svr} = $svr;
|
||||
|
||||
# Set $msg to the quit message.
|
||||
my $msg = 0;
|
||||
@@ -732,7 +774,7 @@ sub quit {
|
||||
}
|
||||
|
||||
# Trigger on_quit.
|
||||
API::Std::event_run("on_quit", ($svr, \%src, $msg));
|
||||
API::Std::event_run("on_quit", (\%src, $msg));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
+4
-3
@@ -70,8 +70,7 @@ sub actonbadword
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('Badwords', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('Badwords', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -122,6 +121,8 @@ Changing the obvious to your wish.
|
||||
|
||||
=over
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+4
-3
@@ -118,8 +118,7 @@ sub reverse
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Bitly', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('Bitly', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=LWP::UserAgent,URI::Escape perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -179,6 +178,8 @@ Add Bitly to module auto-load and the following to your configuration file:
|
||||
This module adds extra dependencies: LWP::UserAgent and URI::Escape. You can
|
||||
get it from the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+5
-4
@@ -72,8 +72,7 @@ sub stats {
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('BotStats', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('BotStats', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -90,7 +89,7 @@ BotStats - General information about the bot
|
||||
|
||||
<starcoder> !stats
|
||||
<blue> I have been running for 0 days, 0 hours, 1 minutes, and 5 seconds.
|
||||
<blue> I am running Auto IRC Bot (version 3.0.0a6) for Perl v5.12.3 on linux.
|
||||
<blue> I am running Auto IRC Bot (version 3.0.0a7) for Perl v5.12.3 on linux.
|
||||
<blue> I am on 2 channels, across 1 networks.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -98,7 +97,7 @@ BotStats - General information about the bot
|
||||
This module creates the STATS command, for returning general information about
|
||||
the bot such as uptime, version, etc.
|
||||
|
||||
This module is compatible with Auto v3.0.0a6+.
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
@@ -113,3 +112,5 @@ This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
This module is released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+4
-3
@@ -78,8 +78,7 @@ sub calc
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Calc', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('Calc', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=LWP::UserAgent,URI::Escape,JSON,JSON::PP perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -119,6 +118,8 @@ Google Calculator.
|
||||
This module requires LWP::UserAgent, URI::Escape and JSON/JSON::PP.
|
||||
All are obtainable from the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
@@ -282,8 +282,7 @@ sub _getdata
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('ChanTopics', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('ChanTopics', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -338,8 +337,10 @@ This module adds no extra dependencies.
|
||||
|
||||
This module is not compatible with PostgreSQL, yet.
|
||||
|
||||
This module is compatible with Auto v3.0.0a6+.
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
|
||||
Ported from v1.0.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
@@ -75,8 +75,7 @@ sub cmd_dict
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Dictionary', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('Dictionary', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=Net::Dict perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -99,6 +98,8 @@ DICT command.
|
||||
This module adds an extra dependency: Net::Dict. You can get it from the CPAN
|
||||
<http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto v3.0.0a6+.
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+28
-29
@@ -99,52 +99,51 @@ sub rigball
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('EightBall', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('EightBall', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
=head1 EightBall
|
||||
=head1 NAME
|
||||
|
||||
=head2 Description
|
||||
Eightball - A magic eightball module.
|
||||
|
||||
=over
|
||||
=head1 VERSION
|
||||
|
||||
1.00
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
<JohnSmith> !8ball Will I be rich?
|
||||
<Auto> Question: Will I be rich?
|
||||
<Auto> Answer: Heck no!
|
||||
>Auto< rigball Of course!
|
||||
<JohnSmith> !8ball Will I be famous?
|
||||
<Auto> Question: Will I be famous?
|
||||
<Auto> Answer: Of course!
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module adds the 8BALL and RIGBALL commands, 8BALL is a channel
|
||||
command for asking the magic 8-Ball a question, RIGBALL is a private
|
||||
command for setting ("rigging") the 8-Ball's next answer.
|
||||
|
||||
=back
|
||||
=head1 INSTALL
|
||||
|
||||
=head2 Examples
|
||||
No additonal steps need to be taking to use this module.
|
||||
|
||||
=over
|
||||
=head1 AUTHOR
|
||||
|
||||
<JohnSmith> !8ball Will I be rich?
|
||||
<Auto> Question: Will I be rich?
|
||||
<Auto> Answer: Heck no!
|
||||
>Auto< rigball Of course!
|
||||
<JohnSmith> !8ball Will I be famous?
|
||||
<Auto> Question: Will I be famous?
|
||||
<Auto> Answer: Of course!
|
||||
This module was written by Elijah Perrault.
|
||||
|
||||
=back
|
||||
This module is maintained by Xelhua Development Group.
|
||||
|
||||
=head2 To Do
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
=over
|
||||
This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
|
||||
* Add Spanish, French and German translations for the help hashes.
|
||||
Released under the same licensing terms as Auto itself.
|
||||
|
||||
=back
|
||||
=cut
|
||||
|
||||
=head2 Technical
|
||||
|
||||
=over
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
|
||||
Ported from Auto 1.0.
|
||||
|
||||
=back
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+4
-3
@@ -63,8 +63,7 @@ sub cmd_eval {
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Eval', 'Xelhua', '1.01', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('Eval', 'Xelhua', '1.01', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -89,7 +88,7 @@ IRC, returning the output via notice.
|
||||
|
||||
This command requires the cmd.eval privilege.
|
||||
|
||||
This module is compatible with Auto v3.0.0a6+.
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
@@ -104,3 +103,5 @@ This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
This module is released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+4
-3
@@ -67,8 +67,7 @@ sub fml
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('FML', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('FML', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=LWP::UserAgent perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -110,8 +109,10 @@ have my hand back?" FML
|
||||
This module adds an extra dependency: LWP::UserAgent. You can get it from
|
||||
the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
|
||||
Ported from Auto 2.0.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+4
-3
@@ -125,8 +125,7 @@ sub hook_rcjoin
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Greet', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('Greet', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -154,6 +153,8 @@ user that has a greet in the database joins a channel the bot is in.
|
||||
|
||||
=over
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+35
-6
@@ -36,16 +36,45 @@ sub hello
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('HelloChan', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('HelloChan', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
=head1 HelloChan
|
||||
=head1 NAME
|
||||
|
||||
=over
|
||||
HelloChan - An example module. Also, cows go moo.
|
||||
|
||||
This is an example module. Also, cows go moo.
|
||||
=head1 VERSION
|
||||
|
||||
=back
|
||||
1.00
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
* Auto has joined #moocows
|
||||
<Auto> Hello channel! I am a bot!
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module sends "Hello channel! I am a bot!" whenever it
|
||||
joins a channel.
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
No additonal steps need to be taking to use this module.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Elijah Perrault.
|
||||
|
||||
This module is maintained by Xelhua Development Group.
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
|
||||
Released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+4
-3
@@ -69,8 +69,7 @@ sub check
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('IsItUp', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('IsItUp', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=LWP::UserAgent perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -110,6 +109,8 @@ appears up or down to Auto.
|
||||
This module requires LWP::UserAgent. You can get it from
|
||||
the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
@@ -66,8 +66,7 @@ sub gettitle
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('LinkTitle', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('LinkTitle', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=LWP::UserAgent,HTML::Entities perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -120,3 +119,7 @@ This module is Copyright 2010-2011 Xelhua Development Group. All rights
|
||||
reserved.
|
||||
|
||||
This module is released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
# Module: Oper.
|
||||
# Copyright (C) 2010-2011 Xelhua Development Group, et al.
|
||||
# This program is free software; rights to this code are stated in doc/LICENSE.
|
||||
package M::Oper;
|
||||
use strict;
|
||||
use warnings;
|
||||
use API::Std qw(hook_add hook_del rchook_add rchook_del conf_get);
|
||||
use API::Log qw(alog);
|
||||
|
||||
# Initialization subroutine.
|
||||
sub _init
|
||||
{
|
||||
# Add a hook for when we join a channel.
|
||||
hook_add("on_connect", "Oper.onconnect", \&M::Oper::on_connect) or return 0;
|
||||
# Add a hook for when we get numeric 491 (ERR_NOOPERHOST)
|
||||
rchook_add("491", "Oper.on381", \&M::Oper::on_num491) or return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Void subroutine.
|
||||
sub _void
|
||||
{
|
||||
# Delete the hooks.
|
||||
hook_del("on_connect", "Oper.onconnect") or return 0;
|
||||
rchook_del("381", "Oper.on381") or return 0;
|
||||
rchook_del("313", "Oper.on313") or return 0;
|
||||
rchook_del("491", "Oper.on491") or return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
# On connect subroutine.
|
||||
sub on_connect
|
||||
{
|
||||
my ($svr) = @_;
|
||||
# Get the configuration values.
|
||||
my $u = (conf_get("server:$svr:oper_username"))[0][0] if conf_get("server:$svr:oper_username");
|
||||
my $p = (conf_get("server:$svr:oper_password"))[0][0] if conf_get("server:$svr:oper_password");
|
||||
# They don't exist - don't continue.
|
||||
return if !$u or !$p;
|
||||
# Send the OPER command.
|
||||
oper($svr, $u, $p);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# On 491 subroutine
|
||||
sub on_num491 {
|
||||
my ($svr, @ex) = @_;
|
||||
my $reason = join ' ', @ex[3 .. $#ex];
|
||||
$reason =~ s/://xsm;
|
||||
alog("FAILED OPER on ".$svr.": ".$reason);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# A subroutine to check if we are opered on a server
|
||||
sub is_opered {
|
||||
my ($svr) = @_;
|
||||
# Auto is not opered.
|
||||
return 0 if $Proto::IRC::botinfo{$svr}{modes} !~ m/o/xsm;
|
||||
# Auto is opered.
|
||||
return 1 if $Proto::IRC::botinfo{$svr}{modes} =~ m/o/xsm;
|
||||
return;
|
||||
}
|
||||
|
||||
# Start of the API
|
||||
|
||||
# Sends the OPER command to the specified server.
|
||||
sub oper {
|
||||
my ($svr, $user, $pass) = @_;
|
||||
Auto::socksnd($svr, "OPER $user $pass");
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Oper', 'Xelhua', '1.01', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Oper - Auto oper-on-connect module.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.01
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
No commands are currently associated with Oper.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module adds the ability for Auto to oper on networks he is
|
||||
configured to do so on.
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
Before using Oper, add the following to the server block in your
|
||||
configuration file, only for servers you wish for Auto to oper on
|
||||
though:
|
||||
|
||||
oper_username <username>;
|
||||
oper_password <password>;
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Matthew Barksdale.
|
||||
|
||||
This module is maintained by Xelhua Development Group.
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
|
||||
Released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+3
-2
@@ -211,8 +211,7 @@ sub cmd_qdb
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('QDB', 'Xelhua', '1.02', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('QDB', 'Xelhua', '1.02', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -260,3 +259,5 @@ This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
Released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+11
-10
@@ -18,16 +18,16 @@ sub _init
|
||||
# Add sasl to supported CAP for servers configured with SASL.
|
||||
my %servers = conf_get('server');
|
||||
foreach my $svr (keys %servers) {
|
||||
if (conf_get("server:$svr:sasl_username")) { $Proto::IRC::cap{$svr} .= ' sasl'; }
|
||||
if (conf_get("server:$svr:sasl_username") and conf_get("server:$svr:sasl_password") and conf_get("server:$svr:sasl_timeout")) { $Proto::IRC::cap{$svr} .= ' sasl'; }
|
||||
}
|
||||
# Hook for when CAP ACK sasl is received.
|
||||
hook_add('on_capack', 'sasl.cap', \&M::SASLAuth::handle_capack) or return;
|
||||
# Hook for parsing 903.
|
||||
rchook_add('903', \&M::SASLAuth::handle_903) or return;
|
||||
rchook_add('903', 'sasl.903', \&M::SASLAuth::handle_903) or return;
|
||||
# Hook for parsing 904.
|
||||
rchook_add('904', \&M::SASLAuth::handle_904) or return;
|
||||
rchook_add('904', 'sasl.904', \&M::SASLAuth::handle_904) or return;
|
||||
# Hook for parsing 906.
|
||||
rchook_add('906', \&M::SASLAuth::handle_906) or return;
|
||||
rchook_add('906', 'sasl.906', \&M::SASLAuth::handle_906) or return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ sub _void
|
||||
{
|
||||
# Delete the hooks.
|
||||
hook_del('on_capack') or return;
|
||||
rchook_del('903') or return;
|
||||
rchook_del('904') or return;
|
||||
rchook_del('906') or return;
|
||||
rchook_del('903', 'sasl.903') or return;
|
||||
rchook_del('904', 'sasl.904') or return;
|
||||
rchook_del('906', 'sasl.906') or return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -111,8 +111,7 @@ sub handle_906
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('SASLAuth', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('SASLAuth', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -169,6 +168,8 @@ block(s) you wish to use SASL with:
|
||||
This adds an extra dependency: You must build Auto with the
|
||||
--enable-sasl option.
|
||||
|
||||
This module is compatible with Auto v3.0.0a6+.
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+11
-10
@@ -5,7 +5,7 @@ package M::UNO;
|
||||
use strict;
|
||||
use warnings;
|
||||
use feature qw(switch);
|
||||
use API::Std qw(cmd_add cmd_del hook_add hook_del trans conf_get err has_priv match_user);
|
||||
use API::Std qw(cmd_add cmd_del hook_add hook_del trans conf_get err has_priv match_user awarn);
|
||||
use API::IRC qw(notice privmsg);
|
||||
|
||||
# Set various variables we'll need throughout runtime.
|
||||
@@ -1194,7 +1194,7 @@ sub _gameover {
|
||||
|
||||
# Subroutine for when someone changes their nick.
|
||||
sub on_nick {
|
||||
my (($svr, $src, $newnick)) = @_;
|
||||
my (($src, $newnick)) = @_;
|
||||
|
||||
# Check if a game is currently running.
|
||||
if ($UNO or $UNOW) {
|
||||
@@ -1227,7 +1227,7 @@ sub on_nick {
|
||||
|
||||
# Subroutine for when someone disconnects.
|
||||
sub on_quit {
|
||||
my (($svr, $src, undef)) = @_;
|
||||
my (($src, undef)) = @_;
|
||||
|
||||
# Check if a game is currently running.
|
||||
if ($UNO or $UNOW) {
|
||||
@@ -1246,7 +1246,7 @@ sub on_quit {
|
||||
|
||||
# Subroutine for when someone parts.
|
||||
sub on_part {
|
||||
my (($svr, $src, $chan, undef)) = @_;
|
||||
my (($src, $chan, undef)) = @_;
|
||||
|
||||
# Check if a game is currently running.
|
||||
if ($UNO or $UNOW) {
|
||||
@@ -1254,7 +1254,7 @@ sub on_part {
|
||||
|
||||
# Check if this is the channel UNO is in.
|
||||
my ($net, $uchan) = split '/', $UNOCHAN;
|
||||
if ($svr eq $net and lc $chan eq $uchan) {
|
||||
if ($src->{svr} eq $net and lc $chan eq $uchan) {
|
||||
# Check if the user is playing.
|
||||
if (defined $PLAYERS{lc $src->{nick}}) {
|
||||
privmsg($net, $uchan, "\2$src->{nick}\2 left the game.");
|
||||
@@ -1268,7 +1268,7 @@ sub on_part {
|
||||
|
||||
# Subroutine for when someone is kicked.
|
||||
sub on_kick {
|
||||
my (($svr, undef, $chan, $user, undef)) = @_;
|
||||
my (($src, $chan, $user, undef)) = @_;
|
||||
|
||||
# Check if a game is currently running.
|
||||
if ($UNO or $UNOW) {
|
||||
@@ -1276,7 +1276,7 @@ sub on_kick {
|
||||
|
||||
# Check if this is the channel UNO is in.
|
||||
my ($net, $uchan) = split '/', $UNOCHAN;
|
||||
if ($svr eq $net and lc $chan eq $uchan) {
|
||||
if ($src->{svr} eq $net and lc $chan eq $uchan) {
|
||||
# Check if the user is playing.
|
||||
if (defined $PLAYERS{lc $user}) {
|
||||
privmsg($net, $uchan, "\2$user\2 left the game.");
|
||||
@@ -1313,8 +1313,7 @@ sub on_rehash {
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('UNO', 'Xelhua', '1.03', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('UNO', 'Xelhua', '1.03', '3.0.0a7', __PACKAGE__);
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -1373,7 +1372,7 @@ The commands this adds are:
|
||||
|
||||
All of which describe themselves quite well with just the name.
|
||||
|
||||
This module is compatible with Auto v3.0.0a6+.
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
@@ -1454,3 +1453,5 @@ This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
Released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
+4
-3
@@ -78,8 +78,7 @@ sub weather
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Weather', 'Xelhua', '1.00', '3.0.0a6', __PACKAGE__);
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
API::Std::mod_init('Weather', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=LWP::UserAgent,XML::Simple perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -121,6 +120,8 @@ From the NE at 9 MPH Gusting to 22 MPH Conditions: Overcast
|
||||
This module requires LWP::UserAgent and XML::Simple. Both are
|
||||
obtainable from CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a6+.
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
|
||||
=back
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
Reference in new issue
Block a user