diff options
| author | Mike Rix Wolfe | 2014-12-01 13:04:58 -0600 |
|---|---|---|
| committer | Mike Rix Wolfe | 2014-12-01 13:04:58 -0600 |
| commit | d6d3e5c3111ebcb6215687a57feee26c983c69ab (patch) | |
| tree | 5748ef71612148574d9627b2fd705acac2a3651e /scripts/rainbow.pl | |
| parent | f460d1e39ac65f2a2c21f0c88aa45e9cd4217520 (diff) | |
| download | scripts.irssi.org-d6d3e5c3111ebcb6215687a57feee26c983c69ab.tar.bz2 | |
Add rknockout
Added rknockout function for colorful knockouts.
Diffstat (limited to 'scripts/rainbow.pl')
| -rw-r--r-- | scripts/rainbow.pl | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/scripts/rainbow.pl b/scripts/rainbow.pl index 4b0361b..0dd292d 100644 --- a/scripts/rainbow.pl +++ b/scripts/rainbow.pl @@ -13,6 +13,9 @@ # # /RKICK <nick> [reason] # - kicks nick from the current channel with coloured reason +# +# /RKNOCKOUT [time] <nicks> [reason] +# - knockouts nicks from the current channel with coloured reason for time # Written by Jakub Jankowski <shasta@atn.pl> # for Irssi 0.7.98.4 and newer @@ -20,7 +23,7 @@ use strict; use vars qw($VERSION %IRSSI); -$VERSION = "1.5"; +$VERSION = "1.6"; %IRSSI = ( authors => 'Jakub Jankowski', contact => 'shasta@atn.pl', @@ -133,10 +136,30 @@ sub rkick { } } +# void rknockout($text, $server, $destination) +# handles /rknockout +sub rknockout { + my ($text, $server, $dest) = @_; + + if (!$server || !$server->{connected}) { + Irssi::print("Not connected to server"); + return; + } + + if ($dest && $dest->{type} eq "CHANNEL") { + my ($time, $nick, $reason) = split(/ +/, $text, 3); + ($time, $nick, $reason) = (300, $time, $nick . " " . $reason) if ($time !~ m/^\d+$/); + return unless $nick; + $reason = "See you in " . $time . " seconds!" if ($reason =~ /^[\ ]*$/); + $dest->command("/knockout " . $time . " " . $nick . " " . make_colors($reason)); + } +} + Irssi::command_bind("rsay", "rsay"); Irssi::command_bind("rtopic", "rtopic"); Irssi::command_bind("rme", "rme"); Irssi::command_bind("rkick", "rkick"); +Irssi::command_bind("rknockout", "rknockout"); # changes: # @@ -146,3 +169,4 @@ Irssi::command_bind("rkick", "rkick"); # 02.02.2002: make_colors() doesn't assign any color to spaces (v1.3) # 23.02.2002: /rkick added # 26.11.2014: utf-8 support +# 01.12.2014: /rknockout added (v1.6) |
