/usr/share/irssi/scripts/twtopic.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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | use vars qw($VERSION %IRSSI);
use Irssi;
use Irssi::Irc;
use Irssi::TextUI;
$VERSION = '1.01';
%IRSSI = (
authors => 'John Engelbrecht',
contact => 'jengelbr@yahoo.com',
name => 'twtopic.pl',
description => 'Animated Topic bar.',
license => 'Public Domain',
changed => 'Sat Nov 20 14:15:18 CST 2004',
url => 'http://irssi.darktalker.net'."\n",
);
my $instrut =
".--------------------------------------------------.\n".
"| 1.) shell> mkdir ~/.irssi/scripts |\n".
"| 2.) shell> cp twtopic.pl ~/.irssi/scripts/ |\n".
"| 3.) shell> mkdir ~/.irssi/scripts/autorun |\n".
"| 4.) shell> ln -s ~/.irssi/scripts/twtopic.pl \\ |\n".
"| ~/.irssi/scripts/autorun/twtopic.pl |\n".
"| 5.) /sbar topic remove topic |\n".
"| 6.) /sbar topic remove topic_empty |\n".
"| 7.) /sbar topic add -after topicbarstart |\n".
"| -priority 100 -alignment left twtopic |\n".
"| 9.) /toggle twtopic_instruct and last /save |\n".
"|--------------------------------------------------|\n".
"| Options: Default: |\n".
"| /set twtopic_refresh <speed> 150 |\n".
"| /set twtopic_size <size> 20 |\n".
"| /toggle twtopic_instruct |Startup instructions |\n".
"\`--------------------------------------------------'";
my $start_pos=0;
my $flipflop=0;
my @mirc_color_arr = ("\0031","\0035","\0033","\0037","\0032","\0036","\00310","\0030","\00314","\0034","\0039","\0038","\00312","\00313","\00311","\00315","\017");
sub setup {
my $time = Irssi::settings_get_int('twtopic_refresh');
Irssi::timeout_remove($timeout);
$timeout = Irssi::timeout_add($time, 'reload' , undef);
}
sub show {
my ($item, $get_size_only) = @_;
$text = get();
$text="[".$text."]";
$item->default_handler($get_size_only,$text, undef, 1);
}
sub get_topic {
$topic = "";
$name = Irssi::active_win()->{active}->{name};
$type = Irssi::active_win()->{active}->{type};
$name = "Status" if($name eq "");
if($name eq "Status") { return "Irssi website: http://www.irssi.org, Irssi IRC channel: #irssi @ irc://irc.freenode:6667, twtopic has been written by Tech Wizard"; }
if($type eq "QUERY") {
$text = "You are now talking too...... ".$name;
return $text;
}
$channel = Irssi::Irc::Server->channel_find($name);
$topic = $channel->{topic};
foreach (@mirc_color_arr) { $topic =~ s/$_//g; }
return $topic;
}
sub get {
$str=get_topic();
$str =~ s/(\00313)+//;
$str =~ s/(\002)+//;
$str =~ s/(\001)+//;
$extra_str= " ";
$size = Irssi::settings_get_int('twtopic_size');
if($str eq "") {
my $str = "=-=-=-=-= No Topic=-=-=-=-=-=-=-";
}
@str_arr = split //, $str;
my $total = $#str_arr;
$str=substr($extra_str,0,$size).$str.$extra_str;
$text = substr($str,$start_pos,$size);
if($start_pos > $total+$size) {
$start_pos=0;
}
if(!$flipflop) {
$flipflop=1;
return $text;
}
$start_pos++;
$flipflop=0;
return $text;
}
Irssi::statusbar_item_register('twtopic', '$0', 'show');
Irssi::signal_add('setup changed', 'setup');
Irssi::settings_add_int('tech_addon', 'twtopic_refresh', 150);
Irssi::settings_add_bool('tech_addon', 'twtopic_instruct', 1);
Irssi::settings_add_int('tech_addon', 'twtopic_size',20);
$timeout = Irssi::timeout_add(Irssi::settings_get_int('twtopic_refresh'), 'reload' , undef);
sub reload { Irssi::statusbar_items_redraw('twtopic'); }
if(Irssi::settings_get_bool('twtopic_instruct')) {
print $instrut;
}
|