Open irssibot opened 13 years ago
splitlong.patch
--- scripts/splitlong.pl 2010-04-03 11:19:50.000000000 -0500
+++ scripts/splitlong.pl.fixed 2011-06-17 22:03:02.000000000 -0500
@@ -12,20 +12,20 @@
use Irssi 20011001;
-$VERSION = "0.20";
+$VERSION = "0.21";
%IRSSI = (
authors => "Bjoern \'fuchs\' Krombholz",
contact => "bjkro\@gmx.de",
name => "splitlong",
licence => "Public Domain",
description => "Split overlong PRIVMSGs to msgs with length allowed by ircd",
- changed => "Wed Jun 25 00:17:00 CET 2003",
- changes => "Actually the real 0.19 (now 0.20), but upload didn't work some month ago, target problem fixed..."
+ changed => "Wed Jun 17 23:50:00 CDT 2011",
+ changes => "updated so that param is actually passed back in the msg, and took into account multiple potential parameters to follow the form: MSG [-<server tag>] [-channel | -nick] <targets> <message>"
);
sub sig_command_msg {
my ($cmd, $server, $winitem) = @_;
- my ( $param, $target,$data) = $cmd =~ /^(-\S*\s)?(\S*)\s(.*)/;
+ my ($param1, $param2, $target, $data) = $cmd =~ /^(-\S*\s)?(-\S*\s)?(\S*)\s(.*)/;
my $maxlength = Irssi::settings_get_int('splitlong_max_length');
my $lstart = Irssi::settings_get_str('splitlong_line_start');
@@ -48,7 +48,7 @@
push @spltarr, $data;
foreach (@spltarr) {
- Irssi::signal_emit("command msg", "$target $_", $server, $winitem);
+ Irssi::signal_emit("command msg", "$param1$param2$target $_", $server, $winitem);
}
Irssi::signal_stop();
}
updated the patch, apparently it wasn't working as expected
splitlong.patch
--- scripts/splitlong.pl 2010-04-03 11:19:50.000000000 -0500
+++ scripts/splitlong.pl.fixed 2011-06-17 22:55:09.000000000 -0500
@@ -9,23 +9,22 @@
###
use strict;
use vars qw($VERSION %IRSSI);
-
use Irssi 20011001;
-$VERSION = "0.20";
+$VERSION = "0.21";
%IRSSI = (
authors => "Bjoern \'fuchs\' Krombholz",
contact => "bjkro\@gmx.de",
name => "splitlong",
licence => "Public Domain",
description => "Split overlong PRIVMSGs to msgs with length allowed by ircd",
- changed => "Wed Jun 25 00:17:00 CET 2003",
- changes => "Actually the real 0.19 (now 0.20), but upload didn't work some month ago, target problem fixed..."
+ changed => "Wed Jun 17 23:50:00 CDT 2011",
+ changes => "updated so that param is actually passed back in the msg, and took into account multiple potential parameters to follow the form: MSG [-<server tag>] [-channel | -nick] <targets> <message>"
);
sub sig_command_msg {
my ($cmd, $server, $winitem) = @_;
- my ( $param, $target,$data) = $cmd =~ /^(-\S*\s)?(\S*)\s(.*)/;
+ my ($param1, $param2, $target, $data) = $cmd =~ /^(-\S*\s)?(-(?:channel|nick)\s)?(\S*)\s(.*)/;
my $maxlength = Irssi::settings_get_int('splitlong_max_length');
my $lstart = Irssi::settings_get_str('splitlong_line_start');
@@ -36,8 +35,18 @@
$maxlength = 497 - length($server->{nick} . $server->{userhost} . $target);
}
my $maxlength2 = $maxlength - length($lend);
-
if (length($data) > ($maxlength)) {
+
+ if (my ($tag) = $param1 =~ /^-(\S+)\s$/) {
+ my @servers = Irssi::servers();
+ foreach my $s(@servers) {
+ if (lc($s->{tag}) eq lc($tag)) {
+ $server = $s;
+ last;
+ }
+ }
+ }
+
my @spltarr;
while (length($data) > ($maxlength2)) {
@@ -48,7 +57,8 @@
push @spltarr, $data;
foreach (@spltarr) {
- Irssi::signal_emit("command msg", "$target $_", $server, $winitem);
+ Irssi::signal_emit("command msg", "$param2$target $_", $server, $winitem);
+
}
Irssi::signal_stop();
}
another tweak to that regex... getting uglier and uglier, but actually works now.
splitlong.patch
--- scripts/splitlong.pl 2010-04-03 11:19:50.000000000 -0500
+++ scripts/splitlong.pl.fixed 2011-06-18 00:01:25.000000000 -0500
@@ -12,20 +12,20 @@
use Irssi 20011001;
-$VERSION = "0.20";
+$VERSION = "0.21";
%IRSSI = (
authors => "Bjoern \'fuchs\' Krombholz",
contact => "bjkro\@gmx.de",
name => "splitlong",
licence => "Public Domain",
description => "Split overlong PRIVMSGs to msgs with length allowed by ircd",
- changed => "Wed Jun 25 00:17:00 CET 2003",
- changes => "Actually the real 0.19 (now 0.20), but upload didn't work some month ago, target problem fixed..."
+ changed => "Wed Jun 17 23:50:00 CDT 2011",
+ changes => "updated so that param is actually passed back in the msg, and took into account multiple potential parameters to follow the form: MSG [-<server tag>] [-channel | -nick] <targets> <message>"
);
sub sig_command_msg {
my ($cmd, $server, $winitem) = @_;
- my ( $param, $target,$data) = $cmd =~ /^(-\S*\s)?(\S*)\s(.*)/;
+ my ($param1, $param2, $target, $data) = $cmd =~ /^(-(?!channel|nick)\S*\s)?(-(?:channel|nick)\s)?(\S*)\s(.*)/;
my $maxlength = Irssi::settings_get_int('splitlong_max_length');
my $lstart = Irssi::settings_get_str('splitlong_line_start');
@@ -38,6 +38,17 @@
my $maxlength2 = $maxlength - length($lend);
if (length($data) > ($maxlength)) {
+
+ if (my ($tag) = $param1 =~ /^-(\S+)\s$/) {
+ my @servers = Irssi::servers();
+ foreach my $s(@servers) {
+ if (lc($s->{tag}) eq lc($tag)) {
+ $server = $s;
+ last;
+ }
+ }
+ }
+
my @spltarr;
while (length($data) > ($maxlength2)) {
@@ -48,7 +59,7 @@
push @spltarr, $data;
foreach (@spltarr) {
- Irssi::signal_emit("command msg", "$target $_", $server, $winitem);
+ Irssi::signal_emit("command msg", "$param2$target $_", $server, $winitem);
}
Irssi::signal_stop();
}
more cleanup
splitlong.patch
--- scripts/splitlong.pl 2010-04-03 11:19:50.000000000 -0500
+++ scripts/splitlong.pl.fixed 2011-06-18 00:24:40.000000000 -0500
@@ -12,20 +12,20 @@
use Irssi 20011001;
-$VERSION = "0.20";
+$VERSION = "0.21";
%IRSSI = (
authors => "Bjoern \'fuchs\' Krombholz",
contact => "bjkro\@gmx.de",
name => "splitlong",
licence => "Public Domain",
description => "Split overlong PRIVMSGs to msgs with length allowed by ircd",
- changed => "Wed Jun 25 00:17:00 CET 2003",
- changes => "Actually the real 0.19 (now 0.20), but upload didn't work some month ago, target problem fixed..."
+ changed => "Wed Jun 17 23:50:00 CDT 2011",
+ changes => "updated so that param is actually passed back in the msg, and took into account multiple potential parameters to follow the form: MSG [-<server tag>] [-channel | -nick] <targets> <message>"
);
sub sig_command_msg {
my ($cmd, $server, $winitem) = @_;
- my ( $param, $target,$data) = $cmd =~ /^(-\S*\s)?(\S*)\s(.*)/;
+ my ($tag, $param, $target, $data) = $cmd =~ /^(?:-(?!channel|nick)(\S*)\s)?(-(?:channel|nick)\s)?(\S*)\s(.*)/i;
my $maxlength = Irssi::settings_get_int('splitlong_max_length');
my $lstart = Irssi::settings_get_str('splitlong_line_start');
@@ -38,6 +38,17 @@
my $maxlength2 = $maxlength - length($lend);
if (length($data) > ($maxlength)) {
+
+ if ($tag ne "") {
+ my @servers = Irssi::servers();
+ foreach my $s(@servers) {
+ if (lc($s->{tag}) eq lc($tag)) {
+ $server = $s;
+ last;
+ }
+ }
+ }
+
my @spltarr;
while (length($data) > ($maxlength2)) {
@@ -48,7 +59,7 @@
push @spltarr, $data;
foreach (@spltarr) {
- Irssi::signal_emit("command msg", "$target $_", $server, $winitem);
+ Irssi::signal_emit("command msg", "$param$target $_", $server, $winitem);
}
Irssi::signal_stop();
}
must have been working on this too late last night, this is much simpler than I thought:
splitlong.patch
--- scripts/splitlong.pl 2010-04-03 11:19:50.000000000 -0500
+++ scripts/splitlong.pl.fixed 2011-06-18 13:08:11.000000000 -0500
@@ -12,20 +12,20 @@
use Irssi 20011001;
-$VERSION = "0.20";
+$VERSION = "0.21";
%IRSSI = (
authors => "Bjoern \'fuchs\' Krombholz",
contact => "bjkro\@gmx.de",
name => "splitlong",
licence => "Public Domain",
description => "Split overlong PRIVMSGs to msgs with length allowed by ircd",
- changed => "Wed Jun 25 00:17:00 CET 2003",
- changes => "Actually the real 0.19 (now 0.20), but upload didn't work some month ago, target problem fixed..."
+ changed => "Wed Jun 17 23:50:00 CDT 2011",
+ changes => "updated so that param is actually passed back in the msg, and took into account multiple potential parameters to follow the form: MSG [-<server tag>] [-channel | -nick] <targets> <message>"
);
sub sig_command_msg {
my ($cmd, $server, $winitem) = @_;
- my ( $param, $target,$data) = $cmd =~ /^(-\S*\s)?(\S*)\s(.*)/;
+ my ($tag, $param, $target, $data) = $cmd =~ /^(-\S*\s)?(-\S*\s)?(\S*)\s(.*)/;
my $maxlength = Irssi::settings_get_int('splitlong_max_length');
my $lstart = Irssi::settings_get_str('splitlong_line_start');
@@ -48,7 +48,7 @@
push @spltarr, $data;
foreach (@spltarr) {
- Irssi::signal_emit("command msg", "$target $_", $server, $winitem);
+ Irssi::signal_emit("command msg", "$tag$param$target $_", $server, $winitem);
}
Irssi::signal_stop();
}
splitlong.pl doesn't pass on anything before target / message when it is splitting a line.
Here is a patch, seems to work for me. YMMV