From 739b33c09c0d6ca0aed2e6038739387e88dd9525 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Fri, 1 Oct 2010 01:06:52 +0100 Subject: added a brief snippet showing how to intercept 'print text' signals, and updated the signal docs to describe hte behaviour of 'gui print text' --- feature-tests/text_intercept.pl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 feature-tests/text_intercept.pl (limited to 'feature-tests') diff --git a/feature-tests/text_intercept.pl b/feature-tests/text_intercept.pl new file mode 100644 index 0000000..932703e --- /dev/null +++ b/feature-tests/text_intercept.pl @@ -0,0 +1,33 @@ +use strict; +use Irssi; +use Irssi::TextUI; # for sbar_items_redraw + +use vars qw($VERSION %IRSSI); +$VERSION = "1.0.1"; +%IRSSI = ( + authors => "shabble", + contact => 'shabble+irssi@metavore.org, shabble@#irssi/Freenode', + name => "", + description => "", + license => "Public Domain", + changed => "" +); + +my $ignore_flag = 0; + +Irssi::signal_add 'print text' => \&handle_text; + + +sub handle_text { + my ($dest, $text, $stripped) = @_; + + return if $ignore_flag; + + Irssi::signal_stop(); + + $text =~ s/a/b/g; + + $ignore_flag = 1; + $dest->print($text); + $ignore_flag = 0; +} -- cgit v1.2.3