-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbork.pl
42 lines (36 loc) · 990 Bytes
/
bork.pl
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
34
35
36
37
38
39
40
41
42
#!/usr/bin/env perl
use strict;
use warnings;
use Irssi;
use Irssi::Irc;
my $ACTIVE_CHAN = '#borkenbork';
my %replace_map = (
'aa' => "\xc3\xa5", # å
'ae' => "\xc3\xa4", # ä
'oe' => "\xc3\xb6", # ö
'AA' => "\xc3\x85",
'AE' => "\xc3\x84",
'OE' => "\xc3\x96",
);
sub text_replace {
my $text = shift;
while (my ($key, $value) = each(%replace_map)) {
$text =~ s/$key/$value/gs;
}
return $text;
}
sub send_text {
my ($msg, $server_rec, $witem) = @_;
# only do this on witem channel
# we must also make sure that a message exists. 'send text' will trigger if you just press enter on the prompt with nothing there.
if ($msg and $witem != 0 and $witem->{type} eq 'CHANNEL') {
my $tag = $server_rec->{tag};
my $channel = $witem->{name};
if ($channel eq $ACTIVE_CHAN) {
my $text = text_replace($text);
Irssi::signal_continue(($text, $server_rec, $witem));
}
}
}
# Hook the signals and start some work.
Irssi::signal_add_first('send text', 'send_text');