From: nwf Date: Wed, 24 Sep 2008 04:09:33 +0000 (-0400) Subject: IrssiInterface now (optionally) warns on initial TLVs or unknown types X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=a38a4d4a6845bc2d7a86423fdd8904e017b184e0;p=instirc IrssiInterface now (optionally) warns on initial TLVs or unknown types darcs-hash:20080924040933-4d648-c7a7305979c9f1af1d30dbf407e7e7ec2a42c141.gz --- diff --git a/IrssiInterface.pl b/IrssiInterface.pl index cb30e09..aa9a571 100644 --- a/IrssiInterface.pl +++ b/IrssiInterface.pl @@ -106,6 +106,8 @@ sub demangle_and_check_routes($$$) { my $target = undef; my $instance_label = undef; + my $warn_initial = 0; + my @unknowns = ( ); # Last one wins approach to instance labels. Sending more than one # really ought be an error. my ($res, $rest) = $mc->tlv_run_callbacks( @@ -114,9 +116,21 @@ sub demangle_and_check_routes($$$) { my ($t,$v) = @_; $instance_label = $hc->decode($v); } + , 'warn_initial' => sub () { $warn_initial = 1; } + , 'default' => + sub ($$) { my ($t,$v) = @_; push @unknowns, $t; } }, $text ); + if (Irssi::settings_get_bool("instance_warn_initial") and $warn_initial) { + Irssi::print("Instancer: warning: $channame sends initial message"); + } + + if (Irssi::settings_get_bool("instance_warn_unknown") + and (scalar @unknowns) != 0) { + Irssi::print("Instancer: warning: unknown message types " . (join " ",@unknowns)); + } + if ($res and defined $instance_label) { $rest =~ s/^(.*)$instance_suffix$/$1/; @@ -520,11 +534,12 @@ Irssi::command_bind('punt', 'cmd_punt'); Irssi::command_bind('debugroutes', 'cmd_debug_routes'); Irssi::command_bind('unpunt', 'cmd_unpunt'); -# NOTICE: This is transitional for experimentation with the protocol and may -# disappear soon. MasterCoder is aware to look at both ends of strings -# passed to tlv_run_callbacks, so this option controls which position we use -# when generating. -Irssi::settings_add_bool('instance','instance_tlvs_at_start', 1); + # Set to recieve warnings about initial TLV streams + # (older protocol) +Irssi::settings_add_bool('instance','instance_warn_initial', 1); + # Set to recieve warnings about unknown TLV types + # (newer protocols) +Irssi::settings_add_bool('instance','instance_warn_unknown', 1); # The old way of storing these... #Irssi::settings_add_str('lookandfeel', 'current_instance', "default");