From ea348b22bc38b6d5cac2a9a2f9fef29937fb02ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= Date: Mon, 3 Feb 2014 15:30:46 +0200 Subject: [PATCH] irssi/coffee.pl: handle "ls" --- irssi/coffee.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/irssi/coffee.pl b/irssi/coffee.pl index e1c725b40..6d68c830a 100644 --- a/irssi/coffee.pl +++ b/irssi/coffee.pl @@ -3,7 +3,7 @@ use vars qw($VERSION %IRSSI); use Irssi; -$VERSION = '0.2'; +$VERSION = '0.3'; %IRSSI = ( name => 'spacefail', description => 'Warns you if you have extra spaces before /command', @@ -13,11 +13,17 @@ Irssi::signal_add("send text" => sub { my ($line, $server, $witem) = @_; + + $witem //= Irssi::active_win; + if ($line =~ m|^\s+/(\w+)|) { - Irssi::command("scrollback end"); - $witem //= Irssi::active_win; + $witem->command("scrollback end"); $witem->print("Stopped command \002/$1\002 from being sent to channel.", MSGLEVEL_CLIENTERROR); Irssi::signal_stop; } + elsif ($line eq 'ls') { + $witem->command("names"); + Irssi::signal_stop; + } });