diff options
author | Tom Feist <shabble@cowu.be> | 2010-07-09 22:01:59 +0000 |
---|---|---|
committer | Tom Feist <shabble@cowu.be> | 2010-07-09 22:01:59 +0000 |
commit | 18e61f4d15f1c6c5058cba6a69caf88114327b0d (patch) | |
tree | 65306f39160c357c008f4ea0b34ef67054118505 /scrolled-reminder/scrolled-reminder.pl | |
parent | initial podifying of irssi docs (diff) | |
download | irssi-scripts-18e61f4d15f1c6c5058cba6a69caf88114327b0d.tar.gz irssi-scripts-18e61f4d15f1c6c5058cba6a69caf88114327b0d.zip |
added history_search and scrolled-reminder as work in progress
Diffstat (limited to 'scrolled-reminder/scrolled-reminder.pl')
-rw-r--r-- | scrolled-reminder/scrolled-reminder.pl | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/scrolled-reminder/scrolled-reminder.pl b/scrolled-reminder/scrolled-reminder.pl new file mode 100644 index 0000000..e2775dc --- /dev/null +++ b/scrolled-reminder/scrolled-reminder.pl @@ -0,0 +1,65 @@ +use strict; +use warnings; + +use Irssi; +use Irssi::TextUI; +use Irssi::Irc; + +use Data::Dumper; + +our $VERSION = '0.01'; +our %IRSSI = ( + authors => 'Tom Feist', + contact => 'shabble@cowu.be', + name => 'scrolled-reminder', + description => 'Requires confirmation to messages sent' + . 'when the current window is scrolled up', + + license => 'WTFPL; http://sam.zoy.org/wtfpl/', + url => 'http://metavore.org/', + ); + + +sub handle_send_text { + my ($text, $server_tag, $win_item) = @_; + unless ($win_item) { + # not all windows have window-items (eg: status window) + return; + } + + my $window = $win_item->window; + my $view = $window->view; + + if ($view->{bottom} != 1) { + # we're scrolled up. + unless (require_confirmation($window)) { + Irssi::signal_stop; + } + } +} + +sub handle_keypress { + my ($key) = @_; + Irssi::print("key pressed: " . $key); + if ($key == 3) { # Ctrl-c + } elsif ($key == 11) { # Ctrl-k + } else { + } + Irssi::signal_remove('gui key pressed', 'handle_keypress'); +} + +sub require_confirmation { + my ($window) = @_; + Irssi::signal_add_first('gui key pressed', 'handle_keypress'); + $window->print("You are scrolled up Really send?"); + write_to_prompt($window, 'Press Ctrl-K to confirm, Ctrl-C to cancel '); +} + +sub write_to_prompt { + my ($window, $msg) = @_; + #$window->command("insert_text $msg"); + +} + +Irssi::signal_add_first('send text', 'handle_send_text'); + |