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 --- 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 + 15 files changed, 3094 insertions(+) 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 (limited to 'weechat') 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