… | |
… | |
38 | if (my $pid = open my $fh, "|-:utf8", $self->{store_cmd}) { |
38 | if (my $pid = open my $fh, "|-:utf8", $self->{store_cmd}) { |
39 | fcntl $fh, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK; |
39 | fcntl $fh, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK; |
40 | $self->{iow} = urxvt::iow |
40 | $self->{iow} = urxvt::iow |
41 | ->new |
41 | ->new |
42 | ->fd (fileno $fh) |
42 | ->fd (fileno $fh) |
43 | ->events (urxvt::EVENT_WRITE) |
43 | ->events (urxvt::EV_WRITE) |
44 | ->start |
44 | ->start |
45 | ->cb (sub { |
45 | ->cb (sub { |
46 | if (my $len = syswrite $fh, $txt) { |
46 | if (my $len = syswrite $fh, $txt) { |
47 | substr $txt, 0, $len, ""; |
47 | substr $txt, 0, $len, ""; |
48 | $self->msg ((length $txt) . " chars to go..."); |
48 | $self->msg ((length $txt) . " chars to go..."); |
… | |
… | |
63 | if (my $pid = open my $fh, "-|:utf8", $self->{fetch_cmd}) { |
63 | if (my $pid = open my $fh, "-|:utf8", $self->{fetch_cmd}) { |
64 | fcntl $fh, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK; |
64 | fcntl $fh, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK; |
65 | $self->{iow} = urxvt::iow |
65 | $self->{iow} = urxvt::iow |
66 | ->new |
66 | ->new |
67 | ->fd (fileno $fh) |
67 | ->fd (fileno $fh) |
68 | ->events (urxvt::EVENT_READ) |
68 | ->events (urxvt::EV_READ) |
69 | ->start |
69 | ->start |
70 | ->cb (sub { |
70 | ->cb (sub { |
71 | if (my $len = sysread $fh, $txt, 8192, length $txt) { |
71 | if (my $len = sysread $fh, $txt, 8192, length $txt) { |
72 | $self->msg ((length $txt) . " chars read..."); |
72 | $self->msg ((length $txt) . " chars read..."); |
73 | } else { |
73 | } else { |
… | |
… | |
98 | }; |
98 | }; |
99 | |
99 | |
100 | () |
100 | () |
101 | } |
101 | } |
102 | |
102 | |
103 | sub on_user_command { |
|
|
104 | my ($self, $cmd) = @_; |
|
|
105 | |
103 | |
106 | if ($cmd eq "selection-pastebin:remote-pastebin") { |
|
|
107 | $self->upload_paste; |
|
|
108 | } |
|
|
109 | |
|
|
110 | () |
|
|
111 | } |
|
|
112 | |
|
|