use strict; use vars qw($VERSION %IRSSI); $VERSION = "20040901"; %IRSSI = ( authors => "Gina 'foosel' Haeussge", contact => "www[at]foosel[dot]net", name => "autocorrect", description => "Corrects common typos and replaces umlauts with their common equivalent", license => "GPLv2", changed => "$VERSION" ); use Irssi 20020324; # replacement function sub autocorrectme ($$$) { my ($text, $server, $witem) = @_; # only autocorrect me when I'm talking in a channel or a query if ($witem && ($witem->{type} eq 'CHANNEL' || $witem->{type} eq 'QUERY')) { $text =~ s/:Ü/:P/g; $text =~ s/:ü/:p/g; $text =~ s/ü/ue/g; $text =~ s/ä/ae/g; $text =~ s/ö/oe/g; $text =~ s/ß/ss/g; $text =~ s/Ü/Ue/g; $text =~ s/Ä/Ae/g; $text =~ s/Ö/Oe/g; Irssi::signal_continue($text, $server, $witem); # else just put out what was put in } else { Irssi::signal_continue($text, $server, $witem); } } # automatically invoke the autocorrect routine # if a text is about to be sent Irssi::signal_add('send text', 'autocorrectme'); # print load message print "%B>>%n ".$IRSSI{name}." ".$VERSION." loaded";