/usr/share/irssi/scripts/tlock.pl is in irssi-scripts 20120326.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | use Irssi 20020300;
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "1.1";
%IRSSI = (
authors => "Maciek \'fahren\' Freudenheim",
contact => "fahren\@bochnia.pl",
name => "Topic Lock",
description => "/TLOCK [-d] [channel] [topic] - locks current or specified topic on [channel]",
license => "GNU GPLv2 or later",
changed => "Fri Mar 15 15:09:42 CET 2002"
);
my %tlock = ();
sub cmd_tlock {
my ($args, $server, $win) = @_;
my $tag = $server->{tag};
my $delete = ($args =~ s/^-d\s//)? 1 : 0;
my ($chan) = $args =~ /^([^\s]+)/;
unless ($chan) {
my $i = 0;
for my $ch (keys %{$tlock{$tag}}) {
if ($tlock{$tag}{$ch}) {
$i = 1;
Irssi::print("Lock on $tag%W/%n$ch%W:%n $tlock{$tag}{$ch}");
}
}
Irssi::print("%R>>%n You dont have any active topic locks at this moment.") unless $i;
return;
}
$chan = lc($chan);
if ($delete) {
Irssi::print("%W>>%n topic lock on $chan removed") if $tlock{$tag}{$chan};
undef $tlock{$tag}{$chan};
return;
}
my $channel = $server->channel_find($chan);
unless ($channel && $channel->{chanop}) {
Irssi::print("%R>>%n You are not channel operator/not on channel on $chan.");
return;
}
$args =~ s/^$chan\s?//;
my $topic = ($args)? $args : $channel->{topic};
if ($tlock{$tag}{$chan}) {
Irssi::print("Changed tlock on $chan to%W:%n $topic");
} else {
Irssi::print("Set tlock on $chan to%W:%n $topic");
}
$server->send_raw("TOPIC $chan :$topic") if $channel->{topic} ne $topic;
$tlock{$tag}{$chan} = $topic;
}
sub sub_tlock {
# "event "<cmd>, SERVER_REC, char *args, char *sender_nick, char *sender_address
my ($server, $args, $nick, $uh) = @_;
return if $server->{nick} eq $nick;
my ($chan, $topic) = split(/ :/, $args);
return unless $server->channel_find($chan)->{chanop};
$chan = lc($chan);
my $tag = $server->{tag};
if ($tlock{$tag}{$chan} && $topic ne $tlock{$tag}{$chan}) {
Irssi::print("%W>>%n tlock: changing topic back on $chan");
$server->send_raw("TOPIC $chan :$tlock{$tag}{$chan}");
}
}
Irssi::signal_add('event topic', 'sub_tlock');
Irssi::command_bind('tlock', 'cmd_tlock');
|