From: bw1 Date: Tue, 19 Feb 2019 15:46:39 +0000 (+0100) Subject: [oopsie] output to status window X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=a6d4df7c2daee8408236998fd88a1135bb67086e;p=irssi-scripts.irssi.org.git [oopsie] output to status window --- diff --git a/scripts/oopsie.pl b/scripts/oopsie.pl index 8cb5992..2646d6c 100644 --- a/scripts/oopsie.pl +++ b/scripts/oopsie.pl @@ -1,7 +1,7 @@ use strict; use warnings; -our $VERSION = "1.0"; +our $VERSION = "1.1"; our %IRSSI = ( authors => 'David Leadbeater', contact => 'dgl@dgl.cx', @@ -32,7 +32,11 @@ Irssi::signal_add("send command" => sub { if ($command =~ /^\s+$cmdchars_re/ || $command =~ /^$cmdchars_re(?:\s+$oopsie_re|$oopsie_re\s*$cmdchars_re)/) { Irssi::signal_stop(); - $rec->print("oopsie " . $words[rand @words] . ": $command", MSGLEVEL_CRAP); + if ($rec ) { + $rec->print("oopsie " . $words[rand @words] . ": $command", MSGLEVEL_CRAP); + } else { + Irssi::print("oopsie " . $words[rand @words] . ": $command", MSGLEVEL_CRAP); + } } }); @@ -42,3 +46,5 @@ Irssi::signal_add("setup changed" => sub { "Your oopsie_chars_regexp matches a space. This is a very bad idea."); } }); + +# vim:set ts=2 sw=2 expandtab: