From e75ab7cfa30804925fede5b54b38a838c1078b4b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 11 Apr 2013 19:57:13 -0500 Subject: switch to weechat --- .gitignore | 3 +- Makefile | 2 +- irssi/config | 511 --------- irssi/scripts/all.pl | 30 - irssi/scripts/autorun/autowrap.pl | 1 - irssi/scripts/autorun/bitlbee_join_notice.pl | 1 - irssi/scripts/autorun/bitlbee_status_notice.pl | 1 - irssi/scripts/autorun/bitlbee_typing_notice.pl | 1 - irssi/scripts/autorun/chanact.pl | 1 - irssi/scripts/autorun/nickcolor.pl | 1 - irssi/scripts/autorun/thistory.pl | 1 - irssi/scripts/autorun/trackbar.pl | 1 - irssi/scripts/autowrap.pl | 38 - irssi/scripts/bitlbee_join_notice.pl | 94 -- irssi/scripts/bitlbee_status_notice.pl | 172 ---- irssi/scripts/bitlbee_typing_notice.pl | 320 ------ irssi/scripts/chanact.pl | 490 --------- irssi/scripts/gobots.pl | 37 - irssi/scripts/hilightwin.pl | 44 - irssi/scripts/nickcolor.pl | 156 --- irssi/scripts/nicklist.pl | 611 ----------- irssi/scripts/thistory.pl | 159 --- irssi/scripts/trackbar.pl | 215 ---- weechat/alias.conf | 38 + weechat/aspell.conf | 17 + weechat/buffers.conf | 60 ++ weechat/charset.conf | 11 + weechat/irc.conf | 330 ++++++ weechat/logger.conf | 24 + weechat/perl/autoload/beep.pl | 257 +++++ weechat/perl/autoload/buffers.pl | 1204 ++++++++++++++++++++++ weechat/perl/autoload/chatters.pl | 266 +++++ weechat/plugins.conf | 61 ++ weechat/python/autoload/bitlbee_typing_notice.py | 157 +++ weechat/relay.conf | 26 + weechat/rmodifier.conf | 13 + weechat/weechat.conf | 594 +++++++++++ weechat/xfer.conf | 36 + 38 files changed, 3097 insertions(+), 2887 deletions(-) delete mode 100644 irssi/config delete mode 100644 irssi/scripts/all.pl delete mode 120000 irssi/scripts/autorun/autowrap.pl delete mode 120000 irssi/scripts/autorun/bitlbee_join_notice.pl delete mode 120000 irssi/scripts/autorun/bitlbee_status_notice.pl delete mode 120000 irssi/scripts/autorun/bitlbee_typing_notice.pl delete mode 120000 irssi/scripts/autorun/chanact.pl delete mode 120000 irssi/scripts/autorun/nickcolor.pl delete mode 120000 irssi/scripts/autorun/thistory.pl delete mode 120000 irssi/scripts/autorun/trackbar.pl delete mode 100644 irssi/scripts/autowrap.pl delete mode 100644 irssi/scripts/bitlbee_join_notice.pl delete mode 100644 irssi/scripts/bitlbee_status_notice.pl delete mode 100644 irssi/scripts/bitlbee_typing_notice.pl delete mode 100644 irssi/scripts/chanact.pl delete mode 100644 irssi/scripts/gobots.pl delete mode 100644 irssi/scripts/hilightwin.pl delete mode 100644 irssi/scripts/nickcolor.pl delete mode 100644 irssi/scripts/nicklist.pl delete mode 100644 irssi/scripts/thistory.pl delete mode 100644 irssi/scripts/trackbar.pl create mode 100644 weechat/alias.conf create mode 100644 weechat/aspell.conf create mode 100644 weechat/buffers.conf create mode 100644 weechat/charset.conf create mode 100644 weechat/irc.conf create mode 100644 weechat/logger.conf create mode 100644 weechat/perl/autoload/beep.pl create mode 100644 weechat/perl/autoload/buffers.pl create mode 100644 weechat/perl/autoload/chatters.pl create mode 100644 weechat/plugins.conf create mode 100644 weechat/python/autoload/bitlbee_typing_notice.py create mode 100644 weechat/relay.conf create mode 100644 weechat/rmodifier.conf create mode 100644 weechat/weechat.conf create mode 100644 weechat/xfer.conf diff --git a/.gitignore b/.gitignore index 3f97e82..30ee2dd 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,6 @@ xmonad/xmonad.errors xmonad/xmonad.hi xmonad/xmonad.o xmonad/history -irssi/default.theme bin/nethack/ipbt bin/nethack/ttydump bin/nethack/ttygrep @@ -39,3 +38,5 @@ mutt/cache fortune/*.dat pentadactyl/info abook/addressbook* +weechat/weechat.log +weechat/weechat_fifo_* diff --git a/Makefile b/Makefile index 1e9419d..e369351 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,6 @@ INSTALL = abcde.conf \ dzil \ i3 \ interhack \ - irssi \ fortune \ ncmpc \ procmail \ @@ -49,6 +48,7 @@ INSTALL = abcde.conf \ themes \ urxvt \ vim \ + weechat \ zsh INSTALLED = $(patsubst %,$(INTO)/.%,$(INSTALL)) diff --git a/irssi/config b/irssi/config deleted file mode 100644 index bce9047..0000000 --- a/irssi/config +++ /dev/null @@ -1,511 +0,0 @@ -servers = ( - { address = "irc.stealth.net"; chatnet = "IRCnet"; port = "6668"; }, - { address = "irc.efnet.net"; chatnet = "EFNet"; port = "6667"; }, - { - address = "irc.perl.org"; - chatnet = "perl"; - port = "6667"; - autoconnect = "yes"; - }, - { - address = "localhost"; - chatnet = "bitlbee"; - port = "6667"; - autoconnect = "yes"; - }, - { - address = "irc.undernet.org"; - chatnet = "Undernet"; - port = "6667"; - }, - { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; }, - { - address = "irc.quakenet.org"; - chatnet = "QuakeNet"; - port = "6667"; - }, - { address = "silc.silcnet.org"; chatnet = "SILC"; port = "706"; }, - { - address = "irc.freenode.net"; - chatnet = "freenode"; - port = "6667"; - use_ssl = "no"; - ssl_verify = "no"; - autoconnect = "yes"; - } -); - -chatnets = { - IRCnet = { - type = "IRC"; - max_kicks = "4"; - max_msgs = "5"; - max_whois = "4"; - max_query_chans = "5"; - }; - EFNet = { - type = "IRC"; - max_kicks = "4"; - max_msgs = "3"; - max_whois = "1"; - }; - Undernet = { - type = "IRC"; - max_kicks = "1"; - max_msgs = "3"; - max_whois = "30"; - }; - DALnet = { - type = "IRC"; - max_kicks = "4"; - max_msgs = "3"; - max_whois = "30"; - }; - QuakeNet = { - type = "IRC"; - max_kicks = "1"; - max_msgs = "3"; - max_whois = "30"; - }; - SILC = { type = "SILC"; }; - freenode = { type = "IRC"; }; - perl = { type = "IRC"; }; - bitlbee = { type = "IRC"; }; -}; - -channels = ( - { - name = "##crawl-offtopic"; - chatnet = "freenode"; - autojoin = "yes"; - }, - { name = "##nethack-elite"; chatnet = "freenode"; autojoin = "yes"; }, - { name = "#interhack"; chatnet = "freenode"; autojoin = "yes"; }, - { name = "#moose"; chatnet = "perl"; autojoin = "yes"; }, - { name = "#kiokudb"; chatnet = "perl"; autojoin = "yes"; }, - { name = "#moose-cabal"; chatnet = "perl"; autojoin = "yes"; }, - { name = "#moose-dev"; chatnet = "perl"; autojoin = "yes"; }, - { name = "#devel-declare"; chatnet = "perl"; autojoin = "yes"; }, - { name = "#tmux"; chatnet = "freenode"; autojoin = "yes"; }, - { name = "#conkeror"; chatnet = "freenode"; autojoin = "yes"; }, - { name = "##crawl"; chatnet = "freenode"; autojoin = "yes"; }, - # { name = "#rodney"; chatnet = "freenode"; autojoin = "yes"; }, - # { name = "#netmonster"; chatnet = "EFNet"; autojoin = "yes"; }, - # { name = "#alephone"; chatnet = "freenode"; autojoin = "yes"; }, -); - -aliases = { - J = "join"; - WJOIN = "join -window"; - WQUERY = "query -window"; - LEAVE = "part"; - BYE = "quit"; - EXIT = "quit"; - SIGNOFF = "quit"; - DESCRIBE = "action"; - DATE = "time"; - HOST = "userhost"; - LAST = "lastlog"; - SAY = "msg *"; - WI = "whois"; - WII = "whois $0 $0"; - WW = "whowas"; - W = "window"; - N = "names"; - M = "msg"; - T = "topic"; - C = "clear"; - CL = "clear"; - K = "kick"; - KB = "kickban"; - KN = "knockout"; - BANS = "ban"; - B = "ban"; - MUB = "unban *"; - UB = "unban"; - IG = "ignore"; - UNIG = "unignore"; - SB = "scrollback"; - UMODE = "mode $N"; - WC = "window close"; - WN = "window new hide"; - SV = "say Irssi $J ($V) - http://irssi.org/"; - GOTO = "sb goto"; - CHAT = "dcc chat"; - RUN = "SCRIPT LOAD"; - UPTIME = "eval exec - expr `date +%s` - \\$F | awk '{print \"Irssi uptime: \"int(\\\\\\$1/3600/24)\"d \"int(\\\\\\$1/3600%24)\"h \"int(\\\\\\$1/60%60)\"m \"int(\\\\\\$1%60)\"s\" }'"; - CALC = "exec - if which bc &>/dev/null\\; then echo '$*' | bc | awk '{print \"$*=\"$$1}'\\; else echo bc was not found\\; fi"; - SBAR = "STATUSBAR"; - INVITELIST = "mode $C +I"; - Q = "QUERY"; - "MANUAL-WINDOWS" = "set use_status_window off;set autocreate_windows off;set autocreate_query_level none;set autoclose_windows off;set reuse_unused_windows on;save"; - EXEMPTLIST = "mode $C +e"; - ATAG = "WINDOW SERVER"; - remove = "quote remove $C $0 :$1-"; -}; - -statusbar = { - # formats: - # when using {templates}, the template is shown only if it's argument isn't - # empty unless no argument is given. for example {sb} is printed always, - # but {sb $T} is printed only if $T isn't empty. - - items = { - # start/end text in statusbars - barstart = "{sbstart}"; - barend = "{sbend}"; - - topicbarstart = "{topicsbstart}"; - topicbarend = "{topicsbend}"; - - # treated "normally", you could change the time/user name to whatever - time = "{sb $Z}"; - user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}"; - - # treated specially .. window is printed with non-empty windows, - # window_empty is printed with empty windows - window = "{sb $winref:$itemname{sbmode $M}}"; - window_empty = "{sb $winref{sbservertag $tag}}"; - prompt = "{prompt $[.15]itemname}"; - prompt_empty = "{prompt $winname}"; - topic = " $topic"; - topic_empty = " Irssi v$J - http://irssi.org/help/"; - - # all of these treated specially, they're only displayed when needed - lag = "{sb Lag: $0-}"; - act = "{sb Act: $0-}"; - more = "-- more --"; - }; - - # there's two type of statusbars. root statusbars are either at the top - # of the screen or at the bottom of the screen. window statusbars are at - # the top/bottom of each split window in screen. - default = { - # the "default statusbar" to be displayed at the bottom of the window. - # contains all the normal items. - window = { - disabled = "no"; - - # window, root - type = "window"; - # top, bottom - placement = "bottom"; - # number - position = "1"; - # active, inactive, always - visible = "active"; - - # list of items in statusbar in the display order - items = { - barstart = { priority = "100"; }; - time = { }; - user = { }; - window = { }; - window_empty = { }; - lag = { priority = "-1"; }; - more = { priority = "-1"; alignment = "right"; }; - barend = { priority = "100"; alignment = "right"; }; - typing_notice = { }; - join_notice = { }; - }; - }; - - # statusbar to use in inactive split windows - window_inact = { - type = "window"; - placement = "bottom"; - position = "1"; - visible = "inactive"; - items = { - barstart = { priority = "100"; }; - window = { }; - window_empty = { }; - more = { priority = "-1"; alignment = "right"; }; - barend = { priority = "100"; alignment = "right"; }; - }; - }; - - # we treat input line as yet another statusbar :) It's possible to - # add other items before or after the input line item. - prompt = { - type = "root"; - placement = "bottom"; - # we want to be at the bottom always - position = "100"; - visible = "always"; - items = { - prompt = { priority = "-1"; }; - prompt_empty = { priority = "-1"; }; - # treated specially, this is the real input line. - input = { priority = "10"; }; - }; - }; - - # topicbar - topic = { - type = "root"; - placement = "top"; - position = "1"; - visible = "always"; - items = { - topicbarstart = { priority = "100"; }; - topic = { }; - topic_empty = { }; - topicbarend = { priority = "100"; alignment = "right"; }; - }; - disabled = "yes"; - }; - chanact = { - type = "root"; - placement = "top"; - position = "1"; - visible = "always"; - items = { chanact = { priority = "10"; }; }; - }; - }; -}; -settings = { - core = { - real_name = "doy"; - user_name = "doy"; - nick = "doy"; - awaylog_level = ""; - awaylog_file = ""; - }; - "fe-common/core" = { - autolog = "yes"; - autolog_path = "~/irclogs/$tag/${0}-%Y-%m.log"; - bell_beeps = "yes"; - beep_msg_level = "MSGS DCC DCCMSGS HILIGHT"; - activity_hide_level = "JOINS PARTS QUITS NICKS MODES"; - windows_auto_renumber = "no"; - window_history = "yes"; - }; - "perl/core/scripts" = { - chanact_abbreviate_names = "2"; - chanact_show_all = "yes"; - gobots_filter_nicks = "Henzell,Gretell"; - nicklist_width = "13"; - chanact_chop_status = "yes"; - bitlbee_typing_allwin = "yes"; - chanact_display = "$H$N$T$C$S"; - bitlbee_send_typing = "yes"; - }; - "fe-text" = { - autostick_split_windows = "no"; - actlist_sort = "refnum"; - paste_verify_line_count = "2"; - }; - "irc/core" = { usermode = "+i"; }; -}; -logs = { }; -hilights = ( { text = "doy"; nick = "yes"; word = "yes"; } ); -notifies = { }; -keyboard = ( { key = "^W"; id = "command"; data = "window close"; } ); -windows = { - 1 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "##crawl-dev"; - tag = "freenode"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 2 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "##crawl-offtopic"; - tag = "freenode"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 3 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "#interhack"; - tag = "freenode"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 4 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "##nethack-elite"; - tag = "freenode"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 5 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "#moose"; - tag = "perl"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 6 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "#moose-dev"; - tag = "perl"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 7 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "#moose-cabal"; - tag = "perl"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 8 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "#devel-declare"; - tag = "perl"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 9 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "#ii"; - tag = "iinteractive"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 10 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "#ii_discuss_models_to_death"; - tag = "iinteractive"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 11 = { - items = ( - { - type = "QUERY"; - chat_type = "IRC"; - name = "starlifesage"; - tag = "bitlbee"; - } - ); - }; - 12 = { - items = ( - { - type = "QUERY"; - chat_type = "IRC"; - name = "sazzyanjali"; - tag = "bitlbee"; - } - ); - }; - 13 = { - items = ( - { - type = "QUERY"; - chat_type = "IRC"; - name = "cb4nova"; - tag = "bitlbee"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 14 = { - items = ( - { - type = "QUERY"; - chat_type = "IRC"; - name = "hyposomnileptic"; - tag = "bitlbee"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 15 = { - items = ( - { - type = "QUERY"; - chat_type = "IRC"; - name = "skltte"; - tag = "bitlbee"; - } - ); - sticky = "yes"; - parent = "50"; - }; - 16 = { - items = ( - { - type = "QUERY"; - chat_type = "IRC"; - name = "stevan"; - tag = "iinteractive"; - } - ); - }; - 50 = { - immortal = "yes"; - name = "(status)"; - level = "ALL"; - sticky = "yes"; - }; - 51 = { - items = ( - { - type = "CHANNEL"; - chat_type = "IRC"; - name = "&bitlbee"; - tag = "bitlbee"; - } - ); - sticky = "yes"; - parent = "50"; - }; -}; -mainwindows = { 50 = { first_line = "1"; lines = "34"; }; }; diff --git a/irssi/scripts/all.pl b/irssi/scripts/all.pl deleted file mode 100644 index 4093bbe..0000000 --- a/irssi/scripts/all.pl +++ /dev/null @@ -1,30 +0,0 @@ -use strict; -use vars qw($VERSION %IRSSI); - -use Irssi qw(signal_add signal_stop window_find_name settings_add_str - settings_get_str); -$VERSION = "0.01"; -%IRSSI = ( - authors => 'Jesse Luehrs', - contact => 'jluehrs2@uiuc.edu', - name => 'all', - license => 'BSD', - changed => 'September 22, 2008', - description => 'Copy all incoming messages into a separate "all" window', -); - -use warnings; - -signal_add 'message public' => sub { - my ($server, $msg, $nick, $address, $target) = @_; - my $window = window_find_name 'all'; - return unless $window; - return if $nick eq 'Henzell' || $nick eq 'Gretell' || $nick eq 'Doryen' || - $nick eq 'dataninja' || $nick eq 'arcaneh1' || - $msg =~ /^(?:\?\?|!|\@|#|arcaneh1:)/; - $window->print(sprintf("%s: <%s> %s", $target, $nick, $msg), - MSGLEVEL_CLIENTCRAP | MSGLEVEL_NO_ACT); -}; - -my $window = window_find_name 'all'; -print 'Create a window named \'all\'' unless $window; diff --git a/irssi/scripts/autorun/autowrap.pl b/irssi/scripts/autorun/autowrap.pl deleted file mode 120000 index 8eca1f3..0000000 --- a/irssi/scripts/autorun/autowrap.pl +++ /dev/null @@ -1 +0,0 @@ -../autowrap.pl \ No newline at end of file diff --git a/irssi/scripts/autorun/bitlbee_join_notice.pl b/irssi/scripts/autorun/bitlbee_join_notice.pl deleted file mode 120000 index c4c5afc..0000000 --- a/irssi/scripts/autorun/bitlbee_join_notice.pl +++ /dev/null @@ -1 +0,0 @@ -../bitlbee_join_notice.pl \ No newline at end of file diff --git a/irssi/scripts/autorun/bitlbee_status_notice.pl b/irssi/scripts/autorun/bitlbee_status_notice.pl deleted file mode 120000 index 06b7906..0000000 --- a/irssi/scripts/autorun/bitlbee_status_notice.pl +++ /dev/null @@ -1 +0,0 @@ -../bitlbee_status_notice.pl \ No newline at end of file diff --git a/irssi/scripts/autorun/bitlbee_typing_notice.pl b/irssi/scripts/autorun/bitlbee_typing_notice.pl deleted file mode 120000 index 9c4da39..0000000 --- a/irssi/scripts/autorun/bitlbee_typing_notice.pl +++ /dev/null @@ -1 +0,0 @@ -../bitlbee_typing_notice.pl \ No newline at end of file diff --git a/irssi/scripts/autorun/chanact.pl b/irssi/scripts/autorun/chanact.pl deleted file mode 120000 index 07762d6..0000000 --- a/irssi/scripts/autorun/chanact.pl +++ /dev/null @@ -1 +0,0 @@ -../chanact.pl \ No newline at end of file diff --git a/irssi/scripts/autorun/nickcolor.pl b/irssi/scripts/autorun/nickcolor.pl deleted file mode 120000 index f4f7c6f..0000000 --- a/irssi/scripts/autorun/nickcolor.pl +++ /dev/null @@ -1 +0,0 @@ -../nickcolor.pl \ No newline at end of file diff --git a/irssi/scripts/autorun/thistory.pl b/irssi/scripts/autorun/thistory.pl deleted file mode 120000 index f234d55..0000000 --- a/irssi/scripts/autorun/thistory.pl +++ /dev/null @@ -1 +0,0 @@ -../thistory.pl \ No newline at end of file diff --git a/irssi/scripts/autorun/trackbar.pl b/irssi/scripts/autorun/trackbar.pl deleted file mode 120000 index 8c5a483..0000000 --- a/irssi/scripts/autorun/trackbar.pl +++ /dev/null @@ -1 +0,0 @@ -../trackbar.pl \ No newline at end of file diff --git a/irssi/scripts/autowrap.pl b/irssi/scripts/autowrap.pl deleted file mode 100644 index c110c91..0000000 --- a/irssi/scripts/autowrap.pl +++ /dev/null @@ -1,38 +0,0 @@ -use strict; -use Text::Wrap; - -use vars qw($VERSION %IRSSI); -$VERSION = '2007031900'; -%IRSSI = ( - authors => 'Bitt Faulk', - contact => 'lxsfx3h02@sneakemail.com', - name => 'autowrap', - description => 'Automatically wraps long sent messages into multiple shorter sent messages', - license => 'BSD', - url => 'none', - modules => 'Text::Wrap', -); - -sub event_send_text () { - my ($line, $server_rec, $wi_item_rec) = @_; - my @shortlines; - if (length($line) <= 400) { - return; - } else { - # split line, recreate multiple "send text" events - local($Text::Wrap::columns) = 400; - @shortlines = split(/\n/,wrap('','',$line)); - foreach (@shortlines) { - if ($_ >= 400) { - Irssi::print("autowrap: unable to split long line. sent as-is"); - return; - } - } - foreach (@shortlines) { - Irssi::signal_emit('send text', $_, $server_rec, $wi_item_rec); - } - Irssi::signal_stop(); - } -} - -Irssi::signal_add_first('send text', "event_send_text"); diff --git a/irssi/scripts/bitlbee_join_notice.pl b/irssi/scripts/bitlbee_join_notice.pl deleted file mode 100644 index d9ec5ac..0000000 --- a/irssi/scripts/bitlbee_join_notice.pl +++ /dev/null @@ -1,94 +0,0 @@ -#CHANGELOG: -# -#28-11-2004: -#it gives a join message in a query if a user joins &bitlbee and you hve a query open with that person. -# -#/statusbar window add join_notice -#use Data::Dumper; - -use strict; -#use Irssi::TextUI; -#use Irssi::Themes; - -use vars qw($VERSION %IRSSI); - -$VERSION = '1.2'; -%IRSSI = ( - authors => 'Tijmen "timing" Ruizendaal', - contact => 'tijmen.ruizendaal@gmail.com', - name => 'BitlBee_join_notice', - description => ' 1. Adds an item to the status bar wich shows [joined: ] when someone is joining &bitlbee. - 2. Shows join messages in the query.', - license => 'GPLv2', - url => 'http://the-timing.nl/stuff/irssi-bitlbee', - changed => '2006-10-27', -); -my %online; -my %tag; -my $bitlbee_channel= "&bitlbee"; -my $bitlbee_server_tag="localhost"; - -get_channel(); - -Irssi::signal_add_last 'channel sync' => sub { - my( $channel ) = @_; - if( $channel->{topic} eq "Welcome to the control channel. Type \x02help\x02 for help information." ){ - $bitlbee_server_tag = $channel->{server}->{tag}; - $bitlbee_channel = $channel->{name}; - } -}; - -sub get_channel { - my @channels = Irssi::channels(); - foreach my $channel(@channels) { - if ($channel->{topic} eq "Welcome to the control channel. Type \x02help\x02 for help information.") { - $bitlbee_channel = $channel->{name}; - $bitlbee_server_tag = $channel->{server}->{tag}; - return 1; - } - } - return 0; -} - -sub event_join { - my ($server, $channel, $nick, $address) = @_; - if ($channel eq ":$bitlbee_channel" && $server->{tag} eq $bitlbee_server_tag){ - $online{$nick} = 1; - Irssi::timeout_remove($tag{$nick}); - $tag{$nick} = Irssi::timeout_add(7000, 'empty', $nick); - Irssi::statusbar_items_redraw('join_notice'); - my $window = Irssi::window_find_item($nick); - if($window){ - $window->printformat(MSGLEVEL_JOINS, 'join', $nick, $address, $bitlbee_channel); - } - } -} -sub join_notice { - my ($item, $get_size_only) = @_; - my $line; - foreach my $key (keys(%online) ) - { - $line = $line." ".$key; - } - if ($line ne "" ){ - $item->default_handler($get_size_only, "{sb joined:$line}", undef, 1); - $line = ""; - }else{ - $item->default_handler($get_size_only, "", undef, 1); - } -} -sub empty{ - my $nick = shift; - delete($online{$nick}); - Irssi::timeout_remove($tag{$nick}); - Irssi::statusbar_items_redraw('join_notice'); -} - -Irssi::signal_add("event join", "event_join"); -Irssi::statusbar_item_register('join_notice', undef, 'join_notice'); -Irssi::statusbars_recreate_items(); -Irssi::theme_register([ - 'join', '{channick_hilight $0} {chanhost $1} has joined {channel $2}', -]); - - diff --git a/irssi/scripts/bitlbee_status_notice.pl b/irssi/scripts/bitlbee_status_notice.pl deleted file mode 100644 index 839d453..0000000 --- a/irssi/scripts/bitlbee_status_notice.pl +++ /dev/null @@ -1,172 +0,0 @@ -# bitlbee_status_notice.pl -# Adds detailed information about status changed to bitlbee query windows -# Information about known offline, online, and away durations will be printed -# to open query windows of buddies. Away messages will also be asked for when -# using the Oscar network. - -# To use: -# Set the correct values for $bitlbee_* below, and then: -# /script load bitlbee_status_notice.pl - -# Settings: -# /set bitlbee_hide_joins ON|OFF -# Prevents joins from showing up in #bitlbee control channel when buddies -# sign on -# /set bitlbee_hide_quits ON|OFF -# Same for buddies signing off, except it also applies to query windows, -# because Irssi shows quit notices in query windows automatically. -# Both settings are ON by default (joins and quits are hidden) - -# Tip: to ignore root's mode changes (when away_devoice = true), use: -# /ignore -channels &bitlbee root!*@* MODES - - -# TODO -# Make server tag and channel settings - -use Data::Dumper; -use strict; -use Irssi::TextUI; -use Time::Duration; - -use vars qw($VERSION %IRSSI); - -$VERSION = '1.3'; -%IRSSI = ( - authors => 'Matt "f0rked" Sparks', - contact => 'root@f0rked.com', - name => 'bitlbee_status_notice', - description => 'Adds detailed information about status changes to bitlbee query windows', - license => 'GPLv2', - url => 'http://f0rked.com', - changed => '2005-12-05', -); - -my $bitlbee_channel="&bitlbee"; -my $bitlbee_server_tag="localhost"; - -my %away_watch; -my %away_times; -my %online_times; -my %offline_times; - -my $hide_it; -my $requested_info; - -Irssi::theme_register([ - 'state_away', '{channick $0} {chanhost $1} has gone away', - 'state_back', '{channick_hilight $0} {chanhost_hilight $1} has come back$2', - 'away_msg', '{chanhost msg} $0', - 'join', '{channick_hilight $0} {chanhost_hilight $1} has signed on$2', - 'quit', '{channick $0} {chanhost $1} has signed off$2', -]); - -Irssi::signal_add_last 'channel sync' => sub { - my($channel)=@_; - if ($channel->{topic} eq "Welcome to the control channel. Type \x02help\x02 for help information.") { - $bitlbee_server_tag=$channel->{server}->{tag}; - $bitlbee_channel=$channel->{name}; - } -}; - -sub event_join { - my($server,$channel,$nick,$address)=@_; - if ($channel eq $bitlbee_channel && $server->{tag} eq $bitlbee_server_tag) { - my $off_time; $off_time=time-$offline_times{$nick} if $offline_times{$nick}; - delete($offline_times{$nick}) if $offline_times{$nick}; - my $str; $str=" (last seen: ".ago_exact($off_time).")" if $off_time; - $online_times{$nick}=time; - my $window = $server->query_find($nick); - if ($window) { - $window->printformat(MSGLEVEL_JOINS,"join",$nick,$address,$str); - } - Irssi::signal_stop() # don't print the join announcement in &bitlbee - if Irssi::settings_get_bool("bitlbee_hide_joins"); - } -} - -sub event_quit { - my($server,$nick,$address,$reason)=@_; - if ($server->{tag} eq $bitlbee_server_tag) { - my $on_time; $on_time=time-$online_times{$nick} if $online_times{$nick}; - delete($online_times{$nick}) if $online_times{$nick}; - my $str; $str=" (duration: ".duration($on_time).")" if $on_time; - $offline_times{$nick}=time; - my $window = $server->query_find($nick); - if ($window) { - $window->printformat(MSGLEVEL_QUITS,"quit",$nick,$address,$str); - } - Irssi::signal_stop() # don't print the quit announcement anywhere - if Irssi::settings_get_bool("bitlbee_hide_quits"); - } -} - -sub event_mode { - my($channel,$nick,$setby,$mode,$type)=@_; - #print Dumper $nick; - #print Dumper $channel; - if ($mode eq "+" && $channel->{name} eq $bitlbee_channel && $channel->{server}->{tag} eq $bitlbee_server_tag) { - my $window=$channel->{server}->query_find($nick->{nick}); - my $gone_time; - - if ($type eq "-") { - $away_times{$nick->{nick}}=time; - } - elsif ($type eq "+") { - if (my $time=$away_times{$nick->{nick}}) { - $gone_time=time-$time; - delete($away_times{$nick->{nick}}); - } - } - - if ($window) { - if ($type eq "+") { - my $gone_str; $gone_str=" (gone: ".duration($gone_time).")" if $gone_time; - $window->printformat(MSGLEVEL_MODES,"state_back",$nick->{nick},$nick->{host},$gone_str) - if (time-$online_times{$nick->{nick}} > 2); - } - elsif ($type eq "-") { - $window->printformat(MSGLEVEL_MODES,"state_away",$nick->{nick},$nick->{host}); - if ($nick->{host} =~ /login\.oscar\.aol\.com$/) { - $away_watch{nick}=$nick->{nick}; - $channel->{server}->send_message($channel->{name},"info $nick->{nick}",0); - $requested_info=1; - } - } - } - } -} - -sub pub_msg { - my($server,$msg,$nick,$address,$target)=@_; - #print "$msg $nick $address $target"; - if ($nick eq "root" && $server->{tag} eq $bitlbee_server_tag && $target eq $bitlbee_channel) { - my $window=$server->channel_find($target); - if ($window) { - my $qwin; - $qwin = $server->query_find($away_watch{nick}) if $away_watch{nick}; - if ($msg =~ /TOC\(?.*\)? - Away Message/g) { - $away_watch{watch}=1; - $hide_it=1 if $requested_info; - Irssi::timeout_add_once(400,sub{$hide_it=0;$requested_info=0;},""); - #$qwin->print("Away message:",MSGLEVEL_CRAP) if $qwin; - } - elsif ($msg =~ /^TOC\(?.*\)? \- .+$/) { - delete($away_watch{watch}); - delete($away_watch{nick}); - } - elsif ($away_watch{watch} && $qwin) { - $qwin->printformat(MSGLEVEL_CRAP,"away_msg",$msg) if $qwin; - } - } - Irssi::signal_stop if $hide_it; - } -} - -Irssi::settings_add_bool("bitlbee","bitlbee_hide_joins",1); -Irssi::settings_add_bool("bitlbee","bitlbee_hide_quits",1); - -Irssi::signal_add("message public","pub_msg"); -Irssi::signal_add("nick mode changed","event_mode"); -Irssi::signal_add("message join", "event_join"); -Irssi::signal_add("message quit", "event_quit"); diff --git a/irssi/scripts/bitlbee_typing_notice.pl b/irssi/scripts/bitlbee_typing_notice.pl deleted file mode 100644 index 3c2968c..0000000 --- a/irssi/scripts/bitlbee_typing_notice.pl +++ /dev/null @@ -1,320 +0,0 @@ -# INSTALLATION -# [&bitlbee] set typing_notice true -# <@root> typing_notice = `true' -# AND -# /statusbar window add typing_notice -# -# SETTINGS -# [bitlbee] -# bitlbee_send_typing = ON -# -> send typing messages to buddies -# bitlbee_typing_allwin = OFF -# -> show typing notifications in all windows -# -# -# Changelog: -# -# 2006-11-02 (version 1.6.1_ -# * Sending typing works again. -# -# 2006-10-27 (version 1.6) -# * 'channel sync' re-implemented. -# * bitlbee_send_typing was a string setting, It's a boolean now, like it should. -# -# 2006-10-24 (version 1.5) -# -# * Sending notices to online users only. -# * Using the new get_channel function; -# -# 2005-12-15 (version 1.42): -# * Fixed small bug with typing notices disappearing under certain circumstances -# in channels -# * Fixed bug that caused outgoing notifications not to work -# * root cares not about our typing status. -# -# 2005-12-04 (version 1.41): -# * Implemented stale states in statusbar (shows "(stale)" for OSCAR connections) -# * Introduced bitlbee_typing_allwin (default OFF). Set this to ON to make -# typing notifications visible in all windows. -# -# 2005-12-03 (version 1.4): -# * Major code cleanups and rewrites for bitlbee 1.0 with the updated typing -# scheme. TYPING 0, TYPING 1, and TYPING 2 are now supported from the server. -# * Stale states (where user has typed in text but has stopped typing) are now -# recognized. -# * Bug where user thinks you are still typing if you close the window after -# typing something and then erasing it quickly.. fixed. -# * If a user signs off while they are still typing, the notification is removed -# This update by Matt "f0rked" Sparks -# -# 2005-08-26: -# Some fixes for AIM, Thanks to Dracula. -# -# 2005-08-16: -# AIM supported, for sending notices, using CTCP TYPING 0. (Use the AIM patch from Hanji http://get.bitlbee.org/patches/) -# -# 2004-10-31: -# Sends typing notice to the bitlbee server when typing a message in irssi. bitlbee > 0.92 -# -# 2004-06-11: -# shows [typing: ] in &bitlbee with multiple users. -# -use strict; -use Irssi::TextUI; - -use vars qw($VERSION %IRSSI); - -$VERSION = '1.6.1'; -%IRSSI = ( - authors => 'Tijmen "timing" Ruizendaal, Matt "f0rked" Sparks', - contact => 'tijmen.ruizendaal@gmail.com, root@f0rked.com', - name => 'BitlBee_typing_notice', - description => '1. Adds an item to the status bar wich shows [typing] when someone is typing a message on the supported IM-networks - 2. Sending typing notices to the supported IM networks (the other way arround)', - license => 'GPLv2', - url => 'http://the-timing.nl/stuff/irssi-bitlbee, - http://f0rked.com', - changed => '2006-11-02', -); - -my $bitlbee_channel = "&bitlbee"; -my $bitlbee_server_tag = "localhost"; - -my $KEEP_TYPING_TIMEOUT = 1; -my $STOP_TYPING_TIMEOUT = 7; # How often to check if we are typing, or on msn, - # how long to keep the typing notice up, or check - # if the other user is still typing... - -my %timer_tag; - -my %typing; -my %tag; -my $line; -my %out_typing; -my $lastkey; -my $keylog_active = 1; -my $command_char = Irssi::settings_get_str('cmdchars'); -my $to_char = Irssi::settings_get_str("completion_char"); - -get_channel(); - -Irssi::signal_add_last 'channel sync' => sub { - my( $channel ) = @_; - if( $channel->{topic} eq "Welcome to the control channel. Type \x02help\x02 for help information." ){ - $bitlbee_server_tag = $channel->{server}->{tag}; - $bitlbee_channel = $channel->{name}; - } -}; - -sub get_channel { - my @channels = Irssi::channels(); - foreach my $channel(@channels) { - if ($channel->{topic} eq "Welcome to the control channel. Type \x02help\x02 for help information.") { - $bitlbee_channel = $channel->{name}; - $bitlbee_server_tag = $channel->{server}->{tag}; - return 1; - } - } - return 0; -} - -sub event_ctcp_msg { - my ($server, $msg, $from, $address) = @_; - #print "CTCP: $msg $from $address"; - return if $server->{tag} ne $bitlbee_server_tag; - if (my($type) = $msg =~ "TYPING ([0-9])") { - Irssi::signal_stop(); - if ($type == 0) { - unset_typing($from); - } - elsif ($type == 1) { - $typing{$from}=1; - if ($address !~ /\@login\.oscar\.aol\.com/ - and $address !~ /\@YAHOO/ - and $address !~ /\@login\.icq\.com/) { - Irssi::timeout_remove($tag{$from}); - $tag{$from}=Irssi::timeout_add_once($STOP_TYPING_TIMEOUT*1000,"unset_typing",$from); - } - redraw($from); - } - elsif ($type == 2) { - stale_typing($from); - } - } -} - -sub unset_typing { - my($from,$no_redraw)=@_; - delete $typing{$from} if $typing{$from}; - Irssi::timeout_remove($tag{$from}); - redraw($from) if !$no_redraw; -} - -sub stale_typing { - my($from)=@_; - $typing{$from}=2; - redraw($from); -} - -sub redraw { - my($from)=@_; - my $window = Irssi::active_win(); - my $channel = $window->get_active_name(); - if ($from eq $channel || $channel eq $bitlbee_channel - || $channel =~ /&chat_0/ - || Irssi::settings_get_bool("bitlbee_typing_allwin")) { - Irssi::statusbar_items_redraw('typing_notice'); - } -} - -sub event_msg { - my ($server,$data,$from,$address,$target) = @_; - return if $server->{tag} ne $bitlbee_server_tag; - my $channel=Irssi::active_win()->get_active_name(); - unset_typing $from, "no redraw"; - unset_typing $channel; -} - -sub event_quit { - my($server,$nick,$address,$reason)=@_; - return if $server->{tag} ne $bitlbee_server_tag; - unset_typing $nick; -} - -sub typing_notice { - my ($item, $get_size_only) = @_; - my $window = Irssi::active_win(); - my $channel = $window->get_active_name(); - - if (exists($typing{$channel})) { - my $append=$typing{$channel}==2 ? " (stale)" : ""; - $item->default_handler($get_size_only, "{sb typing$append}", 0, 1); - } - else { - $item->default_handler($get_size_only, "", 0, 1); - Irssi::timeout_remove($tag{$channel}); - } - if ($channel eq $bitlbee_channel || $channel =~ /&chat_0/ - || Irssi::settings_get_bool("bitlbee_typing_allwin")) { - foreach my $key (keys(%typing)) { - $line .= " ".$key; - if ($typing{$key}==2) { $line .= " (stale)"; } - } - if ($line ne "") { - $item->default_handler($get_size_only, "{sb typing:$line}", 0, 1); - $line = ""; - } - } -} - -sub empty { - my $from = shift; - delete($typing{$from}); - Irssi::statusbar_items_redraw('typing_notice'); -} - -sub window_change { - Irssi::statusbar_items_redraw('typing_notice'); - my $win = !Irssi::active_win() ? undef : Irssi::active_win()->{active}; - if (ref $win && ($win->{server}->{tag} eq $bitlbee_server_tag)) { - if (!$keylog_active) { - $keylog_active = 1; - Irssi::signal_add_last('gui key pressed', 'key_pressed'); - #print "Keylog started"; - } - } - else { - if ($keylog_active) { - $keylog_active = 0; - Irssi::signal_remove('gui key pressed', 'key_pressed'); - #print "Keylog stopped"; - } - } -} - -sub key_pressed { - return if !Irssi::settings_get_bool("bitlbee_send_typing"); - my $key = shift; - if ($key != 9 && $key != 10 && $lastkey != 27 && $key != 27 - && $lastkey != 91 && $key != 126 && $key != 127) - { - my $server = Irssi::active_server(); - my $window = Irssi::active_win(); - my $nick = $window->get_active_name(); - if ($server->{tag} eq $bitlbee_server_tag && - $nick ne "(status)" && - $nick ne "root") - { - if ($nick eq $bitlbee_channel) { - my $input = Irssi::parse_special("\$L"); - my ($first_word) = split(/ /,$input); - if ($input !~ /^$command_char.*/ && $first_word =~ s/$to_char$//){ - send_typing($first_word); - } - } - else { - my $input = Irssi::parse_special("\$L"); - if ($input !~ /^$command_char.*/ && length($input) > 0){ - send_typing($nick); - } - } - } - } - $lastkey = $key; -} - -sub out_empty { - my ($a) = @_; - my($nick,$tag)=@{$a}; - delete($out_typing{$nick}); - #print $winnum."|".$nick; - if (my $server=Irssi::server_find_tag($tag)) { - $server->command("^CTCP $nick TYPING 0"); - } -} - -sub send_typing { - my $nick = shift; - if (!exists($out_typing{$nick}) || time - $out_typing{$nick} > $KEEP_TYPING_TIMEOUT) { - - my @nicks = Irssi::server_find_tag($bitlbee_server_tag)->channel_find($bitlbee_channel)->nicks(); - my $exists=0; - foreach my $nick1(@nicks) { #check if the nickname is in the BitlBee channel - if($nick1->{'nick'} eq $nick) { - # print "Exists!"; - $exists=1; - } - } - if (!$exists) { - #print "Does not exist"; - return; - } - - #print "Send typing"; - my $server = Irssi::active_server(); - $server->command("^CTCP $nick TYPING 1"); - - $out_typing{$nick} = time; - - ### Reset 'stop-typing' timer - if ($timer_tag{$nick}) { - Irssi::timeout_remove($timer_tag{$nick}); - delete($timer_tag{$nick}); - } - $timer_tag{$nick} = Irssi::timeout_add_once($STOP_TYPING_TIMEOUT*1000, 'out_empty', ["$nick", $server->{tag}]); - } -} - - #README: Delete the old bitlbee_send_typing string from ~/.irssi/config. A boolean is better. - -Irssi::settings_add_bool("bitlbee","bitlbee_send_typing",1); -Irssi::settings_add_bool("bitlbee","bitlbee_typing_allwin",0); - -Irssi::signal_add("ctcp msg", "event_ctcp_msg"); -Irssi::signal_add("message private", "event_msg"); -Irssi::signal_add("message public", "event_msg"); -Irssi::signal_add("message quit", "event_quit"); -Irssi::signal_add_last('window changed', 'window_change'); -Irssi::signal_add_last('gui key pressed', 'key_pressed'); -Irssi::statusbar_item_register('typing_notice', undef, 'typing_notice'); -Irssi::statusbars_recreate_items(); diff --git a/irssi/scripts/chanact.pl b/irssi/scripts/chanact.pl deleted file mode 100644 index 4c192e1..0000000 --- a/irssi/scripts/chanact.pl +++ /dev/null @@ -1,490 +0,0 @@ -use Irssi 20020101.0001 (); -use strict; -use Irssi::TextUI; - -use vars qw($VERSION %IRSSI); - -$VERSION = "0.5.5"; -%IRSSI = ( - authors => 'BC-bd, Veli', - contact => 'bd@bc-bd.org, veli@piipiip.net', - name => 'chanact', - description => 'Adds new powerful and customizable [Act: ...] item (chanelnames,modes,alias). Lets you give alias characters to windows so that you can select those with meta-', - license => 'GNU GPLv2 or later', - url => 'http://bc-bd.org/software.php3#irssi' -); - -# Adds new powerful and customizable [Act: ...] item (chanelnames,modes,alias). -# Lets you give alias characters to windows so that you can select those with -# meta-. -# -# for irssi 0.8.2 by bd@bc-bd.org -# -# inspired by chanlist.pl by 'cumol@hammerhart.de' -# -######### -# Contributors -######### -# -# veli@piipiip.net /window_alias code -# qrczak@knm.org.pl chanact_abbreviate_names -# qerub@home.se Extra chanact_show_mode and chanact_chop_status -# -######### -# USAGE -### -# -# copy the script to ~/.irssi/scripts/ -# -# In irssi: -# -# /script load chanact -# /statusbar window add chanact -after act -# -# If you want the item to appear on another position read the help -# for /statusbar. -# To remove the [Act: 1,2,3] item type: -# -# /statusbar window remove act -# -# To see all chanact options type: -# -# / set chanact_ -# -# After these steps you have your new statusbar item and you can start giving -# aliases to your windows. Go to the window you want to give the alias to -# and say: -# -# /window_alias -# -# You can also remove the aliases with: -# -# /window_unalias -# -# or in aliased window: -# -# /window_unalias -# -# To see a list of your windows use: -# -# /window list -# -######### -# OPTIONS -######### -# -# /set chanact_show_all -# * ON : show all windows -# * OFF : show only those with activity -# -# /set chanact_display -# * string : Format String for one Channel. The following $'s are expanded: -# $C : Channel -# $N : Number of the Window -# $M : Mode in that channel -# $H : Start highlightning -# $S : Stop highlightning -# * example: -# -# /set chanact_display $H$N:$M.$S$C -# -# will give you on #irssi.de if you have voice -# -# [3:+.#irssi.de] -# -# with '3:+.' highlighted and the channel name printed in regular color -# -# /set chanact_display_alias -# as 'chanact_display' but is used if the window has an alias and -# 'chanact_show_alias' is set to on. -# -# /set chanact_show_names -# * ON : show the channelnames after the number/alias -# * OFF : don't show the names -# -# /set chanact_abbreviate_names -# * 0 : don't abbreviate -# * : strip channel name prefix character and leave only -# that many characters of the proper name -# -# /set chanact_show_alias -# * ON : show the aliase instead of the refnum -# * OFF : shot the refnum -# -# /set chanact_separator -# * : Characters to be displayed at the start of the item. -# Defaults to: "Act: " -# -# /set chanact_separator -# * : Charater to use between the channel entries -# -# /set chanact_autorenumber -# * ON : Move the window automatically to first available slot -# starting from "chanact_renumber_start" when assigning -# an alias to window. Also moves the window back to a -# first available slot from refnum 1 when the window -# loses it's alias. -# * OFF : Don't move the windows automatically -# -# /set chanact_renumber_start -# * : Move the window to first available slot after this -# num when "chanact_autorenumber" is ON. -# -# -######### -# HINTS -######### -# -# If you have trouble with wrong colored entries your 'default.theme' might -# be too old. Try on a shell: -# -# $ mv ~/.irssi/default.theme /tmp/ -# -# And in irssi: -# /reload -# /save -# -### -################# - -my ($actString,$needRemake); - -sub expand { - my ($string, %format) = @_; - my ($exp, $repl); - $string =~ s/\$$exp/$repl/g while (($exp, $repl) = each(%format)); - return $string; -} - -# method will get called every time the statusbar item will be displayed -# but we dont need to recreate the item every time so we first -# check if something has changed and only then we recreate the string -# this might just save some cycles -# FIXME implement $get_size_only check, and user $item->{min|max-size} -sub chanact { - my ($item, $get_size_only) = @_; - - if ($needRemake) { - remake(); - } - - $item->default_handler($get_size_only, $actString, undef, 1); -} - -# this is the real creation method -sub remake() { - my ($afternumber,$finish,$hilight,$mode,$number,$display); - my $separator = Irssi::settings_get_str('chanact_separator'); - my $abbrev = Irssi::settings_get_int('chanact_abbreviate_names'); - - $actString = ""; - foreach my $win (sort { ($a->{refnum}) <=> ($b->{refnum})} Irssi::windows) { - - # since irssi is single threaded this shouldn't happen - !ref($win) && next; - - my $name = $win->get_active_name; - my $active = $win->{active}; - my $type = '*'; - - !ref($win) && next; - - $name eq "all" && next; - $name eq "bots" && next; - $name eq "hilight" && next; - $name eq "(status)" && $win->{data_level} <= 0 && next; - $name eq "&bitlbee" && $win->{data_level} <= 0 && next; - - $type = '!' if $name eq "(status)"; - # (status) is an awfull long name, so make it short to 'S' - # some people don't like it, so make it configurable - if (Irssi::settings_get_bool('chanact_chop_status') - && $name eq "(status)") { - $name = "S"; - } - - # check if we should show the mode - $mode = ""; - if ($active->{type} eq "CHANNEL") { - my $server = $win->{active_server}; - !ref($server) && next; - - my $channel = $server->channel_find($name); - !ref($channel) && next; - - my $nick = $channel->nick_find($server->{nick}); - !ref($nick) && next; - - if ($nick->{op}) { - $mode = "@"; - } elsif ($nick->{voice}) { - $mode = "+"; - } elsif ($nick->{halfop}) { - $mode = "%"; - } - $type = substr($name, 0, 1); - } - elsif ($active->{type} eq "QUERY") { - $type = '?'; - } - - # find the right color - if ($win->{data_level} == 1) { - $hilight = "{sb_act_text "; - } elsif ($win->{data_level} == 2) { - $hilight = "{sb_act_msg "; - } elsif ($win->{data_level} == 3) { - $hilight = "{sb_act_hilight "; - } else { - if (Irssi::settings_get_bool('chanact_show_all') == 1) { - $hilight = "{sb_act_hilight_color %K "; - } else { - next; - } - } - - if ($abbrev) { - $name =~ s{.*/}{}; - if ($name =~ /^[&#+!=]*(.*)/) { - $name = substr($1, 0, $abbrev); - } - } - - if (Irssi::settings_get_bool('chanact_show_alias') == 1 && - $win->{name} =~ /^[a-zA-Z+]$/) { - $number = $win->{name}; - $display = Irssi::settings_get_str('chanact_display_alias'); - } else { - $number = $win->{refnum}; - $display = Irssi::settings_get_str('chanact_display'); - } - - $actString .= expand($display,"T",$type,"C",$name,"N",$number,"M",$mode,"H",$hilight,"S","}{sb_background}").$separator; - } - - # assemble the final string - if ($actString ne "") { - # Remove the last separator - $actString =~ s/$separator$//; - - if (Irssi::settings_get_bool('chanact_show_all') == 1) { - $actString = "{sb ".$actString."}"; - } else { - $actString = "{sb ".Irssi::settings_get_str('chanact_header').$actString."}"; - } - } - - # no remake needed any longer - $needRemake = 0; -} - -# method called because of some events. here we dont remake the item but just -# remember that we have to remake it the next time we are called -sub chanactHasChanged() -{ - $needRemake = 1; - - Irssi::statusbar_items_redraw('chanact'); -} - -# function by veli@piipiip.net -# Remove alias -sub cmd_window_unalias { - my ($data, $server, $witem) = @_; - my $rn_start = Irssi::settings_get_int('chanact_renumber_start'); - - unless ($data =~ /^[a-zA-Z]$/ || - Irssi::active_win()->{name} =~ /^[a-zA-Z]$/) { - Irssi::print("Usage: /window_unalias "); - Irssi::print("or /window_alias in window that has an alias."); - return; - } - - if ($data eq '') { $data = Irssi::active_win()->{name}; } - - if (my $oldwin = Irssi::window_find_name($data)) { - $oldwin->set_name(undef); - Irssi::print("Removed alias with the key '$data'."); - - if (Irssi::settings_get_bool('chanact_autorenumber') == 1 && - $oldwin->{refnum} >= $rn_start) { - my $old_refnum = $oldwin->{refnum}; - - # Find the first available slot and move the window - my $newnum = 1; - while (Irssi::window_find_refnum($newnum) ne "") { $newnum++; } - $oldwin->set_refnum($newnum); - - Irssi::print("and moved it to from $old_refnum to $newnum"); - } - } -} - -# function by veli@piipiip.net -# Make an alias -sub cmd_window_alias { - my ($data, $server, $witem) = @_; - my $rn_start = Irssi::settings_get_int('chanact_renumber_start'); - - unless ($data =~ /^[a-zA-Z+]$/) { - Irssi::print("Usage: /window_alias "); - return; - } - - cmd_window_unalias($data, $server, $witem); - - my $window = $witem->window(); - my $winnum = $window->{refnum}; - - if (Irssi::settings_get_bool('chanact_autorenumber') == 1 && - $window->{refnum} < $rn_start) { - my $old_refnum = $window->{refnum}; - - $winnum = $rn_start; - - # Find the first available slot and move the window - while (Irssi::window_find_refnum($winnum) ne "") { $winnum++; } - $window->set_refnum($winnum); - - Irssi::print("Moved the window from $old_refnum to $winnum"); - } - - $window->set_name($data); - $server->command("/bind meta-$data change_window $winnum"); - Irssi::print("Window $winnum is now known as '$data'"); -} - -# function by veli@piipiip.net -# Makes the aliases if names have already been set -sub cmd_rebuild_aliases { - foreach (sort { $a->{refnum} <=> $b->{refnum} } Irssi::windows) { - if ($_->{name} =~ /^[a-zA-Z]$/) { - cmd_window_alias($_->{name}, $_->{active_server}, $_->{active}); - } - } -} - -# function by veli@piipiip.net -# Change the binding if the window refnum changes. -sub refnum_changed { - my ($window, $oldref) = @_; - my $server = Irssi::active_server(); - - if ($window->{name} =~ /^[a-zA-Z]$/) { - $server->command("/bind meta-".$window->{name}." change_window ".$window->{refnum}); - } -} - -$needRemake = 1; - -# Window alias command -Irssi::command_bind('window_alias','cmd_window_alias'); -Irssi::command_bind('window_unalias','cmd_window_unalias'); -# Irssi::command_bind('window_alias_rebuild','cmd_rebuild_aliases'); - -# our config item -Irssi::settings_add_str('chanact', 'chanact_display', '$H$N:$M$C$S'); -Irssi::settings_add_str('chanact', 'chanact_display_alias', '$H$N$M$S'); -Irssi::settings_add_bool('chanact', 'chanact_show_all', 0); -Irssi::settings_add_int('chanact', 'chanact_abbreviate_names', 0); -Irssi::settings_add_bool('chanact', 'chanact_show_alias', 1); -Irssi::settings_add_str('chanact', 'chanact_separator', " "); -Irssi::settings_add_bool('chanact', 'chanact_autorenumber', 0); -Irssi::settings_add_int('chanact', 'chanact_renumber_start', 50); -Irssi::settings_add_str('chanact', 'chanact_header', "Act: "); -Irssi::settings_add_bool('chanact', 'chanact_chop_status', 1); - -# register the statusbar item -Irssi::statusbar_item_register('chanact', '$0', 'chanact'); -# according to cras we shall not call this -# Irssi::statusbars_recreate_items(); - -# register all that nifty callbacks on special events -Irssi::signal_add_last('setup changed', 'chanactHasChanged'); -Irssi::signal_add_last('window hilight', 'chanactHasChanged'); -Irssi::signal_add("window created", "chanactHasChanged"); -Irssi::signal_add("window destroyed", "chanactHasChanged"); -Irssi::signal_add("window name changed", "chanactHasChanged"); -Irssi::signal_add('nick mode changed', 'chanactHasChanged'); - -Irssi::signal_add_last('window refnum changed', 'refnum_changed'); - -############### -### -# -# Changelog -# -# 0.5.5 -# - some speedups from David Leadbeater -# -# 0.5.4 -# - added help for chanact_display_alias -# -# 0.5.3 -# - added '+' to the available chars of aliase's -# - added chanact_display_alias to allow different display modes if the window -# has an alias -# -# 0.5.2 -# - removed unused chanact_show_name settings (thx to Qerub) -# - fixed $mode display -# - guarded reference operations to (hopefully) fix errors on server disconnect -# -# 0.5.1 -# - small typo fixed -# -# 0.5.0 -# - changed chanact_show_mode to chanact_display. reversed changes from -# Qerub through that, but kept funcionality. -# - removed chanact_color_all since it is no longer needed -# -# 0.4.3 -# - changes by Qerub -# + added chanact_show_mode to show the mode just before the channel name -# + added chanact_chop_status to be able to control the (status) chopping -# [bd] minor implementation changes -# - moved Changelog to the end of the file since it is getting pretty big -# -# 0.4.2 -# - changed back to old version numbering sheme -# - added '=' to Qrczak's chanact_abbreviate_names stuff :) -# - added chanact_header -# -# 0.41q -# - changes by Qrczak -# + added setting 'chanact_abbreviate_names' -# + windows are sorted by refnum; I didn't understand the old -# logic and it broke sorting for numbers above 9 -# -# 0.41 -# - minor updates -# + fixed channel sort [veli] -# + removed few typos and added some documentation [veli] -# -# 0.4 -# - merge with window_alias.pl -# + added /window_alias from window_alias.pl by veli@piipiip.net -# + added setting 'chanact_show_alias' -# + added setting 'chanact_show_names' -# + changed setting 'chanact_show_mode' to int -# + added setting 'chanact_separator' [veli] -# + added setting 'chanact_autorenumber' [veli] -# + added setting 'chanact_renumber_start' [veli] -# + added /window_unalias [veli] -# + moved setting to their own group 'chanact' [veli] -# -# 0.3 -# - merge with chanlist.pl -# + added setting 'chanact_show_mode' -# + added setting 'chanact_show_all' -# -# 0.2 -# - added 'Act' to the item -# - added setting 'chanact_color_all' -# - finally found format for statusbar hilight -# -# 0.1 -# - Initial Release -# -### -################ diff --git a/irssi/scripts/gobots.pl b/irssi/scripts/gobots.pl deleted file mode 100644 index a3cc2ef..0000000 --- a/irssi/scripts/gobots.pl +++ /dev/null @@ -1,37 +0,0 @@ -use strict; -use vars qw($VERSION %IRSSI); - -use Irssi qw(signal_add signal_stop window_find_name settings_add_str - settings_get_str); -$VERSION = "0.01"; -%IRSSI = ( - authors => 'Jesse Luehrs', - contact => 'jluehrs2@uiuc.edu', - name => 'gobots', - license => 'BSD', - changed => 'July 29, 2008', - description => 'Filters a list of nicks (typically bots) into a separate '. - '"bots" window', -); - -use warnings; - -signal_add 'message public' => sub { - my ($server, $msg, $nick, $address, $target) = @_; - my $window = window_find_name 'bots'; - return unless $window; - - my $botlist = settings_get_str 'gobots_filter_nicks'; - for (split /,/, $botlist) { - if ($_ eq $nick) { - $window->print(sprintf("<%s> %s", $nick, $msg), - MSGLEVEL_CLIENTCRAP | MSGLEVEL_NO_ACT); - signal_stop; - return; - } - } -}; - -my $window = window_find_name 'bots'; -print 'Create a window named \'bots\'' unless $window; -settings_add_str 'misc', 'gobots_filter_nicks', ''; diff --git a/irssi/scripts/hilightwin.pl b/irssi/scripts/hilightwin.pl deleted file mode 100644 index 251a405..0000000 --- a/irssi/scripts/hilightwin.pl +++ /dev/null @@ -1,44 +0,0 @@ -# Print hilighted messages & private messages to window named "hilight" -# for irssi 0.7.99 by Timo Sirainen -use Irssi; -use vars qw($VERSION %IRSSI); -use POSIX qw(strftime); - -# Tom "Timo \'cras\' Sirainen", - contact => "tss\@iki.fi", - name => "hilightwin", - description => "Print hilighted messages & private messages to window named \"hilight\"", - license => "Public Domain", - url => "http://irssi.org/", - changed => "2007-04-17T08:38-0500" -); - -sub sig_printtext { - my ($dest, $text, $stripped) = @_; - - if (($dest->{level} & (MSGLEVEL_HILIGHT|MSGLEVEL_MSGS|MSGLEVEL_DCCMSGS)) && - ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0) { - $window = Irssi::window_find_name('hilight'); - - if ($dest->{level} & MSGLEVEL_PUBLIC) { - $text = $dest->{target}.": ".$text; - } - $text =~ s/\%/%%/g; - $now_string = strftime(Irssi::settings_get_str('hilightwin_timestamp'), localtime); - $window->print($now_string . ": " . $text, MSGLEVEL_NEVER) if ($window); - } -} - -$window = Irssi::window_find_name('hilight'); -Irssi::print("Create a window named 'hilight'") if (!$window); - -Irssi::signal_add('print text', 'sig_printtext'); - -Irssi::settings_add_str('misc', 'hilightwin_timestamp', Irssi::settings_get_str('timestamp_format')); diff --git a/irssi/scripts/nickcolor.pl b/irssi/scripts/nickcolor.pl deleted file mode 100644 index c99640b..0000000 --- a/irssi/scripts/nickcolor.pl +++ /dev/null @@ -1,156 +0,0 @@ -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 12 13/; - -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 % 9]; - - 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 {pubmsgnick $2 {pubnick '.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/scripts/nicklist.pl b/irssi/scripts/nicklist.pl deleted file mode 100644 index d6d00c6..0000000 --- a/irssi/scripts/nicklist.pl +++ /dev/null @@ -1,611 +0,0 @@ -# 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'})-2)); - $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 < $height) { - nicklist_write_line($line++,'|' . (' ' x ($nicklist_width - 1))); - } - $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/scripts/thistory.pl b/irssi/scripts/thistory.pl deleted file mode 100644 index a1f5b3a..0000000 --- a/irssi/scripts/thistory.pl +++ /dev/null @@ -1,159 +0,0 @@ -# thistory.pl v1.05 [10.03.2002] -# Copyright (C) 2001, 2002 Teemu Hjelt -# -# Written for irssi 0.7.98 and later, idea from JSuvanto. -# -# Many thanks to fuchs, shasta, Paladin, Koffa and people -# on #irssi for their help and suggestions. -# -# Keeps information about the most recent topics of the -# channels you are on. -# Usage: /thistory [channel] and /tinfo [channel] -# -# v1.00 - Initial release. -# v1.02 - Months and topics with formatting were shown -# incorrectly. (Found by fuchs and shasta) -# v1.03 - event_topic was occasionally using the wrong -# server tag. Also added few variables to ease -# changing the settings and behaviour of this -# script. -# v1.04 - Minor bug-fixes. -# v1.05 - Made the script more consistent with other -# Irssi scripts. - -use Irssi; -use Irssi::Irc; -use vars qw($VERSION %IRSSI); - -# Formatting character. -my $fchar = '%'; - -# Format of the line. -my $format = '"%topic" %nick (%address) [%mday.%mon.%year %hour:%min:%sec]'; - -# Amount of topics stored. -my $tamount = 10; - -###### Don't edit below this unless you know what you're doing ###### - -$VERSION = "1.05"; -%IRSSI = ( - authors => "Teemu Hjelt", - contact => "temex\@iki.fi", - name => "topic history", - description => "Keeps information about the most recent topics of the channels you are on.", - license => "GNU GPLv2 or later", - url => "http://www.iki.fi/temex/", - changed => "Sun Mar 10 14:53:59 EET 2002", -); - -sub cmd_topicinfo { - my ($channel) = @_; - my $tag = Irssi::active_server()->{'tag'}; - $channel =~ s/\s+//; - $channel =~ s/\s+$//; - - if ($channel eq "") { - if (Irssi::channel_find(Irssi::active_win()->get_active_name())) { - $channel = Irssi::active_win()->get_active_name(); - } - } - if ($channel ne "") { - if ($topiclist{lc($tag)}{lc($channel)}{0}) { - Irssi::print("%W$channel%n: " . $topiclist{lc($tag)}{lc($channel)}{0}, MSGLEVEL_CRAP); - } else { - Irssi::print("No topic information for %W$channel%n", MSGLEVEL_CRAP); - } - } else { - Irssi::print("Usage: /tinfo "); - } -} - -sub cmd_topichistory { - my ($channel) = @_; - my $tag = Irssi::active_server()->{'tag'}; - $channel =~ s/\s+//; - $channel =~ s/\s+$//; - - if ($channel eq "") { - if (Irssi::channel_find(Irssi::active_win()->get_active_name())) { - $channel = Irssi::active_win()->get_active_name(); - } - } - if ($channel ne "") { - if ($topiclist{lc($tag)}{lc($channel)}{0}) { - my $amount = &getamount($tag, $channel); - Irssi::print("Topic history for %W$channel%n:", MSGLEVEL_CRAP); - for (my $i = 0; $i < $amount; $i++) { - if ($topiclist{lc($tag)}{lc($channel)}{$i}) { - my $num = $i + 1; - if (length($amount) >= length($tamount) && length($i + 1) < length($tamount)) { - for (my $j = length($tamount); $j > length($i + 1); $j--) { - $num = " " . $num; - } - } - Irssi::print($num . ". " . $topiclist{lc($tag)}{lc($channel)}{$i}, MSGLEVEL_CRAP); - } else { - last; - } - } - } else { - Irssi::print("No topic history for %W$channel%n", MSGLEVEL_CRAP); - } - } else { - Irssi::print("Usage: /thistory "); - } -} - -sub event_topic { - my ($server, $data, $nick, $address) = @_; - my ($channel, $topic) = split(/ :/, $data, 2); - my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); - my $tag = $server->{'tag'}; - my $output = $format; - - $topic =~ s/%/%%/g; - $topic .= '%n'; - - $val{'sec'} = $sec < 10 ? "0$sec" : $sec; - $val{'min'} = $min < 10 ? "0$min" : $min; - $val{'hour'} = $hour < 10 ? "0$hour" : $hour; - $val{'mday'} = $mday < 10 ? "0$mday" : $mday; - $val{'mon'} = $mon + 1 < 10 ? "0" . ($mon + 1) : $mon + 1; - $val{'year'} = $year + 1900; - - $val{'nick'} = $nick; - $val{'address'} = $address; - $val{'channel'} = $channel; - $val{'topic'} = $topic; - $val{'tag'} = $tag; - - $output =~ s/$fchar(\w+)/$val{$1}/g; - - for (my $i = (&getamount($tag, $channel) - 1); $i >= 0; $i--) { - if ($topiclist{lc($tag)}{lc($channel)}{$i}) { - $topiclist{lc($tag)}{lc($channel)}{$i + 1} = $topiclist{lc($tag)}{lc($channel)}{$i}; - } - } - $topiclist{lc($tag)}{lc($channel)}{0} = $output; -} - -sub getamount { - my ($tag, $channel) = @_; - my $amount = 0; - - for (my $i = 0; $i < $tamount; $i++) { - if ($topiclist{lc($tag)}{lc($channel)}{$i}) { - $amount++; - } - } - return $amount; -} - -Irssi::command_bind("topichistory", "cmd_topichistory"); -Irssi::command_bind("thistory", "cmd_topichistory"); -Irssi::command_bind("topicinfo", "cmd_topicinfo"); -Irssi::command_bind("tinfo", "cmd_topicinfo"); -Irssi::signal_add("event topic", "event_topic"); - -Irssi::print("Loaded thistory.pl v$VERSION"); diff --git a/irssi/scripts/trackbar.pl b/irssi/scripts/trackbar.pl deleted file mode 100644 index 1a2ad8f..0000000 --- a/irssi/scripts/trackbar.pl +++ /dev/null @@ -1,215 +0,0 @@ -# trackbar.pl -# -# This little script will do just one thing: it will draw a line each time you -# switch away from a window. This way, you always know just upto where you've -# been reading that window :) It also removes the previous drawn line, so you -# don't see double lines. -# -# Usage: -# -# The script works right out of the box, but if you want you can change -# the working by /set'ing the following variables: -# -# trackbar_string The characters to repeat to draw the bar -# trackbar_style The style for the bar, %r is red for example -# See formats.txt that came with irssi -# -# /mark is a command that will redraw the line at the bottom. However! This -# requires irssi version after 20021228. otherwise you'll get the error -# redraw: unknown command, and your screen is all goofed up :) -# -# /upgrade & buf.pl notice: This version tries to remove the trackbars before -# the upgrade is done, so buf.pl does not restore them, as they are not removeable -# afterwards by trackbar. Unfortiounatly, to make this work, trackbar and buf.pl -# need to be loaded in a specific order. Please experiment to see which order works -# for you (strangely, it differs from configuration to configuration, something I will -# try to fix in a next version) -# -# Authors: -# - Main maintainer & author: Peter 'kinlo' Leurs -# - Many thanks to Timo 'cras' Sirainen for placing me on my way -# - on-upgrade-remove-line patch by Uwe Dudenhoeffer -# -# Version history: -# 1.4: - Changed our's by my's so the irssi script header is valid -# - Removed utf-8 support. In theory, the script should work w/o any -# problems for utf-8, just set trackbar_string to a valid utf-8 character -# and everything *should* work. However, this script is being plagued by -# irssi internal bugs. The function Irssi::settings_get_str does NOT handle -# unicode strings properly, hence you will notice problems when setting the bar -# to a unicode char. For changing your bar to utf-8 symbols, read the line sub. -# 1.3: - Upgrade now removes the trackbars. -# - Some code cleanups, other defaults -# - /mark sets the line to the bottom -# 1.2: - Support for utf-8 -# - How the bar looks can now be configured with trackbar_string -# and trackbar_style -# 1.1: - Fixed bug when closing window -# 1.0: - Initial release -# -# -# Call for help! -# -# There is a trackbar version 2.0 that properly handles resizes and immediate config change -# activation. However, there is/are some bug(s) in irssi's main buffer/window code that causes -# irssi to 'forget' lines, which is ofcourse completly unaccepteable. I haven't found the time -# nor do I know the irssi's internals enough to find and fix this bug, if you want to help, please -# contact me, I'll give you a copy of the 2.0 version that will immediatly show you the problems. -# -# Known bugs: -# - if you /clear a window, it will be uncleared when returning to the window -# - UTF-8 characters in the trackbar_string doesnt work. This is an irssi bug. -# - if you resize your irssi (in xterm or so) the bar is not resized -# - changing the trackbar style is only visible after returning to a window -# however, changing style/resize takes in effect after you left the window. -# -# Whishlist/todo: -# - instead of drawing a line, just invert timestamp or something, -# to save a line (but I don't think this is possible with current irssi) -# - some pageup keybinding possibility, to scroll up upto the trackbar -# - <@coekie> kinlo: if i switch to another window, in another split window, i -# want the trackbar to go down in the previouswindow in that splitwindow :) -# - < bob_2> anyway to clear the line once the window is read? -# - < elho> kinlo: wishlist item: a string that gets prepended to the repeating pattern -# - < elho> an option to still have the timestamp in front of the bar -# - < elho> oh and an option to not draw it in the status window :P -# -# BTW: when you have feature requests, mailing a patch that works is the fastest way -# to get it added :p - -use strict; -use 5.6.1; -use Irssi; -use Irssi::TextUI; -use POSIX qw(strftime); - -my $VERSION = "1.4"; - -my %IRSSI = ( - authors => "Peter 'kinlo' Leurs", - contact => "peter\@pfoe.be", - name => "trackbar", - description => "Shows a bar where you've last read a window", - license => "GPLv2", - url => "http://www.pfoe.be/~peter/trackbar/", - changed => "Thu Feb 20 16:18:08 2003", -); - -my %config; - -Irssi::settings_add_str('trackbar', 'trackbar_string' => '-'); -$config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string'); - -Irssi::settings_add_str('trackbar', 'trackbar_style' => '%K'); -$config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style'); - -Irssi::signal_add( - 'setup changed' => sub { - $config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string'); - $config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style'); - if ($config{'trackbar_style'} =~ /(? sub { - my (undef, $oldwindow) = @_; - - if ($oldwindow) { - my $line = $oldwindow->view()->get_bookmark('trackbar'); - $oldwindow->view()->remove_line($line) if defined $line; - $oldwindow->print(line($oldwindow->{'width'}), MSGLEVEL_NEVER); - $oldwindow->view()->set_bookmark_bottom('trackbar'); - } - } -); - -sub line { - my $width = shift; - my $string = $config{'trackbar_string'}; - $string = '-' unless defined $string; - - # There is a bug in irssi's utf-8 handling on config file settings, as you - # can reproduce/see yourself by the following code sniplet: - # - # my $quake = pack 'U*', 8364; # EUR symbol - # Irssi::settings_add_str 'temp', 'temp_foo' => $quake; - # Irssi::print length $quake; - # # prints 1 - # Irssi::print length Irssi::settings_get_str 'temp_foo'; - # # prints 3 - # - # - # Trackbar used to have a workaround, but on recent versions of perl/irssi - # it does no longer work. Therefore, if you want your trackbar to contain - # unicode characters, uncomment the line below for a nice full line, or set - # the string to whatever char you want. - - # $string = pack('U*', 0x2500); - - - my $length = length $string; - - if ($length == 0) { - $string = '-'; - $length = 1; - } - - my $times = $width / $length; - $times = int(1 + $times) if $times != int($times); - $string =~ s/%/%%/g; - return $config{'trackbar_style'} . substr($string x $times, 0, $width); -} - -# Remove trackbars on upgrade - but this doesn't really work if the scripts are not loaded in the correct order... watch out! - -Irssi::signal_add_first( 'session save' => sub { - for my $window (Irssi::windows) { - next unless defined $window; - my $line = $window->view()->get_bookmark('trackbar'); - $window->view()->remove_line($line) if defined $line; - } - } -); - -sub goto_trackbar { - - my $window = Irssi::active_win(); - my $line = $window->view()->get_bookmark('trackbar'); - - if ($line) { - $window->command("scrollback goto ". strftime("%d %H:%M:%S", localtime($line->{'info'}->{'time'}))); - } else { - $window->printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_not_found'); - } -} - -sub cmd_mark { - my $window = Irssi::active_win(); -# return unless defined $window; - my $line = $window->view()->get_bookmark('trackbar'); - $window->view()->remove_line($line) if defined $line; - $window->print(line($window->{'width'}), MSGLEVEL_NEVER); - $window->view()->set_bookmark_bottom('trackbar'); - Irssi::command("redraw"); -} - -sub trackbar_runsub { - - my ($data, $server, $item) = @_; - $data =~ s/\s+$//g; - - if ($data) { - Irssi::command_runsub('trackbar', $data, $server, $item); - } else { - goto_trackbar(); - } -} - -Irssi::command_bind('trackbar', 'trackbar_runsub'); -Irssi::command_bind('mark', 'cmd_mark'); diff --git a/weechat/alias.conf b/weechat/alias.conf new file mode 100644 index 0000000..ebd0c95 --- /dev/null +++ b/weechat/alias.conf @@ -0,0 +1,38 @@ +# +# alias.conf -- weechat v0.3.8 +# + +[cmd] +AAWAY = "allserv /away" +AME = "allchan /me" +AMSG = "allchan /msg *" +ANICK = "allserv /nick" +BYE = "quit" +C = "buffer clear" +CHAT = "dcc chat" +CL = "buffer clear" +CLOSE = "buffer close" +EXIT = "quit" +IG = "ignore" +J = "join" +K = "kick" +KB = "kickban" +LEAVE = "part" +M = "msg" +MUB = "unban *" +N = "names" +Q = "query" +REDRAW = "window refresh" +SAY = "msg *" +SIGNOFF = "quit" +T = "topic" +UB = "unban" +UMODE = "mode $nick" +V = "command core version" +W = "buffer" +WC = "window merge" +WI = "whois" +WII = "whois $1 $1" +WW = "whowas" + +[completion] diff --git a/weechat/aspell.conf b/weechat/aspell.conf new file mode 100644 index 0000000..e0e55d2 --- /dev/null +++ b/weechat/aspell.conf @@ -0,0 +1,17 @@ +# +# aspell.conf -- weechat v0.3.8 +# + +[look] +color = lightred + +[check] +commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic" +default_dict = "en" +during_search = off +real_time = off +word_min_length = 2 + +[dict] + +[option] diff --git a/weechat/buffers.conf b/weechat/buffers.conf new file mode 100644 index 0000000..0ffc3b8 --- /dev/null +++ b/weechat/buffers.conf @@ -0,0 +1,60 @@ +# +# buffers.conf -- weechat v0.3.8 +# + +[color] +current_bg = default +current_fg = lightcyan +default_bg = default +default_fg = darkgray +hotlist_highlight_bg = default +hotlist_highlight_fg = lightmagenta +hotlist_low_bg = default +hotlist_low_fg = cyan +hotlist_message_bg = default +hotlist_message_fg = white +hotlist_private_bg = default +hotlist_private_fg = lightgreen +none_channel_bg = default +none_channel_fg = darkgray +number = lightgreen +number_char = lightgreen +queries_default_bg = default +queries_default_fg = default +queries_highlight_bg = default +queries_highlight_fg = default +queries_message_bg = default +queries_message_fg = default +whitelist_default_bg = default +whitelist_default_fg = default +whitelist_highlight_bg = default +whitelist_highlight_fg = default +whitelist_low_bg = default +whitelist_low_fg = default +whitelist_message_bg = default +whitelist_message_fg = default +whitelist_private_bg = default +whitelist_private_fg = default + +[look] +core_to_front = off +detach = 0 +detach_free_content = off +detach_query = off +hide_merged_buffers = server +hotlist_counter = off +immune_detach_buffers = "" +indenting = off +indenting_number = on +jump_prev_next_visited_buffer = off +mark_inactive = off +name_crop_suffix = "" +name_size_max = 3 +number_char = "" +prefix = off +prefix_empty = on +short_names = on +show_lag = off +show_number = on +sort = number +whitelist_buffers = "" diff --git a/weechat/charset.conf b/weechat/charset.conf new file mode 100644 index 0000000..e9f3b02 --- /dev/null +++ b/weechat/charset.conf @@ -0,0 +1,11 @@ +# +# charset.conf -- weechat v0.3.8 +# + +[default] +decode = "iso-8859-1" +encode = "" + +[decode] + +[encode] diff --git a/weechat/irc.conf b/weechat/irc.conf new file mode 100644 index 0000000..d1fe309 --- /dev/null +++ b/weechat/irc.conf @@ -0,0 +1,330 @@ +# +# irc.conf -- weechat v0.3.8 +# + +[look] +buffer_switch_autojoin = on +buffer_switch_join = on +color_nicks_in_names = off +color_nicks_in_nicklist = off +color_nicks_in_server_messages = off +color_pv_nick_like_channel = on +display_away = local +display_ctcp_blocked = on +display_ctcp_reply = on +display_ctcp_unknown = on +display_host_join = on +display_host_join_local = on +display_host_quit = on +display_old_topic = on +display_pv_away_once = on +display_pv_back = on +hide_nickserv_pwd = on +highlight_channel = "doy,doyster,@doyster,thedoyster,jesse" +highlight_pv = "" +highlight_server = "$nick" +highlight_tags = "irc_privmsg,irc_notice" +item_away_message = on +item_channel_modes = on +item_channel_modes_hide_key = off +item_display_server = buffer_plugin +item_nick_modes = on +item_nick_prefix = on +msgbuffer_fallback = current +new_channel_position = none +new_pv_position = none +nick_color_force = "" +nick_color_stop_chars = "_|[" +nick_completion_smart = speakers +nick_prefix = "" +nick_suffix = "" +notice_as_pv = auto +notify_tags_ison = "notify_message" +notify_tags_whois = "notify_message" +part_closes_buffer = on +raw_messages = 256 +server_buffer = merge_with_core +smart_filter = on +smart_filter_delay = 60 +smart_filter_join = on +smart_filter_nick = on +smart_filter_quit = on +topic_strip_colors = off + +[color] +input_nick = white +item_away = yellow +item_channel_modes = darkgray +item_lag_counting = default +item_lag_finished = yellow +message_join = darkgray +message_quit = darkgray +mirc_remap = "1,-1:darkgray" +nick_prefix = green +nick_prefixes = "q:lightred;a:lightcyan;o:lightgreen;h:lightmagenta;v:yellow;*:lightblue" +nick_suffix = green +notice = darkgray +reason_quit = darkgray +topic_new = white +topic_old = darkgray + +[network] +autoreconnect_delay_growing = 2 +autoreconnect_delay_max = 1800 +colors_receive = on +colors_send = on +lag_check = 60 +lag_disconnect = 0 +lag_min_show = 500 +lag_refresh_interval = 1 +notify_check_ison = 1 +notify_check_whois = 5 +send_unknown_commands = off + +[msgbuffer] + +[ctcp] + +[ignore] + +[server_default] +addresses = "" +anti_flood_prio_high = 2 +anti_flood_prio_low = 2 +autoconnect = off +autojoin = "" +autoreconnect = on +autoreconnect_delay = 10 +autorejoin = off +autorejoin_delay = 30 +away_check = 0 +away_check_max_nicks = 25 +capabilities = "" +command = "" +command_delay = 0 +connection_timeout = 60 +default_msg_part = "WeeChat %v" +default_msg_quit = "WeeChat %v" +ipv6 = off +local_hostname = "" +nicks = "doy,doy1,doy2,doy3,doy4" +notify = "" +password = "" +proxy = "" +realname = "" +sasl_mechanism = plain +sasl_password = "" +sasl_timeout = 15 +sasl_username = "" +ssl = off +ssl_cert = "" +ssl_dhkey_size = 2048 +ssl_priorities = "NORMAL" +ssl_verify = on +username = "doy" + +[server] +freenode.addresses = "chat.freenode.net/6667" +freenode.proxy +freenode.ipv6 +freenode.ssl +freenode.ssl_cert +freenode.ssl_priorities +freenode.ssl_dhkey_size +freenode.ssl_verify +freenode.password +freenode.capabilities +freenode.sasl_mechanism +freenode.sasl_username +freenode.sasl_password +freenode.sasl_timeout +freenode.autoconnect = on +freenode.autoreconnect +freenode.autoreconnect_delay +freenode.nicks +freenode.username +freenode.realname +freenode.local_hostname +freenode.command +freenode.command_delay +freenode.autojoin = "##crawl-offtopic" +freenode.autorejoin +freenode.autorejoin_delay +freenode.connection_timeout +freenode.anti_flood_prio_high +freenode.anti_flood_prio_low +freenode.away_check +freenode.away_check_max_nicks +freenode.default_msg_part +freenode.default_msg_quit +freenode.notify +perl.addresses = "irc.perl.org" +perl.proxy +perl.ipv6 +perl.ssl +perl.ssl_cert +perl.ssl_priorities +perl.ssl_dhkey_size +perl.ssl_verify +perl.password +perl.capabilities +perl.sasl_mechanism +perl.sasl_username +perl.sasl_password +perl.sasl_timeout +perl.autoconnect = on +perl.autoreconnect +perl.autoreconnect_delay +perl.nicks +perl.username +perl.realname +perl.local_hostname +perl.command +perl.command_delay +perl.autojoin = "#moe,#plack,#ox,#moose-dev" +perl.autorejoin +perl.autorejoin_delay +perl.connection_timeout +perl.anti_flood_prio_high +perl.anti_flood_prio_low +perl.away_check +perl.away_check_max_nicks +perl.default_msg_part +perl.default_msg_quit +perl.notify +bitlbee.addresses = "localhost" +bitlbee.proxy +bitlbee.ipv6 +bitlbee.ssl +bitlbee.ssl_cert +bitlbee.ssl_priorities +bitlbee.ssl_dhkey_size +bitlbee.ssl_verify +bitlbee.password +bitlbee.capabilities +bitlbee.sasl_mechanism +bitlbee.sasl_username +bitlbee.sasl_password +bitlbee.sasl_timeout +bitlbee.autoconnect = on +bitlbee.autoreconnect +bitlbee.autoreconnect_delay +bitlbee.nicks +bitlbee.username +bitlbee.realname +bitlbee.local_hostname +bitlbee.command +bitlbee.command_delay +bitlbee.autojoin +bitlbee.autorejoin +bitlbee.autorejoin_delay +bitlbee.connection_timeout +bitlbee.anti_flood_prio_high +bitlbee.anti_flood_prio_low +bitlbee.away_check +bitlbee.away_check_max_nicks +bitlbee.default_msg_part +bitlbee.default_msg_quit +bitlbee.notify +ii.addresses = "gw.iinteractive.com/6668" +ii.proxy +ii.ipv6 +ii.ssl = on +ii.ssl_cert +ii.ssl_priorities +ii.ssl_dhkey_size +ii.ssl_verify = off +ii.password +ii.capabilities +ii.sasl_mechanism +ii.sasl_username +ii.sasl_password +ii.sasl_timeout +ii.autoconnect = on +ii.autoreconnect +ii.autoreconnect_delay +ii.nicks +ii.username +ii.realname +ii.local_hostname +ii.command +ii.command_delay +ii.autojoin = "#ii,#ii_wanna_be_jsons_dog" +ii.autorejoin +ii.autorejoin_delay +ii.connection_timeout +ii.anti_flood_prio_high +ii.anti_flood_prio_low +ii.away_check +ii.away_check_max_nicks +ii.default_msg_part +ii.default_msg_quit +ii.notify +flowdock.addresses = "irc.flowdock.com/6697" +flowdock.proxy +flowdock.ipv6 +flowdock.ssl = on +flowdock.ssl_cert +flowdock.ssl_priorities +flowdock.ssl_dhkey_size +flowdock.ssl_verify = off +flowdock.password +flowdock.capabilities +flowdock.sasl_mechanism +flowdock.sasl_username +flowdock.sasl_password +flowdock.sasl_timeout +flowdock.autoconnect = on +flowdock.autoreconnect +flowdock.autoreconnect_delay +flowdock.nicks +flowdock.username +flowdock.realname +flowdock.local_hostname +flowdock.command +flowdock.command_delay +flowdock.autojoin +flowdock.autorejoin +flowdock.autorejoin_delay +flowdock.connection_timeout +flowdock.anti_flood_prio_high +flowdock.anti_flood_prio_low +flowdock.away_check +flowdock.away_check_max_nicks +flowdock.default_msg_part +flowdock.default_msg_quit +flowdock.notify +irc.mozilla.org.addresses = "irc.mozilla.org" +irc.mozilla.org.proxy +irc.mozilla.org.ipv6 +irc.mozilla.org.ssl +irc.mozilla.org.ssl_cert +irc.mozilla.org.ssl_priorities +irc.mozilla.org.ssl_dhkey_size +irc.mozilla.org.ssl_verify +irc.mozilla.org.password +irc.mozilla.org.capabilities +irc.mozilla.org.sasl_mechanism +irc.mozilla.org.sasl_username +irc.mozilla.org.sasl_password +irc.mozilla.org.sasl_timeout +irc.mozilla.org.autoconnect +irc.mozilla.org.autoreconnect +irc.mozilla.org.autoreconnect_delay +irc.mozilla.org.nicks +irc.mozilla.org.username +irc.mozilla.org.realname +irc.mozilla.org.local_hostname +irc.mozilla.org.command +irc.mozilla.org.command_delay +irc.mozilla.org.autojoin = "#rust" +irc.mozilla.org.autorejoin +irc.mozilla.org.autorejoin_delay +irc.mozilla.org.connection_timeout +irc.mozilla.org.anti_flood_prio_high +irc.mozilla.org.anti_flood_prio_low +irc.mozilla.org.away_check +irc.mozilla.org.away_check_max_nicks +irc.mozilla.org.default_msg_part +irc.mozilla.org.default_msg_quit +irc.mozilla.org.notify diff --git a/weechat/logger.conf b/weechat/logger.conf new file mode 100644 index 0000000..b2b4ccc --- /dev/null +++ b/weechat/logger.conf @@ -0,0 +1,24 @@ +# +# logger.conf -- weechat v0.3.8 +# + +[look] +backlog = 20 + +[color] +backlog_end = darkgray +backlog_line = darkgray + +[file] +auto_log = on +flush_delay = 120 +info_lines = off +mask = "$server/$channel-%Y-%m.log" +name_lower_case = on +path = "~/irclogs/" +replacement_char = "_" +time_format = "%Y-%m-%d %H:%M:%S" + +[level] + +[mask] diff --git a/weechat/perl/autoload/beep.pl b/weechat/perl/autoload/beep.pl new file mode 100644 index 0000000..69096c2 --- /dev/null +++ b/weechat/perl/autoload/beep.pl @@ -0,0 +1,257 @@ +# +# Copyright (C) 2006-2012 Sebastien Helleu +# Copyright (C) 2011 Nils Görs +# Copyright (C) 2011 ArZa +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# +# Beep (terminal bell) and/or run command on highlight/private message or new DCC. +# +# History: +# 2012-06-05, ldvx: +# version 1.1: Added wildcard support for whitelist_nicks. +# 2012-05-09, ldvx : +# version 1.0: Added beep_pv_blacklist, beep_highlight_blacklist, blacklist_nicks, +# and wildcard support for blacklist_nicks. +# 2012-05-02, ldvx : +# version 0.9: fix regex for nick in tags, add options "whitelist_channels" +# and "bell_always" +# 2012-04-19, ldvx : +# version 0.8: add whitelist, trigger, use hook_process for commands, +# rename option "beep_command" to "beep_command_pv", add help for options +# 2011-04-16, ArZa : +# version 0.7: fix default beep command +# 2011-03-11, nils_2 : +# version 0.6: add additional command options for dcc and highlight +# 2011-03-09, nils_2 : +# version 0.5: add option for beep command and dcc +# 2009-05-02, Sebastien Helleu : +# version 0.4: sync with last API changes +# 2008-11-05, Sebastien Helleu : +# version 0.3: conversion to WeeChat 0.3.0+ +# 2007-08-10, Sebastien Helleu : +# version 0.2: upgraded licence to GPL 3 +# 2006-09-02, Sebastien Helleu : +# version 0.1: initial release + +use strict; +my $SCRIPT_NAME = "beep"; +my $VERSION = "1.1"; + +# default values in setup file (~/.weechat/plugins.conf) +my %options_default = ('beep_pv' => ['on', 'beep on private message'], + 'beep_pv_whitelist' => ['off', 'turn whitelist for private messages on or off'], + 'beep_pv_blacklist' => ['off', 'turn blacklist for private messages on or off'], + 'beep_highlight' => ['on', 'beep on highlight'], + 'beep_highlight_whitelist' => ['off', 'turn whitelist for highlights on or off'], + 'beep_highlight_blacklist' => ['off', 'turn blacklist for highlights on or off'], + 'beep_dcc' => ['on', 'beep on dcc'], + 'beep_trigger_pv' => ['', 'word that will trigger execution of beep_command_pv (it empty, anything will trigger)'], + 'beep_trigger_highlight' => ['', 'word that will trigger execution of beep_command_highlight (if empty, anything will trigger)'], + 'beep_command_pv' => ['$bell', 'command for beep on private message, special value "$bell" is allowed, as well as "$bell;command"'], + 'beep_command_highlight' => ['$bell', 'command for beep on highlight, special value "$bell" is allowed, as well as "$bell;command"'], + 'beep_command_dcc' => ['$bell', 'command for beep on dcc, special value "$bell" is allowed, as well as "$bell;command"'], + 'beep_command_timeout' => ['30000', 'timeout for command run (in milliseconds, 0 = never kill (not recommended))'], + 'whitelist_nicks' => ['', 'comma-separated list of "server.nick": if not empty, only these nicks will trigger execution of commands (example: "freenode.nick1,freenode.nick2")'], + 'blacklist_nicks' => ['', 'comma-separated list of "server.nick": if not empty, these nicks will not be able to trigger execution of commands. Cannot be used in conjuction with whitelist (example: "freenode.nick1,freenode.nick2")'], + 'whitelist_channels' => ['', 'comma-separated list of "server.#channel": if not empty, only these channels will trigger execution of commands (example: "freenode.#weechat,freenode.#channel2")'], + 'bell_always' => ['', 'use $bell on private messages and/or highlights regardless of trigger and whitelist settings (example: "pv,highlight")'], +); +my %options = (); + +weechat::register($SCRIPT_NAME, "FlashCode ", $VERSION, + "GPL3", "Beep (terminal bell) and/or run command on highlight/private message or new DCC", "", ""); +init_config(); + +weechat::hook_config("plugins.var.perl.$SCRIPT_NAME.*", "toggle_config_by_set", ""); +weechat::hook_print("", "", "", 1, "pv_and_highlight", ""); +weechat::hook_signal("irc_dcc", "dcc", ""); + +sub pv_and_highlight +{ + my ($data, $buffer, $date, $tags, $displayed, $highlight, $prefix, $message) = @_; + + # return if message is filtered + return weechat::WEECHAT_RC_OK if ($displayed != 1); + + # return if nick in message is own nick + my $nick = ""; + $nick = $2 if ($tags =~ m/(^|,)nick_([^,]*)(,|$)/); + return weechat::WEECHAT_RC_OK if (weechat::buffer_get_string($buffer, "localvar_nick") eq $nick); + + # highlight + if ($highlight) + { + # Always print visual bel, regardless of whitelist and trigger settings + # beep_command_highlight does not need to contain $bell + if ($options{bell_always} =~ m/(^|,)highlight(,|$)/) + { + print STDERR "\a"; + } + # Channels whitelist for highlights + if ($options{beep_highlight} eq "on") + { + if ($options{whitelist_channels} ne "") + { + my $serverandchannel = weechat::buffer_get_string($buffer, "localvar_server"). "." . + weechat::buffer_get_string($buffer, "localvar_channel"); + if ($options{beep_trigger_highlight} eq "" or $message =~ m/\b$options{beep_trigger_highlight}\b/) + { + if ($options{whitelist_channels} =~ /(^|,)$serverandchannel(,|$)/) + { + beep_exec_command($options{beep_command_highlight}); + } + # What if we are highlighted and we're in a PM? For now, do nothing. + } + } + else + { + # Execute $bell and/or command with trigger and whitelist/blacklist settings + beep_trigger_whitelist_blacklist($buffer, $message, $nick, $options{beep_trigger_highlight}, + $options{beep_highlight_whitelist}, $options{beep_highlight_blacklist}, + $options{beep_command_highlight}); + } + } + } + # private message + elsif (weechat::buffer_get_string($buffer, "localvar_type") eq "private" and $tags =~ m/(^|,)notify_private(,|$)/) + { + # Always print visual bel, regardless of whitelist and trigger settings + # beep_command_pv does not need to contain $bell + if ($options{bell_always} =~ m/(^|,)pv(,|$)/) + { + print STDERR "\a"; + } + # Execute $bell and/or command with trigger and whitelist/blacklist settings + if ($options{beep_pv} eq "on") + { + beep_trigger_whitelist_blacklist($buffer, $message, $nick, $options{beep_trigger_pv}, + $options{beep_pv_whitelist}, $options{beep_pv_blacklist}, + $options{beep_command_pv}); + } + } + return weechat::WEECHAT_RC_OK; +} + +sub dcc +{ + beep_exec_command($options{beep_command_dcc}) if ($options{beep_dcc} eq "on"); + return weechat::WEECHAT_RC_OK; +} + +sub beep_trigger_whitelist_blacklist +{ + my ($buffer, $message, $nick, $trigger, $whitelist, $blacklist, $command) = @_; + + if ($trigger eq "" or $message =~ m/\b$trigger\b/) + { + my $serverandnick = weechat::buffer_get_string($buffer, "localvar_server").".".$nick; + if ($whitelist eq "on" and $options{whitelist_nicks} ne "") + { + # What to do if there's a wildcard in the whitelit + if ($options{whitelist_nicks} =~ m/\*/ and + match_in_wild_card($serverandnick, $options{whitelist_nicks})) + { + beep_exec_command($command); + } + # What to do if there's no wildcard in the whitelist + elsif ($options{whitelist_nicks} =~ /(^|,)$serverandnick(,|$)/) + { + beep_exec_command($command); + } + } + elsif ($blacklist eq "on" and $options{blacklist_nicks} ne "") + { + # What to do if there's a wildcard in the blacklist + if ($options{blacklist_nicks} =~ m/\*/ and + !match_in_wild_card($serverandnick, $options{blacklist_nicks})) + { + beep_exec_command($command); + } + # What to do if there's no wildcard in the blacklist + elsif ($options{blacklist_nicks} !~ /(^|,)$serverandnick(,|$)/) + { + beep_exec_command($command); + } + } + # What to do if we are not using whitelist of blacklist feature + elsif ($whitelist eq "off" and $blacklist eq "off") + { + beep_exec_command($command); + } + } +} + +sub beep_exec_command +{ + my $command = $_[0]; + if ($command =~ /^\$bell/) + { + print STDERR "\a"; + ($command) = $command =~ /^\$bell;(.+)$/; + } + weechat::hook_process($command, $options{beep_command_timeout}, "my_process", "") if ($command); +} + +sub match_in_wild_card +{ + my ($serverandnick, $white_or_black) = @_; + my $nick_iter; + my @array_of_nicks = split(",", $white_or_black); + + foreach $nick_iter (@array_of_nicks) + { + $nick_iter =~ s/\*/[^,]*/g; + if ($serverandnick =~ /$nick_iter/) + { + return 1; + } + } + return 0; +} + +sub my_process +{ + return weechat::WEECHAT_RC_OK; +} + +sub toggle_config_by_set +{ + my ($pointer, $name, $value) = @_; + $name = substr($name, length("plugins.var.perl.".$SCRIPT_NAME."."), length($name)); + $options{$name} = $value; + return weechat::WEECHAT_RC_OK; +} + +sub init_config +{ + my $version = weechat::info_get("version_number", "") || 0; + foreach my $option (keys %options_default) + { + if (!weechat::config_is_set_plugin($option)) + { + weechat::config_set_plugin($option, $options_default{$option}[0]); + $options{$option} = $options_default{$option}[0]; + } + else + { + $options{$option} = weechat::config_get_plugin($option); + } + if ($version >= 0x00030500) + { + weechat::config_set_desc_plugin($option, $options_default{$option}[1]." (default: \"".$options_default{$option}[0]."\")"); + } + } +} diff --git a/weechat/perl/autoload/buffers.pl b/weechat/perl/autoload/buffers.pl new file mode 100644 index 0000000..447777f --- /dev/null +++ b/weechat/perl/autoload/buffers.pl @@ -0,0 +1,1204 @@ +# +# Copyright (C) 2008-2012 Sebastien Helleu +# Copyright (C) 2011-2012 Nils G +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# +# Display sidebar with list of buffers. +# +# History: +# +# 2012-10-18, nils_2@freenode.#weechat: +# v3.8: add option "mark_inactive", to mark buffers you are not in (idea by xrdodrx) +# : add wildcard "*" for immune_detach_buffers (idea by StarWeaver) +# : add new options "detach_query" and "detach_free_content" (idea by StarWeaver) +# 2012-10-06, Nei : +# v3.7: call menu on right mouse if menu script is loaded. +# 2012-10-06, nils_2 : +# v3.6: add new option "hotlist_counter" (idea by torque). +# 2012-06-02, nils_2 : +# v3.5: add values "server|channel|private|all|keepserver|none" to option "hide_merged_buffers" (suggested by dominikh). +# 2012-05-25, nils_2 : +# v3.4: add new option "show_lag". +# 2012-04-07, Sebastien Helleu : +# v3.3: fix truncation of wide chars in buffer name (option name_size_max) (bug #36034) +# 2012-03-15, nils_2 : +# v3.2: add new option "detach"(weechat >= 0.3.8) +# add new option "immune_detach_buffers" (requested by Mkaysi) +# add new function buffers_whitelist add|del|reset (suggested by FiXato) +# add new function buffers_detach add|del|reset +# 2012-03-09, Sebastien Helleu : +# v3.1: fix reload of config file +# 2012-01-29, nils_2 : +# v3.0: fix: buffers did not update directly during window_switch (reported by FiXato) +# 2012-01-29, nils_2 : +# v2.9: add options "name_size_max" and "name_crop_suffix" +# 2012-01-08, nils_2 : +# v2.8: fix indenting for option "show_number off" +# fix unset of buffer activity in hotlist when buffer was moved with mouse +# add buffer with free content and core buffer sorted first (suggested by nyuszika7h) +# add options queries_default_fg/bg and queries_message_fg/bg (suggested by FiXato) +# add clicking with left button on current buffer will do a jump_previously_visited_buffer (suggested by FiXato) +# add clicking with right button on current buffer will do a jump_next_visited_buffer +# add additional informations in help texts +# add default_fg and default_bg for whitelist channels +# internal changes (script is now 3Kb smaller) +# 2012-01-04, Sebastien Helleu : +# v2.7: fix regex lookup in whitelist buffers list +# 2011-12-04, nils_2 : +# v2.6: add own config file (buffers.conf) +# add new behavior for indenting (under_name) +# add new option to set different color for server buffers and buffers with free content +# 2011-10-30, nils_2 : +# v2.5: add new options "show_number_char" and "color_number_char", +# add help-description for options +# 2011-08-24, Sebastien Helleu : +# v2.4: add mouse support +# 2011-06-06, nils_2 : +# v2.3: added: missed option "color_whitelist_default" +# 2011-03-23, Sebastien Helleu : +# v2.2: fix color of nick prefix with WeeChat >= 0.3.5 +# 2011-02-13, nils_2 : +# v2.1: add options "color_whitelist_*" +# 2010-10-05, Sebastien Helleu : +# v2.0: add options "sort" and "show_number" +# 2010-04-12, Sebastien Helleu : +# v1.9: replace call to log() by length() to align buffer numbers +# 2010-04-02, Sebastien Helleu : +# v1.8: fix bug with background color and option indenting_number +# 2010-04-02, Helios : +# v1.7: add indenting_number option +# 2010-02-25, m4v : +# v1.6: add option to hide empty prefixes +# 2010-02-12, Sebastien Helleu : +# v1.5: add optional nick prefix for buffers like IRC channels +# 2009-09-30, Sebastien Helleu : +# v1.4: remove spaces for indenting when bar position is top/bottom +# 2009-06-14, Sebastien Helleu : +# v1.3: add option "hide_merged_buffers" +# 2009-06-14, Sebastien Helleu : +# v1.2: improve display with merged buffers +# 2009-05-02, Sebastien Helleu : +# v1.1: sync with last API changes +# 2009-02-21, Sebastien Helleu : +# v1.0: remove timer used to update bar item first time (not needed any more) +# 2009-02-17, Sebastien Helleu : +# v0.9: fix bug with indenting of private buffers +# 2009-01-04, Sebastien Helleu : +# v0.8: update syntax for command /set (comments) +# 2008-10-20, Jiri Golembiovsky : +# v0.7: add indenting option +# 2008-10-01, Sebastien Helleu : +# v0.6: add default color for buffers, and color for current active buffer +# 2008-09-18, Sebastien Helleu : +# v0.5: fix color for "low" level entry in hotlist +# 2008-09-18, Sebastien Helleu : +# v0.4: rename option "show_category" to "short_names", +# remove option "color_slash" +# 2008-09-15, Sebastien Helleu : +# v0.3: fix bug with priority in hotlist (var not defined) +# 2008-09-02, Sebastien Helleu : +# v0.2: add color for buffers with activity and config options for +# colors, add config option to display/hide categories +# 2008-03-15, Sebastien Helleu : +# v0.1: script creation +# +# Help about settings: +# display all settings for script (or use iset.pl script to change settings): +# /set buffers* +# show help text for option buffers.look.whitelist_buffers: +# /help buffers.look.whitelist_buffers +# +# Mouse-support (standard key bindings): +# left mouse-button: +# - click on a buffer to switch to selected buffer +# - click on current buffer will do action jump_previously_visited_buffer +# - drag a buffer and drop it on another position will move the buffer to position +# right mouse-button: +# - click on current buffer will do action jump_next_visited_buffer +# - moving buffer to the left/right will close buffer. +# + +use strict; +use Encode qw( decode encode ); +# -------------------------------[ internal ]------------------------------------- +my $version = "3.8"; + +my $BUFFERS_CONFIG_FILE_NAME = "buffers"; +my $buffers_config_file; +my $cmd_buffers_whitelist= "buffers_whitelist"; +my $cmd_buffers_detach = "buffers_detach"; + +my %mouse_keys = ("\@item(buffers):button1*" => "hsignal:buffers_mouse", # catch all left mouse button gestures + "\@item(buffers):button2*" => "hsignal:buffers_mouse"); # catch all right mouse button gestures +my %options; +my %hotlist_level = (0 => "low", 1 => "message", 2 => "private", 3 => "highlight"); +my @whitelist_buffers = (); +my @immune_detach_buffers= (); +my @buffers_focus = (); +my %buffers_timer = (); +my %Hooks = (); + +# --------------------------------[ init ]-------------------------------------- +weechat::register("buffers", "Sebastien Helleu ", $version, + "GPL3", "Sidebar with list of buffers", "", ""); +my $weechat_version = weechat::info_get("version_number", "") || 0; + +buffers_config_init(); +buffers_config_read(); + +weechat::bar_item_new("buffers", "build_buffers", ""); +weechat::bar_new("buffers", "0", "0", "root", "", "left", "horizontal", + "vertical", "0", "0", "default", "default", "default", "1", + "buffers"); +weechat::hook_signal("buffer_*", "buffers_signal_buffer", ""); +weechat::hook_signal("window_switch", "buffers_signal_buffer", ""); +weechat::hook_signal("hotlist_*", "buffers_signal_hotlist", ""); +weechat::hook_signal("window_switch", "buffers_signal_buffer", ""); +#weechat::hook_command_run("/input switch_active_*", "buffers_signal_buffer", ""); +weechat::bar_item_update("buffers"); +if ($weechat_version >= 0x00030600) +{ + weechat::hook_focus("buffers", "buffers_focus_buffers", ""); + weechat::hook_hsignal("buffers_mouse", "buffers_hsignal_mouse", ""); + weechat::key_bind("mouse", \%mouse_keys); +} + +weechat::hook_command( $cmd_buffers_whitelist, + "add/del current buffer to/from buffers whitelist", + "[add] || [del] || [reset]", + + " add: add current buffer in configuration file\n". + " del: delete current buffer from configuration file\n". + "reset: reset all buffers from configuration file (no confirmation!)\n\n". + "Examples:\n". + "/$cmd_buffers_whitelist add\n", + "add %-||". + "del %-||". + "reset %-", + "buffers_cmd_whitelist", ""); +weechat::hook_command( $cmd_buffers_detach, + "add/del current buffer to/from buffers detach", + "[add] || [del] || [reset]", + + " add: add current buffer in configuration file\n". + " del: delete current buffer from configuration file\n". + "reset: reset all buffers from configuration file (no confirmation!)\n\n". + "Examples:\n". + "/$cmd_buffers_detach add\n", + "add %-||". + "del %-||". + "reset %-", + "buffers_cmd_detach", ""); + +if ($weechat_version >= 0x00030800) +{ + weechat::hook_config("buffers.look.detach", "hook_timer_detach", ""); +} + + weechat::hook_config("buffers.look.show_lag", "hook_timer_lag", ""); + +# -------------------------------- [ command ] -------------------------------- +sub buffers_cmd_whitelist +{ +my ( $data, $buffer, $args ) = @_; + $args = lc($args); + my $buffers_whitelist = weechat::config_string( weechat::config_get("buffers.look.whitelist_buffers") ); + return weechat::WEECHAT_RC_OK if ( $buffers_whitelist eq "" and $args eq "del" or $buffers_whitelist eq "" and $args eq "reset" ); + my @buffers_list = split( /,/, $buffers_whitelist ); + # get buffers name + my $infolist = weechat::infolist_get("buffer", weechat::current_buffer(), ""); + weechat::infolist_next($infolist); + my $buffers_name = weechat::infolist_string($infolist, "name"); + weechat::infolist_free($infolist); + return weechat::WEECHAT_RC_OK if ( $buffers_name eq "" ); # should never happen + + if ( $args eq "add" ) + { + return weechat::WEECHAT_RC_OK if ( grep /^$buffers_name$/, @buffers_list ); # check if buffer already in list + push @buffers_list,( $buffers_name ); + my $buffers_list = &create_whitelist(\@buffers_list); + weechat::config_option_set( weechat::config_get("buffers.look.whitelist_buffers"), $buffers_list,1 ); + weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" added to buffers whitelist"); + } + elsif ( $args eq "del" ) + { + return weechat::WEECHAT_RC_OK unless ( grep /^$buffers_name$/, @buffers_list ); # check if buffer is in list + @buffers_list = grep {$_ ne $buffers_name} @buffers_list; # delete entry + my $buffers_list = &create_whitelist(\@buffers_list); + weechat::config_option_set( weechat::config_get("buffers.look.whitelist_buffers"), $buffers_list,1 ); + weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" deleted from buffers whitelist"); + } + elsif ( $args eq "reset" ) + { + return weechat::WEECHAT_RC_OK if ( $buffers_whitelist eq "" ); + weechat::config_option_set( weechat::config_get("buffers.look.whitelist_buffers"), "",1 ); + weechat::print(weechat::current_buffer(), "buffers whitelist is empty, now..."); + } + return weechat::WEECHAT_RC_OK; +} +sub buffers_cmd_detach +{ +my ( $data, $buffer, $args ) = @_; + $args = lc($args); + my $immune_detach_buffers = weechat::config_string( weechat::config_get("buffers.look.immune_detach_buffers") ); + return weechat::WEECHAT_RC_OK if ( $immune_detach_buffers eq "" and $args eq "del" or $immune_detach_buffers eq "" and $args eq "reset" ); + my @buffers_list = split( /,/, $immune_detach_buffers ); + # get buffers name + my $infolist = weechat::infolist_get("buffer", weechat::current_buffer(), ""); + weechat::infolist_next($infolist); + my $buffers_name = weechat::infolist_string($infolist, "name"); + weechat::infolist_free($infolist); + return weechat::WEECHAT_RC_OK if ( $buffers_name eq "" ); # should never happen + + if ( $args eq "add" ) + { + return weechat::WEECHAT_RC_OK if ( grep /^$buffers_name$/, @buffers_list ); # check if buffer already in list + push @buffers_list,( $buffers_name ); + my $buffers_list = &create_whitelist(\@buffers_list); + weechat::config_option_set( weechat::config_get("buffers.look.immune_detach_buffers"), $buffers_list,1 ); + weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" added to immune detach buffers"); + } + elsif ( $args eq "del" ) + { + return weechat::WEECHAT_RC_OK unless ( grep /^$buffers_name$/, @buffers_list ); # check if buffer is in list + @buffers_list = grep {$_ ne $buffers_name} @buffers_list; # delete entry + my $buffers_list = &create_whitelist(\@buffers_list); + weechat::config_option_set( weechat::config_get("buffers.look.immune_detach_buffers"), $buffers_list,1 ); + weechat::print(weechat::current_buffer(), "buffer \"$buffers_name\" deleted from immune detach buffers"); + } + elsif ( $args eq "reset" ) + { + return weechat::WEECHAT_RC_OK if ( $immune_detach_buffers eq "" ); + weechat::config_option_set( weechat::config_get("buffers.look.immune_detach_buffers"), "",1 ); + weechat::print(weechat::current_buffer(), "immune detach buffers is empty, now..."); + } + return weechat::WEECHAT_RC_OK; +} +sub create_whitelist +{ + my @buffers_list = @{$_[0]}; + my $buffers_list = ""; + foreach (@buffers_list) + { + $buffers_list .= $_ .","; + } + chop $buffers_list; # remove last "," + return $buffers_list; +} + +# -------------------------------- [ config ] -------------------------------- +sub hook_timer_detach +{ + my $detach = $_[2]; + if ( $detach eq 0 ) + { + weechat::unhook($Hooks{timer_detach}) if $Hooks{timer_detach}; + $Hooks{timer_detach} = ""; + } + else + { + weechat::unhook($Hooks{timer_detach}) if $Hooks{timer_detach}; + $Hooks{timer_detach} = weechat::hook_timer( weechat::config_integer( $options{"detach"}) * 1000, 60, 0, "buffers_signal_buffer", ""); + } + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} + +sub hook_timer_lag +{ + my $lag = $_[2]; + if ( $lag eq 0 ) + { + weechat::unhook($Hooks{timer_lag}) if $Hooks{timer_lag}; + $Hooks{timer_lag} = ""; + } + else + { + weechat::unhook($Hooks{timer_lag}) if $Hooks{timer_lag}; + $Hooks{timer_lag} = weechat::hook_timer( weechat::config_integer(weechat::config_get("irc.network.lag_refresh_interval")) * 1000, 0, 0, "buffers_signal_hotlist", ""); + } + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} + +sub buffers_config_read +{ + return weechat::config_read($buffers_config_file) if ($buffers_config_file ne ""); +} +sub buffers_config_write +{ + return weechat::config_write($buffers_config_file) if ($buffers_config_file ne ""); +} +sub buffers_config_reload_cb +{ + my ($data,$config_file) = ($_[0], $_[1]); + return weechat::config_reload($config_file) +} +sub buffers_config_init +{ + $buffers_config_file = weechat::config_new($BUFFERS_CONFIG_FILE_NAME,"buffers_config_reload_cb",""); + return if ($buffers_config_file eq ""); + +my %default_options_color = +("color_current_fg" => ["current_fg", "color", "foreground color for current buffer", "", 0, 0,"lightcyan", "lightcyan", 0, "", "","buffers_signal_config", "", "", ""], + "color_current_bg" => ["current_bg", "color", "background color for current buffer", "", 0, 0,"red", "red", 0, "", "","buffers_signal_config", "", "", ""], + "color_default_fg" => ["default_fg", "color", "default foreground color for buffer name", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "color_default_bg" => ["default_bg", "color", "default background color for buffer name", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_highlight_fg" => ["hotlist_highlight_fg", "color", "change foreground color of buffer name if a highlight messaged received","", 0, 0,"magenta", "magenta", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_highlight_bg" => ["hotlist_highlight_bg", "color", "change background color of buffer name if a highlight messaged received", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_low_fg" => ["hotlist_low_fg", "color", "change foreground color of buffer name if a low message received", "", 0, 0,"white", "white", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_low_bg" => ["hotlist_low_bg", "color", "change background color of buffer name if a low message received", "", 0, 0, + "default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_message_fg" => ["hotlist_message_fg", "color", "change foreground color of buffer name if a normal message received", "", 0, 0,"yellow", "yellow", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_message_bg" => ["hotlist_message_bg", "color", "change background color of buffer name if a normal message received", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_private_fg" => ["hotlist_private_fg", "color", "change foreground color of buffer name if a private message received", "", 0, 0,"lightgreen", "lightgreen", 0, "", "","buffers_signal_config", "", "", ""], + "color_hotlist_private_bg" => ["hotlist_private_bg", "color", "change background color of buffer name if a private message received", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "color_number" => ["number", "color", "color for buffer number", "", 0, 0,"lightgreen", "lightgreen", 0, "", "","buffers_signal_config", "", "", ""], + "color_number_char" => ["number_char", "color", "color for buffer number char", "", 0, 0,"lightgreen", "lightgreen", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_default_fg" => ["whitelist_default_fg", "color", "default foreground color for whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_default_bg" => ["whitelist_default_bg", "color", "default background color for whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_low_fg" => ["whitelist_low_fg", "color", "low color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_low_bg" => ["whitelist_low_bg", "color", "low color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_message_fg" => ["whitelist_message_fg", "color", "message color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_message_bg" => ["whitelist_message_bg", "color", "message color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_private_fg" => ["whitelist_private_fg", "color", "private color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_private_bg" => ["whitelist_private_bg", "color", "private color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_highlight_fg" => ["whitelist_highlight_fg", "color", "highlight color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_whitelist_highlight_bg" => ["whitelist_highlight_bg", "color", "highlight color of whitelist buffer name", "", 0, 0,"", "", 0, "", "","buffers_signal_config", "", "", ""], + "color_none_channel_fg" => ["none_channel_fg", "color", "foreground color for none channel buffer (e.g.: core/server/plugin buffer)", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "color_none_channel_bg" => ["none_channel_bg", "color", "background color for none channel buffer (e.g.: core/server/plugin buffer)", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "queries_default_fg" => ["queries_default_fg", "color", "foreground color for query buffer without message", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "queries_default_bg" => ["queries_default_bg", "color", "background color for query buffer without message", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "queries_message_fg" => ["queries_message_fg", "color", "foreground color for query buffer with unread message", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "queries_message_bg" => ["queries_message_bg", "color", "background color for query buffer with unread message", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "queries_highlight_fg" => ["queries_highlight_fg", "color", "foreground color for query buffer with unread highlight", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], + "queries_highlight_bg" => ["queries_highlight_bg", "color", "background color for query buffer with unread highlight", "", 0, 0,"default", "default", 0, "", "","buffers_signal_config", "", "", ""], +); + +my %default_options_look = +( + "hotlist_counter" => ["hotlist_counter","boolean","show number of message for the buffer (this option needs WeeChat >= 0.3.5). The relevant option for notification is \"weechat.look.buffer_notify_default\"","",0,0,"off","off",0,"","","buffers_signal_config","","",""], + "show_lag" => ["show_lag","boolean","show lag behind servername. This option is using \"irc.color.item_lag_finished\", \"irc.network.lag_min_show\" and \"irc.network.lag_refresh_interval\"","",0,0,"off","off",0,"","","buffers_signal_config","","",""], + "look_whitelist_buffers" => ["whitelist_buffers", "string", "comma separated list of buffers for using a differnt color scheme (for example: freenode.#weechat,freenode.#weechat-fr)", "", 0, 0,"", "", 0, "", "", "buffers_signal_config_whitelist", "", "", ""], + "hide_merged_buffers" => ["hide_merged_buffers", "integer", "hide merged buffers. The value determines which merged buffers should be hidden, keepserver meaning 'all except server buffers'. Other values correspondent to the buffer type.", "server|channel|private|keepserver|all|none", 0, 0,"none", "none", 0, "", "", "buffers_signal_config", "", "", ""], + "indenting" => ["indenting", "integer", "use indenting for channel and query buffers. This option only takes effect if bar is left/right positioned", "off|on|under_name", 0, 0,"off", "off", 0, "", "", "buffers_signal_config", "", "", ""], + "indenting_number" => ["indenting_number", "boolean", "use indenting for numbers. This option only takes effect if bar is left/right positioned", "", 0, 0,"on", "on", 0, "", "", "buffers_signal_config", "", "", ""], + "short_names" => ["short_names", "boolean", "display short names (remove text before first \".\" in buffer name)", "", 0, 0,"on", "on", 0, "", "", "buffers_signal_config", "", "", ""], + "show_number" => ["show_number", "boolean", "display channel number in front of buffername", "", 0, 0,"on", "on", 0, "", "", "buffers_signal_config", "", "", ""], + "show_number_char" => ["number_char", "string", "display a char after channel number", "", 0, 0,".", ".", 0, "", "", "buffers_signal_config", "", "", ""], + "show_prefix" => ["prefix", "boolean", "show your prefix for channel", "", 0, 0,"off", "off", 0, "", "", "buffers_signal_config", "", "", ""], + "show_prefix_empty" => ["prefix_empty", "boolean", "use a placeholder for channels without prefix", "", 0, 0,"on", "on", 0, "", "", "buffers_signal_config", "", "", ""], + "sort" => ["sort", "integer", "sort buffer-list by \"number\" or \"name\"", "number|name", 0, 0,"number", "number", 0, "", "", "buffers_signal_config", "", "", ""], + "core_to_front" => ["core_to_front", "boolean", "core buffer and buffers with free content will be listed first. Take only effect if buffer sort is by name", "", 0, 0,"off", "off", 0, "", "", "buffers_signal_config", "", "", ""], + "jump_prev_next_visited_buffer" => ["jump_prev_next_visited_buffer", "boolean", "jump to previously or next visited buffer if you click with left/right mouse button on currently visiting buffer", "", 0, 0,"off", "off", 0, "", "", "buffers_signal_config", "", "", ""], + "name_size_max" => ["name_size_max","integer","maximum size of buffer name. 0 means no limitation","",0,256,0,0,0, "", "", "buffers_signal_config", "", "", ""], + "name_crop_suffix" => ["name_crop_suffix","string","contains an optional char(s) that is appended when buffer name is shortened","",0,0,"+","+",0,"","","buffers_signal_config", "", "", ""], + "detach" => ["detach", "integer","detach channel from buffers list after a specific period of time (in seconds) without action (weechat ≥ 0.3.8 required)", "", 0, 31536000,0, "number", 0, "", "", "buffers_signal_config", "", "", ""], + "immune_detach_buffers"=> ["immune_detach_buffers", "string", "Comma seperated list of buffers to NOT automatically detatch. Allows \"*\" wildcard. Ex: \"BitlBee,freenode.*\"", "", 0, 0,"", "", 0, "", "", "buffers_signal_config_immune_detach_buffers", "", "", ""], + "detach_query" => ["detach_query", "boolean", "query buffer will be detachted", "", 0, 0,"off", "off", 0, "", "", "buffers_signal_config", "", "", ""], + "detach_free_content" => ["detach_free_content", "boolean", "buffers with free content will be detached (Ex: iset, chanmon)", "", 0, 0,"off", "off", 0, "", "", "buffers_signal_config", "", "", ""], + "mark_inactive" => ["mark_inactive", "boolean", "if option is \"on\", inactive buffers (those you are not in) will have parentesis around them. An inactive buffer will not be detached.", "", 0, 0,"off", "off", 0, "", "", "buffers_signal_config", "", "", ""], +); + # section "color" + my $section_color = weechat::config_new_section($buffers_config_file,"color", 0, 0, "", "", "", "", "", "", "", "", "", ""); + if ($section_color eq "") + { + weechat::config_free($buffers_config_file); + return; + } + foreach my $option (keys %default_options_color) + { + $options{$option} = weechat::config_new_option($buffers_config_file, $section_color, + $default_options_color{$option}[0],$default_options_color{$option}[1],$default_options_color{$option}[2], + $default_options_color{$option}[3],$default_options_color{$option}[4],$default_options_color{$option}[5], + $default_options_color{$option}[6],$default_options_color{$option}[7],$default_options_color{$option}[8], + $default_options_color{$option}[9],$default_options_color{$option}[10],$default_options_color{$option}[11], + $default_options_color{$option}[12],$default_options_color{$option}[13],$default_options_color{$option}[14]); + } + + # section "look" + my $section_look = weechat::config_new_section($buffers_config_file,"look", 0, 0, "", "", "", "", "", "", "", "", "", ""); + if ($section_look eq "") + { + weechat::config_free($buffers_config_file); + return; + } + foreach my $option (keys %default_options_look) + { + $options{$option} = weechat::config_new_option($buffers_config_file, $section_look, + $default_options_look{$option}[0],$default_options_look{$option}[1],$default_options_look{$option}[2], + $default_options_look{$option}[3],$default_options_look{$option}[4],$default_options_look{$option}[5], + $default_options_look{$option}[6],$default_options_look{$option}[7],$default_options_look{$option}[8], + $default_options_look{$option}[9],$default_options_look{$option}[10],$default_options_look{$option}[11], + $default_options_look{$option}[12],$default_options_look{$option}[13],$default_options_look{$option}[14]); + } +} + +sub build_buffers +{ + my $str = ""; + + # get bar position (left/right/top/bottom) + my $position = "left"; + my $option_position = weechat::config_get("weechat.bar.buffers.position"); + if ($option_position ne "") + { + $position = weechat::config_string($option_position); + } + + # read hotlist + my %hotlist; + my $infolist = weechat::infolist_get("hotlist", "", ""); + while (weechat::infolist_next($infolist)) + { + $hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")} = + weechat::infolist_integer($infolist, "priority"); + if ( weechat::config_boolean( $options{"hotlist_counter"} ) eq 1 and $weechat_version >= 0x00030500) + { + $hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_00"} = + weechat::infolist_integer($infolist, "count_00"); # low message + $hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_01"} = + weechat::infolist_integer($infolist, "count_01"); # channel message + $hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_02"} = + weechat::infolist_integer($infolist, "count_02"); # private message + $hotlist{weechat::infolist_pointer($infolist, "buffer_pointer")."_count_03"} = + weechat::infolist_integer($infolist, "count_03"); # highlight message + } + } + weechat::infolist_free($infolist); + + # read buffers list + @buffers_focus = (); + my @buffers; + my @current1 = (); + my @current2 = (); + my $old_number = -1; + my $max_number = 0; + my $max_number_digits = 0; + my $active_seen = 0; + $infolist = weechat::infolist_get("buffer", "", ""); + while (weechat::infolist_next($infolist)) + { + my $buffer; + my $number = weechat::infolist_integer($infolist, "number"); + if ($number ne $old_number) + { + @buffers = (@buffers, @current2, @current1); + @current1 = (); + @current2 = (); + $active_seen = 0; + } + if ($number > $max_number) + { + $max_number = $number; + } + $old_number = $number; + my $active = weechat::infolist_integer($infolist, "active"); + if ($active) + { + $active_seen = 1; + } + $buffer->{"pointer"} = weechat::infolist_pointer($infolist, "pointer"); + $buffer->{"number"} = $number; + $buffer->{"active"} = $active; + $buffer->{"current_buffer"} = weechat::infolist_integer($infolist, "current_buffer"); + $buffer->{"plugin_name"} = weechat::infolist_string($infolist, "plugin_name"); + $buffer->{"name"} = weechat::infolist_string($infolist, "name"); + $buffer->{"short_name"} = weechat::infolist_string($infolist, "short_name"); + $buffer->{"full_name"} = $buffer->{"plugin_name"}.".".$buffer->{"name"}; + $buffer->{"type"} = weechat::buffer_get_string($buffer->{"pointer"},"localvar_type"); +# weechat::print("",$buffer->{"type"}); + + # check if buffer is active (or maybe a /part, /kick channel) + if ($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1) + { + my $server = weechat::buffer_get_string($buffer->{"pointer"},"localvar_server"); + my $channel = weechat::buffer_get_string($buffer->{"pointer"},"localvar_channel"); + my $infolist_channel = weechat::infolist_get("irc_channel","",$server.",".$channel); + if ($infolist_channel) + { + weechat::infolist_next($infolist_channel); + $buffer->{"nicks_count"} = weechat::infolist_integer($infolist_channel,"nicks_count"); + }else + { + $buffer->{"nicks_count"} = 0; + } + weechat::infolist_free($infolist_channel); + } + + my $result = check_immune_detached_buffers($buffer->{"name"}); # checking for wildcard + unless ($result) + { + my $detach_time = weechat::config_integer( $options{"detach"}); + my $current_time = time(); + # set timer for buffers with no hotlist action + $buffers_timer{$buffer->{"pointer"}} = $current_time + if ( not exists $hotlist{$buffer->{"pointer"}} + and $buffer->{"type"} eq "channel" + and not exists $buffers_timer{$buffer->{"pointer"}} + and $detach_time > 0); + + $buffers_timer{$buffer->{"pointer"}} = $current_time + if (weechat::config_boolean($options{"detach_query"}) eq 1 + and not exists $hotlist{$buffer->{"pointer"}} + and $buffer->{"type"} eq "private" + and not exists $buffers_timer{$buffer->{"pointer"}} + and $detach_time > 0); + + $detach_time = 0 + if (weechat::config_boolean($options{"detach_query"}) eq 0 + and $buffer->{"type"} eq "private"); + + # free content buffer + $buffers_timer{$buffer->{"pointer"}} = $current_time + if (weechat::config_boolean($options{"detach_free_content"}) eq 1 + and not exists $hotlist{$buffer->{"pointer"}} + and $buffer->{"type"} eq "" + and not exists $buffers_timer{$buffer->{"pointer"}} + and $detach_time > 0); + $detach_time = 0 + if (weechat::config_boolean($options{"detach_free_content"}) eq 0 + and $buffer->{"type"} eq ""); + + $detach_time = 0 if (weechat::config_boolean($options{"mark_inactive"}) eq 1 and defined $buffer->{"nicks_count"} and $buffer->{"nicks_count"} == 0); + + # check for detach + unless ( $buffer->{"current_buffer"} eq 0 + and not exists $hotlist{$buffer->{"pointer"}} +# and $buffer->{"type"} eq "channel" + and exists $buffers_timer{$buffer->{"pointer"}} + and $detach_time > 0 + and $weechat_version >= 0x00030800 + and $current_time - $buffers_timer{$buffer->{"pointer"}} >= $detach_time) + { + if ($active_seen) + { + push(@current2, $buffer); + } + else + { + push(@current1, $buffer); + } + } + } + else # buffer in "immune_detach_buffers" + { + if ($active_seen) + { + push(@current2, $buffer); + } + else + { + push(@current1, $buffer); + } + } + } # while end + + + if ($max_number >= 1) + { + $max_number_digits = length(int($max_number)); + } + @buffers = (@buffers, @current2, @current1); + weechat::infolist_free($infolist); + + # sort buffers by number, name or shortname + my %sorted_buffers; + if (1) + { + my $number = 0; + for my $buffer (@buffers) + { + my $key; + if (weechat::config_integer( $options{"sort"} ) eq 1) # number = 0; name = 1 + { + my $name = $buffer->{"name"}; + $name = $buffer->{"short_name"} if (weechat::config_boolean( $options{"short_names"} ) eq 1); + if (weechat::config_integer($options{"name_size_max"}) >= 1){ + $name = encode("UTF-8", substr(decode("UTF-8", $name), 0, weechat::config_integer($options{"name_size_max"}))); + } + if ( weechat::config_boolean($options{"core_to_front"}) eq 1) + { + if ( (weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "channel" ) and ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "private") ) + { + my $type = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type"); + if ( $type eq "" and $name ne "weechat") + { + $name = " " . $name + }else + { + $name = " " . $name; + } + } + } + $key = sprintf("%s%08d", lc($name), $buffer->{"number"}); + } + else + { + $key = sprintf("%08d", $number); + } + $sorted_buffers{$key} = $buffer; + $number++; + } + } + + # build string with buffers + $old_number = -1; + foreach my $key (sort keys %sorted_buffers) + { + my $buffer = $sorted_buffers{$key}; + + if ( weechat::config_string($options{"hide_merged_buffers"}) eq "server" ) + { + # buffer type "server" or merged with core? + if ( ($buffer->{"type"} eq "server" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) ) + { + next; + } + } + if ( weechat::config_string($options{"hide_merged_buffers"}) eq "channel" ) + { + # buffer type "channel" or merged with core? + if ( ($buffer->{"type"} eq "channel" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) ) + { + next; + } + } + if ( weechat::config_string($options{"hide_merged_buffers"}) eq "private" ) + { + # buffer type "private" or merged with core? + if ( ($buffer->{"type"} eq "private" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) ) + { + next; + } + } + if ( weechat::config_string($options{"hide_merged_buffers"}) eq "keepserver" ) + { + if ( ($buffer->{"type"} ne "server" or $buffer->{"plugin_name"} eq "core") && (! $buffer->{"active"}) ) + { + next; + } + } + if ( weechat::config_string($options{"hide_merged_buffers"}) eq "all" ) + { + if ( ! $buffer->{"active"} ) + { + next; + } + } + + push(@buffers_focus, $buffer); # buffer > buffers_focus, for mouse support + my $color = ""; + my $bg = ""; + + $color = weechat::config_color( $options{"color_default_fg"} ); + $bg = weechat::config_color( $options{"color_default_bg"} ); + + if ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") eq "private" ) + { + if ( (weechat::config_color($options{"queries_default_bg"})) ne "default" || (weechat::config_color($options{"queries_default_fg"})) ne "default" ) + { + $bg = weechat::config_color( $options{"queries_default_bg"} ); + $color = weechat::config_color( $options{"queries_default_fg"} ); + } + } + # check for core and buffer with free content + if ( (weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "channel" ) and ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") ne "private") ) + { + $color = weechat::config_color( $options{"color_none_channel_fg"} ); + $bg = weechat::config_color( $options{"color_none_channel_bg"} ); + } + # default whitelist buffer? + if (grep {$_ eq $buffer->{"name"}} @whitelist_buffers) + { + $color = weechat::config_color( $options{"color_whitelist_default_fg"} ); + $bg = weechat::config_color( $options{"color_whitelist_default_bg"} ); + } + + $color = "default" if ($color eq ""); + + # color for channel and query buffer + if (exists $hotlist{$buffer->{"pointer"}}) + { + delete $buffers_timer{$buffer->{"pointer"}}; + # check if buffer is in whitelist buffer + if (grep {$_ eq $buffer->{"name"}} @whitelist_buffers) + { + $bg = weechat::config_color( $options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} ); + $color = weechat::config_color( $options{"color_whitelist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} ); + } + elsif ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") eq "private" ) + { + # queries_default_fg/bg and buffers.color.queries_message_fg/bg + if ( (weechat::config_color($options{"queries_highlight_fg"})) ne "default" || + (weechat::config_color($options{"queries_highlight_bg"})) ne "default" || + (weechat::config_color($options{"queries_message_fg"})) ne "default" || + (weechat::config_color($options{"queries_message_bg"})) ne "default" ) + { + if ( ($hotlist{$buffer->{"pointer"}}) == 2 ) + { + $bg = weechat::config_color( $options{"queries_message_bg"} ); + $color = weechat::config_color( $options{"queries_message_fg"} ); + } + + elsif ( ($hotlist{$buffer->{"pointer"}}) == 3 ) + { + $bg = weechat::config_color( $options{"queries_highlight_bg"} ); + $color = weechat::config_color( $options{"queries_highlight_fg"} ); + } + }else + { + $bg = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} ); + $color = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} ); + } + }else + { + $bg = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_bg"} ); + $color = weechat::config_color( $options{"color_hotlist_".$hotlist_level{$hotlist{$buffer->{"pointer"}}}."_fg"} ); + } + } + + if ($buffer->{"current_buffer"}) + { + $color = weechat::config_color( $options{"color_current_fg"} ); + $bg = weechat::config_color( $options{"color_current_bg"} ); + } + my $color_bg = ""; + $color_bg = weechat::color(",".$bg) if ($bg ne ""); + + # create channel number for output + if ( weechat::config_boolean( $options{"show_number"} ) eq 1 ) # on + { + if (( weechat::config_boolean( $options{"indenting_number"} ) eq 1) + && (($position eq "left") || ($position eq "right"))) + { + $str .= weechat::color("default").$color_bg + .(" " x ($max_number_digits - length(int($buffer->{"number"})))); + } + if ($old_number ne $buffer->{"number"}) + { + $str .= weechat::color( weechat::config_color( $options{"color_number"} ) ) + .$color_bg + .$buffer->{"number"} + .weechat::color("default") + .$color_bg + .weechat::color( weechat::config_color( $options{"color_number_char"} ) ) + .weechat::config_string( $options{"show_number_char"} ) + .$color_bg; + } + else + { + my $indent = ""; + $indent = ((" " x length($buffer->{"number"}))." ") if (($position eq "left") || ($position eq "right")); + $str .= weechat::color("default") + .$color_bg + .$indent; + } + } + + if (( weechat::config_integer( $options{"indenting"} ) ne 0 ) # indenting NOT off + && (($position eq "left") || ($position eq "right"))) + { + my $type = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type"); + if (($type eq "channel") || ($type eq "private")) + { + if ( weechat::config_integer( $options{"indenting"} ) eq 1 ) + { + $str .= " "; + } + elsif ( (weechat::config_integer($options{"indenting"}) eq 2) and (weechat::config_integer($options{"indenting_number"}) eq 0) ) #under_name + { + if ( weechat::config_boolean( $options{"show_number"} ) eq 0 ) + { + $str .= " "; + }else + { + $str .= ( (" " x ( $max_number_digits - length($buffer->{"number"}) ))." " ); + } + } + } + } + if (weechat::config_boolean( $options{"show_prefix"} ) eq 1) + { + my $nickname = weechat::buffer_get_string($buffer->{"pointer"}, "localvar_nick"); + if ($nickname ne "") + { + # with version >= 0.3.2, this infolist will return only nick + # with older versions, whole nicklist is returned for buffer, and this can be very slow + my $infolist_nick = weechat::infolist_get("nicklist", $buffer->{"pointer"}, "nick_".$nickname); + if ($infolist_nick ne "") + { + my $version = weechat::info_get("version_number", ""); + $version = 0 if ($version eq ""); + while (weechat::infolist_next($infolist_nick)) + { + if ((weechat::infolist_string($infolist_nick, "type") eq "nick") + && (weechat::infolist_string($infolist_nick, "name") eq $nickname)) + { + my $prefix = weechat::infolist_string($infolist_nick, "prefix"); + if (($prefix ne " ") or (weechat::config_boolean( $options{"show_prefix_empty"} ) eq 1)) + { + # with version >= 0.3.5, it is now a color name (for older versions: option name with color) + if (int($version) >= 0x00030500) + { + $str .= weechat::color(weechat::infolist_string($infolist_nick, "prefix_color")); + } + else + { + $str .= weechat::color(weechat::config_color( + weechat::config_get( + weechat::infolist_string($infolist_nick, "prefix_color")))); + } + $str .= $prefix; + } + last; + } + } + weechat::infolist_free($infolist_nick); + } + } + } + if ($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0) + { + $str .= "("; + } + + $str .= weechat::color($color) . weechat::color(",".$bg); + + if (weechat::config_boolean( $options{"short_names"} ) eq 1) + { + my $name = $buffer->{"short_name"}; + $name = '?' . $name if $buffer->{"type"} eq 'private'; + $name =~ s|#iinteractive/|#|; + if (weechat::config_integer($options{"name_size_max"}) >= 1) # check max_size of buffer name + { + $str .= encode("UTF-8", substr(decode("UTF-8", $name), 0, weechat::config_integer($options{"name_size_max"}))); + $str .= weechat::color(weechat::config_color( $options{"color_number_char"})).weechat::config_string($options{"name_crop_suffix"}) if (length($buffer->{"short_name"}) > weechat::config_integer($options{"name_size_max"})); + $str .= add_inactive_parentless($buffer->{"type"},$buffer->{"nicks_count"}); + $str .= add_hotlist_count($buffer->{"pointer"},%hotlist); + } + else + { + $str .= $name; + $str .= add_inactive_parentless($buffer->{"type"},$buffer->{"nicks_count"}); + $str .= add_hotlist_count($buffer->{"pointer"},%hotlist); + } + } + else + { + my $name = $buffer->{"name"}; + $name = '?' . $name if $buffer->{"type"} eq 'private'; + $name =~ s|#iinteractive/|#|; + if (weechat::config_integer($options{"name_size_max"}) >= 1) # check max_size of buffer name + { + $str .= encode("UTF-8", substr(decode("UTF-8", $name,), 0, weechat::config_integer($options{"name_size_max"}))); + $str .= weechat::color(weechat::config_color( $options{"color_number_char"})).weechat::config_string($options{"name_crop_suffix"}) if (length($buffer->{"name"}) > weechat::config_integer($options{"name_size_max"})); + $str .= add_inactive_parentless($buffer->{"type"},$buffer->{"nicks_count"}); + $str .= add_hotlist_count($buffer->{"pointer"},%hotlist); + } + else + { + $str .= $name; + $str .= add_inactive_parentless($buffer->{"type"},$buffer->{"nicks_count"}); + $str .= add_hotlist_count($buffer->{"pointer"},%hotlist); + } + } + if ( weechat::buffer_get_string($buffer->{"pointer"}, "localvar_type") eq "server" and weechat::config_boolean($options{"show_lag"}) eq 1) + { + my $color_lag = weechat::config_color(weechat::config_get("irc.color.item_lag_finished")); + my $min_lag = weechat::config_integer(weechat::config_get("irc.network.lag_min_show")); + my $infolist_server = weechat::infolist_get("irc_server","",$buffer->{"short_name"}); + weechat::infolist_next($infolist_server); + my $lag = (weechat::infolist_integer($infolist_server, "lag")); + weechat::infolist_free($infolist_server); + if ( int($lag) > int($min_lag) ) + { + $lag = $lag / 1000; + $str .= weechat::color("default") . " (" . weechat::color($color_lag) . $lag . weechat::color("default") . ")"; + } + } + $str .= "\n"; + $old_number = $buffer->{"number"}; + } + + return $str; +} + +sub add_inactive_parentless +{ +my ($buf_type, $buf_nicks_count) = @_; +my $str = ""; + if ($buf_type eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buf_nicks_count == 0) + { + $str .= weechat::color(weechat::config_color( $options{"color_number_char"})); + $str .= ")"; + } +return $str; +} + +sub add_hotlist_count +{ +my ($bufpointer,%hotlist) = @_; + +return "" if ( weechat::config_boolean( $options{"hotlist_counter"} ) eq 0 or ($weechat_version < 0x00030500)); # off +my $col_number_char = weechat::color(weechat::config_color( $options{"color_number_char"}) ); +my $str = " ".$col_number_char."("; + +# 0 = low level +if (defined $hotlist{$bufpointer."_count_00"}) +{ + my $bg = weechat::config_color( $options{"color_hotlist_low_bg"} ); + my $color = weechat::config_color( $options{"color_hotlist_low_fg"} ); + $str .= weechat::color($bg). + weechat::color($color). + $hotlist{$bufpointer."_count_00"} if ($hotlist{$bufpointer."_count_00"} ne "0"); +} + +# 1 = message +if (defined $hotlist{$bufpointer."_count_01"}) +{ + my $bg = weechat::config_color( $options{"color_hotlist_message_bg"} ); + my $color = weechat::config_color( $options{"color_hotlist_message_fg"} ); + if ($str =~ /[0-9]$/) + { + $str .= ",". + weechat::color($bg). + weechat::color($color). + $hotlist{$bufpointer."_count_01"} if ($hotlist{$bufpointer."_count_01"} ne "0"); + }else + { + $str .= weechat::color($bg). + weechat::color($color). + $hotlist{$bufpointer."_count_01"} if ($hotlist{$bufpointer."_count_01"} ne "0"); + } +} +# 2 = private +if (defined $hotlist{$bufpointer."_count_02"}) +{ + my $bg = weechat::config_color( $options{"color_hotlist_private_bg"} ); + my $color = weechat::config_color( $options{"color_hotlist_private_fg"} ); + if ($str =~ /[0-9]$/) + { + $str .= ",". + weechat::color($bg). + weechat::color($color). + $hotlist{$bufpointer."_count_02"} if ($hotlist{$bufpointer."_count_02"} ne "0"); + }else + { + $str .= weechat::color($bg). + weechat::color($color). + $hotlist{$bufpointer."_count_02"} if ($hotlist{$bufpointer."_count_02"} ne "0"); + } +} +# 3 = highlight +if (defined $hotlist{$bufpointer."_count_03"}) +{ + my $bg = weechat::config_color( $options{"color_hotlist_highlight_bg"} ); + my $color = weechat::config_color( $options{"color_hotlist_highlight_fg"} ); + if ($str =~ /[0-9]$/) + { + $str .= ",". + weechat::color($bg). + weechat::color($color). + $hotlist{$bufpointer."_count_03"} if ($hotlist{$bufpointer."_count_03"} ne "0"); + }else + { + $str .= weechat::color($bg). + weechat::color($color). + $hotlist{$bufpointer."_count_03"} if ($hotlist{$bufpointer."_count_03"} ne "0"); + } +} +$str .= $col_number_char. ")"; + +$str = "" if (weechat::string_remove_color($str, "") eq " ()"); # remove color and check for buffer with no messages +return $str; +} + +sub buffers_signal_buffer +{ +my ($data, $signal, $signal_data) = @_; + # check for buffer_switch and set or remove detach time + if ($weechat_version >= 0x00030800) + { + if ($signal eq "buffer_switch") + { + my $pointer = weechat::hdata_get_list (weechat::hdata_get("buffer"), "gui_buffer_last_displayed"); # get switched buffer + my $current_time = time(); + if ( weechat::buffer_get_string($pointer, "localvar_type") eq "channel") + { + $buffers_timer{$pointer} = $current_time; + } + else + { + delete $buffers_timer{$pointer}; + } + } + if ($signal eq "buffer_opened") + { + my $current_time = time(); + $buffers_timer{$signal_data} = $current_time; + } + if ($signal eq "buffer_closing") + { + delete $buffers_timer{$signal_data}; + } + } + + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} + +sub buffers_signal_hotlist +{ + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} + + +sub buffers_signal_config_whitelist +{ + @whitelist_buffers = (); + @whitelist_buffers = split( /,/, weechat::config_string( $options{"look_whitelist_buffers"} ) ); + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} +sub buffers_signal_config_immune_detach_buffers +{ + @immune_detach_buffers = (); + @immune_detach_buffers = split( /,/, weechat::config_string( $options{"immune_detach_buffers"} ) ); + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} + +sub buffers_signal_config +{ + weechat::bar_item_update("buffers"); + return weechat::WEECHAT_RC_OK; +} + +# called when mouse click occured in buffers item: this callback returns buffer +# hash according to line of item where click occured +sub buffers_focus_buffers +{ + my %info = %{$_[1]}; + my $item_line = int($info{"_bar_item_line"}); + undef my $hash; + if (($info{"_bar_item_name"} eq "buffers") && ($item_line >= 0) && ($item_line <= $#buffers_focus)) + { + $hash = $buffers_focus[$item_line]; + } + else + { + $hash = {}; + my $hash_focus = $buffers_focus[0]; + foreach my $key (keys %$hash_focus) + { + $hash->{$key} = "?"; + } + } + return $hash; +} + +# called when a mouse action is done on buffers item, to execute action +# possible actions: jump to a buffer or move buffer in list (drag & drop of buffer) +sub buffers_hsignal_mouse +{ + my ($data, $signal, %hash) = ($_[0], $_[1], %{$_[2]}); + my $current_buffer = weechat::buffer_get_integer(weechat::current_buffer(), "number"); # get current buffer number + + if ( $hash{"_key"} eq "button1" ) # left mouse button + { + if ($hash{"number"} eq $hash{"number2"}) + { + if ( weechat::config_integer($options{"jump_prev_next_visited_buffer"}) eq 1 ) + { + if ( $current_buffer eq $hash{"number"} ) + { + weechat::command("","/input jump_previously_visited_buffer"); + } + else + { + weechat::command("", "/buffer ".$hash{"full_name"}); + } + } + else + { + weechat::command("", "/buffer ".$hash{"full_name"}); + } + } + else + { + move_buffer(%hash); + } + } + elsif ( ($hash{"_key"} eq "button2") && (weechat::config_integer($options{"jump_prev_next_visited_buffer"}) eq 1) )# right mouse button + { + if ( $current_buffer eq $hash{"number2"} ) + { + weechat::command("","/input jump_next_visited_buffer"); + } + } + else + { + my $infolist = weechat::infolist_get("hook", "", "command,menu"); + my $has_menu_command = weechat::infolist_next($infolist); + weechat::infolist_free($infolist); + + if ( $has_menu_command && $hash{"_key"} =~ /button2/ ) + { + if ($hash{"number"} eq $hash{"number2"}) + { + weechat::command($hash{"pointer"}, "/menu buffer1 $hash{short_name} $hash{number}"); + } + else + { + weechat::command($hash{"pointer"}, "/menu buffer2 $hash{short_name}/$hash{short_name2} $hash{number} $hash{number2}") + } + } + else + { + move_buffer(%hash); + } + } +} + +sub move_buffer +{ + my %hash = @_; + my $number2 = $hash{"number2"}; + if ($number2 eq "?") + { + # if number 2 is not known (end of gesture outside buffers list), then set it + # according to mouse gesture + $number2 = "999999"; + $number2 = "1" if (($hash{"_key"} =~ /gesture-left/) || ($hash{"_key"} =~ /gesture-up/)); + } + my $ptrbuf = weechat::current_buffer(); + weechat::command($hash{"pointer"}, "/buffer move ".$number2); +} + +sub check_immune_detached_buffers +{ + my ($buffername) = @_; + foreach ( @immune_detach_buffers ){ + my $immune_buffer = weechat::string_mask_to_regex($_); + if ($buffername =~ /^$immune_buffer$/i) + { + return 1; + } + } + return 0; +} diff --git a/weechat/perl/autoload/chatters.pl b/weechat/perl/autoload/chatters.pl new file mode 100644 index 0000000..7478f9b --- /dev/null +++ b/weechat/perl/autoload/chatters.pl @@ -0,0 +1,266 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 Arvydas Sidorenko +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# +# Usage: +# To show the bar item: +# /set weechat.bar.nicklist.items "chatters,buffer_nicklist" +# Config options: +# /set plugins.var.perl.chatters.frame_color "red" +# /set plugins.var.perl.chatters.nick_color "yellow" +# /set plugins.var.perl.chatters.nick_timeout "600" +# +# +# History: +# +# 2012-05-01, Arvydas Sidorenko +# Version 0.1: initial release +# 2012-05-11, Arvydas Sidorenko +# Version 0.2: rewritten script using bar_item to store the chatters +# instead of nicklist_group +# 2012-05-16, Arvydas Sidorenko +# Version 0.2.1: Bug fix: same channels under different servers share a +# common chatter list. +# 2012-05-18, Nils G +# Version 0.3: missing return value for callbacks fixed +# version check added +# improved option handling +# + +use strict; +use warnings; + +my $version = "0.3"; +my $script_name = "chatters"; +my $weechat_version = ""; + +# A hash with groups where the chatters are going to be added +# +# Structure: +# "#channel1" -- "nick1" -- last msg timestamp +# `- "nick2" -- last msg timestamp +# `- "nick3" -- last msg timestamp +# "#channel2" -- "nick1" -- last msg timestamp +# `- ... +my %chatter_groups = (); +my $chatters_bar_item_name = "chatters"; + +weechat::register($script_name, "Arvydas Sidorenko ", $version, "GPL3", "Groups people into chatters and idlers", "", ""); +$weechat_version = weechat::info_get("version_number", ""); +if (($weechat_version eq "") or ($weechat_version < 0x00030600)) # minimum v0.3.6 +{ + weechat::print("",weechat::prefix("error")."$script_name: needs at least WeeChat v0.3.6"); + weechat::command("","/wait 1ms /perl unload $script_name"); +} + +# Check configs +my %default_settings = (frame_color => "red", + nick_color => "yellow", + nick_timeout => 600); +for (keys %default_settings) +{ + weechat::config_set_plugin($_ => $default_settings{$_}) unless weechat::config_is_set_plugin($_); +} + + +# Close a channel +weechat::hook_signal("buffer_closing", "buffer_close_cb", ""); +# Callback whenever someone leaves the channel +weechat::hook_signal("nicklist_nick_removed", "on_leave_cb", ""); +# Callback whenever someone writes something in the channel +weechat::hook_signal("*,irc_in_PRIVMSG", "msg_cb", ""); +# Chatter observer callback +weechat::hook_timer(60000, 0, 0, "cleanup_chatters", 0); +# On config change +weechat::hook_config("plugins.var.perl.${script_name}.*", "config_change_cb", ""); + +weechat::bar_item_new($chatters_bar_item_name, "chatters_bar_cb", ""); + +############################################################################### +# Buffer update callback +sub chatters_bar_cb +{ + # $_[0] - data + # $_[1] - bar item + # $_[2] - window + my $str = ""; + my $buffer = weechat::window_get_pointer($_[2], "buffer"); + my $channel = buf_to_channel_key($buffer); + my $frame_color = weechat::color(weechat::config_get_plugin("frame_color")); + my $nick_color = weechat::color(weechat::config_get_plugin("nick_color")); + + $str = $frame_color . "-- Chatters -----\n"; + + if ($channel and $chatter_groups{$channel}) + { + foreach my $nick (sort {uc($a) cmp uc($b)} keys %{ $chatter_groups{$channel} }) + { + $str .= $nick_color . $nick . "\n"; + } + } + + $str .= $frame_color . "-----------------\n"; + + return $str; +} + +############################################################################### +# Buffer close callback +sub buffer_close_cb +{ + # $_[0] - callback data (3rd hook arg) + # $_[1] - signal (buffer_closing) + # $_[2] - buffer pointer + my $channel = buf_to_channel_key($_[2]); + + if ($chatter_groups{$channel}) + { + delete $chatter_groups{$channel}; + } +return weechat::WEECHAT_RC_OK; +} + +############################################################################### +# Gets called when someones writes in a channel +sub msg_cb +{ + # $_[0] - callback data (3rd hook arg) + # $_[1] - event name + # $_[2] - the message: + # :Asido!~asido@2b600000.rev.myisp.com PRIVMSG #linux :yoo + my $msg = weechat::info_get_hashtable("irc_message_parse" => + { "message" => $_[2] }); + my $channel = ""; + my ($server) = split ",", $_[1]; + my $key = ""; + + # Ignore private messages + unless ($msg->{channel} =~ /^#/) + { + return weechat::WEECHAT_RC_OK; + } + + $key = format_key($server, $msg->{channel}); + + $chatter_groups{$key}{$msg->{nick}} = time(); + weechat::bar_item_update($chatters_bar_item_name); + + return weechat::WEECHAT_RC_OK; +} + +############################################################################### +# Gets called when someones leaves a channel +sub on_leave_cb +{ + # $_[0] - data + # $_[1] - event name (nicklist_nick_removed) + # $_[2] - 0x1ffda70,spoty (,) + my ($buf, $nick) = split ",", $_[2]; + my $channel = buf_to_channel_key($buf); + + if ($chatter_groups{$channel} and $chatter_groups{$channel}{$nick}) + { + delete $chatter_groups{$channel}{$nick}; + weechat::bar_item_update($chatters_bar_item_name); + } + + return weechat::WEECHAT_RC_OK; +} + +############################################################################### +# Script config edit callback +sub config_change_cb +{ + # $_[0] - data + # $_[1] - option name + # $_[2] - new value +# my $opt = $_[1]; + my ( $pointer, $name, $value ) = @_; + $name = substr($name,length("plugins.var.perl.".$script_name."."),length($name)); # don't forget the "." +# $default_settings{$name} = $value; # store new value, if needed! + +# if ($opt =~ /frame_color$/ or $opt =~ /nick_color$/) + if ($name eq "frame_color" or $name eq "nick_color") + { + weechat::bar_item_update($chatters_bar_item_name); + } +# elsif ($opt =~ /nick_timeout$/) + elsif ($name eq "nick_timeout") + { + cleanup_chatters(); + } +return weechat::WEECHAT_RC_OK; +} + +############################################################################### +# Removes nicks from chatter list who idle for too long +sub cleanup_chatters +{ + my $changed = 0; + my $nick_timeout = weechat::config_get_plugin("nick_timeout"); + + foreach my $channel (keys %chatter_groups) + { + foreach my $nick (keys %{ $chatter_groups{$channel} }) + { + if (time() - $chatter_groups{$channel}{$nick} >= $nick_timeout) + { + delete $chatter_groups{$channel}{$nick}; + $changed = 1; + } + } + } + + if ($changed) + { + weechat::bar_item_update($chatters_bar_item_name); + } +} + +############################################################################### +# Returns a key for use in chatter_groups +sub buf_to_channel_key +{ + my $buf = shift; + my $server = weechat::buffer_get_string($buf, "localvar_server"); + my $channel = weechat::buffer_get_string($buf, "localvar_channel"); + + return format_key($server, $channel); +} + +############################################################################### +# Formats a key out of server and channel to use in chatter_groups +sub format_key +{ + my $server = shift; + my $channel = shift; + + # For unknown reason to me some channels have prepended #, some prepended ## + # so the best to get rid of them to keep consistency + $channel =~ /#*(.*)/; + $channel = $1; + + return $server . "|" . $channel; +} + +############################################################################### +# +sub _log +{ + my $msg = shift; + + weechat::print("", "${script_name}: ${msg}\n"); +} diff --git a/weechat/plugins.conf b/weechat/plugins.conf new file mode 100644 index 0000000..36e9428 --- /dev/null +++ b/weechat/plugins.conf @@ -0,0 +1,61 @@ +# +# plugins.conf -- weechat v0.3.8 +# + +[var] +fifo.fifo = "on" +guile.check_license = "on" +lua.check_license = "on" +perl.beep.beep_command_dcc = "$bell" +perl.beep.beep_command_highlight = "$bell" +perl.beep.beep_command_pv = "$bell" +perl.beep.beep_command_timeout = "30000" +perl.beep.beep_dcc = "on" +perl.beep.beep_highlight = "on" +perl.beep.beep_highlight_blacklist = "off" +perl.beep.beep_highlight_whitelist = "off" +perl.beep.beep_pv = "on" +perl.beep.beep_pv_blacklist = "off" +perl.beep.beep_pv_whitelist = "off" +perl.beep.beep_trigger_highlight = "" +perl.beep.beep_trigger_pv = "" +perl.beep.bell_always = "" +perl.beep.blacklist_nicks = "" +perl.beep.whitelist_channels = "" +perl.beep.whitelist_nicks = "" +perl.chatters.frame_color = "red" +perl.chatters.nick_color = "yellow" +perl.chatters.nick_timeout = "600" +perl.check_license = "on" +python.check_license = "on" +python.urlbar.ignore = "grep" +python.urlbar.remember_amount = "25" +python.urlbar.show_buffername = "on" +python.urlbar.show_index = "on" +python.urlbar.show_nick = "on" +python.urlbar.show_timestamp = "on" +python.urlbar.time_format = "%H:%M" +python.urlbar.use_popup = "on" +python.urlbar.visible_amount = "5" +python.urlbar.visible_seconds = "5" +ruby.check_license = "on" +tcl.check_license = "on" + +[desc] +perl.beep.beep_command_dcc = "command for beep on dcc, special value "$bell" is allowed, as well as "$bell;command" (default: "$bell")" +perl.beep.beep_command_highlight = "command for beep on highlight, special value "$bell" is allowed, as well as "$bell;command" (default: "$bell")" +perl.beep.beep_command_pv = "command for beep on private message, special value "$bell" is allowed, as well as "$bell;command" (default: "$bell")" +perl.beep.beep_command_timeout = "timeout for command run (in milliseconds, 0 = never kill (not recommended)) (default: "30000")" +perl.beep.beep_dcc = "beep on dcc (default: "on")" +perl.beep.beep_highlight = "beep on highlight (default: "on")" +perl.beep.beep_highlight_blacklist = "turn blacklist for highlights on or off (default: "off")" +perl.beep.beep_highlight_whitelist = "turn whitelist for highlights on or off (default: "off")" +perl.beep.beep_pv = "beep on private message (default: "on")" +perl.beep.beep_pv_blacklist = "turn blacklist for private messages on or off (default: "off")" +perl.beep.beep_pv_whitelist = "turn whitelist for private messages on or off (default: "off")" +perl.beep.beep_trigger_highlight = "word that will trigger execution of beep_command_highlight (if empty, anything will trigger) (default: "")" +perl.beep.beep_trigger_pv = "word that will trigger execution of beep_command_pv (it empty, anything will trigger) (default: "")" +perl.beep.bell_always = "use $bell on private messages and/or highlights regardless of trigger and whitelist settings (example: "pv,highlight") (default: "")" +perl.beep.blacklist_nicks = "comma-separated list of "server.nick": if not empty, these nicks will not be able to trigger execution of commands. Cannot be used in conjuction with whitelist (example: "freenode.nick1,freenode.nick2") (default: "")" +perl.beep.whitelist_channels = "comma-separated list of "server.#channel": if not empty, only these channels will trigger execution of commands (example: "freenode.#weechat,freenode.#channel2") (default: "")" +perl.beep.whitelist_nicks = "comma-separated list of "server.nick": if not empty, only these nicks will trigger execution of commands (example: "freenode.nick1,freenode.nick2") (default: "")" diff --git a/weechat/python/autoload/bitlbee_typing_notice.py b/weechat/python/autoload/bitlbee_typing_notice.py new file mode 100644 index 0000000..307083b --- /dev/null +++ b/weechat/python/autoload/bitlbee_typing_notice.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2010 by Alexander Schremmer +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# +# (this script requires WeeChat 0.3.0 or newer) +# +# History: +# 2010-05-20, Alexander Schremmer +# version 0.2: also handle users that do not send a TYPING 0 msg before quitting +# removed InfoList code +# 2010-05-16, Alexander Schremmer +# version 0.1: initial release + +import weechat as w +import re + +SCRIPT_NAME = "bitlbee_typing_notice" +SCRIPT_AUTHOR = "Alexander Schremmer " +SCRIPT_VERSION = "0.2" +SCRIPT_LICENSE = "GPL3" +SCRIPT_DESC = "Shows when somebody is typing on bitlbee and sends the notice as well" + + +bitlbee_channel = "&bitlbee" +bitlbee_server_name = "bitlbee" + +KEEP_TYPING_TIMEOUT = 1 +STOP_TYPING_TIMEOUT = 7 + +typing = {} +sending_typing = {} + + +def channel_has_nick(server, channel, nick): + buffer = w.buffer_search("", "%s.%s" % (server, channel)) + return bool(w.nicklist_search_nick(buffer, "", nick)) + + +def redraw(nick): + w.bar_item_update("bitlbee_typing_notice") + + +def ctcp_cb(data, modifier, modifier_data, string): + if modifier_data != bitlbee_server_name: + return string + match = re.match(r'(.*) PRIVMSG (.*)', string) + if match: + host, msg = match.groups() + match = re.search('\001TYPING ([0-9])\001', msg) + if match: + nick = re.match(':(?P.+)!', string).groups()[0] + typing_level = int(match.groups()[0]) + if typing_level == 0: + try: + del typing[nick] + except KeyError: + pass + redraw(nick) + elif typing_level == 1: + typing[nick] = 1 + # XXX add ICQ/Yahoo hack + redraw(nick) + elif typing_level == 2: + typing[nick] = 2 + redraw(nick) + return "" + return string + buffer = w.buffer_search("", "%s.%s" % (server, channel)) + +def stop_typing(data, signal, signal_data): + nick = re.match(':(?P.+)!', signal_data).groups()[0] + try: + del typing[nick] + except KeyError: + pass + redraw(nick) + return w.WEECHAT_RC_OK + +def typed_char(data, signal, signal_data): + buffer = w.current_buffer() + input_s = w.buffer_get_string(buffer, 'input') + server = w.buffer_get_string(buffer, 'localvar_server') + channel = w.buffer_get_string(buffer, 'localvar_channel') + buffer_type = w.buffer_get_string(buffer, 'localvar_type') + + if server != bitlbee_server_name or input_s.startswith("/"): + return w.WEECHAT_RC_OK + if buffer_type == "private": + if input_s: + send_typing(channel, 1) + elif channel == bitlbee_channel: + nick_completer = w.config_string("weechat.completion.nick_completer") + parts = input_s.split(":", 1) + if len(parts) > 1: + nick = parts[0] + send_typing(nick, 1) + + return w.WEECHAT_RC_OK + + +def typing_disable_timer(data, remaining_calls): + nick, cookie = data.rsplit(":", 1) + cookie = int(cookie) + if sending_typing[nick] == cookie: + send_typing_ctcp(nick, 0) + sending_typing[nick] = False + return w.WEECHAT_RC_OK + +def send_typing_ctcp(nick, level): + buffer = w.buffer_search("irc", "%s.%s" % (bitlbee_server_name, bitlbee_channel)) + w.command(buffer, "/mute -all /ctcp %s TYPING %i" % (nick, level)) + +def send_typing(nick, level): + if not channel_has_nick(bitlbee_server_name, bitlbee_channel, nick): + return + cookie = sending_typing.get(nick, 1) + 1 + if not sending_typing.get(nick, None): + send_typing_ctcp(nick, level) + sending_typing[nick] = cookie + w.hook_timer(4000, 0, 1, "typing_disable_timer", "%s:%i" % (nick, cookie)) + + +def typing_notice_item_cb(data, buffer, args): + if typing: + msgs = [] + for key, value in typing.items(): + msg = key + if value == 2: + msg += " (stale)" + msgs.append(msg) + return "typing: " + ", ".join(sorted(msgs)) + return "" + + +if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, + SCRIPT_DESC, "", ""): + w.hook_signal("input_text_changed", "typed_char", "") + w.hook_signal(bitlbee_server_name + ",irc_in_quit", "stop_typing", "") + w.hook_signal(bitlbee_server_name + ",irc_in_privmsg", "stop_typing", "") + w.bar_item_new('bitlbee_typing_notice', 'typing_notice_item_cb', '') + w.hook_modifier("irc_in_privmsg", "ctcp_cb", "") + diff --git a/weechat/relay.conf b/weechat/relay.conf new file mode 100644 index 0000000..6147697 --- /dev/null +++ b/weechat/relay.conf @@ -0,0 +1,26 @@ +# +# relay.conf -- weechat v0.3.8 +# + +[look] +auto_open_buffer = on +raw_messages = 256 + +[color] +status_active = lightblue +status_auth_failed = lightred +status_connecting = yellow +status_disconnected = lightred +status_waiting_auth = brown +text = default +text_bg = default +text_selected = white + +[network] +allowed_ips = "" +bind_address = "" +compression_level = 6 +max_clients = 5 +password = "" + +[port] diff --git a/weechat/rmodifier.conf b/weechat/rmodifier.conf new file mode 100644 index 0000000..169dec3 --- /dev/null +++ b/weechat/rmodifier.conf @@ -0,0 +1,13 @@ +# +# rmodifier.conf -- weechat v0.3.8 +# + +[look] +hide_char = "*" + +[modifier] +nickserv = "history_add,input_text_display;^(/(msg|quote) +nickserv +(id|identify|ghost \S+|release \S+) +)(.*);1,4*" +oper = "history_add,input_text_display;^(/oper +\S+ +)(.*);1,2*" +quote_pass = "history_add,input_text_display;^(/quote pass +)(.*);1,2*" +server = "history_add,input_text_display;^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*);1,4*,5" +set_pass = "history_add;^(/set +\S*password\S* +)(.*);1,2*" diff --git a/weechat/weechat.conf b/weechat/weechat.conf new file mode 100644 index 0000000..37671f0 --- /dev/null +++ b/weechat/weechat.conf @@ -0,0 +1,594 @@ +# +# weechat.conf -- weechat v0.3.8 +# + +[debug] + +[startup] +command_after_plugins = "" +command_before_plugins = "" +display_logo = on +display_version = on + +[look] +align_end_of_lines = message +bar_more_down = "++" +bar_more_left = "<<" +bar_more_right = ">>" +bar_more_up = "--" +buffer_notify_default = message +buffer_time_format = "%H:%M:%S" +color_basic_force_bold = off +color_inactive_buffer = off +color_inactive_message = on +color_inactive_prefix = on +color_inactive_prefix_buffer = on +color_inactive_time = off +color_inactive_window = off +color_pairs_auto_reset = 5 +color_real_white = on +command_chars = "" +confirm_quit = on +day_change = on +day_change_time_format = "%a, %d %b %Y" +eat_newline_glitch = off +highlight = "doy*" +highlight_regex = "" +highlight_tags = "notify_private" +hotlist_add_buffer_if_away = on +hotlist_buffer_separator = ", " +hotlist_count_max = 2 +hotlist_count_min_msg = 2 +hotlist_names_count = 3 +hotlist_names_length = 0 +hotlist_names_level = 14 +hotlist_names_merged_buffers = off +hotlist_short_names = on +hotlist_sort = group_time_asc +hotlist_unique_numbers = on +input_cursor_scroll = 20 +input_share = commands +input_share_overwrite = off +input_undo_max = 32 +item_buffer_filter = "*" +item_time_format = "%H:%M" +jump_current_to_previous_buffer = off +jump_previous_buffer_when_closing = on +mouse = off +mouse_timer_delay = 100 +nickmode = on +nickmode_empty = off +paste_bracketed = off +paste_bracketed_timer_delay = 10 +paste_max_lines = 1 +prefix_action = " *" +prefix_align = right +prefix_align_max = 0 +prefix_align_min = 0 +prefix_align_more = "+" +prefix_buffer_align = right +prefix_buffer_align_max = 0 +prefix_buffer_align_more = "+" +prefix_error = "=!=" +prefix_join = "-->" +prefix_network = "--" +prefix_quit = "<--" +prefix_same_nick = "" +prefix_suffix = "" +read_marker = line +read_marker_always_show = off +read_marker_string = "-" +save_config_on_exit = on +save_layout_on_exit = none +scroll_amount = 3 +scroll_bottom_after_switch = off +scroll_page_percent = 50 +search_text_not_found_alert = on +separator_horizontal = "-" +separator_vertical = "" +set_title = on +time_format = "%a, %d %b %Y %T" + +[palette] + +[color] +bar_more = lightmagenta +chat = default +chat_bg = default +chat_buffer = white +chat_channel = darkgray +chat_delimiters = darkgray +chat_highlight = yellow +chat_highlight_bg = default +chat_host = darkgray +chat_inactive_buffer = darkgray +chat_inactive_window = darkgray +chat_nick = darkgray +chat_nick_colors = "cyan,magenta,green,brown,red,blue" +chat_nick_other = cyan +chat_nick_self = white +chat_prefix_action = white +chat_prefix_buffer = brown +chat_prefix_buffer_inactive_buffer = darkgray +chat_prefix_error = yellow +chat_prefix_join = darkgray +chat_prefix_more = lightmagenta +chat_prefix_network = darkgray +chat_prefix_quit = darkgray +chat_prefix_suffix = green +chat_read_marker = darkgray +chat_read_marker_bg = default +chat_server = brown +chat_tags = red +chat_text_found = yellow +chat_text_found_bg = lightmagenta +chat_time = default +chat_time_delimiters = default +chat_value = cyan +input_actions = lightgreen +input_text_not_found = red +nicklist_away = cyan +nicklist_group = green +nicklist_offline = blue +separator = blue +status_count_highlight = magenta +status_count_msg = brown +status_count_other = default +status_count_private = green +status_data_highlight = lightmagenta +status_data_msg = yellow +status_data_other = default +status_data_private = lightgreen +status_filter = green +status_more = yellow +status_name = white +status_name_ssl = lightgreen +status_number = yellow +status_time = default + +[completion] +base_word_until_cursor = on +default_template = "%(nicks)|%(irc_channels)" +nick_add_space = on +nick_completer = ":" +nick_first_only = off +nick_ignore_chars = "[]`_-^" +partial_completion_alert = on +partial_completion_command = off +partial_completion_command_arg = off +partial_completion_count = on +partial_completion_other = off + +[history] +display_default = 5 +max_buffer_lines_minutes = 1440 +max_buffer_lines_number = 0 +max_commands = 100 +max_visited_buffers = 50 + +[proxy] + +[network] +connection_timeout = 60 +gnutls_ca_file = "/etc/ssl/certs/ca-certificates.crt" +gnutls_handshake_timeout = 30 + +[plugin] +autoload = "*" +debug = off +extension = ".so,.dll" +path = "%h/plugins" +save_config_on_unload = on + +[bar] +buffers.color_bg = default +buffers.color_delim = default +buffers.color_fg = default +buffers.conditions = "" +buffers.filling_left_right = vertical +buffers.filling_top_bottom = horizontal +buffers.hidden = off +buffers.items = "buffers" +buffers.position = left +buffers.priority = 0 +buffers.separator = on +buffers.size = 0 +buffers.size_max = 0 +buffers.type = root +input.color_bg = default +input.color_delim = cyan +input.color_fg = default +input.conditions = "" +input.filling_left_right = vertical +input.filling_top_bottom = horizontal +input.hidden = off +input.items = "[input_prompt]+(away),[input_search],[input_paste],input_text" +input.position = bottom +input.priority = 1000 +input.separator = off +input.size = 1 +input.size_max = 0 +input.type = window +nicklist.color_bg = default +nicklist.color_delim = cyan +nicklist.color_fg = default +nicklist.conditions = "nicklist" +nicklist.filling_left_right = vertical +nicklist.filling_top_bottom = columns_vertical +nicklist.hidden = off +nicklist.items = "chatters,buffer_nicklist" +nicklist.position = right +nicklist.priority = 200 +nicklist.separator = on +nicklist.size = 0 +nicklist.size_max = 0 +nicklist.type = window +status.color_bg = blue +status.color_delim = cyan +status.color_fg = default +status.conditions = "" +status.filling_left_right = vertical +status.filling_top_bottom = horizontal +status.hidden = off +status.items = "[time],[buffer_plugin],buffer_number+:+buffer_name+{buffer_nicklist_count}+buffer_filter,[bitlbee_typing_notice],[lag],completion,scroll" +status.position = bottom +status.priority = 500 +status.separator = off +status.size = 1 +status.size_max = 0 +status.type = window +title.color_bg = blue +title.color_delim = cyan +title.color_fg = default +title.conditions = "" +title.filling_left_right = vertical +title.filling_top_bottom = horizontal +title.hidden = off +title.items = "buffer_title" +title.position = top +title.priority = 500 +title.separator = off +title.size = 1 +title.size_max = 0 +title.type = window +urlbar.color_bg = default +urlbar.color_delim = default +urlbar.color_fg = default +urlbar.conditions = "" +urlbar.filling_left_right = vertical +urlbar.filling_top_bottom = horizontal +urlbar.hidden = on +urlbar.items = "urlbar_urls" +urlbar.position = top +urlbar.priority = 0 +urlbar.separator = off +urlbar.size = 0 +urlbar.size_max = 0 +urlbar.type = root + +[layout] +buffer = "irc;bitlbee.#twitter_doyster;1" +buffer = "irc;freenode.##crawl-offtopic;2" +buffer = "irc;perl.#moe;3" +buffer = "irc;perl.#plack;4" +buffer = "irc;perl.#ox;5" +buffer = "irc;flowdock.#iinteractive/venda;6" +buffer = "irc;flowdock.#iinteractive/hewitt;7" +buffer = "irc;ii.#ii_wanna_be_jsons_dog;8" +buffer = "irc;flowdock.#iinteractive/prg;9" +buffer = "irc;flowdock.#iinteractive/general;10" +buffer = "irc;bitlbee.starlifesage;11" +buffer = "irc;bitlbee.sarahjoseph;12" +buffer = "irc;bitlbee.petersonericc;13" +buffer = "irc;bitlbee.corcoranec;14" +buffer = "irc;ii.stevan;15" +buffer = "irc;flowdock.#iinteractive/gphat;16" +buffer = "irc;flowdock.#iinteractive/training;17" +buffer = "irc;ii.#ii;18" +buffer = "irc;irc.mozilla.org.#rust;19" +buffer = "core;weechat;20" +buffer = "irc;server.freenode;20" +buffer = "irc;server.ii;20" +buffer = "irc;server.perl;20" +buffer = "irc;server.bitlbee;20" +buffer = "irc;server.flowdock;20" +buffer = "irc;server.irc.mozilla.org;20" +buffer = "irc;bitlbee.&bitlbee;21" +buffer = "irc;perl.#moose-dev;22" +buffer = "irc;perl.vti;23" +window = "1;0;0;0;irc;server.irc.mozilla.org" + +[notify] + +[filter] +irc_smart = on;*;irc_smart_filter;* + +[key] +ctrl-? = "/input delete_previous_char" +ctrl-A = "/input move_beginning_of_line" +ctrl-B = "/input move_previous_char" +ctrl-Cb = "/input insert \x02" +ctrl-Cc = "/input insert \x03" +ctrl-Ci = "/input insert \x1D" +ctrl-Co = "/input insert \x0F" +ctrl-Cr = "/input insert \x12" +ctrl-Cu = "/input insert \x15" +ctrl-D = "/input delete_next_char" +ctrl-E = "/input move_end_of_line" +ctrl-F = "/input move_next_char" +ctrl-H = "/input delete_previous_char" +ctrl-I = "/input complete_next" +ctrl-J = "/input return" +ctrl-K = "/input delete_end_of_line" +ctrl-L = "/window refresh" +ctrl-M = "/input return" +ctrl-N = "/buffer +1" +ctrl-P = "/buffer -1" +ctrl-R = "/input search_text" +ctrl-Sctrl-U = "/input set_unread" +ctrl-T = "/input transpose_chars" +ctrl-U = "/input delete_beginning_of_line" +ctrl-W = "/buffer close" +ctrl-X = "/input switch_active_buffer" +ctrl-Y = "/input clipboard_paste" +meta-meta2-1~ = "/window scroll_top" +meta-meta2-23~ = "/bar scroll nicklist * b" +meta-meta2-24~ = "/bar scroll nicklist * e" +meta-meta2-4~ = "/window scroll_bottom" +meta-meta2-5~ = "/window scroll_up" +meta-meta2-6~ = "/window scroll_down" +meta-meta2-7~ = "/window scroll_top" +meta-meta2-8~ = "/window scroll_bottom" +meta-meta2-A = "/buffer -1" +meta-meta2-B = "/buffer +1" +meta-meta2-C = "/buffer +1" +meta-meta2-D = "/buffer -1" +meta-/ = "/input jump_last_buffer_displayed" +meta-0 = "/buffer *10" +meta-1 = "/buffer *1" +meta-2 = "/buffer *2" +meta-3 = "/buffer *3" +meta-4 = "/buffer *4" +meta-5 = "/buffer *5" +meta-6 = "/buffer *6" +meta-7 = "/buffer *7" +meta-8 = "/buffer *8" +meta-9 = "/buffer *9" +meta-< = "/input jump_previously_visited_buffer" +meta-= = "/filter toggle" +meta-> = "/input jump_next_visited_buffer" +meta-OA = "/input history_global_previous" +meta-OB = "/input history_global_next" +meta-OC = "/input move_next_word" +meta-OD = "/input move_previous_word" +meta-OF = "/input move_end_of_line" +meta-OH = "/input move_beginning_of_line" +meta-Oa = "/input history_global_previous" +meta-Ob = "/input history_global_next" +meta-Oc = "/input move_next_word" +meta-Od = "/input move_previous_word" +meta2-15~ = "/buffer -1" +meta2-17~ = "/buffer +1" +meta2-18~ = "/window -1" +meta2-19~ = "/window +1" +meta2-1;3A = "/buffer -1" +meta2-1;3B = "/buffer +1" +meta2-1;3C = "/buffer +1" +meta2-1;3D = "/buffer -1" +meta2-1;5A = "/input history_global_previous" +meta2-1;5B = "/input history_global_next" +meta2-1;5C = "/input move_next_word" +meta2-1;5D = "/input move_previous_word" +meta2-1~ = "/input move_beginning_of_line" +meta2-200~ = "/input paste_start" +meta2-201~ = "/input paste_stop" +meta2-20~ = "/bar scroll title * -30%" +meta2-21~ = "/bar scroll title * +30%" +meta2-23~ = "/bar scroll nicklist * -100%" +meta2-24~ = "/bar scroll nicklist * +100%" +meta2-3~ = "/input delete_next_char" +meta2-4~ = "/input move_end_of_line" +meta2-5;3~ = "/window scroll_up" +meta2-5~ = "/window page_up" +meta2-6;3~ = "/window scroll_down" +meta2-6~ = "/window page_down" +meta2-7~ = "/input move_beginning_of_line" +meta2-8~ = "/input move_end_of_line" +meta2-A = "/input history_previous" +meta2-B = "/input history_next" +meta2-C = "/input move_next_char" +meta2-D = "/input move_previous_char" +meta2-F = "/input move_end_of_line" +meta2-G = "/window page_down" +meta2-H = "/input move_beginning_of_line" +meta2-I = "/window page_up" +meta2-Z = "/input complete_previous" +meta2-[E = "/buffer -1" +meta-_ = "/input redo" +meta-a = "/input jump_smart" +meta-b = "/input move_previous_word" +meta-d = "/input delete_next_word" +meta-e = "/buffer *13" +meta-f = "/input move_next_word" +meta-h = "/input hotlist_clear" +meta-i = "/buffer *18" +meta-jmeta-l = "/input jump_last_buffer" +meta-jmeta-r = "/server raw" +meta-jmeta-s = "/server jump" +meta-j01 = "/buffer 1" +meta-j02 = "/buffer 2" +meta-j03 = "/buffer 3" +meta-j04 = "/buffer 4" +meta-j05 = "/buffer 5" +meta-j06 = "/buffer 6" +meta-j07 = "/buffer 7" +meta-j08 = "/buffer 8" +meta-j09 = "/buffer 9" +meta-j10 = "/buffer 10" +meta-j11 = "/buffer 11" +meta-j12 = "/buffer 12" +meta-j13 = "/buffer 13" +meta-j14 = "/buffer 14" +meta-j15 = "/buffer 15" +meta-j16 = "/buffer 16" +meta-j17 = "/buffer 17" +meta-j18 = "/buffer 18" +meta-j19 = "/buffer 19" +meta-j20 = "/buffer 20" +meta-j21 = "/buffer 21" +meta-j22 = "/buffer 22" +meta-j23 = "/buffer 23" +meta-j24 = "/buffer 24" +meta-j25 = "/buffer 25" +meta-j26 = "/buffer 26" +meta-j27 = "/buffer 27" +meta-j28 = "/buffer 28" +meta-j29 = "/buffer 29" +meta-j30 = "/buffer 30" +meta-j31 = "/buffer 31" +meta-j32 = "/buffer 32" +meta-j33 = "/buffer 33" +meta-j34 = "/buffer 34" +meta-j35 = "/buffer 35" +meta-j36 = "/buffer 36" +meta-j37 = "/buffer 37" +meta-j38 = "/buffer 38" +meta-j39 = "/buffer 39" +meta-j40 = "/buffer 40" +meta-j41 = "/buffer 41" +meta-j42 = "/buffer 42" +meta-j43 = "/buffer 43" +meta-j44 = "/buffer 44" +meta-j45 = "/buffer 45" +meta-j46 = "/buffer 46" +meta-j47 = "/buffer 47" +meta-j48 = "/buffer 48" +meta-j49 = "/buffer 49" +meta-j50 = "/buffer 50" +meta-j51 = "/buffer 51" +meta-j52 = "/buffer 52" +meta-j53 = "/buffer 53" +meta-j54 = "/buffer 54" +meta-j55 = "/buffer 55" +meta-j56 = "/buffer 56" +meta-j57 = "/buffer 57" +meta-j58 = "/buffer 58" +meta-j59 = "/buffer 59" +meta-j60 = "/buffer 60" +meta-j61 = "/buffer 61" +meta-j62 = "/buffer 62" +meta-j63 = "/buffer 63" +meta-j64 = "/buffer 64" +meta-j65 = "/buffer 65" +meta-j66 = "/buffer 66" +meta-j67 = "/buffer 67" +meta-j68 = "/buffer 68" +meta-j69 = "/buffer 69" +meta-j70 = "/buffer 70" +meta-j71 = "/buffer 71" +meta-j72 = "/buffer 72" +meta-j73 = "/buffer 73" +meta-j74 = "/buffer 74" +meta-j75 = "/buffer 75" +meta-j76 = "/buffer 76" +meta-j77 = "/buffer 77" +meta-j78 = "/buffer 78" +meta-j79 = "/buffer 79" +meta-j80 = "/buffer 80" +meta-j81 = "/buffer 81" +meta-j82 = "/buffer 82" +meta-j83 = "/buffer 83" +meta-j84 = "/buffer 84" +meta-j85 = "/buffer 85" +meta-j86 = "/buffer 86" +meta-j87 = "/buffer 87" +meta-j88 = "/buffer 88" +meta-j89 = "/buffer 89" +meta-j90 = "/buffer 90" +meta-j91 = "/buffer 91" +meta-j92 = "/buffer 92" +meta-j93 = "/buffer 93" +meta-j94 = "/buffer 94" +meta-j95 = "/buffer 95" +meta-j96 = "/buffer 96" +meta-j97 = "/buffer 97" +meta-j98 = "/buffer 98" +meta-j99 = "/buffer 99" +meta-k = "/input grab_key_command" +meta-m = "/mute mouse toggle" +meta-n = "/window scroll_next_highlight" +meta-o = "/buffer *19" +meta-p = "/window scroll_previous_highlight" +meta-q = "/buffer *11" +meta-r = "/buffer *14" +meta-t = "/buffer *15" +meta-u = "/buffer *17" +meta-w = "/buffer *12" +meta-wmeta-meta2-A = "/window up" +meta-wmeta-meta2-B = "/window down" +meta-wmeta-meta2-C = "/window right" +meta-wmeta-meta2-D = "/window left" +meta-wmeta2-1;3A = "/window up" +meta-wmeta2-1;3B = "/window down" +meta-wmeta2-1;3C = "/window right" +meta-wmeta2-1;3D = "/window left" +meta-wmeta-b = "/window balance" +meta-wmeta-s = "/window swap" +meta-y = "/buffer *16" +meta-z = "/window zoom" +ctrl-_ = "/input undo" + +[key_search] +ctrl-J = "/input search_stop" +ctrl-M = "/input search_stop" +ctrl-R = "/input search_switch_case" +meta2-A = "/input search_previous" +meta2-B = "/input search_next" + +[key_cursor] +ctrl-J = "/cursor stop" +ctrl-M = "/cursor stop" +meta-meta2-A = "/cursor move area_up" +meta-meta2-B = "/cursor move area_down" +meta-meta2-C = "/cursor move area_right" +meta-meta2-D = "/cursor move area_left" +meta2-1;3A = "/cursor move area_up" +meta2-1;3B = "/cursor move area_down" +meta2-1;3C = "/cursor move area_right" +meta2-1;3D = "/cursor move area_left" +meta2-A = "/cursor move up" +meta2-B = "/cursor move down" +meta2-C = "/cursor move right" +meta2-D = "/cursor move left" +@item(buffer_nicklist):K = "/window ${_window_number};/kickban ${nick}" +@item(buffer_nicklist):b = "/window ${_window_number};/ban ${nick}" +@item(buffer_nicklist):k = "/window ${_window_number};/kick ${nick}" +@item(buffer_nicklist):q = "/window ${_window_number};/query ${nick};/cursor stop" +@item(buffer_nicklist):w = "/window ${_window_number};/whois ${nick}" +@chat:Q = "hsignal:chat_quote_time_prefix_message;/cursor stop" +@chat:m = "hsignal:chat_quote_message;/cursor stop" +@chat:q = "hsignal:chat_quote_prefix_message;/cursor stop" + +[key_mouse] +@bar(input):button2 = "/input grab_mouse_area" +@bar(nicklist):button1-gesture-down = "/bar scroll nicklist ${_window_number} +100%" +@bar(nicklist):button1-gesture-down-long = "/bar scroll nicklist ${_window_number} e" +@bar(nicklist):button1-gesture-up = "/bar scroll nicklist ${_window_number} -100%" +@bar(nicklist):button1-gesture-up-long = "/bar scroll nicklist ${_window_number} b" +@item(buffer_nicklist):button1 = "/window ${_window_number};/query ${nick}" +@item(buffer_nicklist):button1-gesture-left = "/window ${_window_number};/kick ${nick}" +@item(buffer_nicklist):button1-gesture-left-long = "/window ${_window_number};/kickban ${nick}" +@item(buffer_nicklist):button2 = "/window ${_window_number};/whois ${nick}" +@item(buffer_nicklist):button2-gesture-left = "/window ${_window_number};/ban ${nick}" +@item(buffers):button1* = "hsignal:buffers_mouse" +@item(buffers):button2* = "hsignal:buffers_mouse" +@bar:wheeldown = "/bar scroll ${_bar_name} ${_window_number} +20%" +@bar:wheelup = "/bar scroll ${_bar_name} ${_window_number} -20%" +@chat:button1 = "/window ${_window_number}" +@chat:button1-gesture-left = "/window ${_window_number};/buffer -1" +@chat:button1-gesture-left-long = "/window ${_window_number};/buffer 1" +@chat:button1-gesture-right = "/window ${_window_number};/buffer +1" +@chat:button1-gesture-right-long = "/window ${_window_number};/input jump_last_buffer" +@chat:wheeldown = "/window scroll_down -window ${_window_number}" +@chat:wheelup = "/window scroll_up -window ${_window_number}" +@*:button3 = "/cursor go ${_x},${_y}" diff --git a/weechat/xfer.conf b/weechat/xfer.conf new file mode 100644 index 0000000..dffa8e7 --- /dev/null +++ b/weechat/xfer.conf @@ -0,0 +1,36 @@ +# +# xfer.conf -- weechat v0.3.8 +# + +[look] +auto_open_buffer = on +progress_bar_size = 20 + +[color] +status_aborted = lightred +status_active = lightblue +status_connecting = yellow +status_done = lightgreen +status_failed = lightred +status_waiting = lightcyan +text = default +text_bg = default +text_selected = white + +[network] +blocksize = 65536 +fast_send = on +own_ip = "" +port_range = "" +speed_limit = 0 +timeout = 300 + +[file] +auto_accept_chats = off +auto_accept_files = off +auto_rename = on +auto_resume = on +convert_spaces = on +download_path = "%h/xfer" +upload_path = "~" +use_nick_in_filename = on -- cgit v1.2.3-54-g00ecf