aboutsummaryrefslogtreecommitdiffstats
path: root/feature-tests/local_input_capture.pl
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-01-12 00:10:16 +0000
committerTom Feist <shabble@metavore.org>2011-01-12 00:10:16 +0000
commitd285e7854dfc62c213bec4c101eaf080fa81ac46 (patch)
tree6bd9a64ea281dcc40259aa391fc41f2e9ea91258 /feature-tests/local_input_capture.pl
parentsome dirty hacks to make the package appear as an internal module, LeoNerd++ (diff)
downloadirssi-scripts-d285e7854dfc62c213bec4c101eaf080fa81ac46.tar.gz
irssi-scripts-d285e7854dfc62c213bec4c101eaf080fa81ac46.zip
pipes: added an example feature test on how to use pipes for non-blocking
IO. Hope to expand it to include network IO at some point.
Diffstat (limited to '')
-rw-r--r--feature-tests/local_input_capture.pl50
1 files changed, 50 insertions, 0 deletions
diff --git a/feature-tests/local_input_capture.pl b/feature-tests/local_input_capture.pl
new file mode 100644
index 0000000..847ff07
--- /dev/null
+++ b/feature-tests/local_input_capture.pl
@@ -0,0 +1,50 @@
+use strict;
+use warnings;
+
+
+use Irssi;
+use Irssi::Irc;
+use Irssi::TextUI;
+
+use Data::Dumper;
+
+
+our $VERSION = '0.1';
+our %IRSSI = (
+ authors => 'shabble',
+ contact => 'shabble+irssi@metavore.org',
+ name => '',
+ description => '',
+ license => 'Public Domain',
+ );
+
+my $buffer = '';
+init();
+
+sub init {
+
+ Irssi::signal_add_first 'print text', 'sig_print_text';
+ Irssi::command 'echo Hello there';
+ Irssi::signal_remove 'print text', 'sig_print_text';
+ Irssi::command_bind 'showbuf', 'cmd_showbuf';
+}
+
+sub cmd_showbuf {
+ my ($args, $server, $win_item) = @_;
+ my $win;
+ if (defined $win_item) {
+ $win = $win_item->window();
+ } else {
+ $win = Irssi::active_win();
+ }
+
+ $win->print("buffer is: $buffer");
+ $buffer = '';
+}
+
+sub sig_print_text {
+ my ($text_dest, $str, $stripped_str) = @_;
+
+ $buffer .= $stripped_str;
+ Irssi::signal_stop;
+}