Skip to content

Instantly share code, notes, and snippets.

@zachwalton
Created February 4, 2016 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachwalton/699391cd1cdc5bac76bc to your computer and use it in GitHub Desktop.
Save zachwalton/699391cd1cdc5bac76bc to your computer and use it in GitHub Desktop.
convert dropbox urls to raw
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = '0.0.1';
%IRSSI = (
authors => '',
contact => '',
name => 'fix_dropbox',
description => 'unfuck dropbox urls',
license => '',
url => '',
);
sub event_send_text () {
my ($line, $server_rec, $wi_item_rec) = @_;
if ($line =~ /(https:\/\/www.dropbox.com\/s\/(.(?!(raw=1)))+)[\s\n]?$/) {
my $url = (split / /, $1)[0];
$line =~ s/(\Q$url\E)/$1&raw=1/;
}
else {
return;
}
Irssi::signal_emit('send text', $line, $server_rec, $wi_item_rec);
Irssi::signal_stop();
}
Irssi::signal_add_first('send text', "event_send_text");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment