aboutsummaryrefslogtreecommitdiff
path: root/spaceslash.pl
diff options
context:
space:
mode:
Diffstat (limited to 'spaceslash.pl')
-rw-r--r--spaceslash.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/spaceslash.pl b/spaceslash.pl
new file mode 100644
index 0000000..73ea73a
--- /dev/null
+++ b/spaceslash.pl
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Irssi qw/signal_continue signal_stop active_server command signal_add/;
+
+our $VERSION = "0.1";
+our %IRSSI = (
+ authors => 'Urchlay',
+ contact => 'Urchlay on NewNet',
+ name => 'spaceslash',
+ description => 'treat " /command" as though the space weren\'t there',
+ license => 'Same as Perl',
+ url => 'none',
+);
+
+sub sig_send_text {
+ if($_[0] =~ s{^\s+/}{/}) {
+ if($_[0] =~ s{/\s+/\s*}{/}) {
+ signal_continue(@_);
+ return;
+ }
+
+ signal_stop();
+ my $s = active_server();
+ if($s) {
+ $s->command($_[0]);
+ } else {
+ command($_[0]);
+ }
+ }
+}
+
+signal_add("send text", \&sig_send_text);