aboutsummaryrefslogtreecommitdiff
path: root/spaceslash.pl
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-12-26 17:08:34 -0500
committerB. Watson <urchlay@slackware.uk>2024-12-26 17:08:34 -0500
commit9eed830f296dab257759f5276d0963467007aa6b (patch)
tree83d6225d248ec8d4026b514d8b9b248e6c0fce32 /spaceslash.pl
downloadstupid-irssi-tricks-9eed830f296dab257759f5276d0963467007aa6b.tar.gz
initial commit
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);