]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
[oopsie] output to status window
authorbw1 <redacted>
Tue, 19 Feb 2019 15:46:39 +0000 (16:46 +0100)
committerbw1 <redacted>
Tue, 19 Feb 2019 15:49:33 +0000 (16:49 +0100)
scripts/oopsie.pl

index 8cb599290df12ab704c7bd24bdf10267d4405518..2646d6c19af7519a650b5c19520de110c1904cb7 100644 (file)
@@ -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:
git clone https://git.99rst.org/PROJECT