# by Marco d'Itri <md@linux.it>, with help from cras. public domain.

use Irssi;
use strict;

Irssi::command_bind_first('join' => 'join_like_move');

sub join_like_move {
	my ($data, $server) = @_;

	my @params = split(/\s+/, $data);
	return if @params != 1;			# not a simple /join #channel

	my $channel = $server->channel_find($params[0]);
	if ($channel) {
		Irssi::command('window item move ' . $channel->{name});
		Irssi::print("Moving channel $channel->{name} to current window");
	}
}

