#!/usr/bin/perl

# Like /join, but, if you already have joined the
# channel, go to that window.
#
# Don't use a hash/pound (#) prefix for channel names.

use strict;
use warnings;
use Irssi;

sub cmd_join_goto {
    my $server = Irssi::active_server();
    my $dest = $_[0];
    $server->command("window goto #$dest");
    $server->command("join $dest");
}

Irssi::command_bind('jn', 'cmd_join_goto');
