All pastes #981061 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-11 14:55 UTC
rendered paste body
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')) {

        # Put extra regexps here
        $text =~ s/[Ll]evo75/Mario75/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";