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.4 by elmex, Tue Jan 17 17:04:18 2006 UTC vs.
Revision 1.5 by root, Wed Jan 18 10:11:03 2006 UTC

1#! perl 1#! perl
2 2
3my $timers = {}; 3my $timers = {};
4my $pastebin_cmd; 4my $pastebin_cmd;
5my $pastebin_url; 5my $pastebin_url;
6
7sub on_start {
8 my ($self) = @_;
9 $pastebin_cmd =
10 $self->x_resource ("selection-pastebin.cmd")
11 or "scp -p % ruth:/var/www/www.ta-sa.org/files/txt/";
12
13 $pastebin_url =
14 $self->x_resource ("selection-pastebin.url")
15 or "http://www.ta-sa.org/files/txt/";
16
17 ()
18}
19 6
20sub upload_paste { 7sub upload_paste {
21 my ($self) = @_; 8 my ($self) = @_;
22 9
23 require Digest::MD5; 10 require Digest::MD5;
59 ->start ((int urxvt::NOW) + 5) # make sure we update "on" the second 46 ->start ((int urxvt::NOW) + 5) # make sure we update "on" the second
60 ->interval (1) 47 ->interval (1)
61 ->cb (sub { delete $timers->{ov}; delete $timers->{t1}; }); 48 ->cb (sub { delete $timers->{ov}; delete $timers->{t1}; });
62} 49}
63 50
64sub on_keyboard_command { 51sub on_start {
65 my ($self, $cmd) = @_; 52 my ($self) = @_;
53 $pastebin_cmd = $self->x_resource ("selection-pastebin.cmd")
54 || "scp -p % ruth:/var/www/www.ta-sa.org/files/txt/";
66 55
67 $cmd eq "selection-pastebin:remote-pastebin" 56 $pastebin_url = $self->x_resource ("selection-pastebin.url")
68 and upload_paste ($self); 57 || "http://www.ta-sa.org/files/txt/%";
58
59 push @urxvt::ext::selection_popup::hook, sub {
60 ("pastebin upload" => sub { $self->upload_paste })
61 };
69 62
70 () 63 ()
71} 64}
72 65
66sub on_keyboard_command {
67 my ($self, $cmd) = @_;
68
69 if ($cmd eq "selection-pastebin:remote-pastebin") {
70 $self->upload_paste;
71 }
72
73 ()
74}
75

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines