scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

shorturl.pl (612B)


      1 # weechat script for url shorting
      2 # Needed: WWW::Shorten::TinyURL
      3 use strict;
      4 use WWW::Shorten::TinyURL;
      5 use Clipboard;
      6 
      7 weechat::register("shorten", "cipher <haris\@2f30.org", "0.1", "Public Domain",
      8                   "Short url", "", "");
      9 weechat::hook_command("shorten", "Press \"/shorten\" to output on the channel/buffer the url from clipboard in shortened form", "", "", "", "shorten", "");
     10 
     11 sub shorten {
     12   my $external = Clipboard->paste;
     13   my ($data, $buffer, $args) = @_;
     14   my $short_url = makeashorterlink($external);
     15   weechat::command($buffer, "url: $short_url");
     16   return weechat::WEECHAT_RC_OK;
     17 }