From: Wieland Hoffmann Date: Tue, 3 Jul 2018 16:20:51 +0000 (+0200) Subject: [oops] Also call /names on ll X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=76461c37f45c3c72e4ea6dfddd90d8c4df020a61;p=irssi-scripts.irssi.org.git [oops] Also call /names on ll ll is aliased to `ls -l` on a lot of distributions by default and has made its way into (at least my) muscle memory right next to regular ls. --- diff --git a/scripts/oops.pl b/scripts/oops.pl index d72f59f..8b3c33a 100644 --- a/scripts/oops.pl +++ b/scripts/oops.pl @@ -8,22 +8,23 @@ $VERSION = '20071209'; contact => '', name => 'oops', description => -'turns \'ls\' in the beginning of a sent line into the names or whois commands', +'turns \'ll\' and \'ls\' in the beginning of a sent line into the names or whois commands', license => 'Public Domain', ); sub send_text { + my $pattern = qr/(^ll |^ll$|^ls |^ls$)/; #"send text", char *line, SERVER_REC, WI_ITEM_REC my ( $data, $server, $witem ) = @_; if ( $witem && ( $witem->{type} eq "CHANNEL" ) - && ( $data =~ /(^ls |^ls$)/ ) ) + && ( $data =~ $pattern ) ) { $witem->command("names $witem->{name}"); Irssi::signal_stop(); } - if ( $witem && ( $witem->{type} eq "QUERY" ) && ( $data =~ /(^ls |^ls$)/ ) ) + if ( $witem && ( $witem->{type} eq "QUERY" ) && ( $data =~ $pattern ) ) { $witem->command("whois $witem->{name}"); Irssi::signal_stop();