# (c) 2010 by Rhonda D'Vine <rhonda@deb.at>

use Irssi qw();

use strict;
use vars qw($VERSION %IRSSI);

$VERSION = '1.0.0';

%IRSSI = (
  'authors'     => "Rhonda D'Vine",
  'contact'     => 'rhonda@deb.at',
  'name'        => 'missing slash',
  'description' => 'tries to catch commands that are missing the leading /',
  'license'     => 'BSD',
  'url'         => 'http://rhonda.deb.at/projects/irssi/scripts/missingslash.pl',
  'changed'     => '2010-05-10',
);

# Version-History:
# ================
# 1.0.0 -- initial version

sub sig_send_text {
	my ($text, $server, $witem) = @_;

	if ($text =~ m/^\s*\/?\s*w(?:in)?\s+[0-9]+$/i) {
		$text =~ s#^\s*(?:[^\s]+)\s+()#win $1#;
		Irssi::command("$text");
		Irssi::signal_stop;
		return;

	}
}

Irssi::signal_add('send text', 'sig_send_text');
