Revert "Getting rid of tabs."

This reverts commit cc1c8fd5bc.
Failed.
This commit is contained in:
Elijah Perrault committed 2011-02-20 20:47:09 -07:00
1 parent cc1c8fd5bc
commit 92c9a64793
20 files changed
+1277 -1279

No files matched your search

+8 -8
View File
@@ -12,12 +12,12 @@ use API::IRC qw(privmsg notice kick ban);
sub _init
{
# Check for required configuration values.
ssssif (!conf_get('badwords')) {
ssss err(2, 'Please verify that you have a badwords block with word entries defined in your configuration file.', 0);
ssss return;
ssss}
if (!conf_get('badwords')) {
err(2, 'Please verify that you have a badwords block with word entries defined in your configuration file.', 0);
return;
}
# Create the act_on_badword hook.
sssshook_add('on_cprivmsg', 'act_on_badword', \&M::Badwords::actonbadword) or return;
hook_add('on_cprivmsg', 'act_on_badword', \&M::Badwords::actonbadword) or return;
# Success.
return 1;
@@ -27,16 +27,16 @@ sssshook_add('on_cprivmsg', 'act_on_badword', \&M::Badwords::actonbadword) or re
sub _void
{
# Delete the act_on_badword hook.
sssshook_del('act_on_badword') or return 0;
hook_del('act_on_badword') or return 0;
# Success.
ssssreturn 1;
return 1;
}
# Callback for act_on_badword hook.
sub actonbadword
{
ssssmy (($src, $chan, @msg)) = @_;
my (($src, $chan, @msg)) = @_;
my $msg = join ' ', @msg;
+27 -27
View File
@@ -13,13 +13,13 @@ use URI::Escape;
sub _init
{
# Check for required configuration values.
ssssif (!(conf_get('bitly:user'))[0][0] or !(conf_get('bitly:key'))[0][0]) {
ssss err(2, "Please verify that you have bitly_user and bitly_key defined in your configuration file.", 0);
ssss return 0;
ssss}
if (!(conf_get('bitly:user'))[0][0] or !(conf_get('bitly:key'))[0][0]) {
err(2, "Please verify that you have bitly_user and bitly_key defined in your configuration file.", 0);
return 0;
}
# Create the SHORTEN and REVERSE commands.
sssscmd_add("SHORTEN", 0, 0, \%M::Bitly::HELP_SHORTEN, \&M::Bitly::shorten) or return 0;
sssscmd_add("REVERSE", 0, 0, \%M::Bitly::HELP_REVERSE, \&M::Bitly::reverse) or return 0;
cmd_add("SHORTEN", 0, 0, \%M::Bitly::HELP_SHORTEN, \&M::Bitly::shorten) or return 0;
cmd_add("REVERSE", 0, 0, \%M::Bitly::HELP_REVERSE, \&M::Bitly::reverse) or return 0;
# Success.
return 1;
@@ -29,11 +29,11 @@ sssscmd_add("REVERSE", 0, 0, \%M::Bitly::HELP_REVERSE, \&M::Bitly::reverse) or r
sub _void
{
# Delete the SHORTEN and REVERSE commands.
sssscmd_del("SHORTEN") or return 0;
sssscmd_del("REVERSE") or return 0;
cmd_del("SHORTEN") or return 0;
cmd_del("REVERSE") or return 0;
# Success.
ssssreturn 1;
return 1;
}
# Help hashes.
@@ -47,37 +47,37 @@ our %HELP_REVERSE = (
# Callback for SHORTEN command.
sub shorten
{
ssssmy ($src, @args) = @_;
my ($src, @args) = @_;
# Create an instance of LWP::UserAgent.
ssssmy $ua = LWP::UserAgent->new();
ssss$ua->agent('Auto IRC Bot');
ssss$ua->timeout(2);
my $ua = LWP::UserAgent->new();
$ua->agent('Auto IRC Bot');
$ua->timeout(2);
# Put together the call to the Bit.ly API.
if (!defined $args[0]) {
notice($src->{svr}, $src->{nick}, trans("Not enough parameters").".");
return 0;
}
ssssmy ($surl, $user, $key) = ($args[0], (conf_get('bitly:user'))[0][0], (conf_get('bitly:key'))[0][0]);
my ($surl, $user, $key) = ($args[0], (conf_get('bitly:user'))[0][0], (conf_get('bitly:key'))[0][0]);
$surl = uri_escape($surl);
ssssmy $url = "http://api.bit.ly/v3/shorten?version=3.0.1&longUrl=".$surl."&apiKey=".$key."&login=".$user."&format=txt";
my $url = "http://api.bit.ly/v3/shorten?version=3.0.1&longUrl=".$surl."&apiKey=".$key."&login=".$user."&format=txt";
# Get the response via HTTP.
my $response = $ua->get($url);
ssssif ($response->is_success) {
if ($response->is_success) {
# If successful, decode the content.
my $d = $response->decoded_content;
ssss chomp $d;
chomp $d;
# And send to channel.
ssss privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
ssss}
privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
}
else {
# Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "An error occurred while shortening your URL.");
}
ssssreturn 1;
return 1;
}
# Callback for REVERSE command.
@@ -104,16 +104,16 @@ sub reverse
if ($response->is_success) {
# If successful, decode the content.
my $d = $response->decoded_content;
ssss chomp $d;
chomp $d;
# And send it to channel.
ssss privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
ssss}
sssselse {
privmsg($src->{svr}, $src->{chan}, "URL: ".$d);
}
else {
# Otherwise, send an error message.
ssss privmsg($src->{svr}, $src->{chan}, "An error occurred while reversing your URL.");
ssss}
privmsg($src->{svr}, $src->{chan}, "An error occurred while reversing your URL.");
}
ssssreturn 1;
return 1;
}
+36 -36
View File
@@ -13,68 +13,68 @@ use JSON -support_by_pp;
# Initialization subroutine.
sub _init
{
ssss# Create the CALC command.
sssscmd_add("CALC", 0, 0, \%M::Calc::HELP_CALC, \&M::Calc::calc) or return 0;
# Create the CALC command.
cmd_add("CALC", 0, 0, \%M::Calc::HELP_CALC, \&M::Calc::calc) or return 0;
ssss# Success.
ssssreturn 1;
# Success.
return 1;
}
# Void subroutine.
sub _void
{
ssss# Delete the CALC command.
sssscmd_del("CALC") or return 0;
# Delete the CALC command.
cmd_del("CALC") or return 0;
ssss# Success.
ssssreturn 1;
# Success.
return 1;
}
# Help hash.
our %FHELP_CALC = (
ssss'en' => "This command will calculate an expression using Google Calculator. \002Syntax:\002 CALC <expression>",
'en' => "This command will calculate an expression using Google Calculator. \002Syntax:\002 CALC <expression>",
);
# Callback for CALC command.
sub calc
{
ssssmy ($src, @args) = @_;
my ($src, @args) = @_;
ssss# Create an instance of LWP::UserAgent.
ssssmy $ua = LWP::UserAgent->new();
ssss$ua->agent('Auto IRC Bot');
ssss$ua->timeout(2);
ssss# Create an instance of JSON.
ssssmy $json = JSON->new();
ssss# Put together the call to the Google Calculator API.
# Create an instance of LWP::UserAgent.
my $ua = LWP::UserAgent->new();
$ua->agent('Auto IRC Bot');
$ua->timeout(2);
# Create an instance of JSON.
my $json = JSON->new();
# Put together the call to the Google Calculator API.
if (!defined $args[0]) {
notice($src->{svr}, $src->{nick}, trans("Not enough parameters").".");
return 0;
}
my $expr = join(' ', @args);
ssssmy $url = "http://www.google.com/ig/calculator?q=".uri_escape($expr);
ssss# Get the response via HTTP.
ssssmy $response = $ua->get($url);
my $url = "http://www.google.com/ig/calculator?q=".uri_escape($expr);
# Get the response via HTTP.
my $response = $ua->get($url);
ssssif ($response->is_success) {
ssss # If successful, decode the content.
ssss my $d = $json->allow_nonref->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($response->decoded_content);
if ($response->is_success) {
# If successful, decode the content.
my $d = $json->allow_nonref->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($response->decoded_content);
ssss if ($d->{error} eq "" or $d->{error} == 0) {
ssss # And send to channel
if ($d->{error} eq "" or $d->{error} == 0) {
# And send to channel
privmsg($src->{svr}, $src->{chan}, "Result: ".$d->{lhs}." = ".$d->{rhs});
ssss }
ssss else {
ssss # Otherwise, send an error message.
ssss privmsg($src->{svr}, $src->{chan}, "Google Calculator sent an error.");
ssss }
ssss}
sssselse {
ssss # Otherwise, send an error message.
ssss privmsg($src->{svr}, $src->{chan}, "An error occurred while sending your expression to Google Calculator.");
ssss}
}
else {
# Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "Google Calculator sent an error.");
}
}
else {
# Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "An error occurred while sending your expression to Google Calculator.");
}
ssssreturn 1;
return 1;
}
# Start initialization.
+8 -8
View File
@@ -13,8 +13,8 @@ our $ANSWER = 0;
sub _init
{
# Create the 8BALL and RIGBALL commands.
sssscmd_add('8BALL', 0, 0, \%M::EightBall::HELP_8BALL, \&M::EightBall::c_8ball) or return 0;
sssscmd_add('RIGBALL', 1, 'cmd.rigball', \%M::EightBall::HELP_RIGBALL, \&M::EightBall::rigball) or return 0;
cmd_add('8BALL', 0, 0, \%M::EightBall::HELP_8BALL, \&M::EightBall::c_8ball) or return 0;
cmd_add('RIGBALL', 1, 'cmd.rigball', \%M::EightBall::HELP_RIGBALL, \&M::EightBall::rigball) or return 0;
# Success.
return 1;
@@ -24,11 +24,11 @@ sssscmd_add('RIGBALL', 1, 'cmd.rigball', \%M::EightBall::HELP_RIGBALL, \&M::Eigh
sub _void
{
# Delete the 8BALL and RIGBALL commands.
sssscmd_del('8BALL') or return 0;
sssscmd_del('RIGBALL') or return 0;
cmd_del('8BALL') or return 0;
cmd_del('RIGBALL') or return 0;
# Success.
ssssreturn 1;
return 1;
}
# Help hashes.
@@ -42,7 +42,7 @@ our %HELP_RIGBALL = (
# Callback for 8BALL command.
sub c_8ball
{
ssssmy ($src, @argv) = @_;
my ($src, @argv) = @_;
if (!defined $argv[0]) {
notice($src->{svr}, $src->{nick}, trans("Not enough parameters").".");
@@ -77,7 +77,7 @@ ssssmy ($src, @argv) = @_;
privmsg($src->{svr}, $src->{chan}, "\002Answer:\002 ".$a);
ssssreturn 1;
return 1;
}
# Callback for RIGBALL command.
@@ -94,7 +94,7 @@ sub rigball
$ANSWER = join(" ", @argv);
privmsg($src->{svr}, $src->{nick}, "Answer set to: ".$ANSWER);
ssssreturn 1;
return 1;
}
+12 -12
View File
@@ -12,7 +12,7 @@ use LWP::UserAgent;
sub _init
{
# Create the FML command.
sssscmd_add('FML', 0, 0, \%M::FML::HELP_FML, \&M::FML::fml) or return 0;
cmd_add('FML', 0, 0, \%M::FML::HELP_FML, \&M::FML::fml) or return 0;
# Success.
return 1;
@@ -22,10 +22,10 @@ sssscmd_add('FML', 0, 0, \%M::FML::HELP_FML, \&M::FML::fml) or return 0;
sub _void
{
# Delete the FML command.
sssscmd_del('FML') or return 0;
cmd_del('FML') or return 0;
# Success.
ssssreturn 1;
return 1;
}
# Help hash.
@@ -36,34 +36,34 @@ our %HELP_FML = (
# Callback for FML command.
sub fml
{
ssssmy ($src, undef) = @_;
my ($src, undef) = @_;
# Create an instance of LWP::UserAgent.
ssssmy $ua = LWP::UserAgent->new();
ssss$ua->agent('Auto IRC Bot');
ssss$ua->timeout(2);
my $ua = LWP::UserAgent->new();
$ua->agent('Auto IRC Bot');
$ua->timeout(2);
# Get the random FML via HTTP.
my $rp = $ua->get('http://rscript.org/lookup.php?type=fml');
ssssif ($rp->is_success) {
if ($rp->is_success) {
# If successful, decode the content.
my $d = $rp->decoded_content;
ssss $d =~ s/(\n|\r)//g;
$d =~ s/(\n|\r)//g;
# Get the FML.
my (undef, $dfa) = split('Text: ', $d);
my ($fml, undef) = split('Agree:', $dfa);
# And send to channel.
ssss privmsg($src->{svr}, $src->{chan}, "\002Random FML:\002 ".$fml);
ssss}
privmsg($src->{svr}, $src->{chan}, "\002Random FML:\002 ".$fml);
}
else {
# Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "An error occurred while retrieving the FML.");
}
ssssreturn 1;
return 1;
}
# Start initialization.
+12 -12
View File
@@ -10,28 +10,28 @@ use API::IRC qw(privmsg);
# Initialization subroutine.
sub _init
{
ssss# Add a hook for when we join a channel.
sssshook_add("on_ucjoin", "HelloChan", \&M::HelloChan::hello) or return 0;
ssssreturn 1;
# Add a hook for when we join a channel.
hook_add("on_ucjoin", "HelloChan", \&M::HelloChan::hello) or return 0;
return 1;
}
# Void subroutine.
sub _void
{
ssss# Delete the hook.
sssshook_del("on_ucjoin", "HelloChan") or return 0;
ssssreturn 1;
# Delete the hook.
hook_del("on_ucjoin", "HelloChan") or return 0;
return 1;
}
# Main subroutine.
sub hello
{
ssssmy (($svr, $chan)) = @_;
ssss
ssss# Send a PRIVMSG.
ssssprivmsg($svr, $chan, "Hello channel! I am a bot!");
ssss
ssssreturn 1;
my (($svr, $chan)) = @_;
# Send a PRIVMSG.
privmsg($svr, $chan, "Hello channel! I am a bot!");
return 1;
}
+35 -35
View File
@@ -11,61 +11,61 @@ use LWP::UserAgent;
# Initialization subroutine.
sub _init
{
ssss# Create the ISITUP command.
sssscmd_add('ISITUP', 0, 0, \%M::IsItUp::HELP_ISITUP, \&M::IsItUp::check) or return 0;
# Create the ISITUP command.
cmd_add('ISITUP', 0, 0, \%M::IsItUp::HELP_ISITUP, \&M::IsItUp::check) or return 0;
ssss# Success.
ssssreturn 1;
# Success.
return 1;
}
# Void subroutine.
sub _void
{
ssss# Delete the ISITUP command.
sssscmd_del('ISITUP') or return 0;
# Delete the ISITUP command.
cmd_del('ISITUP') or return 0;
ssss# Success.
ssssreturn 1;
# Success.
return 1;
}
# Help hashes.
our %HELP_ISITUP = (
ssss'en' => "This command will check if a website appears up or down to the bot. \002Syntax:\002 ISITUP <url>",
'en' => "This command will check if a website appears up or down to the bot. \002Syntax:\002 ISITUP <url>",
);
# Callback for ISITUP command.
sub check
{
ssssmy ($src, @argv) = @_;
my ($src, @argv) = @_;
ssss# Create an instance of LWP::UserAgent.
ssssmy $ua = LWP::UserAgent->new();
ssss$ua->agent('Auto IRC Bot');
ssss$ua->timeout(2);
ssss# Do we have enough parameters?
ssssif (!defined $argv[0]) {
ssss notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
ssss return 0;
ssss}
ssssmy $curl = $argv[0];
ssss# Does the URL start with http(s)?
ssssif ($curl !~ m/^http/) {
ssss $curl = 'http://'.$curl;
ssss}
# Create an instance of LWP::UserAgent.
my $ua = LWP::UserAgent->new();
$ua->agent('Auto IRC Bot');
$ua->timeout(2);
# Do we have enough parameters?
if (!defined $argv[0]) {
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
return 0;
}
my $curl = $argv[0];
# Does the URL start with http(s)?
if ($curl !~ m/^http/) {
$curl = 'http://'.$curl;
}
ssss# Get the response via HTTP.
ssssmy $response = $ua->get($curl);
# Get the response via HTTP.
my $response = $ua->get($curl);
ssssif ($response->is_success) {
ssss # If successful, it's up.
ssss privmsg($src->{svr}, $src->{chan}, $curl.' appears to be up from here.');
ssss}
sssselse {
ssss # Otherwise, it's down.
ssss privmsg($src->{svr}, $src->{chan}, $curl.' appears to be down from here.');
ssss}
if ($response->is_success) {
# If successful, it's up.
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be up from here.');
}
else {
# Otherwise, it's down.
privmsg($src->{svr}, $src->{chan}, $curl.' appears to be down from here.');
}
ssssreturn 1;
return 1;
}
# Start initialization.
+9 -9
View File
@@ -13,9 +13,9 @@ use API::IRC qw(privmsg);
# Initialization subroutine.
sub _init
{
ssss# Check if this Auto was built with SASL support.
sssserr(2, "Auto was not built with SASL support. Aborting SASLAuth.", 0) and return 0 if $Auto::ENFEAT !~ /sasl/;
ssss# Add a hook for before we connect.
# Check if this Auto was built with SASL support.
err(2, "Auto was not built with SASL support. Aborting SASLAuth.", 0) and return 0 if $Auto::ENFEAT !~ /sasl/;
# Add a hook for before we connect.
hook_add('on_preconnect', 'CAP', sub { my ($srv) = @_; Auto::socksnd($srv, 'CAP LS'); }
) or return 0;
# Hook for parsing CAP.
@@ -26,19 +26,19 @@ ssss# Add a hook for before we connect.
rchook_add('904', \&M::SASLAuth::handle_904) or return 0;
# Hook for parsing 906.
rchook_add('906', \&M::SASLAuth::handle_906) or return 0;
ssssreturn 1;
return 1;
}
# Void subroutine.
sub _void
{
ssss# Delete the hooks.
sssshook_del("on_preconnect", "CAP") or return 0;
# Delete the hooks.
hook_del("on_preconnect", "CAP") or return 0;
rchook_del('CAP');
rchook_del('903');
rchook_del('904');
rchook_del('906');
ssssreturn 1;
return 1;
}
sub handle_cap {
@@ -123,8 +123,8 @@ sub handle_904
# SASL authentication aborted.
sub handle_906
{
ssssmy ($svr, undef) = @_;
ssssAuto::socksnd($svr, 'CAP END');
my ($svr, undef) = @_;
Auto::socksnd($svr, 'CAP END');
timer_del('auth_timeout');
awarn(2, "SASL authentication aborted!");
}
+44 -44
View File
@@ -12,69 +12,69 @@ use XML::Simple;
# Initialization subroutine.
sub _init
{
ssss# Create the Weather command.
sssscmd_add("WEATHER", 0, 0, \%M::Weather::HELP_WEATHER, \&M::Weather::weather) or return 0;
# Create the Weather command.
cmd_add("WEATHER", 0, 0, \%M::Weather::HELP_WEATHER, \&M::Weather::weather) or return 0;
ssss# Success.
ssssreturn 1;
# Success.
return 1;
}
# Void subroutine.
sub _void
{
ssss# Delete the Weather command.
sssscmd_del("WEATHER") or return 0;
# Delete the Weather command.
cmd_del("WEATHER") or return 0;
ssss# Success.
ssssreturn 1;
# Success.
return 1;
}
# Help hashes.
our %HELP_WEATHER = (
ssss'en' => "This command will retrieve the weather via Wunderground for the specified location. \002Syntax:\002 WEATHER <location>",
'en' => "This command will retrieve the weather via Wunderground for the specified location. \002Syntax:\002 WEATHER <location>",
);
# Callback for Weather command.
sub weather
{
ssssmy ($src, @args) = @_;
my ($src, @args) = @_;
ssss# Create an instance of LWP::UserAgent.
ssssmy $ua = LWP::UserAgent->new();
ssss$ua->agent('Auto IRC Bot');
ssss$ua->timeout(2);
ssss# Put together the call to the Wunderground API.
ssssif (!defined $args[0]) {
ssss notice($src->{svr}, $src->{nick}, trans("Not enough parameters").".");
ssss return 0;
ssss}
ssssmy $loc = join(' ', @args);
ssss$loc =~ s/ /%20/g;
ssssmy $url = "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=".$loc;
ssss# Get the response via HTTP.
ssssmy $response = $ua->get($url);
# Create an instance of LWP::UserAgent.
my $ua = LWP::UserAgent->new();
$ua->agent('Auto IRC Bot');
$ua->timeout(2);
# Put together the call to the Wunderground API.
if (!defined $args[0]) {
notice($src->{svr}, $src->{nick}, trans("Not enough parameters").".");
return 0;
}
my $loc = join(' ', @args);
$loc =~ s/ /%20/g;
my $url = "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=".$loc;
# Get the response via HTTP.
my $response = $ua->get($url);
ssssif ($response->is_success) {
ssss# If successful, decode the content.
ssss my $d = XMLin($response->decoded_content);
ssss# And send to channel
ssss if (!ref($d->{observation_location}->{country})) {
ssss my $windc = $d->{wind_string};
ssss if (substr($windc, length($windc) - 1, 1) eq " ") { $windc = substr($windc, 0, length($windc) - 1); }
ssss privmsg($src->{svr}, $src->{chan}, "Results for \2".$d->{observation_location}->{full}."\2 - \2Temperature:\2 ".$d->{temperature_string}." \2Wind Conditions:\2 ".$windc." \2Conditions:\2 ".$d->{weather});
ssss privmsg($src->{svr}, $src->{chan}, "\2Heat index:\2 ".$d->{heat_index_string}." \2Humidity:\2 ".$d->{relative_humidity}." \2Pressure:\2 ".$d->{pressure_string}." - ".$d->{observation_time});
ssss }
ssss else {
ssss # Otherwise, send an error message.
ssss privmsg($src->{svr}, $src->{chan}, "Location not found.");
ssss }
ssss}
sssselse {
ssss# Otherwise, send an error message.
ssss privmsg($src->{svr}, $src->{chan}, "An error occurred while retrieving your weather.");
ssss}
if ($response->is_success) {
# If successful, decode the content.
my $d = XMLin($response->decoded_content);
# And send to channel
if (!ref($d->{observation_location}->{country})) {
my $windc = $d->{wind_string};
if (substr($windc, length($windc) - 1, 1) eq " ") { $windc = substr($windc, 0, length($windc) - 1); }
privmsg($src->{svr}, $src->{chan}, "Results for \2".$d->{observation_location}->{full}."\2 - \2Temperature:\2 ".$d->{temperature_string}." \2Wind Conditions:\2 ".$windc." \2Conditions:\2 ".$d->{weather});
privmsg($src->{svr}, $src->{chan}, "\2Heat index:\2 ".$d->{heat_index_string}." \2Humidity:\2 ".$d->{relative_humidity}." \2Pressure:\2 ".$d->{pressure_string}." - ".$d->{observation_time});
}
else {
# Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "Location not found.");
}
}
else {
# Otherwise, send an error message.
privmsg($src->{svr}, $src->{chan}, "An error occurred while retrieving your weather.");
}
ssssreturn 1;
return 1;
}
# Start initialization.