diff options
author | Tom Feist <shabble@cowu.be> | 2010-08-26 20:20:09 +0000 |
---|---|---|
committer | Tom Feist <shabble@cowu.be> | 2010-08-26 20:20:09 +0000 |
commit | 4403388c523b22cb77b46634f7b02f7bc767e4cd (patch) | |
tree | e1c07624e9718abc7b3e273f382b5e44f491dec6 | |
parent | lots of doc updates (diff) | |
download | irssi-scripts-4403388c523b22cb77b46634f7b02f7bc767e4cd.tar.gz irssi-scripts-4403388c523b22cb77b46634f7b02f7bc767e4cd.zip |
A custom expando like $M that doesnt show channel key
Diffstat (limited to '')
-rw-r--r-- | no-key-modes/no_key_modes.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/no-key-modes/no_key_modes.pl b/no-key-modes/no_key_modes.pl new file mode 100644 index 0000000..32fd2e7 --- /dev/null +++ b/no-key-modes/no_key_modes.pl @@ -0,0 +1,24 @@ + +use strict; +use warnings; + +use Irssi; +use Irssi::TextUI; +use Irssi::Irc; + +Irssi::expando_create('M_nopass', \&expando_nopass_modes, {}); + +sub expando_nopass_modes { + my ($server, $witem, $arg) = @_; + return '' unless ref($witem) eq 'Irssi::Irc::Channel'; + my $modes_str = $witem->{mode}; + my $key_str = $witem->{key}; + + if ($key_str) { + $modes_str =~ s/\Q$key_str\E//; # remove the key + $modes_str =~ s/\s*$//; # strip trailing space if we removed the key. + + } + + return $modes_str; +} |