From: nwf Date: Mon, 3 Aug 2009 04:13:42 +0000 (-0400) Subject: Correct IrssiInstancer to print {bot} even when no instance tag is present X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=48dc18b7b9beec2ca640903c1d13571fe9808311;p=instirc Correct IrssiInstancer to print {bot} even when no instance tag is present Ignore-this: 4135df032bc2907e3d0fb25b33345406 darcs-hash:20090803041342-4d648-d36ba3ae975e7f173390cae6d9532418f0397bf3.gz --- diff --git a/IrssiInstancer.pl b/IrssiInstancer.pl index ddec1ef..dd1994e 100644 --- a/IrssiInstancer.pl +++ b/IrssiInstancer.pl @@ -121,6 +121,7 @@ sub demangle_and_check_routes($$$) { sub ($$) { my ($t,$v) = @_; my $dec = $mc->tdecode($v); + # XXX This knowledge ought be in Definitions.pm $is_bot = $dec & 1 if ($dec > 2); } , 'warn_initial' => sub () { $warn_initial = 1; } @@ -138,22 +139,24 @@ sub demangle_and_check_routes($$$) { Irssi::print("Instancer: warning: unknown message types " . (join " ",@unknowns)); } - # XXX This is pretty hacky. - if ($res and $is_bot) { - $rest = "{bot} " . $rest; - } - - if ($res and defined $instance_label) { - # Find window item given server and name - my $witem = $srv->window_item_find($channame); + if ($res) { + + # XXX This is pretty hacky. + if ($is_bot) { + $rest = "{bot} " . $rest; + } + + if (defined $instance_label) { + # Find window item given server and name + my $witem = $srv->window_item_find($channame); - if (not defined $witem) { + if (not defined $witem) { Irssi::print("No witem while decoding?"); return (undef, undef, $text); - } + } - # override channel name; this may undefine the target. - if (inst_routed($witem, $instance_label)) { + # override channel name; this may undefine the target. + if (inst_routed($witem, $instance_label)) { Irssi::print("Instance $instance_label is routed..."); # See if we have a target. @@ -166,9 +169,12 @@ sub demangle_and_check_routes($$$) { } else { $rest = undef; } - } + } - return ($target, $instance_label, $rest); + return ($target, $instance_label, $rest); + } else { + return (undef, undef, $rest); + } } return (undef, undef, $text);