… | |
… | |
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 | |
… | |
… | |
67 | }; |
70 | }; |
68 | |
71 | |
69 | () |
72 | () |
70 | } |
73 | } |
71 | |
74 | |
72 | sub on_keyboard_command { |
75 | sub 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 | } |