aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2010-09-27 19:49:34 +0000
committerTom Feist <shabble@metavore.org>2010-09-27 19:49:34 +0000
commit9c9773c741cd97394b5394380830ec88f5f0280f (patch)
tree7774e897217852e8194098c0c23135555aaef171 /vim-mode/vim_mode.pl
parentmade commit_line use the most appropriate context (window item, window or (diff)
downloadirssi-scripts-9c9773c741cd97394b5394380830ec88f5f0280f.tar.gz
irssi-scripts-9c9773c741cd97394b5394380830ec88f5f0280f.zip
changed commit_line back to using signal emit to make it tidier.
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r--vim-mode/vim_mode.pl28
1 files changed, 5 insertions, 23 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index a8e1cbb..2e2ca4a 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -1104,32 +1104,14 @@ sub _commit_line {
my $win = Irssi::active_win();
my $witem = ref $win ? $win->{active} : undef;
- my $context;
- if (defined $witem) {
- $context = $witem;
- } elsif (defined $win) {
- $context = $win;
- } elsif (defined $server) {
- $context = $server;
- } else {
- $context = undef;
- }
+ my @context;
+ push @context, $server if defined $server;
+ push @context, $witem if defined $witem;
if ($line =~ /^[\Q$cmdchars\E]/) {
- print "Committing line as command" if DEBUG;
- if (defined $context) {
- $context->command($line);
- } else {
- Irssi::command($line);
- }
-
+ Irssi::signal_emit 'send command', $line, @context;
} else {
- print "Committing line as text" if DEBUG;
- if (defined $context) {
- $context->command("/say $line");
- } else {
- Irssi::command("/say $line");
- }
+ Irssi::signal_emit 'send command', $line, @context;
}
}