summaryrefslogtreecommitdiff
path: root/archive/.irssi/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'archive/.irssi/scripts')
-rwxr-xr-xarchive/.irssi/scripts/autorun/act.pl14
-rwxr-xr-xarchive/.irssi/scripts/autorun/anotherway.pl63
-rw-r--r--archive/.irssi/scripts/autorun/auto_bleh.pl293
-rw-r--r--archive/.irssi/scripts/autorun/format_identify.pl440
-rw-r--r--archive/.irssi/scripts/autorun/go.pl59
-rw-r--r--archive/.irssi/scripts/autorun/hilightwin.pl59
-rw-r--r--archive/.irssi/scripts/autorun/trackbar.pl408
-rw-r--r--archive/.irssi/scripts/autorun/winnum.pl41
8 files changed, 1377 insertions, 0 deletions
diff --git a/archive/.irssi/scripts/autorun/act.pl b/archive/.irssi/scripts/autorun/act.pl
new file mode 100755
index 00000000..252a6d38
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/act.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl -w
+# resets window activity status
+# based on act.pl from http://scripts.irssi.org by c0ffee
+
+use strict;
+use Irssi 20020120;
+
+Irssi::command_bind('ac', sub { _act(); });
+
+sub _act {
+ for (Irssi::windows()) {
+ Irssi::signal_emit("window dehilight", $_);
+ }
+}
diff --git a/archive/.irssi/scripts/autorun/anotherway.pl b/archive/.irssi/scripts/autorun/anotherway.pl
new file mode 100755
index 00000000..ba360f25
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/anotherway.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+#
+# by Stefan Tomanek <stefan@pico.ruhr.de>
+
+use strict;
+use vars qw($VERSION %IRSSI);
+$VERSION = "2003010201";
+%IRSSI = (
+ authors => "Stefan 'tommie' Tomanek",
+ contact => "stefan\@pico.ruhr.de",
+ name => "anotherway",
+ description => "Another auto away script",
+ license => "GPLv2",
+ changed => "$VERSION",
+);
+use Irssi 20020324;
+use vars qw($timer @signals);
+
+@signals = ('message own_public', 'message own_private');
+
+sub go_away {
+ #Irssi::print "%R>>%n Going away...$timer";
+ Irssi::timeout_remove($timer);
+ my $reason = Irssi::settings_get_str("anotherway_reason");
+ my @servers = Irssi::servers();
+ return unless @servers;
+ Irssi::signal_remove($_ , "reset_timer") foreach (@signals);
+ $servers[0]->command('AWAY '.$reason);
+ Irssi::signal_add($_ , "reset_timer") foreach (@signals);
+
+ # # return to the status window so that messages received clearly
+ # # visible in Act bar -- spw
+ # Irssi::command('window goto 1');
+ # ^ annoying and no longer needed now away log gets mailed to me
+
+ # set the trackbar so we can see where we were
+ # -- spw
+ Irssi::command('tb mark');
+}
+
+sub reset_timer {
+ #Irssi::print "%R>>%n RESET";
+ Irssi::signal_remove($_ , "reset_timer") foreach (@signals);
+ foreach (Irssi::servers()) {
+ $_->command('AWAY') if $_->{usermode_away};
+ last;
+ }
+ #Irssi::signal_add('nd', "reset_timer");
+ Irssi::timeout_remove($timer);
+ my $timeout = Irssi::settings_get_int("anotherway_timeout");
+ $timer = Irssi::timeout_add($timeout*1000, "go_away", undef);
+ Irssi::signal_add($_, "reset_timer") foreach (@signals);
+}
+
+Irssi::settings_add_str($IRSSI{name}, 'anotherway_reason', 'a-nother-way');
+Irssi::settings_add_int($IRSSI{name}, 'anotherway_timeout', 300);
+
+{
+ Irssi::signal_add($_, "reset_timer") foreach (@signals);
+ reset_timer();
+}
+
+print CLIENTCRAP '%B>>%n '.$IRSSI{name}.' '.$VERSION.' loaded';
diff --git a/archive/.irssi/scripts/autorun/auto_bleh.pl b/archive/.irssi/scripts/autorun/auto_bleh.pl
new file mode 100644
index 00000000..9c00b2fa
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/auto_bleh.pl
@@ -0,0 +1,293 @@
+use Irssi;
+use Irssi::Irc;
+use strict;
+use vars qw($VERSION %IRSSI $DEBUG);
+
+$VERSION = q$Revision: 1.1 $;
+%IRSSI = (authors => 'tomaw, based on auto_bleh.pl by Don Armstrong',
+ name => 'auto_bleh',
+ description => 'Provides /ak /aq /ab /abr /abrn /arn /amb /amr /at',
+ license => 'GPL',
+ changed => q$Id: auto_bleh.pl,v 1.1 2005/03/17 08:19:53 don Exp $,
+);
+
+#$DEBUG = 1 unless defined $DEBUG;
+
+my ($actions, %defaults);
+
+%defaults = (GET_OP => 1, # Should we try to get opped when we auto_bleh?
+ USE_CHANSERV => 1, # Should we use chanserv to get opped?
+ EXPIRE => 6000, # Do not try to do anything if the action is more than 6000 seconds old.
+ TIMEOUT => 10, # Timeout /at bans after 10 minutes
+);
+
+my %command_bindings = (ak => 'cmd_ak',
+ ab => 'cmd_ab',
+ aq => 'cmd_aq',
+ ar => 'cmd_ar',
+ abr => 'cmd_abr',
+ abk => 'cmd_abk',
+ abrn => 'cmd_abrn',
+ abk => 'cmd_abkn',
+ arn => 'cmd_arn',
+ amb => 'cmd_amb',
+ amr => 'cmd_amr',
+ at => 'cmd_at',
+);
+
+my %bans_to_remove;
+
+sub cmd_at {
+ my ($data, $server, $witem) = @_;
+ return do_auto_bleh('timeout',$data,$server,$witem);
+}
+
+sub cmd_ak {
+ my ($data, $server, $witem) = @_;
+ return do_auto_bleh('kick',$data,$server,$witem);
+}
+
+sub cmd_abk {
+ my ($data, $server, $witem) = @_;
+ return do_auto_bleh('kick,ban',$data,$server,$witem);
+}
+sub cmd_abkn {
+ my ($data, $server, $witem) = @_;
+ return do_auto_bleh('kick,ban,notice',$data,$server,$witem);
+}
+
+sub cmd_amb{
+ my ($data, $server, $witem) = @_;
+ my @nicks = split /\s+/, $data;
+ for (@nicks) {
+ next unless /\w/;
+ do_auto_bleh('ban',$_,$server,$witem);
+ }
+}
+
+sub cmd_ab {
+ my ($data, $server, $witem) = @_;
+ return do_auto_bleh('ban',$data,$server,$witem);
+}
+
+sub cmd_aq {
+ my ($data, $server, $witem) = @_;
+ return do_auto_bleh('quiet',$data,$server,$witem);
+}
+
+
+sub cmd_amr{
+ my ($data, $server, $witem) = @_;
+ my @nicks = split /\s+/, $data;
+ for (@nicks) {
+ next unless /\w/;
+ do_auto_bleh('remove',$_,$server,$witem);
+ }
+}
+
+sub cmd_ar {
+ my ($data, $server, $witem) = @_;
+ return do_auto_bleh('remove',$data,$server,$witem);
+}
+sub cmd_abr{
+ my ($data, $server, $witem) =@_;
+ return do_auto_bleh('remove,ban',$data,$server,$witem);
+}
+sub cmd_abrn{
+ my ($data, $server, $witem) =@_;
+ return do_auto_bleh('remove,ban,notice',$data,$server,$witem);
+}
+sub cmd_arn{
+ my ($data, $server, $witem) =@_;
+ return do_auto_bleh('remove,notice',$data,$server,$witem);
+}
+
+
+sub do_auto_bleh {
+ my ($cmd, $data, $server, $witem, $duration) = @_;
+
+ if (!$server || !$server->{connected}) {
+ Irssi::print("Not connected to server");
+ return;
+ }
+
+ if ($witem->{type} ne 'CHANNEL') {
+ Irssi::print("Can't autokick on a non-channel. [$witem->{type}]");
+ return;
+ }
+
+ # set the network that we're on, the channel and the nick to kick
+ # once we've been opped
+
+ $data =~ /^\s*([^\s]+)\s*(\d+)?\s*(.+?|)\s*$/;
+ my $nick = $1;
+ my $timeout = $2;
+ my $reason = $3;
+ $timeout = $defaults{TIMEOUT} if not defined $timeout or $timeout eq '';
+ $reason = 'you should know better' if not defined $reason or $reason eq '';
+
+ my $nick_rec = $witem->nick_find($nick);
+ if (not defined $nick_rec) {
+ Irssi::print("Unable to find nick: $nick");
+ return;
+ }
+
+ my $hostname = $nick_rec->{host} if defined $nick_rec;
+ Irssi::print("Unable to find hostname for $nick") if not defined $hostname or $hostname eq '';
+ $hostname =~ s/.+\@//;
+
+ Irssi::print("Nick set to '$nick' from '$data', reason set to '$reason'.") if $DEBUG;
+ my $action = {type => $cmd,
+ nick => $nick,
+ nick_rec => $nick_rec,
+ network => $witem->{server}->{chatnet},
+ server => $witem->{server},
+ completed => 0,
+ inserted => time,
+ channel => $witem->{name},
+ reason => $reason,
+ hostname => $hostname,
+ timeout => $timeout,
+ };
+ Irssi::print(i_want($action)) if $DEBUG;
+ if ($witem->{chanop}) {
+ take_action($action,$server,$witem);
+ }
+ else {
+ $actions->{$data.$action->{inserted}}=$action;
+ get_op($server, $action->{channel}) if $defaults{GET_OP};
+ }
+}
+
+sub get_op {
+ my ($server,$channel) = @_;
+
+ Irssi::print("QUOTE CS op $channel") if $DEBUG;
+ $server->command("QUOTE CS op $channel") if $defaults{USE_CHANSERV};
+}
+
+sub i_want {
+ my $action = shift;
+ return "I've wanted to $action->{type} $action->{nick} off $action->{channel} on $action->{network} since $action->{inserted}";
+}
+
+sub take_action {
+ my ($action,$server,$channel) = @_;
+
+ local $_ = $action->{type};
+ # Now support multiple actions against a single nick (to FE, kick ban, or remove ban). See /abr foo
+ if (/timeout/) {
+ Irssi::print("Quieting $action->{nick} on $action->{channel} with hostname $action->{hostname} for $action->{timeout} minutes") if $DEBUG;
+ $channel->command("/quote MODE $action->{channel} +q *!*@".$action->{hostname}) if $action->{hostname} ne ''; #quiet hostname
+ $bans_to_remove{"$action->{nick}$action->{inserted}"} = $action;
+ }
+ if (/quiet/) {
+ Irssi::print("Quieting $action->{nick} on $action->{channel} with hostname $action->{hostname}") if $DEBUG;
+ # Find hostname
+ $channel->command("/quote MODE $action->{channel} +q *!*@".$action->{hostname}) if $action->{hostname} ne ''; #quiet hostname
+ }
+ if (/ban/) {
+ Irssi::print("Banning $action->{nick} from $action->{channel} with hostname $action->{hostname}") if $DEBUG;
+ $channel->command("/quote MODE $action->{channel} +b *!*@".$action->{hostname}) if $action->{hostname} ne ''; # ban hostname
+ }
+ if (/kick/) {
+ Irssi::print("Kicking $action->{nick} from $action->{channel}") if $DEBUG;
+ if ($action->{reason} =~ /\s/) {
+ $channel->command("/quote KICK $action->{channel} $action->{nick} :$action->{reason}");
+ }
+ else {
+ $channel->command("/quote REMOVE $action->{channel} $action->{nick} $action->{reason}");
+ }
+ }
+ if (/remove/) {
+ Irssi::print("Removing $action->{nick} from $action->{channel}") if $DEBUG;
+ if ($action->{reason} =~ /\s/) {
+ $channel->command("/quote REMOVE $action->{channel} $action->{nick} :$action->{reason}");
+ } else {
+ $channel->command("/quote REMOVE $action->{channel} $action->{nick} $action->{reason}");
+ }
+ }
+ if (/notice/) {
+ Irssi::print("Noticing $action->{nick} with $action->{reason}") if $DEBUG;
+ $channel->command("/NOTICE $action->{nick} $action->{reason}");
+ }
+ if (/teiuq/) {
+ Irssi::print("Unquieting $action->{nick} on $action->{channel} with hostname $action->{hostname}") if $DEBUG;
+ $channel->command("/quote MODE $action->{channel} -q *!*@".$action->{hostname});
+ }
+ return; #for now.
+}
+
+sub deop_us {
+ my ($rec) = @_;
+ my $channel = $rec->{channel};
+ my $server = $rec->{server};
+
+ Irssi::print("MODE $channel->{name} -o $channel->{ownnick}->{nick}") if $DEBUG;
+ $channel->command("/deop $channel->{ownnick}->{nick}");
+}
+
+sub sig_mode_change {
+ my ($channel,$nick) = @_;
+
+ # Are there any actions to process?
+ # See if we got opped.
+ return if scalar(keys %$actions) eq 0;
+
+ my @deop_array;
+ if ($channel->{server}->{nick} eq $nick->{nick} and $nick->{op}) {
+ Irssi::print("We've been opped") if $DEBUG;
+ foreach (keys %$actions) {
+ # See if this action is too old
+ if (time - $actions->{$_}->{inserted} > $defaults{EXPIRE}) {
+ Irssi::print("Expiring action: \"".i_want($actions->{$_})."\" because of time") if $DEBUG;
+ delete $actions->{$_};
+ next;
+ }
+ Irssi::print(i_want($actions->{$_})) if $DEBUG;
+ # Find the server to take action on
+ my $server = $actions->{$_}->{server};
+ Irssi::print("Unable to find server for chatnet: $actions->{$_}->{network}") and return if not defined $server;
+ Irssi::print("Found server for chatnet: $actions->{$_}->{network}") if $DEBUG;
+ # Find the channel to take action on
+ my $channel = $server->channel_find($actions->{$_}->{channel});
+ Irssi::print("Unable to find channel for channel: $actions->{$_}->{channel}") and return if not defined $channel;
+ Irssi::print("Found channel for channel: $actions->{$_}->{channel}") if $DEBUG;
+ Irssi::print("We are opped on the channel!") if $DEBUG;
+ take_action($actions->{$_},$server,$channel);
+ push @deop_array,{server=>$server,channel=>$channel} if Irssi::settings_get_bool('auto_bleh_deop_after_action');
+ delete $actions->{$_}; # Do not repeat this action.
+ }
+ foreach (@deop_array) {
+ deop_us($_);
+ }
+ } else {
+ Irssi::print("Fooey. Not opped.") if $DEBUG;
+ }
+}
+
+sub try_to_remove_bans {
+ return unless keys %bans_to_remove;
+ for my $key (keys %bans_to_remove) {
+ if (($bans_to_remove{$key}{inserted} + $bans_to_remove{$key}{timeout}*60) < time) {
+ $bans_to_remove{$key}{type} = 'teiuq'; #unquiet
+ $actions->{$key} = $bans_to_remove{$key};
+ delete $bans_to_remove{$key};
+ get_op($actions->{$key}{server}, $actions->{$key}{channel}) if $defaults{GET_OP};
+ }
+ }
+}
+
+# call the try to remove bans function every minute
+Irssi::timeout_add(1000*60,'try_to_remove_bans',undef);
+Irssi::signal_add_last('nick mode changed','sig_mode_change');
+my ($command,$function);
+
+while (($command,$function) = each %command_bindings) {
+ Irssi::command_bind($command,$function, 'auto_bleh');
+}
+
+Irssi::settings_add_bool($IRSSI{name}, 'auto_bleh_deop_after_action', 1);
+
+1;
+
diff --git a/archive/.irssi/scripts/autorun/format_identify.pl b/archive/.irssi/scripts/autorun/format_identify.pl
new file mode 100644
index 00000000..0b19c445
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/format_identify.pl
@@ -0,0 +1,440 @@
+
+#!/usr/bin/perl
+# ^ to make vim know this is a perl script so I get syntax hilighting.
+
+#####################################################################
+### WARNING: This version was restored from google cache ###
+### by Wouter Coekaerts <coekie@irssi.org>. ###
+### Syntax might not be exactly the same as the original ###
+#####################################################################
+
+# $Id$
+use strict;
+use vars qw($VERSION %IRSSI);
+use Irssi qw(signal_stop signal_emit signal_remove
+ signal_add signal_add_first
+ settings_add_str settings_get_str settings_add_bool
+ settings_get_bool
+ print );
+$VERSION = '1.5-dev-coekie';
+%IRSSI = (
+ authors => 'ResDev (Ben Reser)',
+ contact => 'ben@reser.org',
+ name => 'format_identify',
+ description => 'Formats msgs and notices when the identify-msg and/or ' .
+ 'identify-ctcp capability is available.',
+ license => 'GPL2',
+ url => 'http://ben.reser.org/irssi/',
+);
+
+# Additional credit to ch for his wash-imsg script which was a starting place
+# for this; coekie for pointing me towards the nickcolor script and its
+# technique for doing this; Timo Sirainen and Ian Peters for writing nickcolor.
+
+# This script takes advantage of the identify-msg and identify-ctcp
+# capabilities of the new dancer ircd. The identify-msg capability causes the
+# first character of a msg or notice to be set to a + if the user is identified
+# with nickserve and a - if not. identify-ctcp does similar for CTCP messages.
+# This script removes the tagging and then allows you to configure a
+# modification to the formating of the nickname.
+
+# Installation instructions: Drop this in ~/.irssi/scripts and run
+# /script load format_identify. To make it autorun on startup place it in
+# ~/.irssi/scripts/autorun. This script will detect if the IRC server has
+# the identify-msg and identify-ctcp capability. If it is available it will
+# use it. Messages on servers without support for these capabilities will
+# be tagged as unknown.
+#
+# While you can unload this script. Any servers that you are connected to
+# with identify-msg/identify-ctcp turned on will continue to send data
+# encoded that way. This means messages and notices will have a + or -
+# appended to the front of them. CTCPs will be broken. Unfortunately, there
+# is no way to turn off a capability once it is turned on. You will have to
+# disconnect and reconnect to these servers. This script will warn you when
+# unloading the script of this situation.
+
+#
+# Configuration: You can control the formating of the nickname with the
+# format_identified_nick, format_unidentified_nick, and format_unknown_nick
+# variables. The default is to do nothing to identified nicks and unknown
+# nicks. while unidentified nicks have a ~ to the beginning of nick. An
+# unknown nick means anytime a message or notice doesn't start with a + or -,
+# which will occur when identify-msg isn't enabled. The format_unknown_nick
+# can be really handy to alert you that you don't have identify-msg or
+# identify-ctcp set, but is set by default to do nothing since most servers do
+# not have identify-msg yet. In these variables $0 stands for the nick. You
+# can use the standard formating codes or just text in it. See formats.txt for
+# more information on the codes you can use. Warning about colors. Using
+# colors in this formating will likely break other formating scripts and
+# features, in particular the hilight feature of irssi or vice versa. Remember
+# that %n has a different meaning here as explamined in the default.theme file
+# that comes with irssi.
+#
+# Some examples:
+#
+# Make unidentified nicks have a ? after the nick: /set
+# format_unidentified_nick $0?
+#
+# Make unidentified nicks red and identified nicks green: /set
+# format_identified_nick %G$0 /set format_unidentified_nick %R$0 Note that the
+# above will not do the tagging if a message gets hilighted. Since a hilight
+# (line or nick) will override the colors.
+#
+# So I recommend doing something like this: /set format_identified_nick %G$0
+# /set format_unidentified_nick %R~$0
+#
+# Make unidentified nicks be unmodified but add a * before identified nicks:
+# /set format_identified_nick *$0 /set format_unidentified_nick $0
+#
+# This script works by modifying the formats irssi uses to display various
+# things. Therefore it is highly recommended that you do not change any of the
+# following format variables except through this script: pubmsg pubmsg_channel
+# msg_private msg_private_query pubmsg_hilight pubmsg_hilight_channel pubmsg_me
+# pubmsg_me_channel action_private action_private_query action_public
+# action_public_channel ctcp_requested ctcp_requested_unknown notice_public
+# notice_private ctcp_reply ctcp_reply_channel ctcp_ping_reply
+
+#
+# To change these formats you need to set the variable (with the set command
+# not the format command as usual) of the same name as the format but with
+# _identify on the end. This format has an additional special purpose
+# "abstract" that is only used by this script and is parsed and replaced before
+# setting the format and giving it to irssi. It is called format_identify.
+# Any format you use with this script should have a {format_identify $0} in it
+# to replace where the $0 usually is in the format. Sometimes it will be $1
+# for the nick in the format, in which case you should replace the $1 with
+# {format_identify $1}. For more examples take a look at the defaults at the
+# bottom of this script.
+#
+#
+# If you wish to disable the module from applying a change to the nickname in a
+# particular place the best way to do it is to simply remove the
+# {format_identify $0} from the format that applies. E.G. to disable the
+# format change for a CTCP reply one would do: /set ctcp_reply_identify CTCP
+# {hilight $0} reply from {nick $1}: $2
+#
+
+# TODO
+# * Implement DCC formats, which means figuring out which ones are appropriate
+# to try and format.
+# * Allow different formating on the nick for different types of messages. I'm
+# not sure if this is useful...
+#
+# It should not be necessary to modify anything in this script. Everything
+# should be able to be modified via the variables it exports as described
+# above.
+#
+
+my(@format_identify_message_formats) = qw(pubmsg pubmsg_channel msg_private
+ msg_private_query pubmsg_hilight
+ pubmsg_hilight_channel action_private
+ action_private_query action_public
+ action_public_channel ctcp_requested
+ ctcp_requested_unknown pubmsg_me
+ pubmsg_me_channel
+ );
+
+my(@format_identify_notice_formats) = qw(notice_public notice_private ctcp_reply
+ ctcp_reply_channel ctcp_ping_reply);
+
+
+my %servers;
+
+# Replace the {format_identify $0} place holder with
+# whatever the user has setup for their nick formats...
+sub replace_format_identify {
+ my ($format, $entry) = @_;
+
+ my ($nickarg) = $format =~ /{\s*format_identify\s+?([^\s]+?)\s*}/;
+ $entry =~ s/\$0/$nickarg/;
+ $format =~ s/{\s*format_identify\s+?[^\s]+?\s*}/$entry/g;
+ return $format;
+}
+
+# rewrite the message now that we've updated the formats
+sub format_identify_rewrite {
+ my $signal = shift;
+ my $proc = shift;
+
+ signal_stop();
+ signal_remove($signal,$proc);
+ signal_emit($signal, @_);
+ signal_add($signal,$proc);
+}
+
+
+# Issue the format update after generating the new format.
+sub update_format_identify {
+ my ($server,$entry,$nick) = @_;
+
+ my $identify_format = settings_get_str("${entry}_identify");
+ my $replaced_format = replace_format_identify($identify_format,$nick);
+ $server->command("^format $entry " . $replaced_format);
+}
+
+my %saved_colors;
+my %session_colors = {};
+my @colors = qw/2 3 4 5 6 7 9 10 11 12 13/;
+
+sub simple_hash {
+ my ($string) = @_;
+ chomp $string;
+ my @chars = split //, $string;
+ my $counter;
+
+ foreach my $char (@chars) {
+ $counter += ord $char;
+ }
+
+ $counter = $colors[($counter % @colors)];
+ return $counter;
+}
+
+sub colourise {
+ return if(!settings_get_bool('format_colour'));
+ my ($nick) = @_;
+ my $color = $saved_colors{$nick};
+ if (!$color) {
+ $color = $session_colors{$nick};
+ }
+ if (!$color) {
+ $color = simple_hash $nick;
+ $session_colors{$nick} = $color;
+ }
+ $color = "0".$color if ($color < 10);
+ return chr(3).$color;
+}
+
+
+# catches the signal for a message removes the + or -, updates the
+# formats and then resends the message event.
+sub format_identify_message {
+ my ($server, $data, $nick, $address) = @_;
+ my ($channel, $msg) = split(/ :/, $data,2);
+
+ if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'} &&
+ !$servers{$server->{'real_address'}}->{'IDENTIFY-MSG'}) {
+ my $unknown_nick = settings_get_str('format_unknown_nick');
+ foreach my $format (@format_identify_message_formats) {
+ update_format_identify($server,$format,colourise($nick).$unknown_nick);
+ }
+ } elsif(($msg =~ /^\+(.*)/)){
+ my $newdata = "$channel :$1";
+ my $identified_nick = settings_get_str('format_identified_nick');
+ foreach my $format (@format_identify_message_formats) {
+ update_format_identify($server,$format,colourise($nick).$identified_nick);
+ }
+ format_identify_rewrite('event privmsg','format_identify_message', $server,$newdata,$nick,$address);
+ } elsif(($msg =~ /^-(.*)/)){
+ my $newdata = "$channel :$1";
+ my $unidentified_nick = settings_get_str('format_unidentified_nick');
+ foreach my $format (@format_identify_message_formats) {
+ update_format_identify($server,$format,colourise($nick).$unidentified_nick);
+ }
+ format_identify_rewrite('event privmsg','format_identify_message', $server,$newdata,$nick,$address);
+ } else {
+ my $unknown_nick = settings_get_str('format_unknown_nick');
+ foreach my $format (@format_identify_message_formats) {
+ update_format_identify($server,$format,colourise($nick).$unknown_nick);
+ }
+ }
+}
+
+# catches the signal for a notice removes the + or -, updates the
+# formats and resends the notice event.
+sub format_identify_notice {
+ my ($server, $data, $nick, $address) = @_;
+ my ($channel, $msg) = split(/ :/, $data,2);
+
+ if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'} &&
+ !$servers{$server->{'real_address'}}->{'IDENTIFY-MSG'}) {
+ my $unknown_nick = settings_get_str('format_unknown_nick');
+ foreach my $format (@format_identify_notice_formats) {
+ update_format_identify($server,$format,colourise($nick).$unknown_nick);
+ }
+ } elsif(($msg =~ /^\+(.*)/)){
+ my $newdata = "$channel :$1";
+ my $identified_nick = settings_get_str('format_identified_nick');
+ foreach my $format (@format_identify_notice_formats) {
+ update_format_identify($server,$format,colourise($nick).$identified_nick);
+ }
+ format_identify_rewrite('event notice','format_identify_notice', $server,$newdata,$nick,$address);
+ } elsif(($msg =~ /^-(.*)/)){
+ my $newdata = "$channel :$1";
+ my $unidentified_nick = settings_get_str('format_unidentified_nick');
+ foreach my $format (@format_identify_notice_formats) {
+ update_format_identify($server,$format,colourise($nick).$unidentified_nick);
+ }
+ format_identify_rewrite('event notice','format_identify_notice', $server,$newdata,$nick,$address);
+ } else {
+ my $unknown_nick = settings_get_str('format_unknown_nick');
+ foreach my $format (@format_identify_notice_formats) {
+ update_format_identify($server,$format,colourise($nick).$unknown_nick);
+ }
+ }
+}
+
+# Handle CTCP messages. Note that messages tagged with identify-ctcp will
+# not be seen as CTCPs and will go through event privmsg first. This script
+# will generate new events and send them on through to here. However CTCPs
+# that are not tagged at all will go here first. So we need to test here
+# to see if the message is from a server that does not support identify-ctcp
+# and update the format accordingly.
+sub format_identify_ctcp_msg {
+ my ($server) = @_;
+
+ if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'}) {
+ my $unknown_nick = settings_get_str('format_unknown_nick');
+ foreach my $format (@format_identify_message_formats) {
+ update_format_identify($server,$format,$unknown_nick);
+ }
+ }
+}
+
+# Handle CTCP replies. Note that messages tagged with identify-ctcp will
+# not be seen as CTCPs and will go through event notice first. This script
+# will generate new events and send them on through to here. However CTCPs
+# that are not tagged at all will go here first. So we need to test here
+# to see if the message is from a server that does not support identify-ctcp
+# and update the format accordingly.
+sub format_identify_ctcp_reply {
+ my ($server) = @_;
+
+ if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'}) {
+ my $unknown_nick = settings_get_str('format_unknown_nick');
+ foreach my $format (@format_identify_notice_formats) {
+ update_format_identify($server,$format,$unknown_nick);
+ }
+ }
+}
+
+# If we're getting unloaded reset the formats back to their defaults
+# so that it doesn't wrongly show people being unidentifed or vice versa.
+# Also issue a warning about CTCPs etc being broken.
+sub format_identify_unload {
+ my ($script,$server,$witem) = @_;
+ my @warning_servers = ();
+
+ if ($script =~ /^format_identify(?:\.pl|\.perl)?$/) {
+ foreach my $format (@format_identify_message_formats,
+ @format_identify_notice_formats) {
+ $server->command("^format -reset $format");
+ }
+ foreach my $server_name (keys %servers) {
+ if ( $servers{$server_name}->{'IDENTIFY-MSG'}
+ || $servers{$server_name}->{'IDENTIFY-CTCP'})
+ {
+ if($servers{$server_name}->{'USES-CAP'}) {
+ $server->command("^quote cap req :-identify-msg");
+ } else {
+ push @warning_servers, $server_name;
+ }
+ }
+ }
+ print('Warning: Unloading format_identify will leave your messages '.
+ 'and notices modified and will break CTCPs on the following '.
+ 'servers: ' . join (',',@warning_servers));
+ }
+}
+
+# Server responded to capab request. We want to capture the reply
+# and mark it in a hash so we can keep track of which servers have
+# the capabilities. This style of reply will come from dancer or
+# hyperion.
+sub format_identify_capab_reply {
+ my ($server, $data, $server_name) = @_;
+ unless (ref($servers{$server_name}) eq 'HASH') {
+ $servers{$server_name} = {};
+ $servers{$server_name}->{'IDENTIFY-MSG'} = 0;
+ $servers{$server_name}->{'IDENTIFY-CTCP'} = 0;
+ $servers{$server_name}->{'USES-CAP'} = 0;
+ }
+ if ($data =~ /:IDENTIFY-MSG$/) {
+ $servers{$server_name}->{'IDENTIFY-MSG'} = 1;
+ $servers{$server_name}->{'USES-CAP'} = 0;
+ Irssi::signal_stop();
+ return;
+ }
+ if ($data =~ /:IDENTIFY-CTCP$/) {
+ $servers{$server_name}->{'IDENTIFY-CTCP'} = 1;
+ $servers{$server_name}->{'USES-CAP'} = 0;
+ Irssi::signal_stop();
+ return;
+ }
+}
+
+# The same as above. This style of reply comes from ircd-seven.
+sub format_identify_cap_reply {
+ my ($server, $data, $server_name) = @_;
+ unless (ref($servers{$server_name}) eq 'HASH') {
+ $servers{$server_name} = {};
+ $servers{$server_name}->{'IDENTIFY-MSG'} = 0;
+ $servers{$server_name}->{'IDENTIFY-CTCP'} = 0;
+ $servers{$server_name}->{'USES-CAP'} = 0;
+ }
+ if ($data =~ /ACK :.*identify-msg/) {
+ $servers{$server_name}->{'IDENTIFY-MSG'} = 1;
+ $servers{$server_name}->{'IDENTIFY-CTCP'} = 1;
+ $servers{$server_name}->{'USES-CAP'} = 1;
+ return;
+ }
+}
+
+# Handles connections to new (to this script) servers and
+# attempts to turn on the capabilities it supports.
+# We send the request in both formats, for hyperion and ircd-seven.
+sub format_identify_connected {
+ my $server = shift;
+ $server->command("^quote capab IDENTIFY-MSG");
+ $server->command("^quote capab IDENTIFY-CTCP");
+ $server->command("^quote cap req :identify-msg");
+}
+
+# signals to handle the events we need to intercept.
+signal_add('event privmsg', 'format_identify_message');
+signal_add('event notice', 'format_identify_notice');
+signal_add('ctcp msg', 'format_identify_ctcp_msg');
+signal_add('ctcp reply', 'format_identify_ctcp_reply');
+signal_add('event 290', 'format_identify_capab_reply');
+signal_add('event cap', 'format_identify_cap_reply');
+signal_add('event connected', 'format_identify_connected');
+
+# On load enumerate the servers and try to turn on
+# IDENTIFY-MSG and IDENTIFY-CTCP
+foreach my $server (Irssi::servers()) {
+ %servers = ();
+ format_identify_connected($server);
+}
+
+# signal needed to catch the unload... Be sure to be the first to
+# get it too...
+signal_add_first('command script unload', 'format_identify_unload');
+
+settings_add_bool('format_identify', 'format_colour', 1);
+
+# How we format the nick. $0 is the nick we'll be formating.
+settings_add_str('format_identify','format_identified_nick','$0');
+settings_add_str('format_identify','format_unidentified_nick','~$0');
+settings_add_str('format_identify','format_unknown_nick','$0');
+
+# What we use for the formats...
+# Don't modify here, use the /set command or modify in the ~/.irssi/config file.
+settings_add_str('format_identify','pubmsg_identify','{pubmsgnick $2 {pubnick {format_identify $0}}}$1');
+settings_add_str('format_identify','pubmsg_channel_identify','{pubmsgnick $3 {pubnick {format_identify $0}}{msgchannel $1}}$2');
+settings_add_str('format_identify','msg_private_identify','{privmsg {format_identify $0} $1 }$2');
+settings_add_str('format_identify','msg_private_query_identify','{privmsgnick {format_identify $0}}$2');
+settings_add_str('format_identify','pubmsg_hilight_identify','{pubmsghinick {format_identify $0} $3 $1}$2');
+settings_add_str('format_identify','pubmsg_hilight_channel_identify','{pubmsghinick {format_identify $0} $4 $1{msgchannel $2}$3');
+settings_add_str('format_identify','action_private_identify','{pvtaction {format_identify $0}}$2');
+settings_add_str('format_identify','action_private_query_identify','{pvtaction_query {format_identify $0}}$2');
+settings_add_str('format_identify','action_public_identify','{pubaction {format_identify $0}}$1');
+settings_add_str('format_identify','action_public_channel_identify', '{pubaction {format_identify $0}{msgchannel $1}}$2');
+settings_add_str('format_identify','ctcp_requested_identify','{ctcp {hilight {format_identify $0}} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3');
+settings_add_str('format_identify','ctcp_requested_unknown_identify','{ctcp {hilight {format_identify $0}} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3');
+settings_add_str('format_identify','pubmsg_me_identify','{pubmsgmenick $2 {menick {format_identify $0}}}$1');
+settings_add_str('format_identify','pubmsg_me_channel_identify','{pubmsgmenick $3 {menick {format_identify $0}}{msgchannel $1}}$2');
+settings_add_str('format_identify','notice_public_identify','{notice {format_identify $0}{pubnotice_channel $1}}$2');
+settings_add_str('format_identify','notice_private_identify','{notice {format_identify $0}{pvtnotice_host $1}}$2');
+settings_add_str('format_identify','ctcp_reply_identify','CTCP {hilight $0} reply from {nick {format_identify $1}}: $2');
+settings_add_str('format_identify','ctcp_reply_channel_identify','CTCP {hilight $0} reply from {nick {format_identify $1}} in channel {channel $3}: $2');
+settings_add_str('format_identify','ctcp_ping_reply_identify','CTCP {hilight PING} reply from {nick {format_identify $0}}: $1.$[-3.0]2 seconds');
diff --git a/archive/.irssi/scripts/autorun/go.pl b/archive/.irssi/scripts/autorun/go.pl
new file mode 100644
index 00000000..b656a0fc
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/go.pl
@@ -0,0 +1,59 @@
+use strict;
+use vars qw($VERSION %IRSSI);
+use Irssi;
+use Irssi::Irc;
+
+# Usage:
+# /script load go.pl
+# If you are in #irssi you can type /go #irssi or /go irssi or even /go ir ...
+# also try /go ir<tab> and /go <tab> (that's two spaces)
+
+$VERSION = '1.01';
+
+%IRSSI = (
+ authors => 'nohar',
+ contact => 'nohar@freenode',
+ name => 'go to window',
+ description => 'Implements /go command that activates a window given a name/partial name. It features a nice completion.',
+ license => 'GPLv2 or later',
+ changed => '2014-10-19'
+);
+
+sub signal_complete_go {
+ my ($complist, $window, $word, $linestart, $want_space) = @_;
+ my $channel = $window->get_active_name();
+ my $k = Irssi::parse_special('$k');
+
+ return unless ($linestart =~ /^\Q${k}\Ego\b/i);
+
+ @$complist = ();
+ foreach my $w (Irssi::windows) {
+ my $name = $w->get_active_name();
+ if ($word ne "") {
+ if ($name =~ /\Q${word}\E/i) {
+ push(@$complist, $name)
+ }
+ } else {
+ push(@$complist, $name);
+ }
+ }
+ Irssi::signal_stop();
+};
+
+sub cmd_go
+{
+ my($chan,$server,$witem) = @_;
+
+ $chan =~ s/ *//g;
+ foreach my $w (Irssi::windows) {
+ my $name = $w->get_active_name();
+ if ($name =~ /^#?\Q${chan}\E/) {
+ $w->set_active();
+ return;
+ }
+ }
+}
+
+Irssi::command_bind("go", "cmd_go");
+Irssi::signal_add_first('complete word', 'signal_complete_go');
+
diff --git a/archive/.irssi/scripts/autorun/hilightwin.pl b/archive/.irssi/scripts/autorun/hilightwin.pl
new file mode 100644
index 00000000..d735e1b7
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/hilightwin.pl
@@ -0,0 +1,59 @@
+#
+# Print hilighted messages & private messages to window named "hilight" for
+# irssi 0.7.99 by Timo Sirainen
+#
+# Modded a tiny bit by znx to stop private messages entering the hilighted
+# window (can be toggled) and to put up a timestamp.
+#
+
+use strict;
+use Irssi;
+use POSIX;
+use vars qw($VERSION %IRSSI);
+
+$VERSION = "0.03";
+%IRSSI = (
+ authors => "Timo \'cras\' Sirainen, Mark \'znx\' Sangster",
+ contact => "tss\@iki.fi, znxster\@gmail.com",
+ name => "hilightwin",
+ description => "Print hilighted messages to window named \"hilight\"",
+ license => "Public Domain",
+ url => "http://irssi.org/",
+ changed => "Sun May 25 18:59:57 BST 2008"
+);
+
+sub sig_printtext {
+ my ($dest, $text, $stripped) = @_;
+
+ my $opt = MSGLEVEL_HILIGHT;
+
+ if(Irssi::settings_get_bool('hilightwin_showprivmsg')) {
+ $opt = MSGLEVEL_HILIGHT|MSGLEVEL_MSGS;
+ }
+
+ if(
+ ($dest->{level} & ($opt)) &&
+ ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0
+ ) {
+ my $window = Irssi::window_find_name('hilight');
+
+ if ($dest->{level} & MSGLEVEL_PUBLIC) {
+ $text = $dest->{target}.": ".$text;
+ }
+ $text = strftime(
+ Irssi::settings_get_str('timestamp_format')." ",
+ localtime
+ ).$text;
+ $text =~ s/%/%%/g;
+ $window->print($text, MSGLEVEL_NEVER) if ($window);
+ }
+}
+
+my $window = Irssi::window_find_name('hilight');
+Irssi::print("Create a window named 'hilight'") if (!$window);
+
+Irssi::settings_add_bool('hilightwin','hilightwin_showprivmsg',1);
+
+Irssi::signal_add('print text', 'sig_printtext');
+
+# vim:set ts=4 sw=4 et:
diff --git a/archive/.irssi/scripts/autorun/trackbar.pl b/archive/.irssi/scripts/autorun/trackbar.pl
new file mode 100644
index 00000000..ee660910
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/trackbar.pl
@@ -0,0 +1,408 @@
+# trackbar.pl
+#
+# Track what you read last when switching to a window.
+#
+# Copyright (C) 2003 Peter Leurs
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# This little script will do just one thing: it will draw a line each time you
+# switch away from a window. This way, you always know just upto where you've
+# been reading that window :) It also removes the previous drawn line, so you
+# don't see double lines.
+#
+# Usage:
+#
+# The script works right out of the box, but if you want you can change
+# the working by /set'ing the following variables:
+#
+# trackbar_string The characters to repeat to draw the bar
+# "---" => U+2500 => a line
+# "===" => U+2550 => a double line
+# "___" => U+2501 => a wide line
+# "# #" => U+25ad.U+0020 => a white rectangle and a space
+# trackbar_style The style for the bar, %r is red for example
+# See formats.txt that came with irssi
+# trackbar_hide_windows Comma seperated list of window names where the
+# trackbar should not be drawn.
+# trackbar_timestamp Prints a timestamp at the start of the bar
+# trackbar_timestamp_styled When enabled, the timestamp respects
+# trackbar_style
+#
+# /tb or /tb scroll is a command that will scroll to trackbar.
+#
+# /tb mark is a command that will redraw the line at the bottom. However!
+# This requires irssi version after 20021228. otherwise you'll get the
+# error redraw: unknown command, and your screen is all goofed up :)
+#
+# /upgrade & buf.pl notice: This version tries to remove the trackbars
+# before the upgrade is done, so buf.pl does not restore them, as they are
+# not removeable afterwards by trackbar. Unfortunately, to make this work,
+# trackbar and buf.pl need to be loaded in a specific order. Please
+# experiment to see which order works for you (strangely, it differs from
+# configuration to configuration, something I will try to fix in a next
+# version)
+#
+# Authors:
+# - Main maintainer & author: Peter 'kinlo' Leurs
+# - Many thanks to Timo 'cras' Sirainen for placing me on my way
+# - on-upgrade-remove-line patch by Uwe Dudenhoeffer
+# - trackbar resizing by Michiel Holtkamp (02 Jul 2012)
+# - scroll to trackbar, window excludes, and timestamp options by Nico R.
+# Wohlgemuth (22 Sep 2012)
+#
+# Version history:
+# 1.9: - add version guard
+# 1.8: - sub draw_bar
+# 1.7: - Added /tb scroll, trackbar_hide_windows, trackbar_timestamp_timestamp
+# and trackbar_timestamp_styled
+# 1.6: - Work around Irssi resize bug, please do /upgrade! (see below)
+# 1.5: - Resize trackbars in all windows when terminal is resized
+# 1.4: - Changed our's by my's so the irssi script header is valid
+# - Removed utf-8 support. In theory, the script should work w/o any
+# problems for utf-8, just set trackbar_string to a valid utf-8 character
+# and everything *should* work. However, this script is being plagued by
+# irssi internal bugs. The function Irssi::settings_get_str does NOT handle
+# unicode strings properly, hence you will notice problems when setting the bar
+# to a unicode char. For changing your bar to utf-8 symbols, read the line sub.
+# 1.3: - Upgrade now removes the trackbars.
+# - Some code cleanups, other defaults
+# - /mark sets the line to the bottom
+# 1.2: - Support for utf-8
+# - How the bar looks can now be configured with trackbar_string
+# and trackbar_style
+# 1.1: - Fixed bug when closing window
+# 1.0: - Initial release
+#
+# Contacts
+# https://github.com/mjholtkamp/irssi-trackbar
+#
+# Known bugs:
+# - if you /clear a window, it will be uncleared when returning to the window
+# - changing the trackbar style is only visible after returning to a window
+# however, changing style/resize takes in effect after you left the window.
+#
+# Whishlist/todo:
+# - instead of drawing a line, just invert timestamp or something,
+# to save a line (but I don't think this is possible with current irssi)
+# - <@coekie> kinlo: if i switch to another window, in another split window, i
+# want the trackbar to go down in the previouswindow in that splitwindow :)
+# - < bob_2> anyway to clear the line once the window is read?
+#
+# BTW: when you have feature requests, mailing a patch that works is the fastest way
+# to get it added :p
+
+# IRSSI RESIZE BUG:
+# when resizing from a larger window to a smaller one, the width of the
+# trackbar causes some lines at the bottom not to be shown. This only happens
+# if the trackbar was not the last line. This glitch can be 'fixed' by
+# resetting the trackbar to the last line (e.g. by switching to another window
+# and back) and then resize twice (e.g. to a bigger size and back). Of course,
+# this is not convenient for the user.
+# This script works around this problem by printing not one, but two lines and
+# then removing the second line. My guess is that irssi does something to the
+# previous line (or the line cache) whenever a line is 'completed' (i.e. the
+# EOL is sent). When only one line is printed, it is not 'completed', but when
+# printing the second line, the first line is 'completed'. The second line is
+# still not completed, but since we delete it straight away, it doesn't matter.
+#
+# Some effects from older versions (<1.6) of trackbar.pl can still screw up your
+# buffer so we recommend to restart your irssi, or do an "/upgrade". After
+# installing this version of trackbar.pl
+
+use strict;
+use 5.6.1;
+use Irssi 20140701;
+use Irssi::TextUI;
+use POSIX qw(strftime);
+use utf8;
+
+our $VERSION = "1.9";
+
+our %IRSSI = (
+ authors => "Peter 'kinlo' Leurs, Uwe Dudenhoeffer, " .
+ "Michiel Holtkamp, Nico R. Wohlgemuth",
+ contact => "irssi-trackbar\@supermind.nl",
+ name => "trackbar",
+ description => "Shows a bar where you've last read a window",
+ license => "GPLv2",
+ url => "http://github.com/mjholtkamp/irssi-trackbar/",
+ changed => "2015-01-15 08:00",
+);
+
+my %config;
+
+my $screen_resizing = 0; # terminal is being resized
+
+# This could be '(status)' if you want to hide the status window
+Irssi::settings_add_str('trackbar', 'trackbar_hide_windows' => '');
+$config{'trackbar_hide_windows'} = Irssi::settings_get_str('trackbar_hide_windows');
+
+Irssi::settings_add_str('trackbar', 'trackbar_string' => '-');
+$config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string');
+
+Irssi::settings_add_str('trackbar', 'trackbar_style' => '%K');
+$config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style');
+
+Irssi::settings_add_bool('trackbar', 'trackbar_timestamp' => 0);
+$config{'trackbar_timestamp'} = Irssi::settings_get_bool('trackbar_timestamp');
+
+Irssi::settings_add_bool('trackbar', 'trackbar_timestamp_styled' => 1);
+$config{'trackbar_timestamp_styled'} = Irssi::settings_get_bool('trackbar_timestamp_styled');
+
+$config{'timestamp_format'} = Irssi::settings_get_str('timestamp_format');
+
+Irssi::signal_add(
+ 'setup changed' => sub {
+ $config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string');
+ $config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style');
+ $config{'trackbar_hide_windows'} = Irssi::settings_get_str('trackbar_hide_windows');
+ $config{'trackbar_timestamp'} = Irssi::settings_get_bool('trackbar_timestamp');
+ $config{'trackbar_timestamp_styled'} = Irssi::settings_get_bool('trackbar_timestamp_styled');
+ $config{'timestamp_format'} = Irssi::settings_get_str('timestamp_format');
+ if ($config{'trackbar_style'} =~ /(?<!%)[^%]|%%|%$/) {
+ Irssi::print(
+ "trackbar: %RWarning!%n 'trackbar_style' seems to contain "
+ . "printable characters. Only use format codes (read "
+ . "formats.txt).", MSGLEVEL_CLIENTERROR);
+ }
+ }
+);
+
+Irssi::signal_add(
+ 'window changed' => sub {
+ my (undef, $oldwindow) = @_;
+
+ draw_bar($oldwindow);
+ }
+);
+
+# handel the line creation and the removing of the old lines
+sub draw_bar ($) {
+ (my $window) = @_;
+ if ($window) {
+ my $line = $window->view()->get_bookmark('trackbar');
+
+ if (defined $line) {
+ $window->view()->remove_line($line);
+ $window->view()->redraw();
+ }
+
+ my $hidden =$config{'trackbar_hide_windows'};
+ my $wname =$window->{'name'};
+
+ if ($wname eq "" || $hidden !~ $wname) {
+ $window->print(line($window->{'width'}), MSGLEVEL_NEVER);
+ $window->view()->set_bookmark_bottom('trackbar');
+ }
+ }
+}
+
+# terminal resize code inspired on nicklist.pl
+sub sig_terminal_resized {
+ if ($screen_resizing) {
+ # prevent multiple resize_trackbars from running
+ return;
+ }
+ $screen_resizing = 1;
+ Irssi::timeout_add_once(10,\&resize_trackbars,[]);
+}
+
+sub resize_trackbars {
+ my $active_win = Irssi::active_win();
+ for my $window (Irssi::windows) {
+ next unless defined $window;
+ my $line = $window->view()->get_bookmark('trackbar');
+ next unless defined $line;
+
+ # first add new trackbar line, then remove the old one. For some reason
+ # this works better than removing the old one, then adding a new one
+ $window->print_after($line, MSGLEVEL_NEVER, line($window->{'width'}));
+ my $next = $line->next();
+ $window->view()->set_bookmark('trackbar', $next);
+ $window->view()->remove_line($line);
+
+ # This hack exists to work around a bug: see IRSSI RESIZE BUG above.
+ # Add a line after the trackbar and delete it immediately
+ $window->print_after($next, MSGLEVEL_NEVER, line(1));
+ $window->view()->remove_line($next->next);
+ }
+ $active_win->view()->redraw();
+ $screen_resizing = 0;
+}
+
+Irssi::signal_add('terminal resized' => \&sig_terminal_resized);
+
+sub line {
+ my $width = shift;
+ my $string = $config{'trackbar_string'};
+
+ my $tslen = 0;
+
+ if ($config{'trackbar_timestamp'}) {
+ $tslen = int(1 + length $config{'timestamp_format'});
+ }
+
+ if (!defined($string) || $string eq '') {
+ $string = '-';
+ }
+
+ # There is a bug in (irssi's) utf-8 handling on config file settings, as you
+ # can reproduce/see yourself by the following code sniplet:
+ #
+ # my $quake = pack 'U*', 8364; # EUR symbol
+ # Irssi::settings_add_str 'temp', 'temp_foo' => $quake;
+ # $a= length($quake);
+ # # $a => 1
+ # $a= length(Irssi::settings_get_str 'temp_foo');
+ # # $a => 3
+ # $a= utf8::is_utf8(Irssi::settings_get_str 'temp_foo');
+ # # $a => false
+
+ utf8::decode($string);
+
+ if ($string =~ m/---/) {
+ $string = pack('U*', 0x2500);
+ }
+
+ if ($string =~ m/===/) {
+ $string = pack('U*', 0x2550);
+ }
+
+ if ($string =~ m/___/) {
+ $string = pack('U*', 0x2501);
+ }
+
+ if ($string =~ m/# #/) {
+ $string = pack('U*', 0x25ad)." ";
+ }
+
+ my $length = length $string;
+
+ my $times = $width / $length - $tslen;
+ $times = int(1 + $times) if $times != int($times);
+ $string =~ s/%/%%/g;
+
+ if ($tslen) {
+ # why $config{'timestamp_format'} won't work here?
+ my $ts = strftime(Irssi::settings_get_str('timestamp_format')." ", localtime);
+
+ if ($config{'trackbar_timestamp_styled'}) {
+ return $config{'trackbar_style'} . $ts . substr($string x $times, 0, $width);
+ } else {
+ return $ts . $config{'trackbar_style'} . substr($string x $times, 0, $width);
+ }
+ } else {
+ return $config{'trackbar_style'} . substr($string x $times, 0, $width);
+ }
+}
+
+# Remove trackbars on upgrade - but this doesn't really work if the scripts are not loaded in the correct order... watch out!
+
+Irssi::signal_add_first('session save' => sub {
+ for my $window (Irssi::windows) {
+ next unless defined $window;
+ my $line = $window->view()->get_bookmark('trackbar');
+ $window->view()->remove_line($line) if defined $line;
+ }
+}
+);
+
+sub cmd_mark {
+ my $window = Irssi::active_win();
+
+ draw_bar($window);
+}
+
+
+# mark all visible windows with a line
+sub cmd_mark_visual {
+ my $w= Irssi::active_win();
+ my $refs =$w->{refnum};
+ my $refa;
+
+ cmd_mark();
+
+ do {
+ Irssi::command('window down');
+ $w= Irssi::active_win();
+ $refa =$w->{refnum};
+
+ if ($refs != $refa) {
+ cmd_mark();
+ }
+
+ } while ($refs != $refa)
+}
+
+# /tb or /trackbar
+sub cmd_tb {
+ if ($#_ >=0 ) {
+ my $sc = shift @_;
+ $sc =~ s/\s+$//;
+
+ if ($sc eq "mark") {
+ cmd_mark();
+ } elsif ($sc eq "help") {
+ cmd_help("trackbar");
+ } elsif ($sc eq "vmark") {
+ cmd_mark_visual();
+ } else {
+ cmd_scroll();
+ }
+ }
+}
+
+sub cmd_scroll {
+ my $window = Irssi::active_win();
+ my $line = $window->view()->get_bookmark('trackbar');
+ $window->view()->scroll_line($line) if defined $line;
+}
+
+sub cmd_help {
+ my $help = <<HELP;
+/trackbar or /tb
+ /tb mark
+ - Set the trackbar of the current window at the bottom
+ /tb vmark
+ - Set the trackbar on all visible windows
+ /tb scroll
+ - Scroll to where the trackbar is right now
+ /tb help
+ - this help
+ /tb
+ - Same as /tb scroll
+HELP
+ if ($_[0] =~ m/^tb/ or $_[0] =~ m/^trackbar/ ) {
+ Irssi::print($help, MSGLEVEL_CLIENTCRAP);
+ Irssi::signal_stop;
+ }
+}
+
+Irssi::command_bind('tb', 'cmd_tb');
+Irssi::command_bind('tb help', 'cmd_tb');
+Irssi::command_bind('tb mark', 'cmd_tb');
+Irssi::command_bind('tb scroll', 'cmd_tb');
+Irssi::command_bind('tb vmark', 'cmd_tb');
+
+Irssi::command_bind('trackbar', 'cmd_tb');
+Irssi::command_bind('trackbar help', 'cmd_tb');
+Irssi::command_bind('trackbar mark', 'cmd_tb');
+Irssi::command_bind('trackbar scroll', 'cmd_tb');
+Irssi::command_bind('trackbar vmark', 'cmd_tb');
+
+Irssi::command_bind('mark', 'cmd_mark');
+#Irssi::command_bind('scroll', 'cmd_scroll');
+Irssi::command_bind('help', 'cmd_help');
diff --git a/archive/.irssi/scripts/autorun/winnum.pl b/archive/.irssi/scripts/autorun/winnum.pl
new file mode 100644
index 00000000..e9ed0bc3
--- /dev/null
+++ b/archive/.irssi/scripts/autorun/winnum.pl
@@ -0,0 +1,41 @@
+#
+# winnum.pl
+# Goto a window by its reference number with /##
+#
+#
+# Commands:
+# /<window #> Go to window
+#
+
+use strict;
+use vars qw($VERSION %IRSSI);
+
+$VERSION = '1.0.0';
+%IRSSI = (
+ authors => 'Trevor "tee" Slocum',
+ contact => 'tslocum@gmail.com',
+ name => 'WinNum',
+ description => 'Goto a window by its reference number with /##',
+ license => 'GPLv3',
+ url => 'https://github.com/tslocum/irssi-scripts',
+ changed => '2014-05-01'
+);
+
+sub winnum_default_command {
+ my ($command, $server) = @_;
+
+ $command =~ s/^\s+//;
+ $command =~ s/\s+$//;
+ my $winnum = ($command =~ /(\w+)/)[0];
+
+ if ($winnum =~ /^\d+$/) {
+ my $window = Irssi::window_find_refnum($winnum);
+ $window->set_active if $window;
+
+ Irssi::signal_stop();
+ }
+}
+
+Irssi::signal_add_first("default command", "winnum_default_command");
+
+print $IRSSI{name} . ': v' . $VERSION . ' loaded. Enter %9/<window #>%9 to goto a window.';