aboutsummaryrefslogtreecommitdiffstats
path: root/weechat/perl
diff options
context:
space:
mode:
Diffstat (limited to 'weechat/perl')
-rw-r--r--weechat/perl/buffers.pl17
-rw-r--r--weechat/perl/iset.pl48
-rw-r--r--weechat/perl/stalker.pl22
3 files changed, 71 insertions, 16 deletions
diff --git a/weechat/perl/buffers.pl b/weechat/perl/buffers.pl
index 472f6e9..c31d8fc 100644
--- a/weechat/perl/buffers.pl
+++ b/weechat/perl/buffers.pl
@@ -20,6 +20,8 @@
#
# History:
#
+# 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,7 +166,7 @@ use strict;
use Encode qw( decode encode );
# -----------------------------[ internal ]-------------------------------------
my $SCRIPT_NAME = "buffers";
-my $SCRIPT_VERSION = "5.0";
+my $SCRIPT_VERSION = "5.1";
my $BUFFERS_CONFIG_FILE_NAME = "buffers";
my $buffers_config_file;
@@ -1298,8 +1300,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;
diff --git a/weechat/perl/iset.pl b/weechat/perl/iset.pl
index f179022..af74767 100644
--- a/weechat/perl/iset.pl
+++ b/weechat/perl/iset.pl
@@ -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
@@ -19,6 +19,12 @@
#
# History:
#
+# 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>:
@@ -117,7 +123,7 @@
use strict;
my $PRGNAME = "iset";
-my $VERSION = "3.6";
+my $VERSION = "3.9";
my $DESCR = "Interactive Set for configuration options";
my $AUTHOR = "Sebastien Helleu <flashcode\@flashtux.org>";
my $LICENSE = "GPL3";
@@ -237,6 +243,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);
@@ -976,22 +986,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 +1184,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")
diff --git a/weechat/perl/stalker.pl b/weechat/perl/stalker.pl
index b418fad..ce2bb65 100644
--- a/weechat/perl/stalker.pl
+++ b/weechat/perl/stalker.pl
@@ -20,6 +20,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# History:
+# version 1.5:nils_2@freenode.#weechat
+# 2015-06-15: add: new option del_date
+#
# version 1.4:nils_2@freenode.#weechat
# 2014-05-14: fix: perl error under some circumstances (thanks Piotrek)
#
@@ -98,7 +101,7 @@ use File::Spec;
use DBI;
my $SCRIPT_NAME = "stalker";
-my $SCRIPT_VERSION = "1.4";
+my $SCRIPT_VERSION = "1.5";
my $SCRIPT_AUTHOR = "Nils Görs <weechatter\@arcor.de>";
my $SCRIPT_LICENCE = "GPL3";
my $SCRIPT_DESC = "Records and correlates nick!user\@host information";
@@ -777,6 +780,15 @@ sub _deassociate_nick_from_host
return $sth->rows;
}
+sub delete_older_entries
+{
+ # $day = yyyy-mm-dd
+ my ( $day1, $day2 ) = @_;
+ # from date ? to date ?
+ $sth = $DBH->prepare( "DELETE FROM records WHERE added >= '" . $day1 . "' AND added < '" . $day2 . "'" );
+ $sth->execute();
+}
+
# ------------------------[ OUTPUT with tags ]------------------------------
sub OUTPUT
{
@@ -934,6 +946,10 @@ sub stalker_command_cb
my $DEBUG_prefix = weechat::config_string(weechat::config_get('weechat.look.prefix_error'));
weechat::print($buffer, _color_str($color, $DEBUG_prefix) . "\t$SCRIPT_NAME: $affected_rows deleted");
}
+ elsif (lc($args_array[0]) eq 'del_date')
+ {
+ delete_older_entries($args_array[1],$args_array[2]) if ($args_array[1] and $args_array[2]);
+ }
return weechat::WEECHAT_RC_OK;
}
@@ -1370,6 +1386,7 @@ weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION,
" scan : scan a channel (be careful; scanning large channels takes a while!)\n".
" you should manually /WHO #channel first or use /quote PROTOCTL UHNAMES\n".
" count: display the number of rows in database\n".
+ " del_date: delete all entries from date1 to date2\n".
"remove_nick_from_host: remove a nick from a given host\n".
"\n\n".
"Stalker will add nick!user\@host to database monitoring JOIN/WHOIS/NICK messages.\n\n".
@@ -1411,8 +1428,11 @@ weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION,
" /".$SCRIPT_NAME." host .*\\.de -regex\n".
" remove nick from an association host'\n".
" /".$SCRIPT_NAME." remove_nick_from_host TheNick ~the\@bad.users.host\n".
+ " remove entries from database in range of given date:'\n".
+ " /".$SCRIPT_NAME." del_date 2014-01-01 2014-12-31\n".
"",
"count %-||".
+ "del_date %-||".
"host %% %(irc_servers)|-regex %-||".
"nick %(nick) %(irc_servers)|-regex -regex %-||".
"remove_nick_from_host %(nick) |-regex -regex %-||".