rendered paste body#!/usr/bin/perl -w## Copyright (c) 2008 Stacey Ell <stacey.ell@gmail.com># All rights reserved.## Redistribution and use in source and binary forms, with or without# modification, are permitted provided that the following conditions# are met:# 1. Redistributions of source code must retain the above copyright# notice, this list of conditions and the following disclaimer.# 2. Redistributions in binary form must reproduce the above copyright# notice, this list of conditions and the following disclaimer in the# documentation and/or other materials provided with the distribution.## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF# SUCH DAMAGE.#use strict;use vars qw($VERSION %IRSSI);$VERSION = '0.1-1';%IRSSI = ( authors => 'InfinityB', contact => 'stacey.ell@gmail.com', name => 'ingfix', description => 'translates bad english to acceptable english', license => 'BSD 2-clause', url => 'N/A');my(%replace) = ( ':lod' => 'ಠ_ಠ', ':2surprise' => '( ゚д゚)', ':surprise' => 'Σ(゚Д゚ )', ':dismay' => '( ´Д`)', ':Dismay' => '( ´Д`)', ':smirk' => '( `ー´)', ':Smirk' => '( `ー´)', ':serious' => '( ´_ゝ`)', ':Serious' => '( ´_ゝ`)', ':punch' => '( ゜▽゜)=◯)`ν゜)', ':=3=' => "( ¯3¯)", ':awesome' => "のヮの", ':moe' => "ℳℴℯ\x034❤\017", ':cut' => '(✂゚∀゚)✂ CUTTO', ':nyoro' => '(´・ω・`)', ':arigato' => 'ARIGATO ☆ヽ(´ー` )ノ', ':rdozo' => '(ノ゚-゚)ノ☆ DOZO', ':ldozo' => 'DOZO ★ヽ(°ー° )ノ', ':teadozo' => '(ノ゚-゚)ノ旦~DOZO', ':teaarigato'=> 'ARIGATO ~旦ヽ(´ー` )ノ', ':laugh' => 'ヽ( >∀<)ノ AHAHA AHAHA AHAHAHAHA', ':shrug' => '¯\(°_o)/¯', ':hi5' => 'ヽ( ゚Д゚)人(゚Д゚ )ノ', ':zws' => "\xE2\x80\x8B", ':zwnj' => "\xE2\x80\x8C", ':zwj' => "\xE2\x80\x8D", ':zwnbs' => "\xEF\xBB\xBF", ':Alpha' => 'Α', ':alpha' => 'α', ':Beta' => 'Β', ':beta' => 'β', ':Gamma' => 'Γ', ':gamma' => 'γ', ':Delta' => 'Δ', ':delta' => 'δ', ':Epsilon' => 'Ε', ':epsilon' => 'ε', ':Zeta' => 'Ζ', ':zeta' => 'ζ', ':Eta' => 'Η', ':eta' => 'η', ':Theta' => 'Θ', ':theta' => 'θ', ':Iota' => 'Ι', ':iota' => 'ι', ':Kappa' => 'Κ', ':kappa' => 'κ', ':Lambda' => 'Λ', ':lambda' => 'λ', ':Mu' => 'Μ', ':mu' => 'μ', ':Nu' => 'Ν', ':nu' => 'ν', ':Xi' => 'Ξ', ':xi' => 'ξ', ':Omicron' => 'Ο', ':omicron' => 'ο', ':Pi' => 'Π', ':pi' => 'π', ':Rho' => 'Ρ', ':rho' => 'ρ', ':Sigma' => 'Σ', ':sigma' => 'σ', ':Tau' => 'Τ', ':tau' => 'τ', ':Upsilon' => 'Υ', ':upsilon' => 'υ', ':Phi' => 'Φ', ':phi' => 'φ', ':Chi' => 'Χ', ':chi' => 'χ', ':Psi' => 'Ψ', ':psi' => 'ψ', ':Omega' => 'Ω', ':omega' => 'ω', ':Digamma' => 'Ϝ', ':digamma' => 'ϝ', ':San' => 'Ϻ', ':san' => 'ϻ', ':Qoppa' => 'Ϙ', ':qoppa' => 'ϙ', ':Sampi' => 'Ϡ', ':sampi' => 'ϡ', ':Stigma' => 'Ϛ', ':stigma' => 'ϛ', ':Heta' => 'Ͱ', ':heta' => 'ͱ', ':Sho' => 'Ϸ', ':sho' => 'ϸ', ':!=' => '≠', ':>>' => '≫', ':<<' => '≪', ':>=' => '≥', ':<=' => '≤', ':cross' => '×', ':dot' => '·', ':divide' => '÷', ':pom' => '±', ':mop' => '∓', ':sqrt' => '√', ':approx' => '≈', ':therefore' => '∴', ':int' => '∫', ':cint' => '∮', ':pd' => '∂', ':(9)' => '⑨',);my($lock_ev) = 0;sub event1 { my ($line, $server, $witem) = @_; if ($lock_ev) { return }; if ($line =~ /^\//) { return }; ## don't want to filter commands. my ($str) = $line; $str =~ s/ +$//; # fix my horrible trailing whitespace habit while (my($key, $value) = each(%replace)) { #FIXME: there must be a better way # involving percompiled regexp's too. $str =~ s/$key/$value/g; #$str =~ s/^$key /$value /g; #$str =~ s/^$key$/$value/g; #$str =~ s/ $key$/ $value/g; } $str = $str;# . " ni-pah~"; $lock_ev = 1; Irssi::signal_emit('send command', $str, $server, $witem); Irssi::signal_stop(); $lock_ev = 0;}sub cmd_ingfix { Irssi::print('Fixes my shitty speech.');}Irssi::signal_add('send command', "event1");Irssi::command_bind('ingfix', \&cmd_ingfix);Irssi::print('%B'.$IRSSI{name}.' '.$VERSION.'%n loaded; type /ingfix for more info');