aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-02-15 00:50:39 +0100
committerTeddy Wing2018-02-15 00:51:17 +0100
commit6afd74fb5199c946c3e56e21433df12cc13445c0 (patch)
tree9fac706037e68ebf06a16606a5ec70a5b881a562
parent1c89f65861cd8366770b9ac2804852fbc4b9f346 (diff)
downloadirssi-dimpid-6afd74fb5199c946c3e56e21433df12cc13445c0.tar.bz2
Add `help` command
Provide a command to print the documentation via Irssi's built-in `help` command. Uses the mechanism I used in Vimput to get autocompletion of "dimpid" even though it isn't a command.
-rw-r--r--dimpid.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/dimpid.pl b/dimpid.pl
index b809dab..2bcf180 100644
--- a/dimpid.pl
+++ b/dimpid.pl
@@ -42,6 +42,38 @@ our %IRSSI = {
use constant ESCAPE => "\x{03}";
use constant GREY => '14';
+
+Irssi::command_bind('help dimpid', sub {
+ my $help = <<HELP;
+
+%9Description:%9
+
+ Outputs public messages from certain nicks in grey instead of standard
+ black.
+
+%9Settings:%9
+
+ dimpid_nicks: a space-separated list of nicks whose public messages will
+ be printed in grey.
+
+ %9Example:%9 /set dimpid_nicks nibbler hermes zoidberg
+HELP
+
+ Irssi::print($help, MSGLEVEL_CLIENTCRAP);
+});
+
+Irssi::command_bind('help', sub {
+ my ($data, $server, $item) = @_;
+
+ if ($data !~ /^dimpid\s*$/) {
+ return;
+ }
+
+ Irssi::command_runsub('help', $data, $server, $item);
+ Irssi::signal_stop();
+});
+
+
Irssi::signal_add('message public', sub {
my ($server, $text, $nick, @rest) = @_;