#!/usr/bin/perl
#use Mooix::Thing;
run sub {
	my $this=shift;
	%_=@_;
	my $key;
	if ($_{initiator}) {
		$key=int(rand(100000000));
	}
	else {
		$key='';
	}
	umask(077); # protect the key from prying eyes
	$this->mcpsession_auth_key($key);

	if (! $_{initiator}) {
		# Send the mcp version message.
		return $this->mcpsession_send("mcp",
			version => $this->mcpsession_min_version,
			to => $this->mcpsession_max_version
		);
	}
	else {
		return 1;
	}
}
