ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/selection-pastebin
(Generate patch)

Comparing rxvt-unicode/src/perl/selection-pastebin (file contents):
Revision 1.14 by root, Wed Jan 25 14:53:14 2006 UTC vs.
Revision 1.17 by sf-exg, Sat Nov 19 17:40:48 2011 UTC

4 my ($self) = @_; 4 my ($self) = @_;
5 5
6 require Digest::MD5; 6 require Digest::MD5;
7 7
8 my $txt = $self->selection; 8 my $txt = $self->selection;
9
10 my $filename = $txt;
11 utf8::encode $filename;
9 my $filename = Digest::MD5::md5_hex ($txt) . ".txt"; 12 $filename = Digest::MD5::md5_hex ($filename) . ".txt";
10 13
11 my $tmpfile = "/tmp/$filename"; 14 my $tmpfile = "/tmp/$filename";
12 15
13 my $msg = "uploaded as $filename"; 16 my $msg = "uploaded as $filename";
14 17
21 } 24 }
22 25
23 my $cmd = $self->{pastebin_cmd}; 26 my $cmd = $self->{pastebin_cmd};
24 $cmd =~ s/%/$tmpfile/; 27 $cmd =~ s/%/$tmpfile/;
25 28
26 my $pid = $self->exec_async ("/bin/sh", "-c", $cmd); 29 my $pid = $self->exec_async ($cmd);
27 30
28 $self->{pw} = urxvt::pw->new->start ($pid)->cb (sub { 31 $self->{pw} = urxvt::pw->new->start ($pid)->cb (sub {
29 my (undef, $status) = @_; 32 my (undef, $status) = @_;
30 33
31 delete $self->{pw}; 34 delete $self->{pw};
67 }; 70 };
68 71
69 () 72 ()
70} 73}
71 74
72sub on_keyboard_command { 75sub on_user_command {
73 my ($self, $cmd) = @_; 76 my ($self, $cmd) = @_;
74 77
75 if ($cmd eq "selection-pastebin:remote-pastebin") { 78 if ($cmd eq "selection-pastebin:remote-pastebin") {
76 $self->upload_paste; 79 $self->upload_paste;
77 } 80 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines