]> git.rmz.io Git - dotfiles.git/commitdiff
weechat: update scripts and settings
authorSamir Benmendil <samir.benmendil@ultrahaptics.com>
Mon, 31 Oct 2016 09:42:56 +0000 (09:42 +0000)
committerSamir Benmendil <samir.benmendil@ultrahaptics.com>
Mon, 31 Oct 2016 09:42:56 +0000 (09:42 +0000)
weechat/buffer_autoset.conf
weechat/buffers.conf
weechat/perl/buffers.pl
weechat/perl/iset.pl
weechat/python/buffer_autoset.py
weechat/python/grep.py
weechat/relay.conf
weechat/sec.conf
weechat/trigger.conf
weechat/weechat.conf

index 7b43f8f47020aa0b39f47a36f0529e501dfd7eb4..0cc0b92e7b2356caea599e446357b88e3040118e 100644 (file)
@@ -2,5 +2,9 @@
 # weechat -- buffer_autoset.conf
 #
 
+[look]
+instant = on
+timer = 1
+
 [buffer]
 perl.highmon.number = "100"
index f2a5b5e3ddcf4c8998211897218072c111413d04..633fc6bd2871604456d0a40cef0a4057295f298d 100644 (file)
@@ -42,6 +42,7 @@ whitelist_private_fg = default
 core_to_front = off
 detach = 0
 detach_buffer_immediately = "highmon"
+detach_buffer_immediately_level = 2
 detach_display_window_number = off
 detach_displayed_buffers = on
 detach_free_content = off
@@ -50,6 +51,7 @@ hide_merged_buffers = server
 hotlist_counter = on
 immune_detach_buffers = ""
 indenting = off
+indenting_amount = 2
 indenting_number = on
 jump_prev_next_visited_buffer = off
 mark_inactive = off
index 472f6e95df9ed315a0131880db2f2e53c1545fe7..73eb4b55cd74b09ced7312121d5631611812449a 100644 (file)
 #
 # History:
 #
+# 2016-05-01, mumixam <mumixam@gmail.com>:
+#     v5.4: added option "detach_buffer_immediately_level"
+# 2015-08-21, Matthew Cox <matthewcpcox@gmail.com>
+#     v5.3: add option "indenting_amount", to adjust the indenting of channel buffers
+# 2015-05-02, arza <arza@arza.us>:
+#     v5.2: truncate long names (name_size_max) more when mark_inactive adds parenthesis
+# 2015-03-29, Ed Santiago <ed@edsantiago.com>:
+#     v5.1: merged buffers: always indent, except when filling is horizontal
 # 2014-12-12
 #     v5.0: fix cropping non-latin buffer names
 # 2014-08-29, Patrick Steinhardt <ps@pks.im>:
@@ -164,13 +172,15 @@ use strict;
 use Encode qw( decode encode );
 # -----------------------------[ internal ]-------------------------------------
 my $SCRIPT_NAME = "buffers";
-my $SCRIPT_VERSION = "5.0";
+my $SCRIPT_VERSION = "5.4";
 
 my $BUFFERS_CONFIG_FILE_NAME = "buffers";
 my $buffers_config_file;
 my $cmd_buffers_whitelist= "buffers_whitelist";
 my $cmd_buffers_detach   = "buffers_detach";
 
+my $maxlength;
+
 my %mouse_keys = ("\@item(buffers):button1*" => "hsignal:buffers_mouse",
                   "\@item(buffers):button2*" => "hsignal:buffers_mouse",
                   "\@bar(buffers):ctrl-wheelup" => "hsignal:buffers_mouse",
@@ -675,6 +685,13 @@ my %default_options_look =
      "", 0, 0, "on", "on", 0,
      "", "", "buffers_signal_config", "", "", ""
  ],
+ "indenting_amount" => [
+     "indenting_amount", "integer",
+     "amount of indenting to use. This option only takes effect if bar ".
+     "is left/right positioned, and indenting is enabled",
+     "", 0, 16, 2, 2, 0,
+     "", "", "buffers_signal_config", "", "", ""
+ ],
  "short_names" => [
      "short_names", "boolean",
      "display short names (remove text before first \".\" in buffer name)",
@@ -778,12 +795,24 @@ my %default_options_look =
  ],
  "detach_buffer_immediately" => [
      "detach_buffer_immediately", "string",
-     "comma separated list of buffers to detach immediately. A query and ".
-     "highlight message will attach buffer again. Allows \"*\" wildcard. ".
+     "comma separated list of buffers to detach immediately. Buffers ".
+     "will attach again based on notify level set in ".
+     "\"detach_buffer_immediately_level\". Allows \"*\" wildcard. ".
      "Ex: \"BitlBee,freenode.*\"",
      "", 0, 0, "", "", 0,
      "", "", "buffers_signal_config_detach_buffer_immediately", "", "", ""
  ],
+ "detach_buffer_immediately_level" => [
+     "detach_buffer_immediately_level", "integer",
+     "The value determines what notify level messages are reattached from activity. ".
+     " This option works in conjunction with \"detach_buffer_immediately\" ".
+     "0: low priority (like join/part messages), ".
+     "1: message, ".
+     "2: private, ".
+     "3: highlight",
+     "", 0, 3, 2, 2, 0,
+     "", "", "buffers_signal_config", "", "", ""
+ ],
  "detach_free_content" => [
      "detach_free_content", "boolean",
      "buffers with free content will be detached (Ex: iset, chanmon)",
@@ -992,11 +1021,11 @@ sub build_buffers
             weechat::infolist_free($infolist_channel);
         }
 
-        my $result = check_immune_detached_buffers($buffer->{"name"});          # checking for wildcard 
-
+        my $result = check_immune_detached_buffers($buffer->{"name"});          # checking for wildcard
+        my $maxlevel = weechat::config_integer($options{"detach_buffer_immediately_level"});
         next if ( check_detach_buffer_immediately($buffer->{"name"}) eq 1
                  and $buffer->{"current_buffer"} eq 0
-                 and ( not exists $hotlist{$buffer->{"pointer"}} or $hotlist{$buffer->{"pointer"}} < 2) );          # checking for buffer to immediately detach
+                 and ( not exists $hotlist{$buffer->{"pointer"}} or $hotlist{$buffer->{"pointer"}} < $maxlevel) );          # checking for buffer to immediately detach
 
         unless ($result)
         {
@@ -1116,8 +1145,14 @@ sub build_buffers
                         $name = $buffer->{"name"};
                     }
                 }
-                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_integer($options{"name_size_max"}) >= 1)
+                {
+                    $maxlength = weechat::config_integer($options{"name_size_max"});
+                    if($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0)
+                    {
+                        $maxlength -= 2;
+                    }
+                    $name = encode("UTF-8", substr(decode("UTF-8", $name), 0, $maxlength));
                 }
                 if ( weechat::config_boolean($options{"core_to_front"}) eq 1)
                 {
@@ -1298,8 +1333,17 @@ sub build_buffers
             }
             else
             {
-                my $indent = "";
-                $indent = ((" " x length($buffer->{"number"}))." ") if (($position eq "left") || ($position eq "right"));
+                # Indentation aligns channels in a visually appealing way
+                # when viewing list top-to-bottom...
+                my $indent = (" " x length($buffer->{"number"}))." ";
+                # ...except when list is top/bottom and channels left-to-right.
+                my $option_pos = weechat::config_string( weechat::config_get( "weechat.bar.buffers.position" ) );
+                if (($option_pos eq 'top') || ($option_pos eq 'bottom')) {
+                    my $option_filling = weechat::config_string( weechat::config_get( "weechat.bar.buffers.filling_top_bottom" ) );
+                    if ($option_filling =~ /horizontal/) {
+                        $indent = '';
+                    }
+                }
                 $str .= weechat::color("default")
                     .$color_bg
                     .$indent;
@@ -1314,16 +1358,17 @@ sub build_buffers
             {
                 if ( weechat::config_integer( $options{"indenting"} ) eq 1 )
                 {
-                    $str .= "  ";
+                    $str .= (" " x weechat::config_integer( $options{"indenting_amount"} ) );
                 }
                 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 weechat::config_integer( $options{"indenting_amount"} ) );
+                    }
+                    else
                     {
-                      $str .= ( (" " x ( $max_number_digits - length($buffer->{"number"}) ))." " );
+                      $str .= ( (" " x ( $max_number_digits - length($buffer->{"number"}) )).(" " x weechat::config_integer( $options{"indenting_amount"} ) ) );
                     }
                 }
             }
@@ -1389,7 +1434,14 @@ sub build_buffers
         if (weechat::config_integer($options{"name_size_max"}) >= 1)                # check max_size of buffer name
         {
             $name = decode("UTF-8", $name);
-            $str .= encode("UTF-8", substr($name, 0, weechat::config_integer($options{"name_size_max"})));
+
+            $maxlength = weechat::config_integer($options{"name_size_max"});
+            if($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0)
+            {
+                $maxlength -= 2;
+            }
+
+            $str .= encode("UTF-8", substr($name, 0, $maxlength));
             $str .= weechat::color(weechat::config_color( $options{"color_number_char"})).weechat::config_string($options{"name_crop_suffix"}) if (length($name) > weechat::config_integer($options{"name_size_max"}));
             $str .= add_inactive_parentless($buffer->{"type"}, $buffer->{"nicks_count"});
             $str .= add_hotlist_count($buffer->{"pointer"}, %hotlist);
index f179022b3645ac63e7f8c6158e23a169dd0b2817..163dfb5e37b3b0f97ad14018169df8ca9498834a 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Copyright (C) 2008-2014 Sebastien Helleu <flashcode@flashtux.org>
-# Copyright (C) 2010-2014 Nils Görs <weechatter@arcor.de>
+# Copyright (C) 2010-2015 Nils Görs <weechatter@arcor.de>
 #
 # 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
 #
 # History:
 #
+# 2016-07-08, nils_2 <weechatter@arcor.de>
+#     version 4.2: add diff function
+# 2016-02-06, Sebastien Helleu <flashcode@flashtux.org>:
+#     version 4.1: remove debug print
+# 2015-12-24, Sebastien Helleu <flashcode@flashtux.org>:
+#     version 4.0: add support of parent options (inherited values in irc servers)
+#                  with WeeChat >= 1.4
+# 2015-05-16, Sebastien Helleu <flashcode@flashtux.org>:
+#     version 3.9: fix cursor position when editing an option with WeeChat >= 1.2
+# 2015-05-02, arza <arza@arza.us>:
+#     version 3.8: don't append "null" to /set when setting an undefined setting
+# 2015-05-01, nils_2 <weechatter@arcor.de>:
+#     version 3.7: fix two perl warnings (reported by t3chguy)
 # 2014-09-30, arza <arza@arza.us>:
 #     version 3.6: fix current line counter when options aren't found
 # 2014-06-03, nils_2 <weechatter@arcor.de>:
 use strict;
 
 my $PRGNAME = "iset";
-my $VERSION = "3.6";
+my $VERSION = "4.2";
 my $DESCR   = "Interactive Set for configuration options";
 my $AUTHOR  = "Sebastien Helleu <flashcode\@flashtux.org>";
 my $LICENSE = "GPL3";
@@ -129,9 +142,11 @@ my $iset_buffer = "";
 my $wee_version_number = 0;
 my @iset_focus = ();
 my @options_names = ();
+my @options_parent_names = ();
 my @options_types = ();
 my @options_values = ();
 my @options_default_values = ();
+my @options_parent_values = ();
 my @options_is_null = ();
 my $option_max_length = 0;
 my $current_line = 0;
@@ -139,7 +154,7 @@ my $filter = "*";
 my $description = "";
 my $options_name_copy = "";
 my $iset_filter_title = "";
-# search modes: 0 = index() on value, 1 = grep() on value, 2 = grep() on option, 3 = grep on option & value
+# search modes: 0 = index() on value, 1 = grep() on value, 2 = grep() on option, 3 = grep on option & value, 4 = diff all, 5 = diff parts
 my $search_mode = 2;
 my $search_value = "";
 my $help_text_keys = "alt + space: toggle, +/-: increase/decrease, enter: change, ir: reset, iu: unset, v: toggle help bar";
@@ -189,6 +204,12 @@ sub iset_title
             $filter = "*" if ($filter eq "");
             $show_filter = $filter;
         }
