All pastes #910193 Raw Edit

attempted irssi scripting

public text v1 · immutable
·published 2008-02-19 20:19 UTC
rendered paste body
#!/usr/bin/perl

use warnings;
use strict;

use Irssi;

our $VERSION = "0.1";
our %IRSSI = (
	authors     => 'Urchlay',
	contact     => 'Urchlay on NewNet',
	name        => 'urlmanager',
	description => 'treat " /command" as though the space weren\'t there',
	license     => 'Same as Perl',
	url         => 'none',
);

sub sig_own_public {
	my $msg = $_[1];

	if($msg =~ s{^\s+/}{/}) {
		if($msg =~ s{/\s+/}{/}) {
			Irssi::signal_continue($_[0], $msg, $_[2]);
			return;
		}

		Irssi::signal_stop();
		Irssi::command($msg);
	}
}

Irssi::signal_add("message own_public", \&sig_own_public);