From f20ab72edf4d214a8dcdadf55a559863d53fd345 Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Thu, 24 Apr 2014 18:20:18 -0700 Subject: [PATCH] super basic irssi config --- irssi-files/scripts/adv_windowlist.pl | 1916 +++++++++++++++++++++++++ irssi-files/scripts/nicklist.pl | 611 ++++++++ irssi-files/scripts/splitlong.pl | 60 + irssi-files/scripts/xchatnickcolor.pl | 160 +++ irssi-files/themes/xchat.theme | 465 ++++++ 5 files changed, 3212 insertions(+) create mode 100644 irssi-files/scripts/adv_windowlist.pl create mode 100644 irssi-files/scripts/nicklist.pl create mode 100644 irssi-files/scripts/splitlong.pl create mode 100644 irssi-files/scripts/xchatnickcolor.pl create mode 100644 irssi-files/themes/xchat.theme diff --git a/irssi-files/scripts/adv_windowlist.pl b/irssi-files/scripts/adv_windowlist.pl new file mode 100644 index 0000000..7b1a988 --- /dev/null +++ b/irssi-files/scripts/adv_windowlist.pl @@ -0,0 +1,1916 @@ +use strict; +use warnings; +no warnings 'redefine'; +use constant IN_IRSSI => __PACKAGE__ ne 'main' || $ENV{IRSSI_MOCK}; +no if !IN_IRSSI, strict => (qw(subs refs)); +use if IN_IRSSI, Irssi => (); +use if IN_IRSSI, 'Irssi::TextUI' => (); +use v5.10; +use Encode; + +our $VERSION = '0.8b3'; +our %IRSSI = ( + authors => 'Nei', + contact => 'Nei @ anti@conference.jabber.teamidiot.de', + url => "http://anti.teamidiot.de/", + name => 'awl', + description => 'Adds a permanent advanced window list on the right or in a statusbar.', + license => 'GNU GPLv2 or later', + ); + +# UPGRADE NOTE +# ============ +# for users of 0.7 or earlier series, please note that appearance +# settings have moved to /format, i.e. inside your theme! +# the fifo (screen) has been replaced by an external viewer script + +# Usage +# ===== +# copy the script to ~/.irssi/scripts/ +# +# In irssi: +# +# /run adv_windowlist +# +# In your shell (for example a tmux split): +# +# perl ~/.irssi/scripts/adv_windowlist.pl +# +# To use sbar mode instead: +# +# /toggle awl_viewer +# +# Hint: to get rid of the old [Act:] display +# /statusbar window remove act +# +# to get it back: +# /statusbar window add -after lag -priority 10 act + +# Options +# ======= +# /format awl_display_(no)key(_active|_visible) +# * string : Format String for one window. The following $'s are expanded: +# $C : Name +# $N : Number of the Window +# $Q : meta-Keymap +# $H : Start highlighting +# $S : Stop highlighting +# /+++++++++++++++++++++++++++++++++, +# | **** I M P O R T A N T : **** | +# | | +# | don't forget to use $S if you | +# | used $H before! | +# | | +# '+++++++++++++++++++++++++++++++++/ +# +# /format awl_display_header +# * string : Format String for this header line. The following $'s are expanded: +# $C : network tag +# +# /format awl_separator +# * string : Charater to use between the channel entries +# +# /format awl_viewer_item_bg +# * string : Format String specifying the viewer's item background colour +# +# /set awl_prefer_name +# * this setting decides whether awl will use the active_name (OFF) or the +# window name as the name/caption in awl_display_*. +# That way you can rename windows using /window name myownname. +# +# /set awl_hide_empty +# * if visible windows without items should be hidden from the window list +# set it to 0 to show all windows +# 1 to hide visible windows without items (negative exempt active window) +# +# /set awl_hide_data +# * num : hide the window if its data_level is below num +# set it to 0 to basically disable this feature, +# 1 if you don't want windows without activity to be shown +# 2 to show only those windows with channel text or hilight +# 3 to show only windows with hilight (negative exempt active window) +# +# /set awl_hide_name_data +# * num : hide the name of the window if its data_level is below num +# (only works in status bar without block display) +# you will want to change your formats to add $H...$S around $Q or $N +# if you plan to use this +# +# /set awl_maxlines +# * num : number of lines to use for the window list (0 to disable, negative +# lock) +# +# /set awl_block +# * num : width of a column in viewer mode (negative values = block display) +# /+++++++++++++++++++++++++++++++++, +# | ****** W A R N I N G ! ****** | +# | | +# | If your block display looks | +# | DISTORTED, you need to add the | +# | following line to your .theme | +# | file under | +# | abstracts = { : | +# | | +# | sb_act_none = "%K$*"; | +# | | +# '+++++++++++++++++++++++++++++++++/ +# +# /set awl_sbar_maxlength +# * if you enable the maxlength setting, the block width will be used as a +# maximum length for the non-block statusbar mode too. +# +# /set awl_height_adjust +# * num : how many lines to leave empty in viewer mode +# +# /set awl_sort <-data_level|-last_line|refnum> +# * you can change the window sort order with this variable +# -data_level : sort windows with hilight first +# -last_line : sort windows in order of activity +# refnum : sort windows by window number +# +# /set awl_placement +# /set awl_position +# * these settings correspond to /statusbar because awl will create +# statusbars for you +# (see /help statusbar to learn more) +# +# /set awl_all_disable +# * if you set awl_all_disable to ON, awl will also remove the +# last statusbar it created if it is empty. +# As you might guess, this only makes sense with awl_hide_data > 0 ;) +# +# /set awl_viewer +# * enable the external viewer script +# +# /set awl_path +# * path to the file which the viewer script reads +# +# /set fancy_abbrev +# * how to shorten too long names +# no : shorten in the middle +# head : always cut off the ends +# strict : shorten repeating substrings +# fancy : combination of no+strict +# +# /set awl_custom_xform +# * specify a custom routine to transform window names +# example: s/^#// remove the #-mark of IRC channels +# +# /set awl_last_line_shade +# * set timeout to shade activity base colours, to enable +# you also need to add +-last_line to awl_sort +# (requires 256 colour support) +# +# /set awl_mouse +# * enable the terminal mouse in irssi +# +# /set awl_mouse_offset +# * specifies where on the screen is the awl statusbar +# (0 = on top/bottom, 1 = one additional line in between, +# e.g. prompt) +# you MUST set this correctly otherwise the mouse coordinates will +# be off +# +# /set mouse_scroll +# * how many lines the mouse wheel scrolls +# +# /set mouse_escape +# * seconds to disable the mouse, when not clicked on the windowlist +# + +# Commands +# ======== +# /awl redraw +# * redraws the windowlist. There may be occasions where the +# windowlist can get destroyed so you can use this command to +# force a redraw. + +# Nei =^.^= ( anti@conference.jabber.teamidiot.de ) + +use Storable (); +use IO::Socket::UNIX; + +unless (IN_IRSSI) { + local *_ = \@ARGV; + &AwlViewer::main; + exit; +} + + +use constant GLOB_QUEUE_TIMER => 100; + +our $BLOCK_ALL; # localized blocker +my @actString; # statusbar texts +my @win_items; +my $currentLines = 0; +my %awins; +my $globTime; # timer to limit remake calls + +my %CHANGED; +my $VIEWER_MODE; +my $MOUSE_ON; +my %mouse_coords; +my %statusbars; +my %S; # settings +my $settings_str = ''; +my $window_sort_func; +my $custom_xform; +my ($sb_base_width, $sb_base_width_pre, $sb_base_width_post); +my $print_text_activity; +my $shade_line_timer; +my ($screenHeight, $screenWidth); +my %viewer; + +my (%keymap, %nummap, %wnmap, %specialmap, %wnmap_exp, %custom_key_map); +my %banned_channels; +my %abbrev_cache; + +sub setc () { + $IRSSI{name} +} + +sub set ($) { + setc . '_' . $_[0] +} + +sub add_statusbar { + for (@_) { + # add subs + my $l = set $_; + { + my $close = $_; + no strict 'refs'; + *{$l} = sub { awl($close, @_) }; + } + Irssi::command("statusbar $l reset"); + Irssi::command("statusbar $l enable"); + if (lc $S{placement} eq 'top') { + Irssi::command("statusbar $l placement top"); + } + if (my $x = $S{position}) { + Irssi::command("statusbar $l position $x"); + } + Irssi::command("statusbar $l add -priority 100 -alignment left barstart"); + Irssi::command("statusbar $l add $l"); + Irssi::command("statusbar $l add -priority 100 -alignment right barend"); + Irssi::command("statusbar $l disable"); + Irssi::statusbar_item_register($l, '$0', $l); + $statusbars{$_} = 1; + Irssi::command("statusbar $l enable"); + } +} + +sub remove_statusbar { + for (@_) { + my $l = set $_; + Irssi::command("statusbar $l disable"); + Irssi::command("statusbar $l reset"); + Irssi::statusbar_item_unregister($l); + { + no strict 'refs'; + undef &{$l}; + } + delete $statusbars{$_}; + } +} + + +sub syncLines { + my $maxLines = $S{maxlines}; + my $newLines = ($maxLines > 0 and @actString > $maxLines) ? + $maxLines : + ($maxLines < 0) ? + -$maxLines : + @actString; + if ($currentLines == $newLines) { return; } + elsif ($newLines > $currentLines) { + add_statusbar ($currentLines .. ($newLines - 1)); + } + else { + remove_statusbar (reverse ($newLines .. ($currentLines - 1))); + } + $currentLines = $newLines; +} + +sub awl { + return if $BLOCK_ALL; + my ($line, $item, $get_size_only) = @_; + + my $text = $actString[$line]; + my $pat = defined $text ? '{sb $*}' : '{sb }'; + $text //= ''; + $item->default_handler($get_size_only, $pat, $text, 0); +} + +# remove old statusbars +{ my %killBar; + sub get_old_status { + my ($textDest, $cont, $cont_stripped) = @_; + if ($textDest->{level} == 524288 and $textDest->{target} eq '' and !defined $textDest->{server}) { + my $name = quotemeta(set ''); + if ($cont_stripped =~ m/^$name(\d+)\s/) { $killBar{$1} = 1; } + Irssi::signal_stop; + } + } + sub killOldStatus { + %killBar = (); + Irssi::signal_add_first('print text' => 'get_old_status'); + Irssi::command('statusbar'); + Irssi::signal_remove('print text' => 'get_old_status'); + remove_statusbar(keys %killBar); + } +} + +sub get_keymap { + my ($textDest, undef, $cont_stripped) = @_; + if ($textDest->{level} == 524288 and $textDest->{target} eq '' and !defined $textDest->{server}) { + my $one_meta_or_ctrl_key = qr/((?:meta-)*?)(?:(meta-|\^)(\S)|(\w+))/; + $cont_stripped = as_uni($cont_stripped); + if ($cont_stripped =~ m/((?:$one_meta_or_ctrl_key-)*$one_meta_or_ctrl_key)\s+(.*)$/) { + my ($combo, $command) = ($1, $10); + my $map = ''; + while ($combo =~ s/(?:-|^)$one_meta_or_ctrl_key$//) { + my ($level, $ctl, $key, $nkey) = ($1, $2, $3, $4); + my $numlevel = ($level =~ y/-//); + $ctl = '' if !$ctl || $ctl ne '^'; + $map = ('-' x ($numlevel%2)) . ('+' x ($numlevel/2)) . + $ctl . (defined $key ? $key : "\01$nkey\01") . $map; + } + for ($command) { + last unless length $map; + if (/^change_window (\d+)/i) { + $nummap{$1} = $map; + } + elsif (/^command window goto (\S+)/i) { + my $window = $1; + if ($window !~ /\D/) { + $nummap{$window} = $map; + } + elsif (lc $window eq 'active') { + $specialmap{_active} = $map; + } + else { + $wnmap{$window} = $map; + } + } + elsif (/^(?:active_window|command (ack))/i) { + $specialmap{_active} = $map; + $viewer{use_ack} = !!$1; + } + elsif (/^command window last/i) { + $specialmap{_last} = $map; + } + elsif (/^(?:upper_window|command window up)/i) { + $specialmap{_up} = $map; + } + elsif (/^(?:lower_window|command window down)/i) { + $specialmap{_down} = $map; + } + elsif (/^key\s+(\w+)/i) { + $custom_key_map{$1} = $map; + } + } + } + Irssi::signal_stop; + } +} + +sub update_keymap { + %nummap = %wnmap = %specialmap = %custom_key_map = (); + Irssi::signal_remove('command bind' => 'watch_keymap'); + Irssi::signal_add_first('print text' => 'get_keymap'); + Irssi::command('bind'); + Irssi::signal_remove('print text' => 'get_keymap'); + for (keys %custom_key_map) { + if (exists $custom_key_map{$_} && + $custom_key_map{$_} =~ s/\01(\w+)\01/exists $custom_key_map{$1} ? $custom_key_map{$1} : "\02"/ge) { + if ($custom_key_map{$_} =~ /\02/) { + delete $custom_key_map{$_}; + } + else { + redo; + } + } + } + for my $keymap (\(%specialmap, %wnmap, %nummap)) { + for (keys %$keymap) { + if ($keymap->{$_} =~ s/\01(\w+)\01/exists $custom_key_map{$1} ? $custom_key_map{$1} : "\02"/ge) { + if ($keymap->{$_} =~ /\02/) { + delete $keymap->{$_}; + } + } + } + } + Irssi::signal_add('command bind' => 'watch_keymap'); + delete $viewer{client_keymap}; + &wl_changed; +} + +# watch keymap changes +sub watch_keymap { + Irssi::timeout_add_once(1000, 'update_keymap', undef); +} + +{ my %strip_table = ( + # fe-common::core::formats.c:format_expand_styles + # delete format_backs format_fores bold_fores other stuff + (map { $_ => '' } (split //, '04261537' . 'kbgcrmyw' . 'KBGCRMYW' . 'U9_8:|FnN>#[')), + # escape + (map { $_ => $_ } (split //, '{}%')), + ); + sub ir_strip_codes { # strip %codes + my $o = shift; + $o =~ s/(%(%|Z.{6}|z.{6}|X..|x..|.))/exists $strip_table{$2} ? $strip_table{$2} : + $2 =~ m{x(?:0[a-f]|[1-6][0-9a-z]|7[a-x])|z[0-9a-f]{6}}i ? '' : $1/gex; + $o + } +} +## ir_parse_special -- wrapper around parse_special +## $i - input format +## $args - array ref of arguments to format +## $win - different target window (default current window) +## $flags - different kind of escape flags (default 4|8) +## returns formatted str +sub ir_parse_special { + my $o; + my $i = shift; + my $args = shift // []; + y/ /\177/ for @$args; # hack to escape spaces + my $win = shift || Irssi::active_win; + my $flags = shift // 0x4|0x8; + my @cmd_args = ($i, (join ' ', @$args), $flags); + my $server = Irssi::active_server(); + if (ref $win and ref $win->{active}) { + # irssi XS oddity: only takes scalar parameters + $o = $win->{active}->parse_special($cmd_args[0], $cmd_args[1], $cmd_args[2]); + } + elsif (ref $win and ref $win->{active_server}) { + $o = $win->{active_server}->parse_special($cmd_args[0], $cmd_args[1], $cmd_args[2]); + } + elsif (ref $server) { + $o = $server->parse_special($cmd_args[0], $cmd_args[1], $cmd_args[2]); + } + else { + $o = Irssi::parse_special($cmd_args[0], $cmd_args[1], $cmd_args[2]); + } + $o =~ y/\177/ /; + $o +} + +sub sb_format_expand { # Irssi::current_theme->format_expand wrapper + Irssi::current_theme->format_expand( + $_[0], + ( + Irssi::EXPAND_FLAG_IGNORE_REPLACES + | + ($_[1] ? 0 : Irssi::EXPAND_FLAG_IGNORE_EMPTY) + ) + ) +} + +{ my $term_type = Irssi::version > 20040819 ? 'term_charset' : 'term_type'; + eval { require Text::CharWidth; }; + unless ($@) { + *screen_length = sub { Text::CharWidth::mbswidth($_[0]) }; + } + else { + my $err = $@; chomp $err; $err =~ s/\sat .* line \d+\.$//; + #Irssi::print("%_$IRSSI{name}: warning:%_ Text::CharWidth module failed to load. Length calculation may be off! Error was:"); + print "%_$IRSSI{name}:%_ $err"; + *screen_length = sub { + my $temp = shift; + if (lc Irssi::settings_get_str($term_type) eq 'utf-8') { + Encode::_utf8_on($temp); + } + length($temp) + }; + } + sub as_uni { + no warnings 'utf8'; + Encode::decode(Irssi::settings_get_str($term_type), $_[0], 0) + } + sub as_tc { + Encode::encode(Irssi::settings_get_str($term_type), $_[0], 0) + } +} + +sub sb_length { + screen_length(ir_strip_codes($_[0])) +} + +sub remove_uniform { + my $o = shift; + $o =~ s/^xmpp:(.*?[%@]).+\.[^.]+$/$1/ or + $o =~ s#^psyc://.+\.[^.]+/([@~].*)$#$1#; + if ($custom_xform) { + $custom_xform->() for $o; + } + $o +} + +sub lc1459 { + my $x = shift; + $x =~ y/][\\^/}{|~/; + lc $x +} + +sub window_list { + sort $window_sort_func Irssi::windows; +} + +sub _calculate_abbrev { + my ($wins, $abbrevList) = @_; + if ($S{fancy_abbrev} !~ /^(no|off|head)/i) { + my @nameList = map { ref $_ ? remove_uniform(as_uni($_->get_active_name) // '') : '' } @$wins; + for (my $i = 0; $i < @nameList - 1; ++$i) { + my ($x, $y) = ($nameList[$i], $nameList[$i + 1]); + s/^[+#!=]// for $x, $y; + my $res = exists $abbrev_cache{$x}{$y} ? $abbrev_cache{$x}{$y} + : $abbrev_cache{$x}{$y} = string_LCSS($x, $y); + if (defined $res) { + for ($nameList[$i], $nameList[$i + 1]) { + $abbrevList->{$_} //= int((index $_, $res) + (length $res) / 2); + } + } + } + } +} + +my %act_last_line_shades = ( + r => [qw[ 50 40 30 20 ]], + g => [qw[ 1O 1I 1C 16 ]], + y => [qw[ 5O 4I 3C 26 ]], + b => [qw[ 15 14 13 12 ]], + m => [qw[ 54 43 32 21 ]], + c => [qw[ 1S 1L 1E 17 ]], + w => [qw[ 7W 7T 7Q 3E ]], + K => [qw[ 7M 7K 27 7H ]], + R => [qw[ 60 50 40 30 ]], + G => [qw[ 1U 1O 1I 1C ]], + Y => [qw[ 6U 5O 4I 3C ]], + B => [qw[ 2B 2A 29 28 ]], + M => [qw[ 65 54 43 32 ]], + C => [qw[ 1Z 1S 1L 1E ]], + W => [qw[ 6Z 5S 7R 7O ]], + ); + +use List::Util qw(min max); + +sub _format_display { + my ($pre, $format, $post, $hilight, $name, $number, $key, $win) = @_; + my @str = split /\177/, sb_format_expand("$pre\177$post"), 2; + my @hilight_code = split /\177/, sb_format_expand("{$hilight \177}"), 2; + if ($print_text_activity && $S{line_shade}) { + my $max_time = max(1, log($S{line_shade}) - log(1000)); + my $time_delta = min(3, min($max_time, log(max(1, time - $win->{last_line}))) / $max_time * 3); + $hilight_code[0] =~ s/%\K(.)/exists $act_last_line_shades{$1} ? 'X'.$act_last_line_shades{$1}[$time_delta] : $1/e; + } + $format =~ s<\$H((?:\$.|[^\$])*?)\$S><$hilight_code[0]$1$hilight_code[1]>g; + my %map = (C => 0, N => 1, Q => 2); + $format =~ s<\$\K(.)><$map{$1}//$1>ge; + my @ret = ir_parse_special($str[0].$format.$str[1], [$name, $number, $key], $win); + @ret +} + +sub _calculate_items { + my ($wins, $abbrevList) = @_; + + my $display_header = Irssi::current_theme->get_format(__PACKAGE__, set 'display_header'); + my %displays; + + my $active = Irssi::active_win; + @win_items = (); + %keymap = (%nummap, %wnmap_exp); + + my ($numPad, $keyPad) = (0, 0); + if ($VIEWER_MODE or $S{block} < 0) { + $numPad = length((sort { length $b <=> length $a } keys %keymap)[0]) // 0; + $keyPad = length((sort { length $b <=> length $a } values %keymap)[0]) // 0; + } + my $last_net; + for my $win (@$wins) { + my $global_hack_alert_tag_header; + + next unless ref $win; + + my $backup_win = Storable::dclone($win); + delete $backup_win->{active} unless ref $backup_win->{active}; + + $global_hack_alert_tag_header = + $display_header && ($last_net // '') ne ($backup_win->{active}{server}{tag} // ''); + + if ($win->{data_level} < abs $S{hide_data} + && ($win->{refnum} != $active->{refnum} || 0 <= $S{hide_data})) { + next; } + elsif (exists $awins{$win->{refnum}} && $S{hide_empty} && !$win->items + && ($win->{refnum} != $active->{refnum} || 0 <= $S{hide_empty})) { + next; } + + my $colour = $win->{hilight_color} // ''; + my $hilight = do { + if ($win->{data_level} == 0) { 'sb_act_none'; } + elsif ($win->{data_level} == 1) { 'sb_act_text'; } + elsif ($win->{data_level} == 2) { 'sb_act_msg'; } + elsif ($colour ne '') { "sb_act_hilight_color $colour"; } + elsif ($win->{data_level} == 3) { 'sb_act_hilight'; } + else { 'sb_act_special'; } + }; + my $number = $win->{refnum}; + + my ($name, $display); + if ($global_hack_alert_tag_header) { + $display = $display_header; + $name = as_uni($backup_win->{active}{server}{tag}) // ''; + if ($custom_xform) { + $custom_xform->() for $name; + } + } + else { + my @display = ('display_nokey'); + if (defined $keymap{$number} and $keymap{$number} ne '') { + unshift @display, map { (my $cpy = $_) =~ s/_no/_/; $cpy } @display; + } + if (exists $awins{$number}) { + unshift @display, map { my $cpy = $_; $cpy .= '_visible'; $cpy } @display; + } + if ($active->{refnum} == $number) { + unshift @display, map { my $cpy = $_; $cpy .= '_active'; $cpy } + grep { !/_visible$/ } @display; + } + $display = (grep { length $_ } + map { $displays{$_} //= Irssi::current_theme->get_format(__PACKAGE__, set $_) } + @display)[0]; + + $name = as_uni($win->get_active_name) // ''; + $name = '*' if $S{banned_on} and exists $banned_channels{lc1459($name)}; + $name = remove_uniform($name) if $name ne '*'; + $name = as_uni($win->{name}) if $name ne '*' and $win->{name} ne '' and $S{prefer_name}; + + $name = '' if !$VIEWER_MODE && $S{block} >= 0 && $S{hide_name} + && $win->{data_level} < abs $S{hide_name} + && ($win->{refnum} != $active->{refnum} || 0 <= $S{hide_data}); + } + + $display = "$display%n"; + my $num_ent = (' 'x($numPad - length $number)) . $number; + my $key_ent = exists $keymap{$number} ? ((' 'x($keyPad - length $keymap{$number})) . $keymap{$number}) : ' 'x$keyPad; + if ($VIEWER_MODE or $S{sbar_maxlen} or $S{block} < 0) { + my $baseLength = sb_length(_format_display( + '', $display, '', $hilight, + 'x', # placeholder + $num_ent, + $key_ent, + $win)) - 1; + my $diff = (abs $S{block}) - (screen_length(as_tc($name)) + $baseLength); + if ($diff < 0) { # too long + my $screen_length = screen_length(as_tc($name)); + if ((abs $diff) >= $screen_length) { $name = '' } # forget it + elsif ((abs $diff) + screen_length(as_tc(substr($name, 0, 1))) >= $screen_length) { $name = substr($name, 0, 1); } + else { + my $ulen = length $name; + my $middle2 = exists $abbrevList->{$name} ? + ($S{fancy_strict}) ? + 2* $abbrevList->{$name} : + (2*($abbrevList->{$name} + $ulen) / 3) : + ($S{fancy_head}) ? + 2*$ulen : + $ulen; + my $first = 1; + while (length $name > 1) { + my $cp = $middle2 > -1 ? $middle2/2 : -1; # check position for double width + my $rm = 2; + if (screen_length(as_tc(substr $name, $cp, 1)) > 1) { + if ($first || $cp < 0) { + $rm = 1; + $first = undef; + } + } + elsif ($cp < 0) { + --$cp; + } + (substr $name, $cp, $rm) = '~'; + if ($cp > -1 && $rm > 1) { + --$middle2; + } + my $sl = screen_length(as_tc($name)); + if ($sl + $baseLength < abs $S{block}) { + (substr $name, ($middle2+1)/2, 1) = "\x{301c}"; + last; + } + elsif ($sl + $baseLength == abs $S{block}) { + last; + } + } + } + } + elsif ($VIEWER_MODE or $S{block} < 0) { + $name .= (' ' x $diff); + } + } + + push @win_items, _format_display( + '', $display, '', $hilight, + as_tc($name), + $num_ent, + as_tc($key_ent), + $win); + + if ($global_hack_alert_tag_header) { + $last_net = $backup_win->{active}{server}{tag}; + redo; + } + + $mouse_coords{refnum}{$#win_items} = $number; + } +} + +sub _spread_items { + my $width = [Irssi::windows]->[0]{width} - $sb_base_width - 1; + my $separator = Irssi::current_theme->get_format(__PACKAGE__, set 'separator'); + $separator = "$separator%n"; + my $sepLen = sb_length($separator); + + @actString = (); + my $curLine; + my $curLen = 0; + my $mouse_header_check = 0; + for my $it (@win_items) { + my $itemLen = sb_length($it); + if ($curLen) { + if ($curLen + $itemLen + $sepLen > $width) { + push @actString, $curLine; + $curLine = undef; + $curLen = 0; + } + else { + $curLine .= $separator; + $curLen += $sepLen; + } + } + $curLine .= $it; + if (exists $mouse_coords{refnum}{$mouse_header_check}) { + $mouse_coords{scalar @actString}{ $_ } = $mouse_coords{refnum}{$mouse_header_check} + for $curLen .. $curLen + $itemLen - 1; + } + $curLen += $itemLen; + } + continue { + ++$mouse_header_check; + } + push @actString, $curLine if $curLen; +} + +sub remake { + my %abbrevList; + my @wins = window_list(); + if ($VIEWER_MODE or $S{sbar_maxlen} or $S{block} < 0) { + _calculate_abbrev(\@wins, \%abbrevList); + } + + %mouse_coords = (); + _calculate_items(\@wins, \%abbrevList); + + unless ($VIEWER_MODE) { + _spread_items(); + + push @actString, undef unless @actString || $S{all_disable}; + } +} + +sub update_wl { + return if $BLOCK_ALL; + remake(); + + Irssi::statusbar_items_redraw(set $_) for keys %statusbars; + + unless ($VIEWER_MODE) { + Irssi::timeout_add_once(100, 'syncLines', undef); + } + else { + syncViewer(); + } +} + +sub screenFullRedraw { + my ($window) = @_; + if (!ref $window or $window->{refnum} == Irssi::active_win->{refnum}) { + $viewer{fullRedraw} = 1 if $viewer{client}; + $settings_str = ''; + &setup_changed; + } +} + +sub start_viewer { + unlink $viewer{path} if -S $viewer{path} || -p _; + + $viewer{server} = IO::Socket::UNIX->new( + Type => SOCK_STREAM, + Local => $viewer{path}, + Listen => 1 + ); + unless ($viewer{server}) { + $viewer{msg} = $!; + $viewer{retry} = Irssi::timeout_add_once(5000, 'retry_viewer', 1); + return; + } + my ($name) = __PACKAGE__ =~ /::([^:]+)$/; + $viewer{server}->blocking(0); + $viewer{msg} = "Run $name from the shell or switch to sbar mode"; + $viewer{server_tag} = Irssi::input_add($viewer{server}->fileno, INPUT_READ, 'vi_connected', undef); +} + +sub retry_viewer { + start_viewer(); +} + +sub vi_close_client { + Irssi::input_remove(delete $viewer{client_tag}) if exists $viewer{client_tag}; + $viewer{client}->close if $viewer{client}; + delete $viewer{client}; + delete $viewer{client_keymap}; + delete $viewer{client_settings}; + delete $viewer{client_env}; + delete $viewer{fullRedraw}; +} + +sub vi_connected { + vi_close_client(); + $viewer{client} = $viewer{server}->accept or return; + $viewer{client}->blocking(0); + $viewer{client_tag} = Irssi::input_add($viewer{client}->fileno, INPUT_READ, 'vi_clientinput', undef); + syncViewer(); +} + +use constant VIEWER_BLOCK_SIZE => 1024; +sub vi_clientinput { + if ($viewer{client}->read(my $buf, VIEWER_BLOCK_SIZE)) { + $viewer{rcvbuf} .= $buf; + if ($viewer{rcvbuf} =~ s/^(?:(active|\d+)|(last|up|down))\n//igm) { + if (length $2) { + Irssi::command("window $2"); + } + elsif (lc $1 eq 'active' && $viewer{use_ack}) { + Irssi::command("ack"); + } + else { + Irssi::command("window goto $1"); + } + } + } + else { + vi_close_client(); + Irssi::timeout_add_once(100, 'syncViewer', undef); + } +} + +sub stop_viewer { + Irssi::timeout_remove(delete $viewer{retry}) if exists $viewer{retry}; + vi_close_client(); + Irssi::input_remove(delete $viewer{server_tag}) if exists $viewer{server_tag}; + return unless $viewer{server}; + $viewer{server}->close; + delete $viewer{server}; +} +sub _encode_var { + my $str; + while (@_) { + my ($name, $var) = splice @_, 0, 2; + my $type = ref $var ? $var =~ /HASH/ ? 'map' : $var =~ /ARRAY/ ? 'list' : '' : ''; + $str .= "\n\U$name$type\_begin\n"; + if ($type eq 'map') { + no warnings 'numeric'; + $str .= " $_\n ${$var}{$_}\n" for sort { $a <=> $b || $a cmp $b } keys %$var; + } + elsif ($type eq 'list') { + $str .= " $_\n" for @$var; + } + else { + $str .= " $var\n"; + } + $str .= "\U$name$type\_end\n"; + } + $str +} +sub syncViewer { + if ($viewer{client}) { + @actString = (); + if ($currentLines) { + killOldStatus(); + $currentLines = 0; + } + my $str; + unless ($viewer{client_keymap}) { + $str .= _encode_var('key', +{ %nummap, %specialmap }); + $viewer{client_keymap} = 1; + } + unless ($viewer{client_settings}) { + $str .= _encode_var( + block => $S{block}, + ha => $S{height_adjust}, + ); + $viewer{client_settings} = 1; + } + unless ($viewer{client_env}) { + $str .= _encode_var(irssienv => +{ + length $ENV{TMUX_PANE} && length $ENV{TMUX} ? + (tmux_pane => $ENV{TMUX_PANE}, + tmux_srv => $ENV{TMUX}) : (), + length $ENV{WINDOWID} ? + (xwinid => $ENV{WINDOWID}) : (), + }); + $viewer{client_env} = 1; + } + my $separator = Irssi::current_theme->get_format(__PACKAGE__, set 'separator'); + my $sepLen = sb_length($separator); + my $item_bg = Irssi::current_theme->get_format(__PACKAGE__, set 'viewer_item_bg'); + $str .= _encode_var(redraw => 1) if delete $viewer{fullRedraw}; + $str .= _encode_var(separator => $separator, + seplen => $sepLen, + itembg => $item_bg, + mouse => $mouse_coords{refnum}, + key2 => \%wnmap_exp, + win => \@win_items); + + my $was = $viewer{client}->blocking(1); + $viewer{client}->print($str); + $viewer{client}->blocking($was); + } + elsif ($viewer{server}) { + @actString = ((uc setc()).": $viewer{msg}"); + } + else { + @actString = ((uc setc()).": $viewer{msg}"); + } + if (@actString) { + Irssi::timeout_add_once(100, 'syncLines', undef); + } +} + +use Hash::Util qw(lock_keys); + +sub reset_awl { + Irssi::timeout_remove($shade_line_timer) if $shade_line_timer; $shade_line_timer = undef; + my $was_sort = $S{sort} // ''; + my $was_xform = $S{xform} // ''; + %S = ( + sort => Irssi::settings_get_str( set 'sort'), + fancy_abbrev => Irssi::settings_get_str('fancy_abbrev'), + xform => Irssi::settings_get_str( set 'custom_xform'), + block => Irssi::settings_get_int( set 'block'), + banned_on => Irssi::settings_get_bool('banned_channels_on'), + prefer_name => Irssi::settings_get_bool(set 'prefer_name'), + hide_data => Irssi::settings_get_int( set 'hide_data'), + hide_name => Irssi::settings_get_int( set 'hide_name_data'), + hide_empty => Irssi::settings_get_int( set 'hide_empty'), + sbar_maxlen => Irssi::settings_get_bool(set 'sbar_maxlength'), + placement => Irssi::settings_get_str( set 'placement'), + position => Irssi::settings_get_int( set 'position'), + maxlines => Irssi::settings_get_int( set 'maxlines'), + all_disable => Irssi::settings_get_bool(set 'all_disable'), + height_adjust=> Irssi::settings_get_int( set 'height_adjust'), + mouse_offset => Irssi::settings_get_int( set 'mouse_offset'), + mouse_scroll => Irssi::settings_get_int( 'mouse_scroll'), + mouse_escape => Irssi::settings_get_int( 'mouse_escape'), + line_shade => Irssi::settings_get_time(set 'last_line_shade'), + ); + $S{fancy_strict} = $S{fancy_abbrev} =~ /^strict/i; + $S{fancy_head} = $S{fancy_abbrev} =~ /^head/i; + lock_keys(%S); + if ($was_sort ne $S{sort}) { + my @sort_order = map { + /^[-!](.*)/ + ? [ -1, $1 ] + : [ 1, $_ ] + } split /\+/, $S{sort}; + $window_sort_func = sub { + no warnings qw(numeric uninitialized); + for (@sort_order) { + return ((($a->{$_->[1]} <=> $b->{$_->[1]}) * $_->[0]) || next); + } + return ($a->{refnum} <=> $b->{refnum}); + }; + } + if ($was_xform ne $S{xform}) { + if ($S{xform} !~ /\S/) { + $custom_xform = undef; + } + else { + my $script_pkg = __PACKAGE__ . '::custom_xform'; + $custom_xform = eval qq{package $script_pkg; use strict; no warnings; return sub { +# line 1 @{[ set 'custom_xform' ]}\n$S{xform}}}; + if ($@) { + $@ =~ /^(.*)/; + print '%_'.(set 'custom_xform').'%_ did not compile: '.$1; + } + } + } + + my $new_settings = join "\n", $VIEWER_MODE + ? ("\\", $S{block}, $S{height_adjust}) + : ("!", $S{placement}, $S{position}); + + if ($settings_str ne $new_settings) { + @actString = (); + %abbrev_cache = (); + $currentLines = 0; + killOldStatus(); + delete $viewer{client_settings}; + $settings_str = $new_settings; + } + + my $was_mouse_mode = $MOUSE_ON; + if ($MOUSE_ON = Irssi::settings_get_bool(set 'mouse') and !$was_mouse_mode) { + install_mouse(); + } + elsif ($was_mouse_mode and !$MOUSE_ON) { + uninstall_mouse(); + } + + my $path = Irssi::settings_get_str(set 'path'); + my $was_viewer_mode = $VIEWER_MODE; + if (defined $viewer{path} && $viewer{path} ne $path && $was_viewer_mode) { + stop_viewer(); + $was_viewer_mode = 0; + } + $viewer{path} = $path; + if ($VIEWER_MODE = Irssi::settings_get_bool(set 'viewer') and !$was_viewer_mode) { + start_viewer(); + } + elsif ($was_viewer_mode and !$VIEWER_MODE) { + stop_viewer(); + } + + $print_text_activity = $S{sort} =~ /(?:^|\+)[-!]?last_line(?:\+|$)/; + + %banned_channels = map { lc1459(to_uni($_)) => undef } + split ' ', Irssi::settings_get_str('banned_channels'); + + my @sb_base = split /\177/, sb_format_expand("{sb \177}"), 2; + $sb_base_width_pre = sb_length($sb_base[0]); + $sb_base_width_post = sb_length($sb_base[1]); + $sb_base_width = $sb_base_width_pre + $sb_base_width_post; + + if ($print_text_activity && $S{line_shade}) { + $shade_line_timer = Irssi::timeout_add(max(10 * GLOB_QUEUE_TIMER, 100*$S{line_shade}**(1/3)), 'wl_changed', undef); + } + + $CHANGED{AWINS} = 1; +} + +sub stop_mouse_tracking { + print STDERR "\e[?1005l\e[?1000l"; +} +sub start_mouse_tracking { + print STDERR "\e[?1000h\e[?1005h"; +} +sub install_mouse { + Irssi::command_bind('mouse_xterm' => 'mouse_xterm'); + Irssi::command('^bind meta-[M /mouse_xterm'); + Irssi::signal_add_first('gui key pressed' => 'mouse_key_hook'); + start_mouse_tracking(); +} +sub uninstall_mouse { + stop_mouse_tracking(); + Irssi::signal_remove('gui key pressed' => 'mouse_key_hook'); + Irssi::command('^bind -delete meta-[M'); + Irssi::command_unbind('mouse_xterm' => 'mouse_xterm'); +} + +sub awl_mouse_event { + return if $VIEWER_MODE; + if ((($_[0] == 3 and $_[3] == 0) + || $_[0] == 64 || $_[0] == 65) and + $_[1] == $_[4] and $_[2] == $_[5]) { + my $top = lc $S{placement} eq 'top'; + my ($pos, $line) = @_[1 .. 2]; + unless ($top) { + $line -= $screenHeight; + $line += $currentLines; + $line += $S{mouse_offset}; + } + else { + $line -= $S{mouse_offset}; + } + $pos -= $sb_base_width_pre; + return if $line < 0 || $line >= $currentLines; + if ($_[0] == 64) { + Irssi::command('window up'); + } + elsif ($_[0] == 65) { + Irssi::command('window down'); + } + elsif (exists $mouse_coords{$line}{$pos}) { + my $win = $mouse_coords{$line}{$pos}; + Irssi::command('window ' . $win); + } + Irssi::signal_stop; + } +} + +sub mouse_scroll_event { + return unless $S{mouse_scroll}; + if (($_[3] == 64 or $_[3] == 65) and + $_[0] == $_[3] and $_[1] == $_[4] and $_[2] == $_[5]) { + my $cmd = '/scrollback goto ' . ($_[3] == 64 ? '-' : '+') . $S{mouse_scroll}; + my $active = Irssi::active_win; + Irssi::signal_emit('send command', $cmd, $active->{active_server}, $active->{active}); + Irssi::signal_stop; + } + elsif ($_[0] == 64 or $_[0] == 65) { + Irssi::signal_stop; + } +} + +sub mouse_escape { + return unless $S{mouse_escape} > 0; + if ($_[0] == 3) { + my $tm = $S{mouse_escape}; + $tm *= 1000 if $tm < 1000; + stop_mouse_tracking(); + Irssi::timeout_add_once($tm, 'start_mouse_tracking', undef); + Irssi::signal_stop; + } +} + +{ sub UNLOAD { + @actString = (); + killOldStatus(); + stop_viewer() if $VIEWER_MODE; + uninstall_mouse() if $MOUSE_ON; + } +} + +sub addPrintTextHook { # update on print text + return if $BLOCK_ALL; + return unless $print_text_activity; + return if $_[0]->{level} == 262144 and $_[0]->{target} eq '' + and !defined($_[0]->{server}); + &wl_changed; +} + +sub block_event_window_change { + Irssi::signal_stop; +} +sub distort_event_window_change { + Irssi::signal_continue($_[0], undef, @_[1..$#_]) +} + +sub update_awins { + { + my @wins = Irssi::windows; + Irssi::signal_add_first('window changed' => 'block_event_window_change'); + local $BLOCK_ALL = 1; + my $bwin = + my $awin = Irssi::active_win; + $awin->command('window last'); + my $lwin = Irssi::active_win; + $lwin->command('window last'); + my $defer_irssi_broken_last = $lwin->{refnum} == $bwin->{refnum}; + my $awin_counter = 0; + # missing special case: more than 1 last win, so /win last; + # /win last doesn't come back to the current window. eg. after + # connect & autojoin + Irssi::signal_remove('window changed' => 'block_event_window_change'); + unless ($defer_irssi_broken_last) { + %awins = %wnmap_exp = (); + Irssi::signal_add_first('window changed' => 'distort_event_window_change'); + do { + Irssi::active_win->command('window up'); + $awin = Irssi::active_win; + $awins{$awin->{refnum}} = undef; + ++$awin_counter; + } until ($awin->{refnum} == $bwin->{refnum} || $awin_counter >= @wins); + Irssi::signal_remove('window changed' => 'distort_event_window_change'); + Irssi::signal_add_first('window changed' => 'block_event_window_change'); + for my $key (keys %wnmap) { + next unless Irssi::window_find_name($key) || Irssi::window_find_item($key); + $awin->command("window goto $key"); + my $cwin = Irssi::active_win; + $wnmap_exp{ $cwin->{refnum} } = $wnmap{$key}; + $cwin->command('window last') + if $cwin->{refnum} != $awin->{refnum}; + } + for my $win (reverse @wins) { # restore original window order + Irssi::active_win->command('window '.$win->{refnum}); + } + $awin->command('window '.$lwin->{refnum}); # restore last win + Irssi::active_win->command('window last'); + Irssi::signal_remove('window changed' => 'block_event_window_change'); + } + } + $CHANGED{WL} = 1; +} + +sub resizeTerm { + ($screenHeight, $screenWidth) = split ' ', `stty size 2>/dev/null`; + $CHANGED{SETUP} = 1; +} + +sub awl_refresh { + $globTime = undef; + resizeTerm() if delete $CHANGED{SIZE}; + reset_awl() if delete $CHANGED{SETUP}; + update_awins() if delete $CHANGED{AWINS}; + update_wl() if delete $CHANGED{WL}; +} + +sub termsize_changed { $CHANGED{SIZE} = 1; &queue_refresh; } +sub setup_changed { $CHANGED{SETUP} = 1; &queue_refresh; } +sub awins_changed { $CHANGED{AWINS} = 1; &queue_refresh; } +sub wl_changed { $CHANGED{WL} = 1; &queue_refresh; } + +sub queue_refresh { + return if $BLOCK_ALL; + Irssi::timeout_remove($globTime) + if defined $globTime; # delay the update further + $globTime = Irssi::timeout_add_once(GLOB_QUEUE_TIMER, 'awl_refresh', undef); +} + +sub awl_init { + termsize_changed(); + update_keymap(); + print setc(), " is brand new beta release, please report issues and do read the upgrade notes. thanks!" + if $VERSION =~ /b/; +} + +sub runsub { + my $cmd = shift; + sub { + my ($data, $server, $item) = @_; + Irssi::command_runsub($cmd, $data, $server, $item); + }; +} + +Irssi::signal_register({ + 'gui mouse' => [qw/int int int int int int/], + }); +{ my $broken_expandos = (Irssi::version >= 20081128 && Irssi::version < 20110210) + ? sub { my $x = shift; $x =~ s/\$\{cumode_space\}/ /; $x } : undef; + Irssi::theme_register([ + map { $broken_expandos ? $broken_expandos->($_) : $_ } + set 'display_nokey' => '$N${cumode_space}$H$C$S', + set 'display_key' => '$Q${cumode_space}$H$C$S', + set 'display_nokey_visible' => '%2$N${cumode_space}$H$C$S', + set 'display_key_visible' => '%2$Q${cumode_space}$H$C$S', + set 'display_nokey_active' => '%1$N${cumode_space}$H$C$S', + set 'display_key_active' => '%1$Q${cumode_space}$H$C$S', + set 'display_header' => '%8$C|${N}', + set 'separator' => ' ', + set 'viewer_item_bg' => sb_format_expand('{sb_background}'), + ]); +} +Irssi::settings_add_bool(setc, set 'prefer_name', 0); # +Irssi::settings_add_int( setc, set 'hide_empty', 0); # +Irssi::settings_add_int( setc, set 'hide_data', 0); # +Irssi::settings_add_int( setc, set 'hide_name_data', 0); # +Irssi::settings_add_int( setc, set 'maxlines', 9); # +Irssi::settings_add_int( setc, set 'block', 15); # +Irssi::settings_add_bool(setc, set 'sbar_maxlength', 1); # +Irssi::settings_add_int( setc, set 'height_adjust', 2); # +Irssi::settings_add_str( setc, set 'sort', 'refnum'); # +Irssi::settings_add_str( setc, set 'placement', 'bottom'); # +Irssi::settings_add_int( setc, set 'position', 0); # +Irssi::settings_add_bool(setc, set 'all_disable', 1); # +Irssi::settings_add_bool(setc, set 'viewer', 1); # +Irssi::settings_add_bool(setc, set 'mouse', 0); # +Irssi::settings_add_str( setc, set 'path', Irssi::get_irssi_dir . '/_windowlist'); # +Irssi::settings_add_str( setc, set 'custom_xform', ''); # +Irssi::settings_add_time(setc, set 'last_line_shade', '0'); # +Irssi::settings_add_int( setc, set 'mouse_offset', 1); # +Irssi::settings_add_int( setc, 'mouse_scroll', 3); # +Irssi::settings_add_int( setc, 'mouse_escape', 1); # +Irssi::settings_add_str( setc, 'banned_channels', ''); +Irssi::settings_add_bool(setc, 'banned_channels_on', 1); +Irssi::settings_add_str( setc, 'fancy_abbrev', 'fancy'); # + +Irssi::signal_add_last({ + 'setup changed' => 'setup_changed', + 'print text' => 'addPrintTextHook', + 'terminal resized' => 'termsize_changed', + 'setup reread' => 'screenFullRedraw', + 'window hilight' => 'wl_changed', + 'command format' => 'wl_changed', +}); +Irssi::signal_add({ + 'window changed' => 'awins_changed', + 'window item changed' => 'wl_changed', + 'window changed automatic' => 'awins_changed', + 'window created' => 'awins_changed', + 'window destroyed' => 'awins_changed', + 'window name changed' => 'wl_changed', + 'window refnum changed' => 'wl_changed', +}); +Irssi::signal_add_last('gui mouse' => 'mouse_escape'); +Irssi::signal_add_last('gui mouse' => 'mouse_scroll_event'); +Irssi::signal_add_last('gui mouse' => 'awl_mouse_event'); +Irssi::command_bind( setc() => runsub(setc()) ); +Irssi::command_bind( setc() . ' redraw' => 'screenFullRedraw' ); + +awl_init(); + +# Mouse script based on irssi mouse patch by mirage +{ my $mouse_status = -1; # -1:off 0,1,2:filling mouse_combo + my @mouse_combo; # 0:button 1:x 2:y + my @mouse_previous; # previous contents of mouse_combo + + sub mouse_xterm_off { + $mouse_status = -1; + } + sub mouse_xterm { + $mouse_status = 0; + Irssi::timeout_add_once(10, 'mouse_xterm_off', undef); + } + + sub mouse_key_hook { + my ($key) = @_; + if ($mouse_status != -1) { + if ($mouse_status == 0) { + @mouse_previous = @mouse_combo; + #if @mouse_combo && $mouse_combo[0] < 64; + } + $mouse_combo[$mouse_status] = $key - 32; + $mouse_status++; + if ($mouse_status == 3) { + $mouse_status = -1; + # match screen coordinates + $mouse_combo[1]--; + $mouse_combo[2]--; + Irssi::signal_emit('gui mouse', @mouse_combo[0 .. 2], @mouse_previous[0 .. 2]); + } + Irssi::signal_stop; + } + } +} + +sub string_LCSS { + my $str = join "\0", @_; + (sort { length $b <=> length $a } $str =~ /(?=(.+).*\0.*\1)/g)[0] +} + +{ package Irssi::Nick } + +UNITCHECK +{ package AwlViewer; + use strict; + use warnings; + no warnings 'redefine'; + use Encode; + use IO::Socket::UNIX; + use IO::Select; + use constant BLOCK_SIZE => 1024; + use constant RECONNECT_TIME => 5; + + my $sockpath; + + our $VERSION = '0.2'; + + our ($got_int, $resized, $timeout); + + my %vars; + my (%c2w, @seqlist); + my %mouse_coords; + my (@mouse, @last_mouse); + my ($err, $sock, $loop); + my ($keybuf, $rcvbuf); + my @screen; + my ($screenHeight, $screenWidth); + my ($disp_update, $fs_open); + + sub connect_it { + $sock = IO::Socket::UNIX->new( + Type => SOCK_STREAM, + Peer => $sockpath, + ); + unless ($sock) { + $err = $!; + return; + } + $sock->blocking(0); + $loop->add($sock); + } + + sub remove_conn { + my $fh = shift; + $loop->remove($fh); + $fh->close; + $sock = undef; + %vars = (); + @screen = (); + } + + { package Terminfo; # xterm + sub civis { "\e[?25l" } + sub sc { "\e7" } + sub cup { "\e[" . ($_[0] + 1) . ';' . ($_[1] + 1) . 'H' } + sub el { "\e[K" } + sub rc { "\e8" } + sub cnorm { "\e[?25h" } + sub setab { "\e[4" . $_[0] . 'm' } + sub setaf { "\e[3" . $_[0] . 'm' } + sub setaf16 { "\e[9" . $_[0] . 'm' } + sub setab16 { "\e[10" . $_[0] . 'm' } + sub setaf256 { "\e[38;5;" . $_[0] . 'm' } + sub setab256 { "\e[48;5;" . $_[0] . 'm' } + sub sgr0 { "\e[0m" } + sub bold { "\e[1m" } + sub blink { "\e[5m" } + sub rev { "\e[7m" } + sub op { "\e[39;49m" } + sub exit_bold { "\e[22m" } + sub exit_blink { "\e[25m" } + sub exit_rev { "\e[27m" } + sub smcup { "\e[?1049h" } + sub rmcup { "\e[?1049l" } + sub smmouse { "\e[?1000h\e[?1005h" } + sub rmmouse { "\e[?1005l\e[?1000l" } + } + + sub init { + $sockpath = shift // "$ENV{HOME}/.irssi/_windowlist"; + STDOUT->autoflush(1); + printf "\r%swaiting for %s...", Terminfo::sc, ::setc(); + + `stty -icanon -echo`; + + $loop = IO::Select->new; + STDIN->blocking(0); + $loop->add(\*STDIN); + + $SIG{INT} = sub { $got_int = 1 }; + $SIG{WINCH} = sub { $resized = 1 }; + + $resized = 3; + + $disp_update = 2; + } + + sub enter_fs { + return if $fs_open; + safe_print(Terminfo::rc, Terminfo::smcup, Terminfo::civis, Terminfo::smmouse); + $fs_open = 1; + } + + sub leave_fs { + return unless $fs_open; + safe_print(Terminfo::rmmouse, Terminfo::cnorm, Terminfo::rmcup); + safe_print(sprintf "\r%swaiting for %s...", Terminfo::sc, ::setc()) if $_[0]; + + $fs_open = 0; + } + + sub end_prog { + leave_fs(); + STDIN->blocking(1); + `stty sane`; + printf "\r%s%sthanks for using %s\n", Terminfo::rc, Terminfo::el, ::setc(); + } + + sub safe_print { + my $st = STDIN->blocking(1); + print @_; + STDIN->blocking($st); + } + + sub safe_qx { + my $st = STDIN->blocking(1); + my $ret = `$_[0]`; + STDIN->blocking($st); + $ret + } + + sub safe_print_sock { + return unless $sock; + my $was = $sock->blocking(1); + $sock->print(@_); + $sock->blocking($was); + } + + sub process_recv { + my $need = 0; + while ($rcvbuf =~ s/\n(.+)_BEGIN\n((?: .*\n)*)\1_END\n//) { + my $var = lc $1; + my $data = $2; + my @data = split "\n ", "\n$data ", -1; + shift @data; pop @data; + my $itembg = $vars{itembg}; + if ($var =~ s/list$//) { + $vars{$var} = \@data; + } + elsif ($var =~ s/map$//) { + $vars{$var} = +{ @data }; + } + else { + $vars{$var} = join "\n", @data; + } + $need = 1 if $var eq 'win'; + $need = 1 if $var eq 'redraw' && $vars{$var}; + if (($itembg//'') ne ($vars{itembg}//'')) { + $need = $vars{redraw} = 1; + } + _build_keymap() if $var eq 'key2'; + } + $need + } + + { my %ansi_table; + my ($i, $j, $k) = (0, 0, 0); + my %term_state; + sub reset_term_state { my %old_term = %term_state; %term_state = (); %old_term } + sub set_term_state { my %old_term = %term_state; %term_state = @_; %old_term } + %ansi_table = ( + # fe-common::core::formats.c:format_expand_styles + (map { my $t = $i++; ($_ => sub { my $n = $term_state{hicolor} ? \&Terminfo::setab16 : \&Terminfo::setab; + $n->($t) }) } (split //, '01234567' )), + (map { my $t = $j++; ($_ => sub { my $n = $term_state{hicolor} ? \&Terminfo::setaf16 : \&Terminfo::setaf; + $n->($t) }) } (split //, 'krgybmcw' )), + (map { my $t = $k++; ($_ => sub { my $n = $term_state{hicolor} ? \&Terminfo::setaf : \&Terminfo::setaf16; + $n->($t) }) } (split //, 'KRGYBMCW')), + # reset + n => sub { $term_state{hicolor} = 0; my $r = Terminfo::op; + for (qw(blink rev bold)) { + $r .= Terminfo->can("exit_$_")->() if delete $term_state{$_}; + } + { + local $ansi_table{n} = $ansi_table{N}; + $r .= formats_to_ansi_basic($vars{itembg}); + } + $r + }, + N => sub { reset_term_state(); Terminfo::sgr0 }, + # flash/bright + F => sub { my $n = 'blink'; my $e = ($term_state{$n} ^= 1) ? $n : "exit_$n"; Terminfo->can($e)->() }, + # reverse + 8 => sub { my $n = 'rev'; my $e = ($term_state{$n} ^= 1) ? $n : "exit_$n"; Terminfo->can($e)->() }, + # bold + "_" => sub { my $n = 'bold'; my $e = ($term_state{$n} ^= 1) ? $n : "exit_$n"; Terminfo->can($e)->() }, + # bold, used as colour modifier + 9 => sub { $term_state{hicolor} ^= 1; '' }, + # delete other stuff + (map { $_ => sub { '' } } (split //, ':|>#[')), + # escape + (map { my $close = $_; $_ => sub { $close } } (split //, '{}%')), + ); + for my $base (0 .. 15) { + my $close = $base; + $ansi_table{ (sprintf "x0%x", $close) } = + $ansi_table{ (sprintf "x0%X", $close) } = + sub { Terminfo::setab256($close) }; + $ansi_table{ (sprintf "X0%x", $close) } = + $ansi_table{ (sprintf "X0%X", $close) } = + sub { Terminfo::setaf256($close) }; + } + for my $plane (1 .. 6) { + for my $coord (0 .. 35) { + my $close = 16 + ($plane-1) * 36 + $coord; + my $ch = $coord < 10 ? $coord : chr( $coord - 10 + ord 'a' ); + $ansi_table{ "x$plane$ch" } = + $ansi_table{ "x$plane\U$ch" } = + sub { Terminfo::setab256($close) }; + $ansi_table{ "X$plane$ch" } = + $ansi_table{ "X$plane\U$ch" } = + sub { Terminfo::setaf256($close) }; + } + } + for my $gray (0 .. 23) { + my $close = 232 + $gray; + my $ch = chr( $gray + ord 'a' ); + $ansi_table{ "x7$ch" } = + $ansi_table{ "x7\U$ch" } = + sub { Terminfo::setab256($close) }; + $ansi_table{ "X7$ch" } = + $ansi_table{ "X7\U$ch" } = + sub { Terminfo::setaf256($close) }; + } + sub formats_to_ansi_basic { + my $o = shift; + $o =~ s/(%(X..|x..|.))/exists $ansi_table{$2} ? $ansi_table{$2}->() : $1/gex; + $o + } + } + + sub _header { + my $str = uc ::setc(); + my $space = int( ((abs $vars{block}) - length $str) / (1 + length $str)); + if ($space > 0) { + my $ss = ' ' x $space; + $str = join $ss, '', (split //, $str), ''; + } + my $pad = (abs $vars{block}) - length $str; + $str = ' ' x ($pad/2) . $str . ' ' x ($pad/2 + $pad%2); + $str + } + + sub _add_item { + my ($i, $j, $c, $wi, $screen, $mouse) = @_; + $screen->[$i][$j] = "%N%n$wi"; + if (exists $vars{mouse}{$c - 1}) { + $mouse->[$i][$j] = $vars{mouse}{$c - 1}; + } + } + sub update_screen { + $disp_update = 0; + unless ($sock && exists $vars{seplen} && exists $vars{block}) { + leave_fs(1); + return; + } + enter_fs(); + @screen = () if delete $vars{redraw}; + %mouse_coords = (); + my $ncols = int( ($screenWidth + $vars{seplen}) / ($vars{seplen} + abs $vars{block}) ); + my $xenl = $ncols > int( ($screenWidth + $vars{seplen} - 1) / ($vars{seplen} + abs $vars{block}) ); + my $nrows = $screenHeight - $vars{ha}; + my @wi = @{$vars{win}//[]}; + my $max_items = $ncols * $nrows; + my $c = 1; + my $items = @wi + $c; + my $titems = $items > $max_items ? $max_items : $items; + my $i = 0; + my $j = 0; + my @new_screen; + my @new_mouse; + $new_screen[0][0] = _header() . ' ' x $vars{seplen}; + unless ($nrows > $ncols) { # line layout + ++$j; + for my $wi (@wi) { + if ($j >= $ncols) { + $j = 0; + ++$i; + } + last if $i >= $nrows; + _add_item($i, $j, $c, $wi, \@new_screen, \@new_mouse); + if ($c + 1 < $titems && $j + 1 < $ncols) { + $new_screen[$i][$j] .= $vars{separator}; + } + ++$j; + ++$c; + } + } + else { # column layout + ++$i; + for my $wi (@wi) { + if ($i >= $nrows) { + $i = 0; + ++$j; + } + last if $j >= $ncols; + _add_item($i, $j, $c, $wi, \@new_screen, \@new_mouse); + if ($c + $nrows < $titems) { + $new_screen[$i][$j] .= $vars{separator}; + } + ++$i; + ++$c; + } + } + my $step = $vars{seplen} + abs $vars{block}; + $i = 0; + my $str = Terminfo::sc . Terminfo::sgr0; + for (my $i = 0; $i < @new_screen; ++$i) { + for (my $j = 0; $j < @{$new_screen[$i]}; ++$j) { + if (defined $new_mouse[$i] && defined $new_mouse[$i][$j]) { + my $from = $j * $step; + $mouse_coords{$i}{$_} = $new_mouse[$i][$j] + for $from .. $from + abs $vars{block}; + } + next if defined $screen[$i] && defined $screen[$i][$j] + && $screen[$i][$j] eq $new_screen[$i][$j]; + $str .= Terminfo::cup($i, $j * $step) + . formats_to_ansi_basic($new_screen[$i][$j]) + . Terminfo::sgr0; + $str .= Terminfo::el if $j == $#{$new_screen[$i]} && (!$xenl || $j + 1 != $ncols); + } + } + for (@new_screen .. $screenHeight - 1) { + if (!@screen || defined $screen[$_]) { + $str .= Terminfo::cup($_, 0) . Terminfo::sgr0 . Terminfo::el; + } + } + $str .= Terminfo::rc; + safe_print $str; + @screen = @new_screen; + } + + sub handle_resize { + ($screenHeight, $screenWidth) = split ' ', safe_qx('stty size'); + $resized = 0; + @screen = (); + $disp_update = 1; + } + + sub _build_keymap { + %c2w = reverse( %{$vars{key}}, %{$vars{key2}} ); + if (!grep { /^[+-]./ } keys %c2w) { + %c2w = (%c2w, map { ("-$_" => $c2w{$_}) } grep { !/^\^./ } keys %c2w); + } + %c2w = map { + my $key = $_; + s{^(-)?(\+)?(\^)?(.)}{ + join '', ( + ($1 ? "\e" : ''), + ($2 ? "\e\e" : ''), + ($3 ? "$4"^"@" : $4) + ) + }e; + $_ => $c2w{$key} + } keys %c2w; + @seqlist = sort { length $b <=> length $a } keys %c2w; + } + + sub process_keys { + Encode::_utf8_on($keybuf); + my $win; + my $use_mouse; + my $maybe; + KEY: while (length $keybuf && !$maybe) { + $maybe = 0; + if ($keybuf =~ s/^\e\[M(.)(.)(.)//) { + @last_mouse = @mouse;# if @mouse && $mouse[0] < 64; + @mouse = map { -32 + ord } ($1, $2, $3); + $use_mouse = 1; + next KEY; + } + for my $s (@seqlist) { + if ($keybuf =~ s/^\Q$s//) { + $win = $c2w{$s}; + $use_mouse = 0; + next KEY; + } + elsif (length $keybuf < length $s && $s =~ /^\Q$keybuf/) { + $maybe = 1; + } + } + unless ($maybe) { + substr $keybuf, 0, 1, ''; + } + } + if ($use_mouse && @mouse && @last_mouse && + $mouse[2] == $last_mouse[2] && + $mouse[1] == $last_mouse[1] && + ($mouse[0] == 3 || $mouse[0] == 64 || $mouse[0] == 65)) { + if ($mouse[0] == 64) { + $win = 'up'; + } + elsif ($mouse[0] == 65) { + $win = 'down'; + } + elsif (exists $mouse_coords{$mouse[2] - 1}{$mouse[1] - 1}) { + $win = $mouse_coords{$mouse[2] - 1}{$mouse[1] - 1}; + } + elsif ($mouse[2] == 1 && $mouse[1] <= abs $vars{block}) { + $win = $last_mouse[0] != 0 ? 'last' : 'active'; + } + else { + } + } + if (defined $win) { + $win =~ s/^_//; + safe_print_sock("$win\n"); + if (!exists $ENV{AWL_AUTOFOCUS} || $ENV{AWL_AUTOFOCUS}) { + if (length $ENV{TMUX} && exists $vars{irssienv}{tmux_srv} && length $vars{irssienv}{tmux_pane} + && $ENV{TMUX} eq $vars{irssienv}{tmux_srv}) { + safe_qx("tmux selectp -t $vars{irssienv}{tmux_pane} 2>&1"); + } + elsif (exists $vars{irssienv}{xwinid}) { + safe_qx("wmctrl -ia $vars{irssienv}{xwinid} 2>/dev/null"); + } + } + } + Encode::_utf8_off($keybuf); + } + + sub main { + init(); + until ($got_int) { + $timeout = undef; + if ($resized) { + if ($resized == 1) { + $timeout = 1; + $resized++; + } + else { + handle_resize(); + } + } + unless ($sock || $timeout) { + connect_it(); + } + $timeout ||= RECONNECT_TIME unless $sock; + update_screen() if $disp_update; + while (my @read = $loop->can_read($timeout)) { + for my $fh (@read) { + if ($fh == \*STDIN) { + if (read STDIN, my $buf, BLOCK_SIZE) { + do { + $keybuf .= $buf; + } while read STDIN, $buf, BLOCK_SIZE; + } + else { + $got_int = 1; + last; + } + } + else { + if ($fh->read(my $buf, BLOCK_SIZE)) { + do { + $rcvbuf .= $buf; + } while $fh->read($buf, BLOCK_SIZE); + } + else { + $disp_update = 1; + remove_conn($fh); + $timeout ||= RECONNECT_TIME; + } + } + } + $disp_update |= process_recv() if length $rcvbuf; + process_keys() if length $keybuf; + update_screen() if $disp_update; + } + continue { + } + } + end_prog(); + } +} + +1; + +# Changelog +# ========= +# 0.8b3+ +# - replace fifo mode with external viewer script +# - remove bundled cpan modules +# - work around bogus irssi warning +# - improve mouse support +# - workaround for broken cumode in irssi 0.8.15 +# - fix handling of non-meta windows (uninitialized warning) +# - add 256 colour support, strip true colour codes +# - fix totally bogus $N padding reported by Ed S. +# - make /window goto #name mappings work but ignore non-existant ones +# - improve incomplete reads reported by bcode +# - fix single % in awl_viewer reported by bcode +# - add support for key bindings by nike and ferret +# - coerce utf8 key binds +# - add settings: custom_xform, last_line_shade, hide_name_data +# - abbreviations were broken in some cases +# +# 0.7g +# - remove screen support and replace it with fifo support +# - add double-width support to the shortener +# - correct documentation regarding $T vs. display_header +# - add missing refresh for window item changed (thanks vague) +# - add visible windows +# - add exemptions for active window +# - workaround for hiding the window changes from trackbar +# - hack to force 16colours in screen mode +# - remember last window (reported by earthnative) +# - wrong window focus on new queries (reported by emsid) +# - dataloss bug on trying to remember last window +# +# 0.6d+ +# - add support for network headers +# - fixed regression bug /exec -interactive +# +# 0.6ca+ +# - add screen support (from nicklist.pl) +# - names can now have a max length and window names can be used +# - fixed a bug with block display in screen mode and statusbar mode +# - added space handling to ir_fe and removed it again +# - now handling formats on my own +# - started to work on $tag display +# - added warning about missing sb_act_none abstract leading to +# - display*active settings +# - added warning about the bug in awl_display_(no)key_active settings +# - mouse hack +# +# 0.5d +# - add setting to also hide the last statusbar if empty (awl_all_disable) +# - reverted to old utf8 code to also calculate broken utf8 length correctly +# - simplified dealing with statusbars in wlreset +# - added a little tweak for the renamed term_type somewhere after Irssi 0.8.9 +# - fixed bug in handling channel #$$ +# - reset background colour at the beginning of an entry +# +# 0.4d +# - fixed order of disabling statusbars +# - several attempts at special chars, without any real success +# and much more weird new bugs caused by this +# - setting to specify sort order +# - reduced timeout values +# - added awl_hide_data +# - make it so the dynamic sub is actually deleted +# - fix a bug with removing of the last separator +# - take into consideration parse_special +# +# 0.3b +# - automatically kill old statusbars +# - reset on /reload +# - position/placement settings +# +# 0.2 +# - automated retrieval of key bindings (thanks grep.pl authors) +# - improved removing of statusbars +# - got rid of status chop +# +# 0.1 +# - Based on chanact.pl which was apparently based on lightbar.c and +# nicklist.pl with various other ideas from random scripts. diff --git a/irssi-files/scripts/nicklist.pl b/irssi-files/scripts/nicklist.pl new file mode 100644 index 0000000..0dbe4fb --- /dev/null +++ b/irssi-files/scripts/nicklist.pl @@ -0,0 +1,611 @@ +# for documentation: see http://wouter.coekaerts.be/site/irssi/nicklist + +use Irssi; +use strict; +use IO::Handle; # for (auto)flush +use Fcntl; # for sysopen +use vars qw($VERSION %IRSSI); +$VERSION = '0.4.6'; +%IRSSI = ( + authors => 'Wouter Coekaerts', + contact => 'coekie@irssi.org', + name => 'nicklist', + description => 'draws a nicklist to another terminal, or at the right of your irssi in the same terminal', + license => 'GPLv2', + url => 'http://wouter.coekaerts.be/irssi', + changed => '29/06/2004' +); + +sub cmd_help { + print ( < +NICKLIST SCREEN +NICKLIST FIFO +NICKLIST OFF +NICKLIST UPDATE + +For help see: http://wouter.coekaerts.be/site/irssi/nicklist + +in short: + +1. FIFO MODE +- in irssi: /NICKLIST FIFO (only the first time, to create the fifo) +- in a shell, in a window where you want the nicklist: cat ~/.irssi/nicklistfifo +- back in irssi: + /SET nicklist_heigth + /SET nicklist_width + /NICKLIST FIFO + +2. SCREEN MODE +- start irssi inside screen ("screen irssi") +- /NICKLIST SCREEN +EOF + ); +} + +my $prev_lines = 0; # number of lines in previous written nicklist +my $scroll_pos = 0; # scrolling position +my $cursor_line; # line the cursor is currently on +my ($OFF, $SCREEN, $FIFO) = (0,1,2); # modes +my $mode = $OFF; # current mode +my $need_redraw = 0; # nicklist needs redrawing +my $screen_resizing = 0; # terminal is being resized +my $active_channel; # (REC) + +my @nicklist=(); # array of hashes, containing the internal nicklist of the active channel + # nick => realnick + # mode => + my ($MODE_OP, $MODE_HALFOP, $MODE_VOICE, $MODE_NORMAL) = (0,1,2,3); + # status => + my ($STATUS_NORMAL, $STATUS_JOINING, $STATUS_PARTING, $STATUS_QUITING, $STATUS_KICKED, $STATUS_SPLIT) = (0,1,2,3,4,5); + # text => text to be printed + # cmp => text used to compare (sort) nicks + + +# 'cached' settings +my ($screen_prefix, $irssi_width, @prefix_mode, @prefix_status, $height, $nicklist_width); + +sub read_settings { + ($screen_prefix = Irssi::settings_get_str('nicklist_screen_prefix')) =~ s/\\e/\033/g; + + ($prefix_mode[$MODE_OP] = Irssi::settings_get_str('nicklist_prefix_mode_op')) =~ s/\\e/\033/g; + ($prefix_mode[$MODE_HALFOP] = Irssi::settings_get_str('nicklist_prefix_mode_halfop')) =~ s/\\e/\033/g; + ($prefix_mode[$MODE_VOICE] = Irssi::settings_get_str('nicklist_prefix_mode_voice')) =~ s/\\e/\033/g; + ($prefix_mode[$MODE_NORMAL] = Irssi::settings_get_str('nicklist_prefix_mode_normal')) =~ s/\\e/\033/g; + + if ($mode != $SCREEN) { + $height = Irssi::settings_get_int('nicklist_height'); + } + my $new_nicklist_width = Irssi::settings_get_int('nicklist_width'); + if ($new_nicklist_width != $nicklist_width && $mode == $SCREEN) { + sig_terminal_resized(); + } + $nicklist_width = $new_nicklist_width; +} + +sub update { + read_settings(); + make_nicklist(); +} + +################## +##### OUTPUT ##### +################## + +### off ### + +sub cmd_off { + if ($mode == $SCREEN) { + screen_stop(); + } elsif ($mode == $FIFO) { + fifo_stop(); + } +} + +### fifo ### + +sub cmd_fifo_start { + read_settings(); + my $path = Irssi::settings_get_str('nicklist_fifo_path'); + unless (-p $path) { # not a pipe + if (-e _) { # but a something else + die "$0: $path exists and is not a pipe, please remove it\n"; + } else { + require POSIX; + POSIX::mkfifo($path, 0666) or die "can\'t mkfifo $path: $!"; + Irssi::print("Fifo created. Start reading it (\"cat $path\") and try again."); + return; + } + } + if (!sysopen(FIFO, $path, O_WRONLY | O_NONBLOCK)) { # or die "can't write $path: $!"; + Irssi::print("Couldn\'t write to the fifo ($!). Please start reading the fifo (\"cat $path\") and try again."); + return; + } + FIFO->autoflush(1); + print FIFO "\033[2J\033[1;1H"; # erase screen & jump to 0,0 + $cursor_line = 0; + if ($mode == $SCREEN) { + screen_stop(); + } + $mode = $FIFO; + make_nicklist(); +} + +sub fifo_stop { + close FIFO; + $mode = $OFF; + Irssi::print("Fifo closed."); +} + +### screen ### + +sub cmd_screen_start { + if (!defined($ENV{'STY'})) { + Irssi::print 'screen not detected, screen mode only works inside screen'; + return; + } + read_settings(); + if ($mode == $SCREEN) {return;} + if ($mode == $FIFO) { + fifo_stop(); + } + $mode = $SCREEN; + Irssi::signal_add_last('gui print text finished', \&sig_gui_print_text_finished); + Irssi::signal_add_last('gui page scrolled', \&sig_page_scrolled); + Irssi::signal_add('terminal resized', \&sig_terminal_resized); + screen_size(); + make_nicklist(); +} + +sub screen_stop { + $mode = $OFF; + Irssi::signal_remove('gui print text finished', \&sig_gui_print_text_finished); + Irssi::signal_remove('gui page scrolled', \&sig_page_scrolled); + Irssi::signal_remove('terminal resized', \&sig_terminal_resized); + system 'screen -x '.$ENV{'STY'}.' -X fit'; +} + +sub screen_size { + if ($mode != $SCREEN) { + return; + } + $screen_resizing = 1; + # fit screen + system 'screen -x '.$ENV{'STY'}.' -X fit'; + # get size (from perldoc -q size) + my ($winsize, $row, $col, $xpixel, $ypixel); + eval 'use Term::ReadKey; ($col, $row, $xpixel, $ypixel) = GetTerminalSize'; + # require Term::ReadKey 'GetTerminalSize'; + # ($col, $row, $xpixel, $ypixel) = Term::ReadKey::GetTerminalSize; + #}; + if ($@) { # no Term::ReadKey, try the ugly way + eval { + require 'sys/ioctl.ph'; + # without this reloading doesn't work. workaround for some unknown bug + do 'asm/ioctls.ph'; + }; + + # ugly way not working, let's try something uglier, the dg-hack(tm) (constant for linux only?) + if($@) { no strict 'refs'; *TIOCGWINSZ = sub { return 0x5413 } } + + unless (defined &TIOCGWINSZ) { + die "Term::ReadKey not found, and ioctl 'workaround' failed. Install the Term::ReadKey perl module to use screen mode.\n"; + } + open(TTY, "+{'nick'}) =~ s/^(.{$tmp})..+$/$1\033[34m~\033[m/; + $nick->{'text'} = $prefix_mode[$nick->{'mode'}] . $text . (' ' x ($nicklist_width-length($nick->{'nick'})-1)); + $nick->{'cmp'} = $nick->{'mode'}.lc($nick->{'nick'}); +} + +# redraw the given nick (nr) if it is visible +sub redraw_nick_nr { + my ($nr) = @_; + my $line = $nr - $scroll_pos; + if ($line >= 0 && $line < $height) { + nicklist_write_line($line, $nicklist[$nr]->{'text'}); + } +} + +# nick was inserted, redraw area if necessary +sub draw_insert_nick_nr { + my ($nr) = @_; + my $line = $nr - $scroll_pos; + if ($line < 0) { # nick is inserted above visible area + $scroll_pos++; # 'scroll' down :) + } elsif ($line < $height) { # line is visible + if ($mode == $SCREEN) { + need_redraw(); + } elsif ($mode == $FIFO) { + my $data = "\033[m\033[L". $nicklist[$nr]->{'text'}; # reset color & insert line & write nick + if ($line == $cursor_line) { + $data = "\033[1G".$data; # back to beginning of line + } else { + $data = "\033[".($line+1).";1H".$data; # jump + } + $cursor_line=$line; + print(FIFO $data) or fifo_stop(); + if ($prev_lines < $height) { + $prev_lines++; # the nicklist has one line more + } + } + } +} + +sub draw_remove_nick_nr { + my ($nr) = @_; + my $line = $nr - $scroll_pos; + if ($line < 0) { # nick removed above visible area + $scroll_pos--; # 'scroll' up :) + } elsif ($line < $height) { # line is visible + if ($mode == $SCREEN) { + need_redraw(); + } elsif ($mode == $FIFO) { + #my $data = "\033[m\033[L[i$line]". $nicklist[$nr]->{'text'}; # reset color & insert line & write nick + my $data = "\033[M"; # delete line + if ($line != $cursor_line) { + $data = "\033[".($line+1)."d".$data; # jump + } + $cursor_line=$line; + print(FIFO $data) or fifo_stop(); + if (@nicklist-$scroll_pos >= $height) { + redraw_nick_nr($scroll_pos+$height-1); + } + } + } +} + +# redraw the whole nicklist +sub redraw { + $need_redraw = 0; + #make_nicklist(); + nicklist_write_start(); + my $line = 0; + ### draw nicklist ### + for (my $i=$scroll_pos;$line < $height && $i < @nicklist; $i++) { + nicklist_write_line($line++, $nicklist[$i]->{'text'}); + } + + ### clean up other lines ### + my $real_lines = $line; + while($line < $prev_lines) { + nicklist_write_line($line++,' ' x $nicklist_width); + } + $prev_lines = $real_lines; + nicklist_write_end(); +} + +# redraw (with little delay to avoid redrawing to much) +sub need_redraw { + if(!$need_redraw) { + $need_redraw = 1; + Irssi::timeout_add_once(10,\&redraw,[]); + } +} + +sub sig_page_scrolled { + $prev_lines = $height; # we'll need to redraw everything if he scrolled up + need_redraw; +} + +# redraw (with delay) if the window is visible (only in screen mode) +sub sig_gui_print_text_finished { + if ($need_redraw) { # there's already a redraw 'queued' + return; + } + my $window = @_[0]; + if ($window->{'refnum'} == Irssi::active_win->{'refnum'} || Irssi::settings_get_str('nicklist_screen_split_windows') eq '*') { + need_redraw; + return; + } + foreach my $win (split(/[ ,]/, Irssi::settings_get_str('nicklist_screen_split_windows'))) { + if ($window->{'refnum'} == $win || $window->{'name'} eq $win) { + need_redraw; + return; + } + } +} + +#################### +##### NICKLIST ##### +#################### + +# returns the position of the given nick(as string) in the (internal) nicklist +sub find_nick { + my ($nick) = @_; + for (my $i=0;$i < @nicklist; $i++) { + if ($nicklist[$i]->{'nick'} eq $nick) { + return $i; + } + } + return -1; +} + +# find position where nick should be inserted into the list +sub find_insert_pos { + my ($cmp)= @_; + for (my $i=0;$i < @nicklist; $i++) { + if ($nicklist[$i]->{'cmp'} gt $cmp) { + return $i; + } + } + return scalar(@nicklist); #last +} + +# make the (internal) nicklist (@nicklist) +sub make_nicklist { + @nicklist = (); + $scroll_pos = 0; + + ### get & check channel ### + my $channel = Irssi::active_win->{active}; + + if (!$channel || (ref($channel) ne 'Irssi::Irc::Channel' && ref($channel) ne 'Irssi::Silc::Channel') || $channel->{'type'} ne 'CHANNEL' || ($channel->{chat_type} ne 'SILC' && !$channel->{'names_got'}) ) { + $active_channel = undef; + # no nicklist + } else { + $active_channel = $channel; + ### make nicklist ### + my $thisnick; + foreach my $nick (sort {(($a->{'op'}?'1':$a->{'halfop'}?'2':$a->{'voice'}?'3':'4').lc($a->{'nick'})) + cmp (($b->{'op'}?'1':$b->{'halfop'}?'2':$b->{'voice'}?'3':'4').lc($b->{'nick'}))} $channel->nicks()) { + $thisnick = {'nick' => $nick->{'nick'}, 'mode' => ($nick->{'op'}?$MODE_OP:$nick->{'halfop'}?$MODE_HALFOP:$nick->{'voice'}?$MODE_VOICE:$MODE_NORMAL)}; + calc_text($thisnick); + push @nicklist, $thisnick; + } + } + need_redraw(); +} + +# insert nick(as hash) into nicklist +# pre: cmp has to be calculated +sub insert_nick { + my ($nick) = @_; + my $nr = find_insert_pos($nick->{'cmp'}); + splice @nicklist, $nr, 0, $nick; + draw_insert_nick_nr($nr); +} + +# remove nick(as nr) from nicklist +sub remove_nick { + my ($nr) = @_; + splice @nicklist, $nr, 1; + draw_remove_nick_nr($nr); +} + +################### +##### ACTIONS ##### +################### + +# scroll the nicklist, arg = number of lines to scroll, positive = down, negative = up +sub cmd_scroll { + if (!$active_channel) { # not a channel active + return; + } + my @nicks=Irssi::active_win->{active}->nicks; + my $nick_count = scalar(@nicks)+0; + my $channel = Irssi::active_win->{active}; + if (!$channel || $channel->{type} ne 'CHANNEL' || !$channel->{names_got} || $nick_count <= Irssi::settings_get_int('nicklist_height')) { + return; + } + $scroll_pos += @_[0]; + + if ($scroll_pos > $nick_count - $height) { + $scroll_pos = $nick_count - $height; + } + if ($scroll_pos <= 0) { + $scroll_pos = 0; + } + need_redraw(); +} + +sub is_active_channel { + my ($server,$channel) = @_; # (channel as string) + return ($server && $server->{'tag'} eq $active_channel->{'server'}->{'tag'} && $server->channel_find($channel) && $active_channel && $server->channel_find($channel)->{'name'} eq $active_channel->{'name'}); +} + +sub sig_channel_wholist { # this is actualy a little late, when the names are received would be better + my ($channel) = @_; + if (Irssi::active_win->{'active'} && Irssi::active_win->{'active'}->{'name'} eq $channel->{'name'}) { # the channel joined is active + make_nicklist + } +} + +sub sig_join { + my ($server,$channel,$nick,$address) = @_; + if (!is_active_channel($server,$channel)) { + return; + } + my $newnick = {'nick' => $nick, 'mode' => $MODE_NORMAL}; + calc_text($newnick); + insert_nick($newnick); +} + +sub sig_kick { + my ($server, $channel, $nick, $kicker, $address, $reason) = @_; + if (!is_active_channel($server,$channel)) { + return; + } + my $nr = find_nick($nick); + if ($nr == -1) { + Irssi::print("nicklist warning: $nick was kicked from $channel, but not found in nicklist"); + } else { + remove_nick($nr); + } +} + +sub sig_part { + my ($server,$channel,$nick,$address, $reason) = @_; + if (!is_active_channel($server,$channel)) { + return; + } + my $nr = find_nick($nick); + if ($nr == -1) { + Irssi::print("nicklist warning: $nick has parted $channel, but was not found in nicklist"); + } else { + remove_nick($nr); + } + +} + +sub sig_quit { + my ($server,$nick,$address, $reason) = @_; + if ($server->{'tag'} ne $active_channel->{'server'}->{'tag'}) { + return; + } + my $nr = find_nick($nick); + if ($nr != -1) { + remove_nick($nr); + } +} + +sub sig_nick { + my ($server, $newnick, $oldnick, $address) = @_; + if ($server->{'tag'} ne $active_channel->{'server'}->{'tag'}) { + return; + } + my $nr = find_nick($oldnick); + if ($nr != -1) { # if nick was found (nickchange is in current channel) + my $nick = $nicklist[$nr]; + remove_nick($nr); + $nick->{'nick'} = $newnick; + calc_text($nick); + insert_nick($nick); + } +} + +sub sig_mode { + my ($channel, $nick, $setby, $mode, $type) = @_; # (nick and channel as rec) + if ($channel->{'server'}->{'tag'} ne $active_channel->{'server'}->{'tag'} || $channel->{'name'} ne $active_channel->{'name'}) { + return; + } + my $nr = find_nick($nick->{'nick'}); + if ($nr == -1) { + Irssi::print("nicklist warning: $nick->{'nick'} had mode set on $channel->{'name'}, but was not found in nicklist"); + } else { + my $nicklist_item = $nicklist[$nr]; + remove_nick($nr); + $nicklist_item->{'mode'} = ($nick->{'op'}?$MODE_OP:$nick->{'halfop'}?$MODE_HALFOP:$nick->{'voice'}?$MODE_VOICE:$MODE_NORMAL); + calc_text($nicklist_item); + insert_nick($nicklist_item); + } +} + +##### command binds ##### +Irssi::command_bind 'nicklist' => sub { + my ( $data, $server, $item ) = @_; + $data =~ s/\s+$//g; + Irssi::command_runsub ('nicklist', $data, $server, $item ) ; +}; +Irssi::signal_add_first 'default command nicklist' => sub { + # gets triggered if called with unknown subcommand + cmd_help(); +}; +Irssi::command_bind('nicklist update',\&update); +Irssi::command_bind('nicklist help',\&cmd_help); +Irssi::command_bind('nicklist scroll',\&cmd_scroll); +Irssi::command_bind('nicklist fifo',\&cmd_fifo_start); +Irssi::command_bind('nicklist screen',\&cmd_screen_start); +Irssi::command_bind('nicklist screensize',\&screen_size); +Irssi::command_bind('nicklist off',\&cmd_off); + +##### signals ##### +Irssi::signal_add_last('window item changed', \&make_nicklist); +Irssi::signal_add_last('window changed', \&make_nicklist); +Irssi::signal_add_last('channel wholist', \&sig_channel_wholist); +Irssi::signal_add_first('message join', \&sig_join); # first, to be before ignores +Irssi::signal_add_first('message part', \&sig_part); +Irssi::signal_add_first('message kick', \&sig_kick); +Irssi::signal_add_first('message quit', \&sig_quit); +Irssi::signal_add_first('message nick', \&sig_nick); +Irssi::signal_add_first('message own_nick', \&sig_nick); +Irssi::signal_add_first('nick mode changed', \&sig_mode); + +Irssi::signal_add('setup changed', \&read_settings); + +##### settings ##### +Irssi::settings_add_str('nicklist', 'nicklist_screen_prefix', '\e[m '); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_op', '\e[32m@\e[39m'); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_halfop', '\e[34m%\e[39m'); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_voice', '\e[33m+\e[39m'); +Irssi::settings_add_str('nicklist', 'nicklist_prefix_mode_normal', ' '); + +Irssi::settings_add_int('nicklist', 'nicklist_width',11); +Irssi::settings_add_int('nicklist', 'nicklist_height',24); +Irssi::settings_add_str('nicklist', 'nicklist_fifo_path', Irssi::get_irssi_dir . '/nicklistfifo'); +Irssi::settings_add_str('nicklist', 'nicklist_screen_split_windows', ''); +Irssi::settings_add_str('nicklist', 'nicklist_automode', ''); + +read_settings(); +if (uc(Irssi::settings_get_str('nicklist_automode')) eq 'SCREEN') { + cmd_screen_start(); +} elsif (uc(Irssi::settings_get_str('nicklist_automode')) eq 'FIFO') { + cmd_fifo_start(); +} diff --git a/irssi-files/scripts/splitlong.pl b/irssi-files/scripts/splitlong.pl new file mode 100644 index 0000000..e88840b --- /dev/null +++ b/irssi-files/scripts/splitlong.pl @@ -0,0 +1,60 @@ +# /set splitlong_max_length +# specifies the maximum length of a msg, automatically chosen when set to "0" +# default: 0 +# +# /set splitlong_line_start +# /set splitlong_line_end +# self-explanatory +# defaults: "... ", " ..." +### +use strict; +use vars qw($VERSION %IRSSI); + +use Irssi 20011001; + +$VERSION = "0.20"; +%IRSSI = ( + authors => "Bjoern \'fuchs\' Krombholz", + contact => "bjkro\@gmx.de", + name => "splitlong", + licence => "Public Domain", + description => "Split overlong PRIVMSGs to msgs with length allowed by ircd", + changed => "Wed Jun 25 00:17:00 CET 2003", + changes => "Actually the real 0.19 (now 0.20), but upload didn't work some month ago, target problem fixed..." +); + +sub sig_command_msg { + my ($cmd, $server, $winitem) = @_; + my ( $param, $target,$data) = $cmd =~ /^(-\S*\s)?(\S*)\s(.*)/; + + my $maxlength = Irssi::settings_get_int('splitlong_max_length'); + my $lstart = Irssi::settings_get_str('splitlong_line_start'); + my $lend = Irssi::settings_get_str('splitlong_line_end'); + + if ($maxlength == 0) { + # 497 = 510 - length(":" . "!" . " PRIVMSG " . " :"); + $maxlength = 497 - length($server->{nick} . $server->{userhost} . $target); + } + my $maxlength2 = $maxlength - length($lend); + + if (length($data) > ($maxlength)) { + my @spltarr; + + while (length($data) > ($maxlength2)) { + my $pos = rindex($data, " ", $maxlength2); + push @spltarr, substr($data, 0, ($pos < ($maxlength/10 + 4)) ? $maxlength2 : $pos) . $lend; + $data = $lstart . substr($data, ($pos < ($maxlength/10 + 4)) ? $maxlength2 : $pos+1); + } + + push @spltarr, $data; + foreach (@spltarr) { + Irssi::signal_emit("command msg", "$target $_", $server, $winitem); + } + Irssi::signal_stop(); + } +} + +Irssi::settings_add_int('misc', 'splitlong_max_length', 0); +Irssi::settings_add_str('misc', 'splitlong_line_start', "... "); +Irssi::settings_add_str('misc', 'splitlong_line_end', " ..."); +Irssi::command_bind('msg', 'sig_command_msg'); diff --git a/irssi-files/scripts/xchatnickcolor.pl b/irssi-files/scripts/xchatnickcolor.pl new file mode 100644 index 0000000..0269260 --- /dev/null +++ b/irssi-files/scripts/xchatnickcolor.pl @@ -0,0 +1,160 @@ +use strict; +use Irssi 20020101.0250 (); +use vars qw($VERSION %IRSSI); +$VERSION = "1"; +%IRSSI = ( + authors => "Timo Sirainen, Ian Peters", + contact => "tss\@iki.fi", + name => "Nick Color", + description => "assign a different color for each nick", + license => "Public Domain", + url => "http://irssi.org/", + changed => "2002-03-04T22:47+0100" +); + +# hm.. i should make it possible to use the existing one.. +Irssi::theme_register([ + 'pubmsg_hilight', '{pubmsghinick $0 $3 $1}$2' +]); + +my %saved_colors; +my %session_colors = {}; +my @colors = qw/ 2 3 4 5 6 7 9 10 11 12 13 14 15/; + +sub load_colors { + open COLORS, "$ENV{HOME}/.irssi/saved_colors"; + + while () { + # I don't know why this is necessary only inside of irssi + my @lines = split "\n"; + foreach my $line (@lines) { + my($nick, $color) = split ":", $line; + $saved_colors{$nick} = $color; + } + } + + close COLORS; +} + +sub save_colors { + open COLORS, ">$ENV{HOME}/.irssi/saved_colors"; + + foreach my $nick (keys %saved_colors) { + print COLORS "$nick:$saved_colors{$nick}\n"; + } + + close COLORS; +} + +# If someone we've colored (either through the saved colors, or the hash +# function) changes their nick, we'd like to keep the same color +# associated +# with them (but only in the session_colors, ie a temporary mapping). + +sub sig_nick { + my ($server, $newnick, $nick, $address) = @_; + my $color; + + $newnick = substr ($newnick, 1) if ($newnick =~ /^:/); + + if ($color = $saved_colors{$nick}) { + $session_colors{$newnick} = $color; + } elsif ($color = $session_colors{$nick}) { + $session_colors{$newnick} = $color; + } +} + +# This gave reasonable distribution values when run across +# /usr/share/dict/words + +sub simple_hash { + my ($string) = @_; + chomp $string; + my @chars = split //, $string; + my $counter; + + foreach my $char (@chars) { + $counter += ord $char; + } + + $counter = $colors[$counter % 11]; + + return $counter; +} + +# FIXME: breaks /HILIGHT etc. +sub sig_public { + my ($server, $msg, $nick, $address, $target) = @_; + my $chanrec = $server->channel_find($target); + return if not $chanrec; + my $nickrec = $chanrec->nick_find($nick); + return if not $nickrec; + my $nickmode = $nickrec->{op} ? "@" : $nickrec->{voice} ? "+" : ""; + + # Has the user assigned this nick a color? + my $color = $saved_colors{$nick}; + + # Have -we- already assigned this nick a color? + if (!$color) { + $color = $session_colors{$nick}; + } + + # Let's assign this nick a color + if (!$color) { + $color = simple_hash $nick; + $session_colors{$nick} = $color; + } + + $color = "0".$color if ($color < 10); + $server->command('/^format pubmsg %b<%w$2'.chr(3).$color.'$[-11]0%b> +%K|%n $1'); + # $server->command('/^format action_public {pubaction + # '.chr(3).$color.'$0}$1'); +} + +sub cmd_color { + my ($data, $server, $witem) = @_; + my ($op, $nick, $color) = split " ", $data; + + $op = lc $op; + + if (!$op) { + Irssi::print ("No operation given"); + } elsif ($op eq "save") { + save_colors; + } elsif ($op eq "set") { + if (!$nick) { + Irssi::print ("Nick not given"); + } elsif (!$color) { + Irssi::print ("Color not given"); + } elsif ($color < 2 || $color > 14) { + Irssi::print ("Color must be between 2 and 14 inclusive"); + } else { + $saved_colors{$nick} = $color; + } + } elsif ($op eq "clear") { + if (!$nick) { + Irssi::print ("Nick not given"); + } else { + delete ($saved_colors{$nick}); + } + } elsif ($op eq "list") { + Irssi::print ("\nSaved Colors:"); + foreach my $nick (keys %saved_colors) { + Irssi::print (chr (3) . "$saved_colors{$nick}$nick" . + chr (3) . "1 ($saved_colors{$nick})"); + } + } elsif ($op eq "preview") { + Irssi::print ("\nAvailable colors:"); + foreach my $i (2..14) { + Irssi::print (chr (3) . "$i" . "Color #$i"); + } + } +} + +load_colors; + +Irssi::command_bind('color', 'cmd_color'); + +Irssi::signal_add('message public', 'sig_public'); +Irssi::signal_add('event nick', 'sig_nick'); diff --git a/irssi-files/themes/xchat.theme b/irssi-files/themes/xchat.theme new file mode 100644 index 0000000..ca253fd --- /dev/null +++ b/irssi-files/themes/xchat.theme @@ -0,0 +1,465 @@ +####################################################################### +# +# xchat.theme for irssi - http://waxman.org/irssi/xchat.theme (xchat.png) +# +# xchat.theme, Public Beta, 1.5.1 2004/08/06 +# +# Copyright 2004 Dave Waxman +# +# Please report any bugs to xchattheme@waxman.org +# +# For best results it is suggested you do the following: +# /set show_nickmode_empty on +# /set hide_server_tag on +# /set timestamp %H:%M:%S +# /set indent 28 +# +# This theme 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 theme 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 theme; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +####################################################################### + + +# default foreground color (%w) - -1 is the "default terminal color" +default_color = "-1"; + +# print timestamp/servertag at the end of line, not at beginning +info_eol = "false"; + +# these characters are automatically replaced with specified color +# (dark grey by default) +#replaces = { "[]=" = "%b$*%n"; }; + +abstracts = { + + # text to insert at the beginning of each non-message line + line_start = ""; + + # timestamp styling, nothing by default + timestamp = "%K[%n$0-%K]%n"; + + # any kind of text that needs hilighting, default is to bold + hilight = "%_$*%_"; + + # any kind of error message, default is bright red + error = "%R$*%n"; + + # channel name is printed + channel = "$*"; + + # nick is printed + nick = "%_$*%_"; + + # nick host is printed + nickhost = "%K[%n$*%K]%n"; + + # server name is printed + server = "%_$*%_"; + + # some kind of comment is printed + comment = "$*"; + + # reason for something is printed (part, quit, kick, ..) + reason = "{comment $*}"; + + # highlighted nick/host is printed (joins) + channick_hilight = "%W$*%w"; + chanhost_hilight = "{nickhost %c$*%w}"; + + # nick/host is printed (parts, quits, etc.) + channick = "%w$*%w"; + chanhost = "{nickhost $*}"; + + # highlighted channel name is printed + channelhilight = "%n$*%n"; + + # ban/ban exception/invite list mask is printed + ban = "%c$*%n"; + + # Actions + + action_core = " %m * %K|%W $*%n"; + + # generic one that's used by most actions + action = "{action_core $*} "; + + # own action, both private/public + ownaction = "{action $*}"; + + # own action with target, both private/public + ownaction_target = "{action_core $0}%W:%c$1%n "; + + # private action sent by others + pvtaction = "%G (*) $*%n "; + pvtaction_query = "{action $*}"; + + # public action sent by others + pubaction = "{action $*}"; + + # wallops + wallop = "%b$*%n: "; + wallop_nick = "%w$*"; + wallop_action = "%W * $*%n "; + + # DCC + dcc = " %w-%c-%C- %K|%G $*%n"; + dccfile = "%_$*%_"; + + # DCC chat, own msg/action + dccownmsg = "%K[%r$0%b($1-%b)%w%K] "; + dccownnick = "%R$*%n"; + dccownquerynick = "%G$*%n"; + dccownaction = "{action $*}"; + dccownaction_target = "{action_core $0}%W:%c$1%n "; + + # DCC chat, others + dccmsg = "%K[%G$1-%b(%g$0%b)%w%K]%n "; + dccquerynick = "%G$*%w"; + dccaction = "%W (*dcc*) $*%w %|"; + + ## + ## statusbar + ## + + # default background for all statusbars. You can also give + # the default foreground color for statusbar items. + sb_background = "%n%n"; + + # background for prompt / input line + sb_prompt_bg = "%w"; + # background for info statusbar + sb_info_bg = "%8"; + + # text at the beginning of statusbars. sb-item already puts + # space there,so we don't use anything by default. + sbstart = "%K-("; + # text at the end of statusbars. Use space so that it's never + # used for anything. + sbend = "%K)-"; + + topicsbstart = "{sbstart $*}"; + topicsbend = "{sbend $*}"; + + prompt = "%K[%w$tag%K/%m$cumode%c$*%K]%n "; + + + sb = " %m-=%K[%w$*%K]%m=-%n"; + sbmode = "%K(%n+%C$*%K)%n"; + sbaway = " %K(%MzZzZ%K)"; + sbservertag = "%n:$0 (change with ^X)"; + + # activity in statusbar + + # ',' separator + sb_act_sep = "%K$*"; + # normal text + sb_act_text = "%c$*"; + # public message + sb_act_msg = "%W$*"; + # hilight + sb_act_hilight = "%M$*"; + # hilight with specified color, $0 = color, $1 = text + sb_act_hilight_color = "$0$1-%w"; + + indent_default = " %K|%n "; +}; +formats = { + "fe-text" = { + lastlog_too_long = " %w-%c-%C- %K| %W/LASTLOG %nwould print %C$0 %nlines. Use the -force option to print all of them."; + lastlog_count = " %w-%c-%C- %K| %W/LASTLOG %C$0 $nlines"; + lastlog_start = " %w-%c-%C- %K| %nBegining of LASTLOG:"; + lastlog_end = " %w-%c-%C- %K| %nEnd of LASTLOG"; + lastlog_separator = " %w-%c-%C- %K| %c---"; + refnum_not_found = " %w-%c-%C- %K| %RERROR: %nWindow number %C{hilight $0] %ndoes not exist"; + window_too_small = " %w-%c-%C- %K| %RERROR: %nNot enough room to resize this window"; + cant_hide_last = " %w-%c-%C- %K| %RERROR: %nYou can't hide the last window"; + cant_hide_sticky_windows = " %w-%c-%C- %K| %RError: %nYou can't hide sticky windows"; + cant_show_sticky_windows = " %w-%c-%C- %K| %RError: %nYou can't show sticky windows"; + window_not_sticky = " %w-%c-%C- %K| %WWindow: %nWindow is not sticky"; + window_set_sticky = " %w-%c-%C- %K| %WWindow: %nWindow set sticky"; + window_unset_sticky = " %w-%c-%C- %K| %WWindow: %nWindow set not sticky"; + window_info_sticky = " %w-%c-%C- %K| %WWindow: %nWindow Sticky : $0"; + Window_info_scroll = " %w-%c-%C- %K| %WWindow: %nWindow Scroll : $0"; + paste_warning = " %w-%c-%C- %K| %rWARNING: %nTrying to paste %C$0%n lines to %W$1%n."; + paste_prompt = "%RPress Ctrl-K to continue, Ctrl-C to abort."; + }; + "fe-common/core" = { + line_start_irssi = ""; + join = " %w-%c-%C> %K|%n {channick_hilight $0} {chanhost_hilight $1} has joined %c{channel $2}"; + part = " %w<%c-%C- %K|%n {channick_hilight $0} {chanhost_hilight $1} has left %c{channel $_$2$_} %K(%n{reason $3}%K)"; + kick = " %w<%c-%C- %K|%n {nick $2} has kicked {channick_hilight $0} %nfrom %c{channel $_$1$_} %K(%n{reason $3}%K)"; + quit = " %w<%c-%C- %K|%n {channick_hilight $0} %K[%c$1%K] %nhas quit %K(%n{reason $2}%K)"; + names = " %w-%c-%C- %K|%C Users on $0:"; + names_prefix = " %w-%c-%C- %K| "; + names_nick_op = "%K[%C$0%n$1-%K] "; + names_nick_halfop = "%K[%c$0%n$1-%K] "; + names_nick_voice = "%K[%c$0%n$1-%K] "; + names_nick = "%K[%n$0$1%K] "; + endofnames = " %w-%c-%C- %K| %nUsers %c$1 %nnicks %K[%c$2 %nops, %c$3 %nhalfops, %c$4 %nvoices, %c$5 %nnormal%K]"; + quit_once = "{channel $3} {channick $0} {chanhost $1} %K(%n{reason $2}%K)%n {channel $_$2$_}"; + nick_changed = " %w-%c-%C- %K| %W$0 %nis now known as %C$1"; + chanmode_change = " %w-%c-%C- %K| %W{nickhilight $2} %nsets modes %K[%n{$channelhilight $0} {mode $1}%K]"; + channel_mode = " %w-%c-%C- %K| %W{nickhilight $2} %nsets modes %K[%n{$channelhilight $0} {mode $1}%K]"; + topic = " %w-%c-%C- %K| %nTopic for {channelhilight $0} is $1"; + new_topic = " %w-%c-%C- %K| %W{nick $0} %nhas changed the topic to: %C$2"; + topic_unset = " %w-%c-%C- %K| %nTopic unset by {nick $0} on {channel $1}"; + daychange = " %w-%c-%C- %K| %nDay changed to %%d %%b %%Y"; + your_nick_changed = " %w-%c-%C- %K| %nYou're now known as %W$1"; + + #pubmsg = "%b<%w$2\00311$[-11]0%b> %K|%n $1"; + own_msg_private_query = "%m<%W$[-12]2%m> %K| %n$1"; + msg_private_query = "%b<%w$[-12]0%b>%K | %n$2"; + own_msg = "%m<%W$2$[-11]0%m>%K | %n$1"; + own_msg_private = "%G>%w$[-12]0%G<%K |%n $1-"; + pubmsg_me = "{pubmsgmenick {menick $[-11]0}}%K|%n $1"; + pubmsg_me_channel = "{pubmsgmenick $3 {menick $[-11]0}{msgchannel $1}}%K|%n $2"; + pubmsg_hilight = "{pubmsghinick $0 $3 $[-11]1}%K|%n $2"; + pubmsg_hilight_channel = "{pubmsghinick $0 $4 $[-11]1{msgchannel $2}}%K|%n $3"; + #pubmsg_channel = "{pubmsgnick {pubnick $[-11]0}{msgchannel $1}}%K|%n $2"; + + pubmsg = "{pubmsgnick $2 {pubnick \00304$0}}$1"; + talking_with = " %w-%c-%C- %K| %nYou are now talking with %W$0"; + refnum_too_low = " %w-%c-%C- %K| %WWindow: %nWindow number must be greater than 1"; + error_server_sticky = " %w-%c-%C- %K| %WWindow: %nWindow's server is sticky, use -unsticky option to change"; + set_server_sticky = " %w-%c-%C- %K| %WWindow: %nWindow's server set sticky"; + unset_server_sticky = " %w-%c-%C- %K| %WWindow: %nWindow's server set not sticky"; + window_name_not_unique = " %w-%c-%C- %K| %WWindow: %nWindow names must be unique"; + window_level = " %w-%c-%C- %K| %WWindow: %nWindow level is now %C$0"; + window_set_immortal = " %w-%c-%C- %K| %WWindow: %nWindow set immortal"; + window_unset_immortal = " %w-%c-%C- %K| %WWindow: %nbWindow set not immortal"; + window_immortal_error = " %w-%c-%C- %K| %WWindow: %nWindow is immortal"; + windowlist_header = " %w-%c-%C- %K| %nRef Name Active item Server Level"; + windowlist_line = " %w-%c-%C- %K| %n$[3]0 %|$[20]1 $[15]2 $[15]3 $4"; + windowlist_footer = ""; + windows_layout_saved = " %w-%c-%C- %K| %WWindow: %nLayout of windows saved"; + windows_layout_reset = " %w-%c-%C- %K| %WWindow: %nLayout of windows reset to defaults"; + window_info_header = ""; + window_info_footer = ""; + window_info_refnum = " %w-%c-%C- %K| %WWindow: %nWindow : %W$0"; + window_info_refnum_sticky = " %w-%c-%C- %K| %WWindow: %nWindow : %W{hilight #$0 (sticky)}"; + window_info_name = " %w-%c-%C- %K| %WWindow: %nName : $0"; + window_info_history = " %w-%c-%C- %K| %WWindow: %nHistory : $0"; + window_info_immortal = " %w-%c-%C- %K| %WWindow: %nImmortal: yes"; + window_info_size = " %w-%c-%C- %K| %WWindow: %nSize : $0x$1"; + window_info_level = " %w-%c-%C- %K| %WWindow: %nLevel : $0"; + window_info_server = " %w-%c-%C- %K| %WWindow: %nServer : $0"; + window_info_server_sticky = " %w-%c-%C- %K| %WWindow: %nServer : $0 (sticky)"; + window_info_theme = " %w-%c-%C- %K| %WWindow: %nTheme : $0$1"; + window_info_bound_items_header = " %w-%c-%C- %K| %WWindow: %nBounds : {hilight Name Server tag}"; + window_info_bound_item = " %K | %n : $[!30]0 $[!15]1 $2"; + window_info_bound_items_footer = ""; + window_info_items_header = " %w-%c-%C- %K| %WWindow: %nItems : {hilight Name Server tag}"; + window_info_item = " %w-%c-%C- %K| %WWindow: %n$[7]0: $[!30]1 $2"; + window_info_items_footer = ""; + looking_up = " %w-%c-%C- %K| %WServer: %nLooking up host %W$0"; + connecting = " %w-%c-%C- %K| %WConnecting to %W$0 %K(%C$1%K) %non port %C$2"; + connection_established = " %w-%c-%C- %K| %WServer:%n Connection to %W$0 %nestablished"; + cant_connect = " %w-%c-%C- %K| %WServer:%n Unable to connect to %W$0 %non port %C$1 %K(%C$2%K)"; + connection_lost = " %w-%c-%C- %K| %WServer:%n Connection lost to %W$0"; + lag_disconnected = " %w-%c-%C- %K| %WServer:%n No PONG reply from server %W$0 %nin %C$1 %nseconds, disconnecting"; + disconnected = " %w-%c-%C- %K| %WServer:%n Disconnected from %W$0 %K(%C$1%K)"; + server_quit = " %w-%c-%C- %K| %WServer:%n Disconnecting from server %W$0%n: %C$1"; + server_changed = " %w-%c-%C- %K| %WServer:%n Changed to %W{hilight $2} %nserver %C$1"; + unknown_server_tag = " %w-%c-%C- %K| %RERROR:%n Server tag %W$0 %nnot found"; + no_connected_servers = " %w-%c-%C- %K| %RERROR:%n Not connected to any servers"; + server_list = " %w-%c-%C- %K| %WServer:%n $0: $1:$2 ($3)"; + server_lookup_list = " %w-%c-%C- %K| %WServer:%n $0: $1:$2 ($3) (connecting...)"; + server_reconnect_list = " %w-%c-%C- %K| %WServer:%n $0: $1:$2 ($3) ($5 left before reconnecting)"; + server_reconnect_removed = " %w-%c-%C- %K| %WServer:%n Removed reconnection to server %W$0 %nport %C$1"; + server_reconnect_not_found = " %w-%c-%C- %K| %WServer:%n Reconnection tag %W{hilight $0} %ndoes not exist"; + setupserver_added = " %w-%c-%C- %K| %WServer:%n Server %W{hilight $0} %nsaved"; + setupserver_removed = " %w-%c-%C- %K| %WServer:%n Server %W{hilight $0} %nremoved"; + setupserver_not_found = " %w-%c-%C- %K| %WServer:%n Server %W{hilight $0} %ndoes not exist"; + your_nick = " %w-%c-%C- %K| %nYour nickname is %W$0"; + invite = " %w-%c-%C- %K| %W$0 %ninvites you to channel %W$1"; + not_invited = " %w-%c-%C- %K| %nYou have not been invited to a channel!"; + chanlist_header = " %w-%c-%C- %K| %WChannel: %nYou are on the following channels:"; + chanlist_line = " %w-%c-%C- %K| %WChannel: %C{hilight $0} (+$1) [$2]: $3"; + chansetup_not_found = " %w-%c-%C- %K| %WChannel: %nChannel %W{hilight $0} %ndoes not exist"; + chansetup_added = " %w-%c-%C- %K| %WChannel: %nChannel %W{hilight $0} %nsaved"; + chansetup_removed = " %w-%c-%C- %K| %WChannel: %nChannel %W{hilight $0} %nremoved"; + chansetup_header = " %w-%c-%C- %K| %WChannel Network Password Settings"; + chansetup_line = " %w-%c-%C- %K| %n{hilight $[15]0} $[10]1 $[10]2 $3"; + chansetup_footer = ""; + no_msgs_got = " %b{fq Error}%n | %bYou have not received a message from anyone yet"; + no_msgs_sent = " %b{fq Error}%n | %bYou have not sent a message to anyone yet"; + query_start = " %w-%c-%C- %K| %WQuery: %nStarting query with %W$0 %non %C$1"; + query_stop = " %w-%c-%C- %K| %WQuery: %nClosing query with %W$0"; + no_query = " %w-%c-%C- %K| %WQuery: %nNo query with %W$0"; + query_server_changed = " %w-%c-%C- %K| %WQuery: %nQuery with %W$0 %nchanged to %C$1"; + hilight_header = ""; + hilight_line = " %w-%c-%C- %K| %WHilight: %n$[-4]0 $1 $2 $3$4"; + hilight_footer = ""; + hilight_not_found = " %w-%c-%C- %K| %WHighlight: %nHilight item %C{hilight $0} %ndoes not exist"; + hilight_removed = " %w-%c-%C- %K| %WHilight: %nHighlight item %C{hilight $0} removed"; + alias_added = " %w-%c-%C- %K| %WAlias: %nAlias %W{hilight $0} %nadded"; + alias_removed = " %w-%c-%C- %K| %WAlias: %nAlias %W{hilight $0} %nremoved"; + alias_not_found = " %w-%c-%C- %K| %WAlias: %nAlias %W{hilight $0} %ndoes not exist"; + aliaslist_header = ""; + aliaslist_line = " %w-%c-%C- %K| %WAlias: %n$[10]0 $1"; + aliaslist_footer = ""; + no_away_msgs = " %w-%c-%C- %K| %WAwayLog: %nYou have no messages waiting"; + away_msgs = " %w-%c-%C- %K| %WAwayLog: %nYou have %C$1 %nmessages waiting:"; + command_unknown = " %w-%c-%C- %K| %RERROR: %nUnknown command %C{hilight $0}"; + command_ambiguous = " %w-%c-%C- %K| %RERROR: %nAmbiguous command %C{hilight $0}"; + option_unknown = " %w-%c-%C- %K| %RERROR: %nUnknown option %C{hilight $0}"; + option_ambiguous = " %w-%c-%C- %K| %RERROR: %nAmbiguous option %C{hilight $0}"; + option_missing_arg = " %w-%c-%C- %K| %RERROR: %nMissing required argument for %C{hilight $0}"; + not_enough_params = " %w-%c-%C- %K| %RERROR: %nNot enough parameters given"; + not_connected = " %w-%c-%C- %K| %RERROR: %nNot connected to server"; + not_joined = " %w-%c-%C- %K| %RERROR: %nNot joined to any channel"; + chan_not_found = " %w-%c-%C- %K| %RERROR: %nNot joined to this channel"; + chan_not_synced = " %w-%c-%C- %K| %RERROR: %nChannel not fully synchronized yet, try again after a while"; + illegal_proto = " %w-%c-%C- %K| %RERROR: %nCommand isn't designed for the chat protocol of the active server"; + not_good_idea = " %w-%c-%C- %K| %RERROR: %nDoing this is not a good idea. Add -YES if you really mean it"; + format_title = " %w-%c-%C- %K| %WFormat: %n{hilight $0}%n%: %w-%c-%C- %K| %WFormat: %n {hilight $1}"; + format_subtitle = " %w-%c-%C- %K| %WFormat: %n {hilight $0}"; + format_item = " %w-%c-%C- %K| %WFormat:%W $0 =%C \"$1\";"; + ignored = " %w-%c-%C- %K| %WIgnore: %nIgnoring %C{hilight $1} %nfrom %W{nick $0}"; + ignored_options = " %w-%c-%C- %K| %WIgnore: %nIgnoring %C{hilight $1} %nfrom %W{nick $0} ($2)"; + unignored = " %w-%c-%C- %K| %WIgnore: %nUnignored %W{nick $0}"; + ignore_not_found = " %w-%c-%C- %K| %W{nick $0} %nis not being ignored"; + ignore_no_ignores = " %w-%c-%C- %K| %nThere are no ignores"; + ignore_header = " %w-%c-%C- %K| %n%# Num Mask Type Options"; + ignore_line = " %w-%c-%C- %K| %n%#$[-4]0 $[32]1 $[10]2 $3 $4"; + ignore_footer = ""; + bind_header = " %w-%c-%C- %K| %n%#Key Action"; + bind_list = " %w-%c-%C- %K| %n%#$[!16]0 $1 $2"; + bind_footer = ""; + no_completions = " %w-%c-%C- %K| %nThere are no completions"; + completion_removed = " %w-%c-%C- %K| %nRemoved completion %W$0"; + completion_header = " %w-%c-%C- %K| %n%#Key Value Auto"; + completion_line = " %w-%c-%C- %K| %n%#$[10]0 $[!40]1 $2"; + completion_footer = ""; + theme_saved = " %w-%c-%C- %K| %nTheme saved to %W$0"; + theme_save_failed = " %w-%c-%C- %K| %RERROR:%n Error saving theme to %W$0: $1"; + theme_not_found = " %w-%c-%C- %K| %RERROR:%n Theme %W{hilight $0} %nnot found"; + theme_changed = " %w-%c-%C- %K| %nNow using theme %W{hilight $0} ($1)"; + unknown_chatnet = " %w-%c-%C- %K| %RERROR: %nUnknown chat network %W{hilight $0}"; + perl_error = " %w-%c-%C- %K| %RERROR: %n%RPerl error: $0"; + config_saved = " %w-%c-%C- %K| %WSaved configuration to file %C$0"; + config_reloaded = " %w-%c-%C- %K| %WReloaded configuration"; + config_modified = " %w-%c-%C- %K| %WConfiguration file was modified since irssi was last started - do you want to overwrite the possible changes?"; + set_title = " %w-%c-%C- %K| %WSET: %W{hilight $0}:"; + set_item = " %w-%c-%C- %K| %WSET:%W $0 %n= %C$1"; + set_unknown = " %w-%c-%C- %K| %WSET: %nUnknown setting {hilight $0}"; + set_not_boolean = " %w-%c-%C- %K| %WSET: %nSetting %C{hilight $0} %nis not boolean, use /SET"; + not_toggle = " %w-%c-%C- %K| %RERROR: %nValue must be either ON, OFF or TOGGLE"; + talking_in = " %b{fq Irssi}%n | %bYou are now talking in %W$0"; + not_in_channels = " %b{fq Channels}%n | %bYou are not on any channels"; + current_channel = " %b{fq Channels}%n | %bCurrent channel $0"; + }; + "fe-common/irc" = { + usermode_change = " %w-%c-%C- %K| %nMode change %C{mode $0}%n for user {nick $1}"; + ircnet_added = " %w-%c-%C- %K| %WIRCnet %W{hilight $0} %nsaved"; + ircnet_removed = " %w-%c-%C- %K| %WIRCnet %W{hilight $0} %nremoved"; + ircnet_not_found = " %w-%c-%C- %K| %WIRCnet %W{hilight $0} %ndoes not exist"; + ircnet_header = " %w-%c-%C- %K| %WIRCnets:"; + ircnet_footer = ""; + setupserver_header = " %w-%c-%C- %K| %WServer Port Network Settings"; + setupserver_line = " %w-%c-%C- %K| %n$[!20]0 $[5]1 $[10]2 $3"; + setupserver_footer = ""; + joinerror_toomany = " %w-%c-%C- %K| %RERROR: %nCannot join channel %W$0%n (You have joined too many channels)"; + joinerror_full = " %w-%c-%C- %K| %RERROR: %nCannot join channel %W$0%n (Channel is full)"; + joinerror_invite = " %w-%c-%C- %K| %RERROR: %nCannot join channel %W$0%n (Channel is invite only)"; + joinerror_banned = " %w-%c-%C- %K| %RERROR: %nCannot join channel %W$0%n (You are banned!)"; + joinerror_bad_key = " %w-%c-%C- %K| %RERROR: %nCannot join channel %W$0%n (Channel is keyword protected)"; + joinerror_bad_mask = " %w-%c-%C- %K| %RERROR: %nCannot join channel %W$0%n (Bad channel mask)"; + joinerror_unavail = " %w-%c-%C- %K| %RERROR: %nCannot join channel %W$0%n (Channel is temporarily unavailable)"; + joinerror_duplicate = " %w-%c-%C- %K| %RERROR: %nCannot create channel %W$0%n, it already exists"; + joinerror_rejoin = " %w-%c-%C- %K| %RERROR: %nChannel %W$0%n is temporarily unavailable. Trying to rejoin automatically, use /RMREJOINS to abort."; + inviting = " %w-%c-%C- %K| %WInviting: %W$0 %nto %C$1"; + chanmode_change = " %w-%c-%C- %K| %W{nickhilight $2} %nsets modes %K[%n{$channelhilight $0} {mode $1}%K]"; + url = " %w-%c-%C- %K| %nHome page for channel %W$0 %nis at %C$1"; + bantype = " %w-%c-%C- %K| %nBan type set to $0"; + no_bans = " %w-%c-%C- %K| %nNo bans set in channel %C$0"; + banlist = " %w-%c-%C- %K| %n$[-2]0. $1: $2"; + banlist_long = " %w-%c-%C- %K| %n$[-2]0. $1: $2 (set by $3 $4 secs ago)"; + nick_away = " %w-%c-%C- %K| %W$0 %nis away: %C$1"; + no_such_nick = " %w-%c-%C- %K| %W{hilight $0}%n: no such nick/channel"; + nick_in_use = " %w-%c-%C- %K| %nNick %W$0%n is already in use"; + nick_unavailable = " %w-%c-%C- %K| %nNick %W$0%n is temporarily unavailable"; + your_nick_owned = " %w-%c-%C- %K| %nYour nick is owned by %W$3 %K(%C$1@$2%K)"; + notice_server = " %w-%c-%C- %K| %WServer: $n[$0] $1"; + kill = " %w-%c-%C- %K| %RKILLED!! %nYou were killed by %W$0 %C($1): $2 (Path: $3)"; + kill_server = " %w-%c-%C- %K| %RKILLED!! %nYou were killed by $0: $1 (Path: $2)"; + error = " %w-%c-%C- %K| %RERROR: %n$0"; + default_event = " %w-%c-%C- %K| %WServer:%n $1"; + default_event_server = " %w-%c-%C- %K| %n[$0] $2: $1"; + channel_mode = " %w-%c-%C- %K| %W{nick $2} %nsets modes %K[%n{$channelhilight $0} {mode $1}%K]"; + topic = " %w-%c-%C- %K| %nTopic for %W{channelhilight $0}%n is:%C $1"; + channel_created = " %w-%c-%C- %K| %nChannel %W$0 %nwas created on %c$1"; + no_topic = " %w-%c-%C- %K| %nNo topic set for {channelhilight $0}"; + topic_info = " %w-%c-%C- %K| %nTopic set by {nick $0} {nickhost $2} {comment $1}"; + away = " %w-%c-%C- %K| %nYou have been marked as being away"; + unaway = " %w-%c-%C- %K| %nYou are no longer marked as being away"; + whois = " %w-%c-%C- %K| %b[%n$0%b] %n($1@$2) %n: $3"; + whois_channels = " %w-%c-%C- %K| %b[%n$0%b] %n$1"; + whois_idle = " %w-%c-%C- %K| %b[%n$0%b] %n$1 days $2 hours $3 minet $4 secs"; + whois_server = " %w-%c-%C- %K| %b[%n$0%b] %n$1 [$2]"; + whois_idle_signon = " %w-%c-%C- %K| %b[%w$0%b] %nIdle%w $1 days $2 hours $3 minutes $4 seconds, Signon $5"; + whois_oper = " %w-%c-%C- %K| %b[%n$0%b]%n $1 $2 $3 $4"; + whois_ip = " %w-%c-%C- %K| %b[%n$0%b]%n IP: $1"; + end_of_whois = " %w-%c-%C- %K| %b[%n$0%b] %nEnd of WHOIS List"; + whois_away = " %w-%c-%C- %K| %b[%n$0%b] %nis Away: %|$1"; + whois_registered = " %w-%c-%C- %K| %b[%n$0%b] %nhas registered this nick"; + whowas = " %w-%c-%C- %K| %b[%n$0%b]%n WAS ($1@$2) : $3"; + end_of_whowas = " %w-%c-%C- %K| %b[%n$0%b] %nEnd of WHOWAS List"; + who = " %w-%c-%C- %K| %b[%n$1%b]%n %n$4@$5 ($6) [Server: $7, $3 Hops]"; + end_of_who = " %w-%c-%C- %K| %b[%n$0%b] %nEnd of WHO list"; + whois_not_found = " %w-%c-%C- %K| %b[%n$0%b]%n No such nick"; + notice_public = "%W-%m$[-12]{0}%W- %K| %b(%m$1%b)%n $2"; + notice_private = "%b-%M$[-12]{0}%b- %K| %b(%M$1%b)%n $2"; + own_notice = "%G>%W$[-12]0%G< %K| %n$1-"; + channel_synced = " %w-%c-%C- %K| %nChannel %W{channel $0} %nwas synced in %C{hilight $1} %nseconds"; + netsplit = " %w<%c-%C- %K| %RNetsplit:%W $0 %R<-> %W$1 %nquits: %C$2"; + netsplit_more = " %w<%c-%C- %K| %RNetsplit: %W$0%R <-> %W$1 %nquits: %C$2 %n(+$3 more)"; + netsplit_join = " %w-%c-%C> %K| %gNetsplit Over%n - Joins: %C$0"; + netsplit_join_more = " %w-%c-%C> %K| %nJoins: %n$0 (+$1 more)"; + no_netsplits = " %w-%c-%C- %K| %nThere are no net splits"; + netsplits_header = " %w-%c-%C- %K| %n%C%#Nick Channel Server Splitted server"; + netsplits_line = " %w-%c-%C- %K| %n%#$[15]0 $[10]1 $[20]2 $[20]3"; + netsplits_footer = ""; + server_chanmode_change = " %w-%c-%C- %K| %W$2%n sets modes %K[%n$0 $1%K]%n"; + ctcp_reply = " %w-%c-%C- %K| %nGot %C$0 %nreply from %W$1: %C$2"; + ctcp_reply_channel = " %w-%c-%C- %K| %nGot %C$0 %nreply from %W$1 %nin channel %c$3: $2"; + ctcp_ping_reply = " %w-%c-%C- %K| %nGot %CPING %nresponse from %W$0: %c$1.$[-3.0]2 %nseconds"; + ctcp_requested = " %w-%c-%C- %K| %nGot %C$2 %nrequest from %W$0 %n($1) to $4: $3"; + ctcp_requested_unknown = " %w-%c-%C- %K| %nGot unknown %C$2%n request from %c$0 %n($1) to %n$4: $3"; + own_ctcp = " %w-%c-%C- %K| %nSending %WCTCP %C$1 %nto %c$0: $2"; + }; + "fe-common/perl" = { + script_not_found = " %w-%c-%C- %K| %rScript: %W{hilight $0} %nnot found"; + script_not_loaded = " %w-%c-%C- %K| %rScript: %W{hilight $0} is not loaded"; + script_loaded = " %w-%c-%C- %K| %rScript: %nLoded script %W{hilight $0}"; + script_unloaded = " %w-%c-%C- %K| %rScript: %nUnloaded script %W{hilight $0}"; + no_scripts_loaded = " %w-%c-%C- %K| %rScript: %nNo scripts are loaded"; + script_list_header = " %w-%c-%C- %K| %rScript Path"; + script_list_line = " %w-%c-%C- %K| %n$[!20]0 $1"; + script_list_footer = ""; + script_error = " %w-%c-%C- %K| %rScript: ERROR %n in script %W{hilight $0}:"; + }; + + "fe-common/irc/notifylist" = { + notify_join = " %w-%c-%C- %K| %WNotify: %W{hilight $0} %C($1@$2) [$3] %nhas connected to %C$4"; + notify_part = " %w-%c-%C- %K| %WNotify: %W{hilight $0}%n has disconnected from %C$4"; + notify_away = " %w-%c-%C- %K| %WNotify: %W{hilight $0} %C[$5] ($1@$2) [$3] %nis now away: %C$4"; + notify_unaway = " %w-%c-%C- %K| %WNotify: %W{hilight $0} %C($1@$2) [$3] %nis no longer away on %C$4"; + notify_unidle = " %w-%c-%C- %K| %WNotify: %W{hilight $0} %C($1@$2) [$3] %njust stopped idling on %C$5"; + notify_online = " %w-%c-%C- %K| %WNotify: %WOnline: $0: {hilight $1}"; + notify_offline = " %w-%c-%C- %K| %WNotify: %WOffline: $0"; + notify_list = " %w-%c-%C- %K| %n#$0: $1 $2 $3"; + notify_list_empty = " %w-%c-%C- %K| %WNotify: %nThe notify list is empty"; + }; +};