my $cmdchar = '/';
setcmdchars();
Irssi::signal_add('setup changed', \&setcmdchars);
Irssi::signal_add('send command',\&snd_cmd);

sub snd_cmd {
   my($command, $server, $wi) = @_;

   if($command =~ m!^/([+-].*)! && ref $wi) {
      $wi->command("mode $1");
      Irssi::signal_stop();
   }

}

sub setcmdchars {
   $cmdchar = substr(Irssi::settings_get_str('cmdchars'), 0, 1);
   $cmdchar ||= '/';
}

