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

+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;
}