From 9c9773c741cd97394b5394380830ec88f5f0280f Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 27 Sep 2010 20:49:34 +0100 Subject: changed commit_line back to using signal emit to make it tidier. --- vim-mode/vim_mode.pl | 28 +++++----------------------- 1 file 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; } } -- cgit v1.2.3