diff options
author | Tom Feist <shabble@metavore.org> | 2010-09-27 19:49:34 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2010-09-27 19:49:34 +0000 |
commit | 9c9773c741cd97394b5394380830ec88f5f0280f (patch) | |
tree | 7774e897217852e8194098c0c23135555aaef171 | |
parent | made commit_line use the most appropriate context (window item, window or (diff) | |
download | irssi-scripts-9c9773c741cd97394b5394380830ec88f5f0280f.tar.gz irssi-scripts-9c9773c741cd97394b5394380830ec88f5f0280f.zip |
changed commit_line back to using signal emit to make it tidier.
Diffstat (limited to '')
-rw-r--r-- | vim-mode/vim_mode.pl | 28 |
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; } } |