diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/vowels.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/vowels.pl')
| -rw-r--r-- | scripts/vowels.pl | 93 | 
1 files changed, 93 insertions, 0 deletions
| diff --git a/scripts/vowels.pl b/scripts/vowels.pl new file mode 100644 index 0000000..eae47d7 --- /dev/null +++ b/scripts/vowels.pl @@ -0,0 +1,93 @@ +#!/usr/bin/perl -w + +# /VSAY <text> +#  - same as /say, but removes vowels from text +# +# /VME <text> +#  - same as /me, but removes vowels from text +# +# /VTOPIC <text> +#  - same as /topic, but removes vowels from text :) + +# Written by Jakub Jankowski <shasta@atn.pl> +# for Irssi 0.7.98.4+ + +use strict; +use vars qw($VERSION %IRSSI); + +$VERSION = "1.0"; +%IRSSI = ( +    authors     => 'Jakub Jankowski', +    contact     => 'shasta@atn.pl', +    name        => 'vowels', +    description => 'Silly script, removes vowels, idea taken from #linuxnews ;-)', +    license     => 'GNU GPLv2 or later', +    url         => 'http://irssi.atn.pl/', +); + +use Irssi; +use Irssi::Irc; + +# str remove_vowels($string) +# returns random-coloured string +sub remove_vowels { +	my ($string) = @_; +	$string =~ s/[eyuioa]//gi; +	return $string; +} + +# void rsay($text, $server, $destination) +# handles /rsay +sub rsay { +	my ($text, $server, $dest) = @_; + +	if (!$server || !$server->{connected}) { +		Irssi::print("Not connected to server"); +		return; +	} + +	return unless $dest; +	if ($dest->{type} eq "CHANNEL" || $dest->{type} eq "QUERY") { +		$dest->command("/msg " . $dest->{name} . " " . remove_vowels($text)); +	} +} + +# void rme($text, $server, $destination) +# handles /rme +sub rme { +	my ($text, $server, $dest) = @_; + +	if (!$server || !$server->{connected}) { +		Irssi::print("Not connected to server"); +		return; +	} + +	return unless $dest; +	if ($dest->{type} eq "CHANNEL" || $dest->{type} eq "QUERY") { +		$dest->command("/me " . remove_vowels($text)); +	} +} + +# void rtopic($text, $server, $destination) +# handles /rtopic +sub rtopic { +	my ($text, $server, $dest) = @_; + +	if (!$server || !$server->{connected}) { +		Irssi::print("Not connected to server"); +		return; +	} + +	return unless $dest; +	if ($dest->{type} eq "CHANNEL") { +		$dest->command("/topic " . remove_vowels($text)); +	} +} + +Irssi::command_bind("vsay", "rsay"); +Irssi::command_bind("vtopic", "rtopic"); +Irssi::command_bind("vme", "rme"); + +# changes: +# +# 07.02.2002: Initial release (v1.0) | 
