aboutsummaryrefslogtreecommitdiffstats
path: root/feature-tests/text_intercept.pl
blob: 932703ef5c4211235502d48fccb219827cb16826 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}