Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use warnings;
- use LWP::Simple;
- use Xchat ':all';
- use subs qw/true false/;
- Xchat::hook_command('shorten', 'decide');
- my $show = false;
- sub decide {
- if ((split(/ /, $_[1][1]))[0] eq "set") {
- if ($show == true) {
- $show = false;
- Xchat::print("Show.....: OFF");
- } else {
- $show = true;
- Xchat::print("Show.....: ON");
- }
- } else {
- get_url($_);
- }
- }
- sub get_url {
- my $url = $_[1][1];
- my $miniurl = get("http://is.gd/create.php?format=simple&url=" . $url);
- my $page = "NIL"; $page = get($url);
- $page =~ /\<title\>(.+?)\<\/title>/;
- if ($1 && $show == true) {
- Xchat::command("SAY $miniurl #{" . decode_entities($1) . "}");
- } else {
- Xchat::command("SAY $miniurl");
- }
- }
- sub true {
- return 1;
- }
- sub false {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement