--- rxvt-unicode/src/perl/selection-pastebin 2006/01/25 15:33:43 1.15 +++ rxvt-unicode/src/perl/selection-pastebin 2012/06/10 13:58:06 1.19 @@ -1,12 +1,18 @@ #! perl +#:META:X_RESOURCE:%.cmd:string:the command to run create a new pastebin +#:META:X_RESOURCE:%.url:string:the url template for new pastebins + sub upload_paste { my ($self) = @_; require Digest::MD5; my $txt = $self->selection; - my $filename = Digest::MD5::md5_hex ($txt) . ".txt"; + + my $filename = $txt; + utf8::encode $filename; + $filename = Digest::MD5::md5_hex ($filename) . ".txt"; my $tmpfile = "/tmp/$filename"; @@ -23,7 +29,7 @@ my $cmd = $self->{pastebin_cmd}; $cmd =~ s/%/$tmpfile/; - my $pid = $self->exec_async ("/bin/sh", "-c", $cmd); + my $pid = $self->exec_async ($cmd); $self->{pw} = urxvt::pw->new->start ($pid)->cb (sub { my (undef, $status) = @_; @@ -56,10 +62,10 @@ sub on_start { my ($self) = @_; - $self->{pastebin_cmd} = $self->x_resource ("selection-pastebin.cmd") + $self->{pastebin_cmd} = $self->x_resource ("%.cmd") || "rcp -p % ruth:/var/www/www.ta-sa.org/files/txt/"; - $self->{pastebin_url} = $self->x_resource ("selection-pastebin.url") + $self->{pastebin_url} = $self->x_resource ("%.url") || "http://www.ta-sa.org/files/txt/%"; push @{ $self->{term}{selection_popup_hook} }, sub {