-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasciimorse.pl
38 lines (33 loc) · 1.03 KB
/
asciimorse.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
use warnings;
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
use Encode;
use Data::Dumper; # for debugging only
use Convert::Morse qw(as_ascii as_morse is_morsable);
$VERSION = '0.1';
%IRSSI = (
authors => 'LAama1',
contact => 'LAama1@Ircnet',
name => 'ascii 2 morse',
description => 'Tulostaa morsekooodia.',
license => 'BSD',
url => 'https://8-b.fi',
changed => $VERSION
);
sub pubmsg {
my ($serverrec, $msg, $nick, $address, $target) = @_;
my $mynick = quotemeta $serverrec->{nick};
return if ($nick eq $mynick); # self-test
return if $nick eq 'kaaosradio'; # ignore this nick
if ($msg =~ /\!morse (.*)/ui) {
return if KaaosRadioClass::floodCheck() == 1; # return if flooding
my $searchw = decode('ISO-8859-1', $1);
print("asciimorse> Searchword: ".$searchw);
my $morse = as_morse($searchw);
$serverrec->command("MSG $target Morse: $morse") if $morse;
}
return;
}
Irssi::signal_add_last('message public', 'pubmsg');
Irssi::print($IRSSI{name}." v. $VERSION loaded");