aboutsummaryrefslogtreecommitdiffstats
path: root/feature-tests
diff options
context:
space:
mode:
Diffstat (limited to 'feature-tests')
-rw-r--r--feature-tests/data.pl32
-rw-r--r--feature-tests/easy_exec.pl23
-rw-r--r--feature-tests/key_test.pl19
-rw-r--r--feature-tests/redir-input.pl30
4 files changed, 100 insertions, 4 deletions
diff --git a/feature-tests/data.pl b/feature-tests/data.pl
new file mode 100644
index 0000000..464a148
--- /dev/null
+++ b/feature-tests/data.pl
@@ -0,0 +1,32 @@
+use strict;
+use warnings;
+
+
+use Irssi;
+use Irssi::Irc;
+use Irssi::TextUI;
+
+use Data::Dumper;
+
+
+our $VERSION = '0.1';
+our %IRSSI = (
+ authors => 'shabble',
+ contact => 'shabble+irssi@metavore.org',
+ name => '',
+ description => '',
+ license => 'Public Domain',
+ );
+
+
+for my $line (<DATA>) {
+ chomp $line;
+ Irssi::active_win()->print($line);
+}
+
+__DATA__
+this is a test
+so is this.
+%rcolour?%n
+what
+yes
diff --git a/feature-tests/easy_exec.pl b/feature-tests/easy_exec.pl
index dbcd101..669a00b 100644
--- a/feature-tests/easy_exec.pl
+++ b/feature-tests/easy_exec.pl
@@ -2,7 +2,7 @@ use strict;
use warnings;
# export everything.
-use Irssi (@Irssi::EXPORT_OK);
+use Irssi; #(@Irssi::EXPORT_OK);
use Irssi::Irc;
use Irssi::TextUI;
@@ -18,12 +18,27 @@ our %IRSSI = (
license => 'Public Domain',
);
-Irssi::signal_add_first 'command script exec', \&better_exec;
+#Irssi::signal_add_first 'command script exec', \&better_exec;
+Irssi::command_bind('script exec', \&better_exec);
sub better_exec {
my ($args, $serv, $witem) = @_;
- eval $args;
- Irssi::signal_stop();
+ # todo: handle permanent arg?
+ my $perm = 0;
+ print "Args: $args";
+ if ($args =~ s/^\s*-permanent\s*(.*)$/$1/) {
+ $perm = 1;
+ }
+ print "Args now: $args";
+
+# eval $args;
+ my $str = "//script exec " .
+ ($perm ? '-permanent' : '')
+ . 'use Irssi (@Irssi::EXPORT_OK); ' . $args;
+ print "Running: $str";
+
+# Irssi::command($str);
+ Irssi::signal_continue($str, @_[1..$#_]);
}
sub Dump {
diff --git a/feature-tests/key_test.pl b/feature-tests/key_test.pl
index b16ff00..e4be63a 100644
--- a/feature-tests/key_test.pl
+++ b/feature-tests/key_test.pl
@@ -98,3 +98,22 @@ sub decode_keypress {
return 'unknown ' . $code;
}
}
+
+
+# # TODO: needs some fixing up?
+# sub _key {
+# my ($key_str, $flags) = @_;
+# my $key_num;
+
+# if ($key_str eq 'DEL' or $key_str eq 'BS') {
+# $key_num = 127;
+# } else {
+# die "Key must be single char" unless length($key_str) == 1;
+# $key_num = ord($key_str);
+# if ($flags & CTRL_KEY) {
+# $key_num = 0 if ($key_num == 32);
+
+# }
+# }
+# return $key_num;
+# }
diff --git a/feature-tests/redir-input.pl b/feature-tests/redir-input.pl
new file mode 100644
index 0000000..94ca523
--- /dev/null
+++ b/feature-tests/redir-input.pl
@@ -0,0 +1,30 @@
+use strict;
+use warnings;
+
+
+use Irssi;
+use Irssi::Irc;
+use Irssi::TextUI;
+
+use Data::Dumper;
+
+
+our $VERSION = '0.1';
+our %IRSSI = (
+ authors => 'shabble',
+ contact => 'shabble+irssi@metavore.org',
+ name => '',
+ description => '',
+ license => 'Public Domain',
+ );
+
+
+Irssi::command_bind("ri", \&cmd_ri);
+
+sub cmd_ri {
+ my ($args, $server, $witem) = @_;
+ my $win = Irssi::active_win();
+
+ #my $ref = Irssi::windows_refnum_last
+ $win->format_create_dest(Irssi::MSGLEVEL_ClIENTCRAP());
+}