+        elsif ($search_mode == 4 or $search_mode == 5)
+        {
+            $iset_filter_title = "diff: ";
+            $show_filter = "all";
+            $show_filter = $search_value if $search_mode == 5;
+        }
         elsif ($search_mode eq 3)
         {
             $iset_filter_title = "(option) ";
@@ -237,6 +258,10 @@ sub iset_create_filter
 sub iset_buffer_input
 {
     my ($data, $buffer, $string) = ($_[0], $_[1], $_[2]);
+
+    # string begins with space?
+    return weechat::WEECHAT_RC_OK if (substr($string, 0, 1 ) eq " ");
+
     if ($string eq "q")
     {
         weechat::buffer_close($buffer);
@@ -257,10 +282,27 @@ sub iset_buffer_input
             weechat::buffer_set($iset_buffer, "localvar_set_iset_search_value", $search_value);
         }
     }
+    # show all diff values
+    elsif ($string eq "d")
+    {
+        $search_mode = 4;
+#        iset_title();
+        iset_create_filter("*");
+        iset_get_options("*");
+    }
+    elsif ( $array_count >= 2 and $cmd_array[0] eq "d")
+    {
+        $search_mode = 5;
+        $search_value = substr($cmd_array[1], 0);  # cut value_search_char
+        $search_value = substr($cmd_array[2], 0) if ( $array_count > 2);  # cut value_search_char
+        iset_create_filter($search_value);
+        iset_get_options($search_value);
+
+    }
     else
     {
         $search_mode = 2;
-        if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s")
+        if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s" )
         {
             if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat::config_string($options_iset{"value_search_char"})
             or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat::config_string($options_iset{"value_search_char"}) )
@@ -274,7 +316,8 @@ sub iset_buffer_input
         {
             iset_create_filter($string);
             iset_get_options($search_value);
-        }else
+        }
+        else
         {
             iset_create_filter($string);
             iset_get_options("");
@@ -343,9 +386,11 @@ sub iset_get_options
     $search_value = $var_value;
     @iset_focus = ();
     @options_names = ();
+    @options_parent_names = ();
     @options_types = ();
     @options_values = ();
     @options_default_values = ();
+    @options_parent_values = ();
     @options_is_null = ();
     $option_max_length = 0;
     my %options_internal = ();
@@ -361,34 +406,61 @@ sub iset_get_options
     {
         $key = sprintf("%08d", $i);
         my $name = weechat::infolist_string($infolist, "full_name");
+        my $parent_name = weechat::infolist_string($infolist, "parent_name");
         next if (weechat::config_boolean($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
         my $type = weechat::infolist_string($infolist, "type");
         my $value = weechat::infolist_string($infolist, "value");
         my $default_value = weechat::infolist_string($infolist, "default_value");
+        my $parent_value;
+        if ($parent_name && (($wee_version_number < 0x00040300) || (weechat::infolist_search_var($infolist, "parent_value"))))
+        {
+            $parent_value = weechat::infolist_string($infolist, "parent_value");
+        }
         my $is_null = weechat::infolist_integer($infolist, "value_is_null");
+
         if ($search_mode == 3)
         {
             my $value = weechat::infolist_string($infolist, "value");
             if ( grep /\Q$var_value/,lc($value) )
             {
+                $options_internal{$name}{"parent_name"} = $parent_name;
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
                 $options_internal{$name}{"default_value"} = $default_value;
+                $options_internal{$name}{"parent_value"} = $parent_value;
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
-        $iset_struct{$key} = $options_internal{$name};
-        push(@iset_focus, $iset_struct{$key});
+                $iset_struct{$key} = $options_internal{$name};
+                push(@iset_focus, $iset_struct{$key});
+            }
+        }
+        # search for diff?
+        elsif ( $search_mode == 4 or $search_mode == 5)
+        {
+            if ($value ne $default_value )
+            {
+                $options_internal{$name}{"parent_name"} = $parent_name;
+                $options_internal{$name}{"type"} = $type;
+                $options_internal{$name}{"value"} = $value;
+                $options_internal{$name}{"default_value"} = $default_value;
+                $options_internal{$name}{"parent_value"} = $parent_value;
+                $options_internal{$name}{"is_null"} = $is_null;
+                $option_max_length = length($name) if (length($name) > $option_max_length);
+                $iset_struct{$key} = $options_internal{$name};
+                push(@iset_focus, $iset_struct{$key});
             }
         }
         else
         {
+            $options_internal{$name}{"parent_name"} = $parent_name;
             $options_internal{$name}{"type"} = $type;
             $options_internal{$name}{"value"} = $value;
             $options_internal{$name}{"default_value"} = $default_value;
+            $options_internal{$name}{"parent_value"} = $parent_value;
             $options_internal{$name}{"is_null"} = $is_null;
             $option_max_length = length($name) if (length($name) > $option_max_length);
-        $iset_struct{$key} = $options_internal{$name};
-        push(@iset_focus, $iset_struct{$key});
+            $iset_struct{$key} = $options_internal{$name};
+            push(@iset_focus, $iset_struct{$key});
         }
         $i++;
     }
@@ -397,9 +469,11 @@ sub iset_get_options
     foreach my $name (sort keys %options_internal)
     {
         push(@options_names, $name);
+        push(@options_parent_names, $options_internal{$name}{"parent_name"});
         push(@options_types, $options_internal{$name}{"type"});
         push(@options_values, $options_internal{$name}{"value"});
         push(@options_default_values, $options_internal{$name}{"default_value"});
+        push(@options_parent_values, $options_internal{$name}{"parent_value"});
         push(@options_is_null, $options_internal{$name}{"is_null"});
     }
 }
@@ -422,9 +496,11 @@ sub iset_search_values
 {
     my ($var_value,$search_mode) = ($_[0],$_[1]);
     @options_names = ();
+    @options_parent_names = ();
     @options_types = ();
     @options_values = ();
     @options_default_values = ();
+    @options_parent_values = ();
     @options_is_null = ();
     $option_max_length = 0;
     my %options_internal = ();
@@ -433,18 +509,26 @@ sub iset_search_values
     while (weechat::infolist_next($infolist))
     {
         my $name = weechat::infolist_string($infolist, "full_name");
+        my $parent_name = weechat::infolist_string($infolist, "parent_name");
         next if (weechat::config_boolean($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
         my $type = weechat::infolist_string($infolist, "type");
         my $is_null = weechat::infolist_integer($infolist, "value_is_null");
         my $value = weechat::infolist_string($infolist, "value");
         my $default_value = weechat::infolist_string($infolist, "default_value");
+        my $parent_value;
+        if ($parent_name && (($wee_version_number < 0x00040300) || (weechat::infolist_search_var($infolist, "parent_value"))))
+        {
+            $parent_value = weechat::infolist_string($infolist, "parent_value");
+        }
         if ($search_mode)
         {
             if ( grep /\Q$var_value/,lc($value) )
             {
+                $options_internal{$name}{"parent_name"} = $parent_name;
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
                 $options_internal{$name}{"default_value"} = $default_value;
+                $options_internal{$name}{"parent_value"} = $parent_value;
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
             }
@@ -454,9 +538,11 @@ sub iset_search_values
 #            if ($value =~ /\Q$var_value/si)
             if (lc($value) eq $var_value)
             {
+                $options_internal{$name}{"parent_name"} = $parent_name;
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
                 $options_internal{$name}{"default_value"} = $default_value;
+                $options_internal{$name}{"parent_value"} = $parent_value;
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
             }
@@ -467,9 +553,11 @@ sub iset_search_values
     foreach my $name (sort keys %options_internal)
     {
         push(@options_names, $name);
+        push(@options_parent_names, $options_internal{$name}{"parent_name"});
         push(@options_types, $options_internal{$name}{"type"});
         push(@options_values, $options_internal{$name}{"value"});
         push(@options_default_values, $options_internal{$name}{"default_value"});
+        push(@options_parent_values, $options_internal{$name}{"parent_value"});
         push(@options_is_null, $options_internal{$name}{"is_null"});
     }
 }
@@ -498,9 +586,11 @@ sub iset_refresh_line
             my $color1 = weechat::color(weechat::config_color($options_iset{"color_option"}));
             my $color2 = weechat::color(weechat::config_color($options_iset{"color_type"}));
             my $color3 = "";
+            my $color4 = "";
             if ($options_is_null[$y])
             {
                 $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef"}));
+                $color4 = weechat::color(weechat::config_color($options_iset{"color_value"}));
             }
             elsif ($options_values[$y] ne $options_default_values[$y])
             {
@@ -517,6 +607,7 @@ sub iset_refresh_line
                 if ($options_is_null[$y])
                 {
                     $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"}));
+                    $color4 = weechat::color(weechat::config_color($options_iset{"color_value_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"}));
                 }
                 elsif ($options_values[$y] ne $options_default_values[$y])
                 {
@@ -528,7 +619,23 @@ sub iset_refresh_line
                 }
             }
             my $value = $options_values[$y];
-            $value = "(undef)" if ($options_is_null[$y]);
+            if ($options_is_null[$y])
+            {
+                $value = "null";
+                if ($options_parent_names[$y])
+                {
+                    if (defined $options_parent_values[$y])
+                    {
+                        my $around_parent = "";
+                        $around_parent = "\"" if ($options_types[$y] eq "string");
+                        $value .= $color1." -> ".$color4.$around_parent.$options_parent_values[$y].$around_parent;
+                    }
+                    else
+                    {
+                        $value .= $color1." -> ".$color3."null";
+                    }
+                }
+            }
             my $strline = sprintf($format,
                                   $color1, $options_names[$y], $padding,
                                   $color2, $options_types[$y],
@@ -702,6 +809,39 @@ sub iset_get_option_name_index
     return -1;
 }
 
+sub iset_refresh_option
+{
+    my $option_name = $_[0];
+    my $index = $_[1];
+    my $infolist = weechat::infolist_get("option", "", $option_name);
+    if ($infolist)
+    {
+        weechat::infolist_next($infolist);
+        if (weechat::infolist_fields($infolist))
+        {
+            $options_parent_names[$index] = weechat::infolist_string($infolist, "parent_name");
+            $options_types[$index] = weechat::infolist_string($infolist, "type");
+            $options_values[$index] = weechat::infolist_string($infolist, "value");
+            $options_default_values[$index] = weechat::infolist_string($infolist, "default_value");
+            $options_is_null[$index] = weechat::infolist_integer($infolist, "value_is_null");
+            $options_parent_values[$index] = undef;
+            if ($options_parent_names[$index]
+                && (($wee_version_number < 0x00040300) || (weechat::infolist_search_var($infolist, "parent_value"))))
+            {
+                $options_parent_values[$index] = weechat::infolist_string($infolist, "parent_value");
+            }
+            iset_refresh_line($index);
+            iset_title() if ($option_name eq "iset.look.show_current_line");
+        }
+        else
+        {
+            iset_full_refresh(1);  # if not found, refresh fully without clearing buffer
+            weechat::print_y($iset_buffer, $#options_names + 1, "");
+        }
+        weechat::infolist_free($infolist);
+    }
+}
+
 sub iset_config_cb
 {
     my ($data, $option_name, $value) = ($_[0], $_[1], $_[2]);
@@ -714,25 +854,14 @@ sub iset_config_cb
         if ($index >= 0)
         {
             # refresh info about changed option
-            my $infolist = weechat::infolist_get("option", "", $option_name);
-            if ($infolist)
+            iset_refresh_option($option_name, $index);
+            # refresh any other option having this changed option as parent
+            foreach my $i (0 .. $#options_names)
             {
-                weechat::infolist_next($infolist);
-                if (weechat::infolist_fields($infolist))
-                {
-                    $options_types[$index] = weechat::infolist_string($infolist, "type");
-                    $options_values[$index] = weechat::infolist_string($infolist, "value");
-                    $options_default_values[$index] = weechat::infolist_string($infolist, "default_value");
-                    $options_is_null[$index] = weechat::infolist_integer($infolist, "value_is_null");
-                    iset_refresh_line($index);
-                    iset_title() if ($option_name eq "iset.look.show_current_line");
-                }
-                else
+                if ($options_parent_names[$i] eq $option_name)
                 {
-                    iset_full_refresh(1); # if not found, refresh fully without clearing buffer
-                    weechat::print_y($iset_buffer, $#options_names + 1, "");
+                    iset_refresh_option($options_names[$i], $i);
                 }
-                weechat::infolist_free($infolist);
             }
         }
         else
@@ -807,20 +936,37 @@ sub iset_cmd_cb
         {
             # f/s option =value
             # option =value
-            $search_mode = 2;
+            $search_mode = 2; # grep on option
             if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s")
             {
                 if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat::config_string($options_iset{"value_search_char"})
                 or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat::config_string($options_iset{"value_search_char"}) )
                 {
-                    $search_mode = 3;
+                    $search_mode = 3; # grep on option and value
                     $search_value = substr($cmd_array[1], 1);  # cut value_search_char
                     $search_value = substr($cmd_array[2], 1) if ( $array_count > 2);  # cut value_search_char
                 }
             }
+
+            # show all diff values
+            if ( $args eq "d")
+            {
+                $search_mode = 4;
+                $search_value = "*";
+                $args = $search_value;
+            }
+            if ( $array_count >= 2 and $cmd_array[0] eq "d")
+            {
+                $search_mode = 5;
+                $search_value = substr($cmd_array[1], 0);  # cut value_search_char
+                $search_value = substr($cmd_array[2], 0) if ( $array_count > 2);  # cut value_search_char
+                $args = $search_value;
+            }
+
             iset_create_filter($args);
             $filter_set = 1;
             my $ptrbuf = weechat::buffer_search($LANG, $PRGNAME);
+
             if ($ptrbuf eq "")
             {
                 iset_init();
@@ -976,22 +1122,34 @@ sub iset_cmd_cb
             my $value = $options_values[$current_line];
             if ($options_is_null[$current_line])
             {
-                $value = "null";
+                $value = "";
             }
             else
             {
                 $quote = "\"" if ($options_types[$current_line] eq "string");
             }
+            $value = " ".$quote.$value.$quote if ($value ne "" or $quote ne "");
+
             my $set_command = "/set";
-            $set_command = "/mute " . $set_command if (weechat::config_boolean($options_iset{"use_mute"}) == 1);
-
-            weechat::buffer_set($iset_buffer, "input", $set_command." ".$options_names[$current_line]." ".$quote.$value.$quote);
-            weechat::command($iset_buffer, "/input move_beginning_of_line");
-            weechat::command($iset_buffer, "/input move_next_word");
-            weechat::command($iset_buffer, "/input move_next_word");
-            weechat::command($iset_buffer, "/input move_next_word") if (weechat::config_boolean($options_iset{"use_mute"}) == 1);
-            weechat::command($iset_buffer, "/input move_next_char");
-            weechat::command($iset_buffer, "/input move_next_char") if ($quote ne "");
+            my $start_index = 5;
+            if (weechat::config_boolean($options_iset{"use_mute"}) == 1)
+            {
+                $set_command = "/mute ".$set_command;
+                $start_index += 11;
+            }
+            $set_command = $set_command." ".$options_names[$current_line].$value;
+            my $pos_space = index($set_command, " ", $start_index);
+            if ($pos_space < 0)
+            {
+                $pos_space = 9999;
+            }
+            else
+            {
+                $pos_space = $pos_space + 1;
+                $pos_space = $pos_space + 1 if ($quote ne "");
+            }
+            weechat::buffer_set($iset_buffer, "input", $set_command);
+            weechat::buffer_set($iset_buffer, "input_pos", "".$pos_space);
         }
     }
     weechat::bar_item_update("isetbar_help") if (weechat::config_boolean($options_iset{"show_help_bar"}) == 1);
@@ -1162,6 +1320,8 @@ sub iset_hsignal_mouse_cb
 {
     my ($data, $signal, %hash) = ($_[0], $_[1], %{$_[2]});
 
+    return weechat::WEECHAT_RC_OK unless (@options_types);
+
     if ($hash{"_buffer_name"} eq $PRGNAME && ($hash{"_buffer_plugin"} eq $LANG))
     {
         if ($hash{"_key"} eq "button1")
@@ -1397,7 +1557,8 @@ $wee_version_number = weechat::info_get("version_number", "") || 0;
 iset_config_init();
 iset_config_read();
 
-weechat::hook_command($PRGNAME, "Interactive set", "f <file> || s <section> || [=][=]<text>",
+weechat::hook_command($PRGNAME, "Interactive set", "d <text> || f <file> || s <section> || [=][=]<text>",
+                      "d <text> : show only changed options\n".
                       "f file   : show options for a file\n".
                       "s section: show options for a section\n".
                       "text     : show options with 'text' in name\n".
@@ -1418,6 +1579,7 @@ weechat::hook_command($PRGNAME, "Interactive set", "f <file> || s <section> || [
                       "text,enter     : set a new filter using command line (use '*' to see all options)\n".
                       "alt+'v'        : toggle help bar on/off\n".
                       "alt+'p'        : toggle option \"show_plugin_description\" on/off\n".
+                      "q              : as input in iset buffer to close it\n".
                       "\n".
                       "Mouse actions:\n".
                       "wheel up/down                 : move cursor up/down\n".
@@ -1426,8 +1588,8 @@ weechat::hook_command($PRGNAME, "Interactive set", "f <file> || s <section> || [
                       "right button + drag left/right: increase/decrease value (for integer or color)\n".
                       "\n".
                       "Examples:\n".
-                      "  show options for file 'weechat'\n".
-                      "    /iset f weechat\n".
+                      "  show changed options in 'aspell' plugin\n".
+                      "    /iset d aspell\n".
                       "  show options for file 'irc'\n".
                       "    /iset f irc\n".
                       "  show options for section 'look'\n".
index a13090931006b01f5d9fec74b3e064761c3d5710..305bd6b2d24268c1ff17afdf8b791a1008603af7 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2010-2012 Sebastien Helleu <flashcode@flashtux.org>
+# Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org>
 #
 # 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
 
 #
 # Auto-set buffer properties when a buffer is opened.
-# (this script requires WeeChat 0.3.2 or newer)
+# (this script requires WeeChat 1.0 or newer)
 #
 # History:
 #
+# 2015-09-28, Simmo Saan <simmo.saan@gmail.com>:
+#     version 0.9: instantly apply properties
+# 2015-07-12, Sébastien Helleu <flashcode@flashtux.org>:
+#     version 0.8: add option buffer_autoset.look.timer to add a small timer
+#                  before setting buffer properties
+# 2015-04-05, Nils Görs <freenode@#weechat>:
+#     version 0.7: increase priority of hook_signal('buffer_opened')
 # 2012-12-09, Nils Görs <freenode@#weechat>:
 #     version 0.6: add support of core buffer
-# 2012-03-09, Sebastien Helleu <flashcode@flashtux.org>:
+# 2012-03-09, Sébastien Helleu <flashcode@flashtux.org>:
 #     version 0.5: fix reload of config file
-# 2012-01-03, Sebastien Helleu <flashcode@flashtux.org>:
+# 2012-01-03, Sébastien Helleu <flashcode@flashtux.org>:
 #     version 0.4: make script compatible with Python 3.x
-# 2010-12-02, Sebastien Helleu <flashcode@flashtux.org>:
+# 2010-12-02, Sébastien Helleu <flashcode@flashtux.org>:
 #     version 0.3: "no_highlight_nicks" replaced by "hotlist_max_level_nicks"
-# 2010-10-11, Sebastien Helleu <flashcode@flashtux.org>:
+# 2010-10-11, Sébastien Helleu <flashcode@flashtux.org>:
 #     version 0.2: add example in /help autosetbuffer with new buffer
 #                  property "no_highlight_nicks"
-# 2010-04-19, Sebastien Helleu <flashcode@flashtux.org>:
+# 2010-04-19, Sébastien Helleu <flashcode@flashtux.org>:
 #     version 0.1: initial release
 #
 
-SCRIPT_NAME    = "buffer_autoset"
-SCRIPT_AUTHOR  = "Sebastien Helleu <flashcode@flashtux.org>"
-SCRIPT_VERSION = "0.6"
+SCRIPT_NAME = "buffer_autoset"
+SCRIPT_AUTHOR = "Sébastien Helleu <flashcode@flashtux.org>"
+SCRIPT_VERSION = "0.9"
 SCRIPT_LICENSE = "GPL3"
-SCRIPT_DESC    = "Auto-set buffer properties when a buffer is opened"
+SCRIPT_DESC = "Auto-set buffer properties when a buffer is opened"
 
 SCRIPT_COMMAND = "autosetbuffer"
 
@@ -56,8 +63,10 @@ except ImportError:
 
 CONFIG_FILE_NAME = "buffer_autoset"
 
-# config file
+# config file / options
 bas_config_file = ""
+bas_options = {}
+
 
 # =================================[ config ]=================================
 
@@ -66,50 +75,75 @@ def bas_config_init():
     Initialization of configuration file.
     Sections: buffer.
     """
-    global bas_config_file
+    global bas_config_file, bas_options
     bas_config_file = weechat.config_new(CONFIG_FILE_NAME,
                                          "bas_config_reload_cb", "")
     if bas_config_file == "":
         return
 
+    # section "look"
+    section_look = weechat.config_new_section(
+        bas_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "")
+    if not section_look:
+        weechat.config_free(bas_config_file)
+        return
+
+    # options in section "look"
+    bas_options["look_timer"] = weechat.config_new_option(
+        bas_config_file, section_look, "timer", "integer",
+        "Timer used to delay the set of properties (in milliseconds, "
+        "0 = don't use a timer)",
+        "", 0, 2147483647, "1", "1", 0, "", "", "", "", "", "")
+
+    bas_options["look_instant"] = weechat.config_new_option(
+        bas_config_file, section_look, "instant", "boolean",
+        "Instantly apply properties to buffers affected",
+        "", 0, 0, "on", "on", 0, "", "", "", "", "", "")
+
     # section "buffer"
     section_buffer = weechat.config_new_section(
         bas_config_file, "buffer", 1, 1, "", "", "", "", "", "",
         "bas_config_buffer_create_option_cb", "", "", "")
-    if section_buffer == "":
+    if not section_buffer:
         weechat.config_free(bas_config_file)
         return
 
-def bas_config_buffer_create_option_cb(data, config_file, section, option_name, value):
+
+def bas_config_buffer_create_option_cb(data, config_file, section, option_name,
+                                       value):
     option = weechat.config_search_option(config_file, section, option_name)
     if option:
-        return weechat.config_option_set (option, value, 1)
+        return weechat.config_option_set(option, value, 1)
     else:
-        option = weechat.config_new_option (config_file, section, option_name, "string",
-                                            "", "", 0, 0, "", value, 0,
-                                            "", "", "", "", "", "")
+        option = weechat.config_new_option(config_file, section, option_name,
+                                           "string", "", "", 0, 0, "",
+                                           value, 0, "", "", "", "", "", "")
         if not option:
             return weechat.WEECHAT_CONFIG_OPTION_SET_ERROR
         return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
 
+
 def bas_config_reload_cb(data, config_file):
-    """ Reload configuration file. """
+    """Reload configuration file."""
     return weechat.config_reload(config_file)
 
+
 def bas_config_read():
-    """ Read configuration file. """
+    """Read configuration file."""
     global bas_config_file
     return weechat.config_read(bas_config_file)
 
+
 def bas_config_write():
-    """ Write configuration file. """
+    """Write configuration file."""
     global bas_config_file
     return weechat.config_write(bas_config_file)
 
+
 # ================================[ command ]=================================
 
 def bas_cmd(data, buffer, args):
-    """ Callback for /autosetbuffer command. """
+    """Callback for /autosetbuffer command."""
     args = args.strip()
     if args == "":
         weechat.command("", "/set %s.buffer.*" % CONFIG_FILE_NAME)
@@ -133,88 +167,167 @@ def bas_cmd(data, buffer, args):
             return weechat.WEECHAT_RC_OK
     return weechat.WEECHAT_RC_OK
 
-def bas_completion_current_buffer_cb(data, completion_item, buffer, completion):
-    """ Complete with current buffer name (plugin.name), for command '/autosetbuffer'. """
+
+def bas_completion_current_buffer_cb(data, completion_item, buffer,
+                                     completion):
+    """
+    Complete with current buffer name (plugin.name),
+    for command '/autosetbuffer'.
+    """
     name = "%s.%s" % (weechat.buffer_get_string(buffer, "plugin"),
                       weechat.buffer_get_string(buffer, "name"))
     weechat.hook_completion_list_add(completion, name,
                                      0, weechat.WEECHAT_LIST_POS_BEGINNING)
     return weechat.WEECHAT_RC_OK
 
+
 def bas_completion_options_cb(data, completion_item, buffer, completion):
-    """ Complete with config options, for command '/autosetbuffer'. """
-    options = weechat.infolist_get("option", "", "%s.buffer.*" % CONFIG_FILE_NAME)
+    """Complete with config options, for command '/autosetbuffer'."""
+    options = weechat.infolist_get("option", "",
+                                   "%s.buffer.*" % CONFIG_FILE_NAME)
     if options:
         while weechat.infolist_next(options):
-            weechat.hook_completion_list_add(completion,
-                                             weechat.infolist_string(options, "option_name"),
-                                             0, weechat.WEECHAT_LIST_POS_SORT)
+            weechat.hook_completion_list_add(
+                completion,
+                weechat.infolist_string(options, "option_name"),
+                0, weechat.WEECHAT_LIST_POS_SORT)
         weechat.infolist_free(options)
     return weechat.WEECHAT_RC_OK
 
-# =================================[ signal ]=================================
+
+# ==========================[ timer/signal/option ]===========================
+
+def bas_apply_options_for_buffer(buffer):
+    full_name = weechat.buffer_get_string(buffer, "full_name")
+    options = weechat.infolist_get("option", "",
+                                   "%s.buffer.*" % CONFIG_FILE_NAME)
+    if not options:
+        return
+
+    while weechat.infolist_next(options):
+        option = weechat.infolist_string(options, "option_name")
+        value = weechat.infolist_string(options, "value")
+        if option:
+            pos = option.rfind(".")
+            if pos > 0:
+                buffer_mask = option[0:pos]
+                property = option[pos+1:]
+                if buffer_mask and property:
+                    if weechat.string_match(full_name, buffer_mask, 1):
+                        weechat.buffer_set(buffer, property, value)
+
+    weechat.infolist_free(options)
+
+
+def bas_timer_buffer_opened_cb(data, remaining_calls):
+    full_name = data
+    buffer = weechat.buffer_search("==", full_name)
+    if not buffer:
+        return weechat.WEECHAT_RC_OK
+    bas_apply_options_for_buffer(buffer)
+    return weechat.WEECHAT_RC_OK
+
 
 def bas_signal_buffer_opened_cb(data, signal, signal_data):
+    global bas_options
     buffer = signal_data
-    name = "%s.%s" % (weechat.buffer_get_string(buffer, "plugin"),
-                      weechat.buffer_get_string(buffer, "name"))
-    options = weechat.infolist_get("option", "", "%s.buffer.*" % CONFIG_FILE_NAME)
-    if options:
-        while weechat.infolist_next(options):
-            option = weechat.infolist_string(options, "option_name")
-            value = weechat.infolist_string(options, "value")
-            if option:
-                pos = option.rfind(".")
-                if pos > 0:
-                    buffer_mask = option[0:pos]
-                    property = option[pos+1:]
-                    if buffer_mask and property:
-                        if weechat.string_match(name, buffer_mask, 1):
-                            weechat.buffer_set(buffer, property, value)
-        weechat.infolist_free(options)
+    timer = weechat.config_integer(bas_options["look_timer"])
+    if timer == 0:
+        bas_apply_options_for_buffer(buffer)
+    else:
+        weechat.hook_timer(timer, 0, 1,
+                           "bas_timer_buffer_opened_cb",
+                           weechat.buffer_get_string(buffer, "full_name"))
+    return weechat.WEECHAT_RC_OK
+
+def bas_config_option_cb(data, option, value):
+    if not weechat.config_boolean(bas_options["look_instant"]):
+        return weechat.WEECHAT_RC_OK
+
+    if not weechat.config_get(option): # option was deleted
+        return weechat.WEECHAT_RC_OK
+
+    option = option[len("%s.buffer." % CONFIG_FILE_NAME):]
+
+    pos = option.rfind(".")
+    if pos > 0:
+        buffer_mask = option[0:pos]
+        property = option[pos+1:]
+        if buffer_mask and property:
+            buffers = weechat.infolist_get("buffer", "", buffer_mask)
+
+            if not buffers:
+                return weechat.WEECHAT_RC_OK
+
+            while weechat.infolist_next(buffers):
+                buffer = weechat.infolist_pointer(buffers, "pointer")
+                weechat.buffer_set(buffer, property, value)
+
+            weechat.infolist_free(buffers)
+
     return weechat.WEECHAT_RC_OK
 
 # ==================================[ main ]==================================
 
 if __name__ == "__main__" and import_ok:
-    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
-                        SCRIPT_DESC, "bas_unload_script", ""):
+    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
+                        SCRIPT_LICENSE, SCRIPT_DESC, "bas_unload_script", ""):
         version = weechat.info_get("version_number", "") or 0
-        if int(version) < 0x00030200:
-            weechat.prnt("", "%s%s: WeeChat 0.3.2 is required for this script."
+        if int(version) < 0x01000000:
+            weechat.prnt("", "%s%s: WeeChat 1.0 is required for this script."
                          % (weechat.prefix("error"), SCRIPT_NAME))
         else:
             bas_config_init()
             bas_config_read()
-            weechat.hook_command(SCRIPT_COMMAND,
-                                 "Auto-set buffer properties when a buffer is opened",
-                                 "[add buffer property value] | [del option]",
-                                 "     add: add a buffer/property/value in configuration file\n"
-                                 "     del: delete an option from configuration file\n"
-                                 "  buffer: name of a buffer (can start or end with \"*\" as wildcard)\n"
-                                 "property: buffer property\n"
-                                 "   value: value for property\n"
-                                 "  option: name of option from configuration file\n\n"
-                                 "Examples:\n"
-                                 "  disable timestamp on channel #weechat:\n"
-                                 "    /" + SCRIPT_COMMAND + " add irc.freenode.#weechat time_for_each_line 0\n"
-                                 "  add word \"weechat\" in highlight list on channel #savannah:\n"
-                                 "    /" + SCRIPT_COMMAND + " add irc.freenode.#savannah highlight_words_add weechat\n"
-                                 "  disable highlights from nick \"mike\" on freenode server, channel #weechat (requires WeeChat >= 0.3.4):\n"
-                                 "    /" + SCRIPT_COMMAND + " add irc.freenode.#weechat hotlist_max_level_nicks_add mike:2\n"
-                                 "  disable hotlist changes for nick \"bot\" on freenode server (all channels) (requires WeeChat >= 0.3.4):\n"
-                                 "    /" + SCRIPT_COMMAND + " add irc.freenode.* hotlist_max_level_nicks_add bot:-1",
-                                 "add %(buffers_plugins_names)|%(buffer_autoset_current_buffer) %(buffer_properties_set)"
-                                 " || del %(buffer_autoset_options)",
-                                 "bas_cmd", "")
-            weechat.hook_completion("buffer_autoset_current_buffer", "current buffer name for buffer_autoset",
-                                    "bas_completion_current_buffer_cb", "")
-            weechat.hook_completion("buffer_autoset_options", "list of options for buffer_autoset",
-                                    "bas_completion_options_cb", "")
-            weechat.hook_signal("buffer_opened", "bas_signal_buffer_opened_cb", "")
+            weechat.hook_command(
+                SCRIPT_COMMAND,
+                "Auto-set buffer properties when a buffer is opened",
+                "[add buffer property value] | [del option]",
+                "     add: add a buffer/property/value in configuration file\n"
+                "     del: delete an option from configuration file\n"
+                "  buffer: name of a buffer (can start or end with \"*\" as "
+                "wildcard)\n"
+                "property: buffer property\n"
+                "   value: value for property\n"
+                "  option: name of option from configuration file\n\n"
+                "Examples:\n"
+                "  disable timestamp on channel #weechat:\n"
+                "    /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
+                "time_for_each_line 0\n"
+                "  add word \"weechat\" in highlight list on channel "
+                "#savannah:\n"
+                "    /" + SCRIPT_COMMAND + " add irc.freenode.#savannah "
+                "highlight_words_add weechat\n"
+                "  disable highlights from nick \"mike\" on freenode server, "
+                "channel #weechat (requires WeeChat >= 0.3.4):\n"
+                "    /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
+                "hotlist_max_level_nicks_add mike:2\n"
+                "  disable hotlist changes for nick \"bot\" on freenode "
+                "server (all channels) (requires WeeChat >= 0.3.4):\n"
+                "    /" + SCRIPT_COMMAND + " add irc.freenode.* "
+                "hotlist_max_level_nicks_add bot:-1",
+                "add %(buffers_plugins_names)|"
+                "%(buffer_autoset_current_buffer) "
+                "%(buffer_properties_set)"
+                " || del %(buffer_autoset_options)",
+                "bas_cmd", "")
+            weechat.hook_completion(
+                "buffer_autoset_current_buffer",
+                "current buffer name for buffer_autoset",
+                "bas_completion_current_buffer_cb", "")
+            weechat.hook_completion(
+                "buffer_autoset_options",
+                "list of options for buffer_autoset",
+                "bas_completion_options_cb", "")
+            weechat.hook_signal("9000|buffer_opened",
+                                "bas_signal_buffer_opened_cb", "")
+            weechat.hook_config("%s.buffer.*" % CONFIG_FILE_NAME,
+                                "bas_config_option_cb", "")
 
             # core buffer is already open on script startup, check manually!
             bas_signal_buffer_opened_cb("", "", weechat.buffer_search_main())
+
+
 # ==================================[ end ]===================================
 
 def bas_unload_script():
index 4fd5c64b780d254c58e19fcaec4666505f48ecd4..30bf2a6c2f0adfdd06d8cf734346f74056e51be7 100644 (file)
 #
 #   History:
 #
+#   2016-06-23, mickael9
+#   version 0.7.7: fix get_home function
+#
+#   2015-11-26
+#   version 0.7.6: fix a typo
+#
 #   2015-01-31, Nicd-
 #   version 0.7.5:
 #   '~' is now expaned to the home directory in the log file path so
@@ -200,7 +206,7 @@ except ImportError:
 
 SCRIPT_NAME    = "grep"
 SCRIPT_AUTHOR  = "Elián Hanisch <lambdae2@gmail.com>"
-SCRIPT_VERSION = "0.7.5"
+SCRIPT_VERSION = "0.7.7"
 SCRIPT_LICENSE = "GPL3"
 SCRIPT_DESC    = "Search in buffers and logs"
 SCRIPT_COMMAND = "grep"
@@ -414,8 +420,9 @@ def get_config_log_filter():
 
 def get_home():
     home = weechat.config_string(weechat.config_get('logger.file.path'))
+    home = home.replace('%h', weechat.info_get('weechat_dir', ''))
     home = path.abspath(path.expanduser(home))
-    return home.replace('%h', weechat.info_get('weechat_dir', ''))
+    return home
 
 def strip_home(s, dir=''):
     """Strips home dir from the begging of the log path, this makes them sorter."""
@@ -1639,7 +1646,7 @@ if __name__ == '__main__' and import_ok and \
                  If used with 'log <file>' search in all logs that matches <file>.
     -b --buffer: Search only in buffers, not in file logs.
      -c --count: Just count the number of matched lines instead of showing them.
- -m --matchcase: Don't do case insensible search.
+ -m --matchcase: Don't do case insensitive search.
    -H --hilight: Colour exact matches in output buffer.
 -o --only-match: Print only the matching part of the line (unique matches).
  -v -i --invert: Print lines that don't match the regular expression.
index e6de21c29aa8e3ed9898fd376cc1886ee8281d4f..aa38a43b1d7c992a2147112f47c8d2d79ebc5d63 100644 (file)
@@ -18,6 +18,7 @@ text_bg = default
 text_selected = white
 
 [network]
+allow_empty_password = off
 allowed_ips = ""
 bind_address = ""
 clients_purge_delay = 0
@@ -33,6 +34,7 @@ websocket_allowed_origins = ""
 backlog_max_minutes = 1440
 backlog_max_number = 256
 backlog_since_last_disconnect = on
+backlog_since_last_message = off
 backlog_tags = "irc_privmsg"
 backlog_time_format = "[%H:%M] "
 
index 3672aa7a8f8a36cfa578c51dc0924d203de0478d..6fad0c03bf3f322581110abce832c86a3af9ad02 100644 (file)
@@ -9,3 +9,6 @@ passphrase_file = ""
 salt = on
 
 [data]
+__passphrase__ = on
+slack_se = "9D731BC5437DB7B75FDFE9769A0C69CFA621998570C38B80791042368A9B8276DCCC468FA9637A4E979F5544A65A819D697A93CD59F6199F823BE0C2A63C0468064C71491A8282D3273BF0FDF2584955BC239DAD7105DF8CE2A73C28349FF003746CC50ABFA47E67C34243CFB89EBECE8F2B"
+slack_uh = "B3B28C0B3195FBE0E921C0C75F3831594D8F01493ABCA68AA837B62C41582453366AC5ACCF743B439703FBB86965EC8C96D53AD2B12E5D8129FB44BC8C9A0BD2D8B9EE042A691DE3AB4280CD8DE00A233792C64EA50AFEF4FB6F1E8F94F684EA9687296CA20565AC6774EFBB529B883091"
index 6d0c6d043fd9bb26fc74e0f86dcce9dc439110d8..69bbe65db27cfb1aad15845eeba126eb66c9a549 100644 (file)
@@ -9,6 +9,7 @@ monitor_strip_colors = off
 [color]
 flag_command = lightgreen
 flag_conditions = yellow
+flag_post_action = lightblue
 flag_regex = lightcyan
 flag_return_code = lightmagenta
 regex = white
@@ -22,6 +23,7 @@ beep.command = "/print -beep"
 beep.conditions = "${tg_highlight} || ${tg_msg_pv}"
 beep.enabled = on
 beep.hook = print
+beep.post_action = none
 beep.regex = ""
 beep.return_code = ok
 cmd_pass.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth"
@@ -29,6 +31,7 @@ cmd_pass.command = ""
 cmd_pass.conditions = ""
 cmd_pass.enabled = on
 cmd_pass.hook = modifier
+cmd_pass.post_action = none
 cmd_pass.regex = "==^((/(msg|quote) +nickserv +(id|identify|register|ghost +\S+|release +\S+|regain +\S+) +)|/oper +\S+ +|/quote +pass +|/set +\S*password\S* +|/secure +(passphrase|decrypt|set +\S+) +)(.*)==$1$.*+"
 cmd_pass.return_code = ok
 msg_auth.arguments = "5000|irc_message_auth"
@@ -36,6 +39,7 @@ msg_auth.command = ""
 msg_auth.conditions = ""
 msg_auth.enabled = on
 msg_auth.hook = modifier
+msg_auth.post_action = none
 msg_auth.regex = "==^(.*(id|identify|register|ghost +\S+|release +\S+) +)(.*)==$1$.*+"
 msg_auth.return_code = ok
 server_pass.arguments = "5000|input_text_display;5000|history_add"
@@ -43,5 +47,6 @@ server_pass.command = ""
 server_pass.conditions = ""
 server_pass.enabled = on
 server_pass.hook = modifier
+server_pass.post_action = none
 server_pass.regex = "==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5"
 server_pass.return_code = ok
index e13b104a71a189c068792c13d934b38e234538e8..76b29bfee47a794054051779dd979dcbb9878d7e 100644 (file)
@@ -20,7 +20,7 @@ bar_more_up = "▲"
 bare_display_exit_on_input = on
 bare_display_time_format = "%H:%M"
 buffer_auto_renumber = off
-buffer_notify_default = highlight
+buffer_notify_default = message
 buffer_position = first_gap
 buffer_search_case_sensitive = off
 buffer_search_force_default = off
@@ -67,6 +67,7 @@ input_cursor_scroll = 20
 input_share = none
 input_share_overwrite = off
 input_undo_max = 32
+item_away_message = on
 item_buffer_filter = "•"
 item_buffer_zoom = "!"
 item_mouse_status = "M"
@@ -78,6 +79,9 @@ key_bind_safe = on
 key_grab_delay = 800
 mouse = on
 mouse_timer_delay = 100
+nick_color_force = ""
+nick_color_hash = djb2
+nick_color_stop_chars = "_|["
 nick_prefix = ""
 nick_suffix = ""
 paste_auto_add_newline = on
@@ -112,7 +116,7 @@ scroll_amount = 3
 scroll_bottom_after_switch = off
 scroll_page_percent = 100
 search_text_not_found_alert = on
-separator_horizontal = "â\80\95"
+separator_horizontal = "â\94\80"
 separator_vertical = ""
 tab_width = 1
 time_format = "%a, %d %b %Y %T"
@@ -165,13 +169,14 @@ chat_text_found_bg = lightmagenta
 chat_time = default
 chat_time_delimiters = brown
 chat_value = cyan
+chat_value_null = blue
 emphasized = yellow
 emphasized_bg = magenta
 input_actions = lightgreen
 input_text_not_found = red
+item_away = yellow
 nicklist_away = cyan
 nicklist_group = green
-nicklist_offline = blue
 separator = 31
 status_count_highlight = magenta
 status_count_msg = brown
@@ -247,7 +252,7 @@ buffers.color_fg = default
 buffers.conditions = "${window.buffer.full_name} == perl.highmon"
 buffers.filling_left_right = columns_vertical
 buffers.filling_top_bottom = columns_vertical
-buffers.hidden = off
+buffers.hidden = on
 buffers.items = "buffers"
 buffers.position = left
 buffers.priority = 0